From 249a44ab8da8417f2f13317a4e7f8ffc443f5bbc Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 10 Nov 2008 01:26:27 +0000 Subject: [PATCH] don't overload the meaning of hasConfigurationInterface for containments, since that makes things difficult for applets-that-are-containments, e.g. folderview svn path=/trunk/KDE/kdelibs/; revision=882205 --- containment.cpp | 36 +++++++++++++++++++++++------------- containment.h | 2 ++ private/containment_p.h | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/containment.cpp b/containment.cpp index 533f730e9..1ea3987e4 100644 --- a/containment.cpp +++ b/containment.cpp @@ -146,6 +146,13 @@ void Containment::init() appletBrowserAction->setShortcut(QKeySequence("ctrl+a")); d->actions().addAction("add widgets", appletBrowserAction); + QAction *configureActivityAction = new QAction(i18n("Activity and Theme Settings"), this); + configureActivityAction->setIcon(KIcon("configure")); + configureActivityAction->setVisible(unlocked); + configureActivityAction->setEnabled(unlocked); + connect(configureActivityAction, SIGNAL(triggered()), this, SLOT(requestConfiguration())); + d->actions().addAction("activity settings", configureActivityAction); + QAction *action = new QAction(i18n("Next Widget"), this); //no icon connect(action, SIGNAL(triggered()), this, SLOT(focusNextApplet())); @@ -210,6 +217,7 @@ void Containment::init() d->toolBox->addTool(this->action("lock widgets")); } d->toolBox->addTool(this->action("add sibling containment")); + d->toolBox->addTool(this->action("activity settings")); if (hasConfigurationInterface()) { // re-use the contianment's action. QAction *configureContainment = this->action("configure"); @@ -217,7 +225,6 @@ void Containment::init() d->toolBox->addTool(this->action("configure")); } } - } //Set a default wallpaper the first time the containment is created, @@ -504,7 +511,7 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, } QList containmentActions = q->contextualActions(); - if (!containmentActions.isEmpty()) { + if (!containmentActions.isEmpty() || q->hasConfigurationInterface()) { if (hasEntries) { desktopMenu.addSeparator(); } @@ -522,6 +529,10 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, containmentActionMenu->addAction(action); } } + + if (q->hasConfigurationInterface()) { + containmentActionMenu->addAction(q->action("configure")); + } } if (static_cast(q->scene())->immutability() == Mutable) { @@ -1358,6 +1369,16 @@ void Containment::destroy() destroy(true); } +void Containment::showConfigurationInterface() +{ + Applet::showConfigurationInterface(); +} + +void ContainmentPrivate::requestConfiguration() +{ + emit q->configureRequested(q); +} + void Containment::destroy(bool confirm) { if (immutability() != Mutable) { @@ -1389,17 +1410,6 @@ void Containment::destroy(bool confirm) } } -void Containment::showConfigurationInterface() -{ - if (isContainment()) { - emit configureRequested(this); - } else { - Applet::showConfigurationInterface(); - } -} - -// Private class implementation - void ContainmentPrivate::toggleDesktopImmutability() { if (q->corona()) { diff --git a/containment.h b/containment.h index 53971f1bd..5925ebac1 100644 --- a/containment.h +++ b/containment.h @@ -431,6 +431,7 @@ class PLASMA_EXPORT Containment : public Applet * @reimplemented from Plasma::Applet */ void showConfigurationInterface(); + protected: /** * Sets the type of this containment. @@ -497,6 +498,7 @@ class PLASMA_EXPORT Containment : public Applet Q_PRIVATE_SLOT(d, void zoomIn()) Q_PRIVATE_SLOT(d, void zoomOut()) Q_PRIVATE_SLOT(d, void toggleDesktopImmutability()) + Q_PRIVATE_SLOT(d, void requestConfiguration()) friend class Applet; friend class AppletPrivate; diff --git a/private/containment_p.h b/private/containment_p.h index 229d19bd6..15321e457 100644 --- a/private/containment_p.h +++ b/private/containment_p.h @@ -57,6 +57,7 @@ public: ToolBox *createToolBox(); void positionToolBox(); void triggerShowAddWidgets(); + void requestConfiguration(); /** * Called when constraints have been updated on this containment to provide