-fix settings shortcut
-QAction->KAction IMPORTANT: if you need to do things to the keyboard shortcuts of kactions (which means all of plasma's standard actions from now on), make sure you're using a KAction* and not a QAction* svn path=/trunk/KDE/kdelibs/; revision=917435
This commit is contained in:
parent
5e46bcc2ef
commit
958cc6e953
19
applet.cpp
19
applet.cpp
@ -25,7 +25,7 @@
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
#include <QAction>
|
||||
#include <KAction>
|
||||
#include <QApplication>
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
@ -906,7 +906,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
//FIXME desktop containments can't be removed while in use.
|
||||
//it's kinda silly to have a keyboard shortcut for something that can only be used when the
|
||||
//shortcut isn't active.
|
||||
QAction *closeApplet = new QAction(this);
|
||||
KAction *closeApplet = new KAction(this);
|
||||
closeApplet->setIcon(KIcon("edit-delete"));
|
||||
closeApplet->setEnabled(unlocked);
|
||||
closeApplet->setVisible(unlocked);
|
||||
@ -1275,19 +1275,19 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
|
||||
d->hasConfigurationInterface = hasInterface;
|
||||
//config action
|
||||
//TODO respect security when it's implemented (4.2)
|
||||
QAction *configAction = d->actions.action("configure");
|
||||
KAction *configAction = qobject_cast<KAction*>(d->actions.action("configure"));
|
||||
if (hasInterface) {
|
||||
if (!configAction) { //should be always true
|
||||
configAction = new QAction(i18n("%1 Settings", name()), this);
|
||||
configAction = new KAction(i18n("%1 Settings", name()), this);
|
||||
configAction->setIcon(KIcon("configure"));
|
||||
configAction->setShortcutContext(Qt::WidgetShortcut); //don't clash with other views
|
||||
bool unlocked = immutability() == Mutable;
|
||||
bool canConfig = unlocked || KAuthorized::authorize("PlasmaAllowConfigureWhenLocked");
|
||||
configAction->setVisible(canConfig);
|
||||
configAction->setEnabled(canConfig);
|
||||
//XXX these shortcuts are also in setIsContainment. keep them in sync.
|
||||
if (d->isContainment) {
|
||||
//FIXME containments don't seem to use this action any more
|
||||
//configAction->setShortcut(QKeySequence("ctrl+shift+s"));
|
||||
configAction->setShortcut(QKeySequence("alt+d,alt+s"));
|
||||
connect(configAction, SIGNAL(triggered()), this, SLOT(requestConfiguration()));
|
||||
} else {
|
||||
configAction->setShortcut(QKeySequence("alt+d,s"));
|
||||
@ -1823,16 +1823,17 @@ void AppletPrivate::setIsContainment(bool nowIsContainment)
|
||||
}
|
||||
}
|
||||
|
||||
QAction *configAction = actions.action("configure");
|
||||
KAction *configAction = qobject_cast<KAction*>(actions.action("configure"));
|
||||
if (configAction) {
|
||||
QObject::disconnect(configAction, SIGNAL(triggered()), q, SLOT(requestConfiguration()));
|
||||
QObject::disconnect(configAction, SIGNAL(triggered(bool)), q, SLOT(showConfigurationInterface()));
|
||||
//XXX these shortcuts are also in setHasConfigurationInterface. keep them in sync.
|
||||
if (nowIsContainment) {
|
||||
//kDebug() << "I am a containment";
|
||||
configAction->setShortcut(QKeySequence("ctrl+shift+s"));
|
||||
configAction->setShortcut(QKeySequence("alt+d,alt+s"));
|
||||
QObject::connect(configAction, SIGNAL(triggered()), q, SLOT(requestConfiguration()));
|
||||
} else {
|
||||
configAction->setShortcut(QKeySequence("ctrl+s"));
|
||||
configAction->setShortcut(QKeySequence("alt+d,s"));
|
||||
QObject::connect(configAction, SIGNAL(triggered(bool)), q, SLOT(showConfigurationInterface()));
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "containment.h"
|
||||
#include "private/containment_p.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <KAction>
|
||||
#include <QFile>
|
||||
#include <QGraphicsSceneContextMenuEvent>
|
||||
#include <QGraphicsView>
|
||||
@ -139,7 +139,7 @@ void Containment::init()
|
||||
//common actions
|
||||
bool unlocked = immutability() == Mutable;
|
||||
|
||||
QAction *appletBrowserAction = new QAction(i18n("Add Widgets..."), this);
|
||||
KAction *appletBrowserAction = new KAction(i18n("Add Widgets..."), this);
|
||||
appletBrowserAction->setIcon(KIcon("list-add"));
|
||||
appletBrowserAction->setVisible(unlocked);
|
||||
appletBrowserAction->setEnabled(unlocked);
|
||||
@ -148,14 +148,14 @@ void Containment::init()
|
||||
appletBrowserAction->setShortcut(QKeySequence("alt+d,a"));
|
||||
d->actions().addAction("add widgets", appletBrowserAction);
|
||||
|
||||
QAction *action = new QAction(i18n("Next Widget"), this);
|
||||
KAction *action = new KAction(i18n("Next Widget"), this);
|
||||
//no icon
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(focusNextApplet()));
|
||||
action->setShortcutContext(Qt::WidgetShortcut);
|
||||
action->setShortcut(QKeySequence("alt+d,n"));
|
||||
d->actions().addAction("next applet", action);
|
||||
|
||||
action = new QAction(i18n("Previous Widget"), this);
|
||||
action = new KAction(i18n("Previous Widget"), this);
|
||||
//no icon
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(focusPreviousApplet()));
|
||||
action->setShortcutContext(Qt::WidgetShortcut);
|
||||
@ -165,8 +165,8 @@ void Containment::init()
|
||||
if (immutability() != SystemImmutable) {
|
||||
//FIXME I'm not certain this belongs in Containment
|
||||
//but it sure is nice to have the keyboard shortcut in every containment by default
|
||||
QAction *lockDesktopAction =
|
||||
new QAction(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"), this);
|
||||
KAction *lockDesktopAction =
|
||||
new KAction(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"), this);
|
||||
lockDesktopAction->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked"));
|
||||
connect(lockDesktopAction, SIGNAL(triggered(bool)),
|
||||
this, SLOT(toggleDesktopImmutability()));
|
||||
@ -177,7 +177,7 @@ void Containment::init()
|
||||
|
||||
if (d->type != PanelContainment &&
|
||||
d->type != CustomPanelContainment) {
|
||||
QAction *zoomAction = new QAction(i18n("Zoom In"), this);
|
||||
KAction *zoomAction = new KAction(i18n("Zoom In"), this);
|
||||
zoomAction->setIcon(KIcon("zoom-in"));
|
||||
connect(zoomAction, SIGNAL(triggered(bool)), this, SLOT(zoomIn()));
|
||||
zoomAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
@ -188,14 +188,14 @@ void Containment::init()
|
||||
zoomAction->setShortcuts(keys);
|
||||
d->actions().addAction("zoom in", zoomAction);
|
||||
|
||||
zoomAction = new QAction(i18n("Zoom Out"), this);
|
||||
zoomAction = new KAction(i18n("Zoom Out"), this);
|
||||
zoomAction->setIcon(KIcon("zoom-out"));
|
||||
connect(zoomAction, SIGNAL(triggered(bool)), this, SLOT(zoomOut()));
|
||||
zoomAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
zoomAction->setShortcut(QKeySequence("alt+d,-"));
|
||||
d->actions().addAction("zoom out", zoomAction);
|
||||
|
||||
QAction *activityAction = new QAction(i18n("Add Activity"), this);
|
||||
KAction *activityAction = new KAction(i18n("Add Activity"), this);
|
||||
activityAction->setIcon(KIcon("list-add"));
|
||||
activityAction->setVisible(unlocked);
|
||||
activityAction->setEnabled(unlocked);
|
||||
|
Loading…
Reference in New Issue
Block a user