* 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
This commit is contained in:
Aaron J. Seigo 2008-09-17 19:16:36 +00:00
parent 04d66c614a
commit 8db733b45a

View File

@ -238,6 +238,9 @@ void Applet::restore(KConfigGroup &group)
QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString());
if (!shortcutText.isEmpty()) { if (!shortcutText.isEmpty()) {
setGlobalShortcut(KShortcut(shortcutText)); 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 // 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 KShortcut Applet::globalShortcut() const
@ -1571,9 +1578,15 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
AppletPrivate::~AppletPrivate() AppletPrivate::~AppletPrivate()
{ {
if (activationAction && activationAction->isGlobalShortcutEnabled()) {
//kDebug() << "reseting global action for" << q->name() << activationAction->objectName();
activationAction->forgetGlobalShortcut();
}
foreach (const QString& engine, loadedEngines) { foreach (const QString& engine, loadedEngines) {
DataEngineManager::self()->unloadEngine( engine ); DataEngineManager::self()->unloadEngine( engine );
} }
delete package; delete package;
delete configXml; delete configXml;
delete mainConfig; delete mainConfig;