From 8db733b45a6a5dfc1e733f242a3522de08c5acd6 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 17 Sep 2008 19:16:36 +0000 Subject: [PATCH] * forget the global shorcut on applet destruction; prevents issues with collisions in the future * be more agressive with claiming global shortcuts * add some debug output to track global shorcut registration svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=862007 --- applet.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/applet.cpp b/applet.cpp index 795f81a43..4b5d33e20 100644 --- a/applet.cpp +++ b/applet.cpp @@ -238,6 +238,9 @@ void Applet::restore(KConfigGroup &group) QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); if (!shortcutText.isEmpty()) { setGlobalShortcut(KShortcut(shortcutText)); + kDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); + kDebug() << "set to" << d->activationAction->objectName() + << d->activationAction->globalShortcut().primary(); } // local shortcut, if any @@ -989,7 +992,11 @@ void Applet::setGlobalShortcut(const KShortcut &shortcut) } } - d->activationAction->setGlobalShortcut(shortcut); + //kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary(); + d->activationAction->setGlobalShortcut(shortcut, + KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), + KAction::NoAutoloading); + //kDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary(); } KShortcut Applet::globalShortcut() const @@ -1571,9 +1578,15 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet AppletPrivate::~AppletPrivate() { + if (activationAction && activationAction->isGlobalShortcutEnabled()) { + //kDebug() << "reseting global action for" << q->name() << activationAction->objectName(); + activationAction->forgetGlobalShortcut(); + } + foreach (const QString& engine, loadedEngines) { DataEngineManager::self()->unloadEngine( engine ); } + delete package; delete configXml; delete mainConfig;