tag the actions; now the desktop toolbox is sanely ordered

svn path=/trunk/KDE/kdelibs/; revision=1069705
This commit is contained in:
Aaron J. Seigo 2010-01-04 06:37:41 +00:00
parent 9a1a29125c
commit 1181a53e3c
3 changed files with 13 additions and 7 deletions

View File

@ -1588,12 +1588,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
configAction->setText(i18n("Widget Settings")); configAction->setText(i18n("Widget Settings"));
configAction->setIcon(KIcon("configure")); configAction->setIcon(KIcon("configure"));
configAction->setShortcut(KShortcut("alt+d, s")); configAction->setShortcut(KShortcut("alt+d, s"));
configAction->setData(AbstractToolBox::ConfigureTool);
KAction *closeApplet = actions->addAction("remove"); KAction *closeApplet = actions->addAction("remove");
closeApplet->setAutoRepeat(false); closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget")); closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(KIcon("edit-delete")); closeApplet->setIcon(KIcon("edit-delete"));
closeApplet->setShortcut(KShortcut("alt+d, r")); closeApplet->setShortcut(KShortcut("alt+d, r"));
closeApplet->setData(AbstractToolBox::DestructiveTool);
KAction *runAssociatedApplication = actions->addAction("run associated application"); KAction *runAssociatedApplication = actions->addAction("run associated application");
runAssociatedApplication->setAutoRepeat(false); runAssociatedApplication->setAutoRepeat(false);
@ -1602,6 +1604,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
runAssociatedApplication->setShortcut(KShortcut("alt+d, t")); runAssociatedApplication->setShortcut(KShortcut("alt+d, t"));
runAssociatedApplication->setVisible(false); runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false); runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(AbstractToolBox::ControlTool);
return actions; return actions;
} }

View File

@ -298,16 +298,19 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(KIcon("list-add")); appletBrowserAction->setIcon(KIcon("list-add"));
appletBrowserAction->setShortcut(KShortcut("alt+d, a")); appletBrowserAction->setShortcut(KShortcut("alt+d, a"));
appletBrowserAction->setData(AbstractToolBox::AddTool);
KAction *action = actions->addAction("next applet"); KAction *action = actions->addAction("next applet");
action->setText(i18n("Next Widget")); action->setText(i18n("Next Widget"));
//no icon //no icon
action->setShortcut(KShortcut("alt+d, n")); action->setShortcut(KShortcut("alt+d, n"));
action->setData(AbstractToolBox::ControlTool);
action = actions->addAction("previous applet"); action = actions->addAction("previous applet");
action->setText(i18n("Previous Widget")); action->setText(i18n("Previous Widget"));
//no icon //no icon
action->setShortcut(KShortcut("alt+d, p")); action->setShortcut(KShortcut("alt+d, p"));
action->setData(AbstractToolBox::ControlTool);
KAction *zoomAction = actions->addAction("zoom in"); KAction *zoomAction = actions->addAction("zoom in");
zoomAction->setAutoRepeat(false); zoomAction->setAutoRepeat(false);
@ -315,6 +318,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
zoomAction->setIcon(KIcon("zoom-in")); zoomAction->setIcon(KIcon("zoom-in"));
//two shortcuts because I hate ctrl-+ but others expect it //two shortcuts because I hate ctrl-+ but others expect it
zoomAction->setShortcuts(KShortcut("alt+d, +; alt+d, =")); zoomAction->setShortcuts(KShortcut("alt+d, +; alt+d, ="));
zoomAction->setData(AbstractToolBox::ControlTool);
} }
@ -2240,9 +2244,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
positionToolBox(); positionToolBox();
} }
if (toolBox && if (toolBox && constraints & Plasma::StartupCompletedConstraint && type < Containment::CustomContainment) {
constraints & Plasma::StartupCompletedConstraint &&
type < Containment::CustomContainment) {
toolBox.data()->addTool(q->action("remove")); toolBox.data()->addTool(q->action("remove"));
checkRemoveAction(); checkRemoveAction();
} }

View File

@ -40,6 +40,7 @@
#include <kaction.h> #include <kaction.h>
#include <kshortcutsdialog.h> #include <kshortcutsdialog.h>
#include "abstracttoolbox.h"
#include "containment.h" #include "containment.h"
#include "containmentactionspluginsconfig.h" #include "containmentactionspluginsconfig.h"
#include "view.h" #include "view.h"
@ -87,10 +88,10 @@ public:
actions.setConfigGroup("Shortcuts"); actions.setConfigGroup("Shortcuts");
KAction *lockAction = actions.addAction("lock widgets"); KAction *lockAction = actions.addAction("lock widgets");
QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability()));
lockAction->setText(i18n("Lock Widgets")); lockAction->setText(i18n("Lock Widgets"));
lockAction->setIcon(KIcon("object-locked")); lockAction->setIcon(KIcon("object-locked"));
QObject::connect(lockAction, SIGNAL(triggered(bool)), lockAction->setData(AbstractToolBox::ControlTool);
q, SLOT(toggleImmutability()));
lockAction->setShortcut(KShortcut("alt+d, l")); lockAction->setShortcut(KShortcut("alt+d, l"));
lockAction->setShortcutContext(Qt::ApplicationShortcut); lockAction->setShortcutContext(Qt::ApplicationShortcut);
@ -98,11 +99,11 @@ public:
//but should the shortcuts be per-app or really-global? //but should the shortcuts be per-app or really-global?
//I don't know how to make kactioncollections use plasmarc //I don't know how to make kactioncollections use plasmarc
KAction *action = actions.addAction("configure shortcuts"); KAction *action = actions.addAction("configure shortcuts");
QObject::connect(action, SIGNAL(triggered()), q, SLOT(showShortcutConfig()));
action->setText(i18n("Shortcut Settings")); action->setText(i18n("Shortcut Settings"));
action->setIcon(KIcon("configure")); action->setIcon(KIcon("configure"));
action->setAutoRepeat(false); action->setAutoRepeat(false);
QObject::connect(action, SIGNAL(triggered()), action->setData(AbstractToolBox::ConfigureTool);
q, SLOT(showShortcutConfig()));
//action->setShortcut(KShortcut("ctrl+h")); //action->setShortcut(KShortcut("ctrl+h"));
action->setShortcutContext(Qt::ApplicationShortcut); action->setShortcutContext(Qt::ApplicationShortcut);