Containment::ToolType -> Plasma::ActionType

actions categories are no more Toolbox-specific, but generic properties for actions
This commit is contained in:
Marco Martin 2013-02-19 14:04:20 +01:00
parent f5b51c7c54
commit 3ce3048ad1
5 changed files with 21 additions and 19 deletions

View File

@ -67,17 +67,6 @@ class PLASMA_EXPORT Containment : public Applet
Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged)
public:
enum ToolType {
AddTool = 0,
ConfigureTool = 100,
ControlTool = 200,
MiscTool = 300,
DestructiveTool = 400,
UserToolType = DestructiveTool + 1000
};
Q_ENUMS(ToolType)
/**
* @param parent the QObject this applet is parented to
* @param serviceId the name of the .desktop file containing the

View File

@ -471,7 +471,7 @@ void CoronaPrivate::init()
lockAction->setText(i18n("Lock Widgets"));
lockAction->setAutoRepeat(true);
lockAction->setIcon(KDE::icon("object-locked"));
lockAction->setData(Containment::ControlTool);
lockAction->setData(Plasma::ControlAction);
lockAction->setShortcut(KShortcut("alt+d, l"));
lockAction->setShortcutContext(Qt::ApplicationShortcut);
@ -483,7 +483,7 @@ void CoronaPrivate::init()
action->setText(i18n("Shortcut Settings"));
action->setIcon(KDE::icon("configure-shortcuts"));
action->setAutoRepeat(false);
action->setData(Containment::ConfigureTool);
action->setData(Plasma::ConfigureAction);
//action->setShortcut(KShortcut("ctrl+h"));
action->setShortcutContext(Qt::ApplicationShortcut);

View File

@ -91,6 +91,19 @@ enum ContainmentType {
};
Q_ENUMS(ContainmentType)
/**
* A descriptrive type for QActions, to help categorizing them when presented to the user
*/
enum ActionType {
AddAction = 0, /**The action will cause something new being created*/
ConfigureAction = 100, /** The Action will make some kind of configuration ui to appear */
ControlAction = 200, /** Generic control, similar to ConfigureAction TODO: better doc */
MiscAction = 300, /** A type of action that doesn't fit in the oher categories */
DestructiveAction = 400, /** A dangerous action, such as deletion of objects, plasmoids and files. They are intended to be shown separed from other actions */
UserAction = DestructiveAction + 1000 /** If new types are needed in a C++ implementation, define them as ids more than UserAction*/
};
Q_ENUMS(ActionType)
/**
* The Direction enumeration describes in which direction, relative to the
* Applet (and its managing container), popup menus, expanders, balloons,

View File

@ -209,14 +209,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
configAction->setText(i18n("Widget Settings"));
configAction->setIcon(KDE::icon("configure"));
configAction->setShortcut(KShortcut("alt+d, s"));
configAction->setData(Containment::ConfigureTool);
configAction->setData(Plasma::ConfigureAction);
KAction *closeApplet = actions->addAction("remove");
closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(KDE::icon("edit-delete"));
closeApplet->setShortcut(KShortcut("alt+d, r"));
closeApplet->setData(Containment::DestructiveTool);
closeApplet->setData(Plasma::DestructiveAction);
KAction *runAssociatedApplication = actions->addAction("run associated application");
runAssociatedApplication->setAutoRepeat(false);
@ -225,7 +225,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
runAssociatedApplication->setShortcut(KShortcut("alt+d, t"));
runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(Containment::ControlTool);
runAssociatedApplication->setData(Plasma::ControlAction);
return actions;
}

View File

@ -71,19 +71,19 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(KDE::icon("list-add"));
appletBrowserAction->setShortcut(KShortcut("alt+d, a"));
appletBrowserAction->setData(Containment::AddTool);
appletBrowserAction->setData(Plasma::AddAction);
KAction *action = actions->addAction("next applet");
action->setText(i18n("Next Widget"));
//no icon
action->setShortcut(KShortcut("alt+d, n"));
action->setData(Containment::ControlTool);
action->setData(Plasma::ControlAction);
action = actions->addAction("previous applet");
action->setText(i18n("Previous Widget"));
//no icon
action->setShortcut(KShortcut("alt+d, p"));
action->setData(Containment::ControlTool);
action->setData(Plasma::ControlAction);
}
void ContainmentPrivate::setScreen(int newScreen)