From 1181a53e3cddd104d734e7783b8519a704797a74 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 4 Jan 2010 06:37:41 +0000 Subject: [PATCH] tag the actions; now the desktop toolbox is sanely ordered svn path=/trunk/KDE/kdelibs/; revision=1069705 --- applet.cpp | 3 +++ containment.cpp | 8 +++++--- corona.cpp | 9 +++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/applet.cpp b/applet.cpp index 427499311..63e30376a 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1588,12 +1588,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent) configAction->setText(i18n("Widget Settings")); configAction->setIcon(KIcon("configure")); configAction->setShortcut(KShortcut("alt+d, s")); + configAction->setData(AbstractToolBox::ConfigureTool); KAction *closeApplet = actions->addAction("remove"); closeApplet->setAutoRepeat(false); closeApplet->setText(i18n("Remove this Widget")); closeApplet->setIcon(KIcon("edit-delete")); closeApplet->setShortcut(KShortcut("alt+d, r")); + closeApplet->setData(AbstractToolBox::DestructiveTool); KAction *runAssociatedApplication = actions->addAction("run associated application"); runAssociatedApplication->setAutoRepeat(false); @@ -1602,6 +1604,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent) runAssociatedApplication->setShortcut(KShortcut("alt+d, t")); runAssociatedApplication->setVisible(false); runAssociatedApplication->setEnabled(false); + runAssociatedApplication->setData(AbstractToolBox::ControlTool); return actions; } diff --git a/containment.cpp b/containment.cpp index 1667710cd..0f784b155 100644 --- a/containment.cpp +++ b/containment.cpp @@ -298,16 +298,19 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setIcon(KIcon("list-add")); appletBrowserAction->setShortcut(KShortcut("alt+d, a")); + appletBrowserAction->setData(AbstractToolBox::AddTool); KAction *action = actions->addAction("next applet"); action->setText(i18n("Next Widget")); //no icon action->setShortcut(KShortcut("alt+d, n")); + action->setData(AbstractToolBox::ControlTool); action = actions->addAction("previous applet"); action->setText(i18n("Previous Widget")); //no icon action->setShortcut(KShortcut("alt+d, p")); + action->setData(AbstractToolBox::ControlTool); KAction *zoomAction = actions->addAction("zoom in"); zoomAction->setAutoRepeat(false); @@ -315,6 +318,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme zoomAction->setIcon(KIcon("zoom-in")); //two shortcuts because I hate ctrl-+ but others expect it zoomAction->setShortcuts(KShortcut("alt+d, +; alt+d, =")); + zoomAction->setData(AbstractToolBox::ControlTool); } @@ -2240,9 +2244,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra positionToolBox(); } - if (toolBox && - constraints & Plasma::StartupCompletedConstraint && - type < Containment::CustomContainment) { + if (toolBox && constraints & Plasma::StartupCompletedConstraint && type < Containment::CustomContainment) { toolBox.data()->addTool(q->action("remove")); checkRemoveAction(); } diff --git a/corona.cpp b/corona.cpp index efcc59800..4fa6d4a1a 100644 --- a/corona.cpp +++ b/corona.cpp @@ -40,6 +40,7 @@ #include #include +#include "abstracttoolbox.h" #include "containment.h" #include "containmentactionspluginsconfig.h" #include "view.h" @@ -87,10 +88,10 @@ public: actions.setConfigGroup("Shortcuts"); KAction *lockAction = actions.addAction("lock widgets"); + QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); lockAction->setText(i18n("Lock Widgets")); lockAction->setIcon(KIcon("object-locked")); - QObject::connect(lockAction, SIGNAL(triggered(bool)), - q, SLOT(toggleImmutability())); + lockAction->setData(AbstractToolBox::ControlTool); lockAction->setShortcut(KShortcut("alt+d, l")); lockAction->setShortcutContext(Qt::ApplicationShortcut); @@ -98,11 +99,11 @@ public: //but should the shortcuts be per-app or really-global? //I don't know how to make kactioncollections use plasmarc KAction *action = actions.addAction("configure shortcuts"); + QObject::connect(action, SIGNAL(triggered()), q, SLOT(showShortcutConfig())); action->setText(i18n("Shortcut Settings")); action->setIcon(KIcon("configure")); action->setAutoRepeat(false); - QObject::connect(action, SIGNAL(triggered()), - q, SLOT(showShortcutConfig())); + action->setData(AbstractToolBox::ConfigureTool); //action->setShortcut(KShortcut("ctrl+h")); action->setShortcutContext(Qt::ApplicationShortcut);