(hopefully) temporary fix for shortcuts.

this could interfere with plasma-mid, because it assumes one view per window
but it's the best we can get until we can use real QGraphicsWidget action stuff

svn path=/trunk/KDE/kdelibs/; revision=935758
This commit is contained in:
Chani Armitage 2009-03-06 05:22:08 +00:00
parent 655f63d1fb
commit d1fa9d361b
2 changed files with 2 additions and 9 deletions

View File

@ -1033,7 +1033,6 @@ void Applet::flushPendingConstraintsEvents()
closeApplet->setIcon(KIcon("edit-delete"));
closeApplet->setEnabled(unlocked);
closeApplet->setVisible(unlocked);
closeApplet->setShortcutContext(Qt::WidgetShortcut); //don't clash with other views
closeApplet->setText(i18nc("%1 is the name of the applet", "Remove this %1", name()));
if (d->isContainment) {
closeApplet->setShortcut(QKeySequence("alt+d,alt+r"));
@ -1170,6 +1169,7 @@ QAction *Applet::action(QString name) const
void Applet::addAction(QString name, QAction *action)
{
d->actions.addAction(name, action);
QGraphicsWidget::addAction(action);
}
void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
@ -1401,7 +1401,7 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
if (!configAction) { //should be always true
configAction = new KAction(i18n("%1 Settings", name()), this);
configAction->setIcon(KIcon("configure"));
configAction->setShortcutContext(Qt::WidgetShortcut); //don't clash with other views
//configAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); //don't clash with other views
bool unlocked = immutability() == Mutable;
bool canConfig = unlocked || KAuthorized::authorize("PlasmaAllowConfigureWhenLocked");
configAction->setVisible(canConfig);

View File

@ -145,21 +145,18 @@ void Containment::init()
appletBrowserAction->setVisible(unlocked);
appletBrowserAction->setEnabled(unlocked);
connect(appletBrowserAction, SIGNAL(triggered()), this, SLOT(triggerShowAddWidgets()));
appletBrowserAction->setShortcutContext(Qt::WidgetShortcut);
appletBrowserAction->setShortcut(QKeySequence("alt+d,a"));
d->actions().addAction("add widgets", appletBrowserAction);
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 KAction(i18n("Previous Widget"), this);
//no icon
connect(action, SIGNAL(triggered()), this, SLOT(focusPreviousApplet()));
action->setShortcutContext(Qt::WidgetShortcut);
action->setShortcut(QKeySequence("alt+d,p"));
d->actions().addAction("previous applet", action);
@ -171,7 +168,6 @@ void Containment::init()
lockDesktopAction->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked"));
connect(lockDesktopAction, SIGNAL(triggered(bool)),
this, SLOT(toggleDesktopImmutability()));
lockDesktopAction->setShortcutContext(Qt::WidgetShortcut);
lockDesktopAction->setShortcut(QKeySequence("alt+d,l"));
d->actions().addAction("lock widgets", lockDesktopAction);
}
@ -181,7 +177,6 @@ void Containment::init()
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);
//two shortcuts because I hate ctrl-+ but others expect it
QList<QKeySequence> keys;
keys << QKeySequence("alt+d,+");
@ -192,7 +187,6 @@ void Containment::init()
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);
@ -201,7 +195,6 @@ void Containment::init()
activityAction->setVisible(unlocked);
activityAction->setEnabled(unlocked);
connect(activityAction, SIGNAL(triggered(bool)), this, SLOT(addSiblingContainment()));
activityAction->setShortcutContext(Qt::WidgetShortcut);
activityAction->setShortcut(QKeySequence("alt+d,alt+a"));
d->actions().addAction("add sibling containment", activityAction);