From b0b03f4a8f73bbb27311c3ee92bdd6b02731f58a Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 26 Apr 2013 13:00:07 +0200 Subject: [PATCH] create config uis always from the same point --- src/shell/desktopcorona.cpp | 25 ------------------------- src/shell/desktopcorona.h | 3 --- src/shell/panelconfigview.h | 1 + src/shell/view.cpp | 32 ++++++++++++++++++++++++++++++++ src/shell/view.h | 5 +++++ 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/shell/desktopcorona.cpp b/src/shell/desktopcorona.cpp index 6fd727f5e..fc04abd1d 100644 --- a/src/shell/desktopcorona.cpp +++ b/src/shell/desktopcorona.cpp @@ -269,8 +269,6 @@ void DesktopCorona::handleContainmentAdded(Plasma::Containment* c) { connect(c, &Plasma::Containment::showAddWidgetsInterface, this, &DesktopCorona::showWidgetExplorer); - connect(c, &Plasma::Containment::configureRequested, - this, &DesktopCorona::showConfigurationInterface); } void DesktopCorona::showWidgetExplorer() @@ -304,28 +302,5 @@ void DesktopCorona::printScriptMessage(const QString &message) qDebug() << message; } -void DesktopCorona::showConfigurationInterface(Plasma::Applet *applet) -{ - if (m_configView) { - m_configView.data()->hide(); - m_configView.data()->deleteLater(); - } - - if (!applet || !applet->containment()) { - return; - } - - Plasma::Containment *cont = qobject_cast(applet); - - if (cont) { - m_configView = new ContainmentConfigView(cont); - } else { - m_configView = new ConfigView(applet); - } - m_configView.data()->init(); - - m_configView.data()->show(); -} - #include "desktopcorona.moc" diff --git a/src/shell/desktopcorona.h b/src/shell/desktopcorona.h index ea110d483..cbdc1a6e8 100644 --- a/src/shell/desktopcorona.h +++ b/src/shell/desktopcorona.h @@ -85,8 +85,6 @@ protected Q_SLOTS: void printScriptError(const QString &error); void printScriptMessage(const QString &message); - void showConfigurationInterface(Plasma::Applet *applet); - private Q_SLOTS: void handleContainmentAdded(Plasma::Containment *c); void showWidgetExplorer(); @@ -97,7 +95,6 @@ private: WidgetExplorerView *m_widgetExplorerView; QHash m_panelViews; KConfigGroup m_desktopDefaultsConfig; - QWeakPointer m_configView; }; #endif diff --git a/src/shell/panelconfigview.h b/src/shell/panelconfigview.h index dfd202977..ce7b56948 100644 --- a/src/shell/panelconfigview.h +++ b/src/shell/panelconfigview.h @@ -21,6 +21,7 @@ #define PANELCONFIGVIEW_H #include "configview.h" + #include #include #include diff --git a/src/shell/view.cpp b/src/shell/view.cpp index 81e359d45..2e48be3ba 100644 --- a/src/shell/view.cpp +++ b/src/shell/view.cpp @@ -17,6 +17,10 @@ */ #include "view.h" +#include "containmentconfigview.h" +#include "panelconfigview.h" +#include "panelview.h" + #include #include @@ -99,6 +103,8 @@ void View::setContainment(Plasma::Containment *cont) this, &View::locationChanged); connect(cont, &Plasma::Containment::formFactorChanged, this, &View::formFactorChanged); + connect(cont, &Plasma::Containment::configureRequested, + this, &View::showConfigurationInterface); } else { return; } @@ -152,4 +158,30 @@ QRectF View::screenGeometry() return screen()->geometry(); } +void View::showConfigurationInterface(Plasma::Applet *applet) +{ + if (m_configView) { + m_configView.data()->hide(); + m_configView.data()->deleteLater(); + } + + if (!applet || !applet->containment()) { + return; + } + + Plasma::Containment *cont = qobject_cast(applet); + PanelView *pv = qobject_cast< PanelView* >(this); + + if (cont && pv) { + m_configView = new PanelConfigView(cont, pv); + } else if (cont) { + m_configView = new ContainmentConfigView(cont); + } else { + m_configView = new ConfigView(applet); + } + m_configView.data()->init(); + + m_configView.data()->show(); +} + #include "moc_view.cpp" diff --git a/src/shell/view.h b/src/shell/view.h index d01a889e7..ff859ee89 100644 --- a/src/shell/view.h +++ b/src/shell/view.h @@ -25,6 +25,7 @@ #include "plasma/corona.h" #include "plasma/containment.h" +#include "configview.h" class View : public QQuickView { @@ -54,6 +55,9 @@ public: QRectF screenGeometry(); +protected Q_SLOTS: + void showConfigurationInterface(Plasma::Applet *applet); + Q_SIGNALS: void locationChanged(Plasma::Location location); void formFactorChanged(Plasma::FormFactor formFactor); @@ -63,6 +67,7 @@ Q_SIGNALS: private: Plasma::Corona *m_corona; QWeakPointer m_containment; + QWeakPointer m_configView; }; #endif // VIEW_H