From 11bd92b381672d62aabf326bd0d115bccc38903a Mon Sep 17 00:00:00 2001 From: Michael Jansen Date: Tue, 30 Sep 2008 20:44:40 +0000 Subject: [PATCH] - Correct key usage. - Forget global shortcut svn path=/trunk/KDE/kdebase/workspace/; revision=866436 --- useractions.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/useractions.cpp b/useractions.cpp index ff5c280be0..7e266f6dbf 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -410,24 +410,31 @@ void Workspace::setupWindowShortcutDone( bool ok ) void Workspace::clientShortcutUpdated( Client* c ) { - QString key = QString::number( c->window()); + QString key = QString( "_k_session:%1" ).arg(c->window()); QAction* action = client_keys->action( key.toLatin1().constData() ); if( !c->shortcut().isEmpty()) { if( action == NULL ) // new shortcut { - action = client_keys->addAction(QString("session:clientShortcut %1").arg(key)); - action->setText(i18n("Activate Window (%1)", c->caption())); - connect( action, SIGNAL(triggered(bool)), c, SLOT(shortcutActivated())); + action = client_keys->addAction(QString( key )); + action->setText( i18n("Activate Window (%1)", c->caption()) ); + connect( action, SIGNAL(triggered(bool)), c, SLOT(shortcutActivated()) ); } + + KAction *kaction = qobject_cast( action ); // no autoloading, since it's configured explicitly here and is not meant to be reused // (the key is the window id anyway, which is kind of random) - qobject_cast< KAction* >( action )->setGlobalShortcut( - c->shortcut(), KAction::ActiveShortcut, KAction::NoAutoloading ); - action->setEnabled( true ); + kaction->setGlobalShortcut( + c->shortcut(), KAction::ActiveShortcut, KAction::NoAutoloading ); + kaction->setEnabled( true ); } else { + KAction *kaction = qobject_cast( action ); + if( kaction ) + { + kaction->forgetGlobalShortcut(); + } delete action; } }