[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/containments/desktop
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-06-11 22:39:37
Message-ID: 1244759977.242467.12735.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 980531 by aseigo:
smarter handling of the QActions, including making sure the panel action was created before accessing it
BUG:196071
M +32 -22 desktop.cpp
--- trunk/KDE/kdebase/workspace/plasma/containments/desktop/desktop.cpp #980530:980531
@@ -61,8 +61,6 @@
DefaultDesktop::DefaultDesktop(QObject *parent, const QVariantList &args)
: Containment(parent, args),
m_addPanelsMenu(0),
- m_lockDesktopAction(0),
- m_appletBrowserAction(0),
m_addPanelAction(0),
m_runCommandAction(0),
m_lockScreenAction(0),
@@ -93,10 +91,12 @@
void DefaultDesktop::constraintsEvent(Plasma::Constraints constraints)
{
- if (constraints & Plasma::ImmutableConstraint && m_appletBrowserAction) {
- // we need to update the menu items that have already been created
- bool locked = immutability() != Mutable;
- m_addPanelAction->setVisible(!locked);
+ if (constraints & Plasma::ImmutableConstraint) {
+ if (m_addPanelAction) {
+ // we need to update the menu items that have already been created
+ bool locked = immutability() != Mutable;
+ m_addPanelAction->setVisible(!locked);
+ }
}
if (constraints & Plasma::SizeConstraint) {
@@ -223,11 +223,7 @@
QList<QAction*> DefaultDesktop::contextualActions()
{
- //TODO: should we offer "Switch User" here?
-
- if (!m_appletBrowserAction) {
- m_appletBrowserAction = action("add widgets");
-
+ if (!m_runCommandAction) {
KPluginInfo::List panelPlugins = listContainmentsOfType("panel");
if (panelPlugins.size() == 1) {
@@ -253,15 +249,14 @@
}
}
- m_addPanelAction->setIcon(KIcon("list-add"));
+ if (m_addPanelAction) {
+ m_addPanelAction->setIcon(KIcon("list-add"));
+ }
m_runCommandAction = new QAction(i18n("Run Command..."), this);
+ m_runCommandAction->setIcon(KIcon("system-run"));
connect(m_runCommandAction, SIGNAL(triggered(bool)), this, SLOT(runCommand()));
- m_runCommandAction->setIcon(KIcon("system-run"));
- m_setupDesktopAction = action("activity settings");
- m_lockDesktopAction = action("lock widgets");
-
m_lockScreenAction = new QAction(i18n("Lock Screen"), this);
m_lockScreenAction->setIcon(KIcon("system-lock-screen"));
connect(m_lockScreenAction, SIGNAL(triggered(bool)), this, SLOT(lockScreen()));
@@ -281,15 +276,30 @@
actions.append(m_runCommandAction);
}
- actions.append(m_appletBrowserAction);
- actions.append(m_addPanelAction);
- actions.append(m_setupDesktopAction);
- if (screen() == -1) {
- actions.append(action("remove"));
+ QAction *appletBrowserAction = action("add widgets");
+ if (appletBrowserAction) {
+ actions.append(appletBrowserAction);
}
- actions.append(m_lockDesktopAction);
+ if (m_addPanelAction) {
+ actions.append(m_addPanelAction);
+ }
+ QAction *setupDesktopAction = action("activity settings");
+ if (setupDesktopAction) {
+ actions.append(setupDesktopAction);
+ }
+
+ QAction *removeAction = action("remove");
+ if (screen() == -1 && removeAction) {
+ actions.append(removeAction);
+ }
+
+ QAction *lockDesktopAction = action("lock widgets");
+ if (lockDesktopAction) {
+ actions.append(lockDesktopAction);
+ }
+
actions.append(m_separator);
if (KAuthorized::authorizeKAction("lock_screen")) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic