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