From 4bc508411a7b874aca5c57d4c8a72301176f1eae Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 16 Jan 2009 00:39:07 +0000 Subject: [PATCH] neat bug: changing Activity type while widgets are locked caused Appearances settings to be permahidden. chased out a few other ways to trigger this once that one was fixed, works nicely now. BUG:180887 svn path=/trunk/KDE/kdelibs/; revision=911727 --- applet.cpp | 12 +++++++++--- containment.cpp | 13 ++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/applet.cpp b/applet.cpp index f8944eeb4..0d750376d 100644 --- a/applet.cpp +++ b/applet.cpp @@ -923,11 +923,13 @@ void Applet::flushPendingConstraintsEvents() action->setVisible(unlocked); action->setEnabled(unlocked); } - if (!KAuthorized::authorize("PlasmaAllowConfigureWhenLocked")) { + + bool canConfig = unlocked || KAuthorized::authorize("PlasmaAllowConfigureWhenLocked"); + if (canConfig) { action = d->actions.action("configure"); if (action) { - action->setVisible(unlocked); - action->setEnabled(unlocked); + action->setVisible(canConfig); + action->setEnabled(canConfig); } } } @@ -1282,6 +1284,10 @@ void Applet::setHasConfigurationInterface(bool hasInterface) configAction = new QAction(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); if (isContainment()) { //kDebug() << "I am a containment"; configAction->setShortcut(QKeySequence("ctrl+shift+s")); diff --git a/containment.cpp b/containment.cpp index f4a737e6b..1d2fffcc8 100644 --- a/containment.cpp +++ b/containment.cpp @@ -153,8 +153,9 @@ void Containment::init() QAction *configureActivityAction = new QAction(i18n("Appearance Settings"), this); configureActivityAction->setIcon(KIcon("configure")); - configureActivityAction->setVisible(unlocked); - configureActivityAction->setEnabled(unlocked); + bool canConfig = unlocked || KAuthorized::authorize("PlasmaAllowConfigureWhenLocked"); + configureActivityAction->setVisible(canConfig); + configureActivityAction->setEnabled(canConfig); connect(configureActivityAction, SIGNAL(triggered()), this, SLOT(requestConfiguration())); d->actions().addAction("activity settings", configureActivityAction); @@ -1599,11 +1600,13 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets")); action->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked")); } - if (!KAuthorized::authorize("PlasmaAllowConfigureWhenLocked")) { + + bool canConfig = unlocked || KAuthorized::authorize("PlasmaAllowConfigureWhenLocked"); + if (canConfig) { action = actions().action("activity settings"); if (action) { - action->setVisible(unlocked); - action->setEnabled(unlocked); + action->setVisible(canConfig); + action->setEnabled(canConfig); } }