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
This commit is contained in:
Aaron J. Seigo 2008-11-10 01:26:27 +00:00
parent 3f246745ed
commit 249a44ab8d
3 changed files with 26 additions and 13 deletions

View File

@ -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<QAction*> 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<Corona*>(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()) {

View File

@ -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;

View File

@ -57,6 +57,7 @@ public:
ToolBox *createToolBox();
void positionToolBox();
void triggerShowAddWidgets();
void requestConfiguration();
/**
* Called when constraints have been updated on this containment to provide