diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index 957afaa07..44a18c2c1 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 7f666d564..3140e6e47 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -62,8 +62,6 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa m_expanded(false) { qmlRegisterType(); - - m_configuration = new ConfigPropertyMap(applet()->configScheme(), this); connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus())); connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving())); @@ -97,6 +95,8 @@ void AppletInterface::init() return; } + m_configuration = new ConfigPropertyMap(applet()->configScheme(), this); + //use our own custom network access manager that will access Plasma packages and to manage security (i.e. deny access to remote stuff when the proper extension isn't enabled QQmlEngine *engine = m_qmlObject->engine(); QQmlNetworkAccessManagerFactory *factory = engine->networkAccessManagerFactory(); diff --git a/src/scriptengines/qml/plasmoid/configview.cpp b/src/scriptengines/qml/plasmoid/configview.cpp index 27e41e000..99ab71baa 100644 --- a/src/scriptengines/qml/plasmoid/configview.cpp +++ b/src/scriptengines/qml/plasmoid/configview.cpp @@ -74,4 +74,11 @@ QVariantList ConfigView::configPages() const return m_configPages; } +//To emulate Qt::WA_DeleteOnClose that QWindow doesn't have +void ConfigView::hideEvent(QHideEvent *ev) +{ + QQuickWindow::hideEvent(ev); + deleteLater(); +} + #include "moc_configview.cpp" diff --git a/src/scriptengines/qml/plasmoid/configview.h b/src/scriptengines/qml/plasmoid/configview.h index 0775e8297..ffcd9e835 100644 --- a/src/scriptengines/qml/plasmoid/configview.h +++ b/src/scriptengines/qml/plasmoid/configview.h @@ -37,6 +37,9 @@ public: QVariantList configPages() const; +protected: + void hideEvent(QHideEvent *ev); + private: AppletInterface *m_appletInterface; QVariantList m_configPages; diff --git a/src/shell/qmlpackages/desktop/contents/ui/Configuration.qml b/src/shell/qmlpackages/desktop/contents/ui/Configuration.qml index 82deaccc5..c91cf818d 100644 --- a/src/shell/qmlpackages/desktop/contents/ui/Configuration.qml +++ b/src/shell/qmlpackages/desktop/contents/ui/Configuration.qml @@ -133,18 +133,18 @@ Rectangle { text: "Ok" onClicked: { root.saveConfig() + configDialog.close() } } PlasmaComponents.Button { iconSource: "dialog-ok-apply" text: "Apply" - onClicked: { - root.saveConfig() - } + onClicked: root.saveConfig() } PlasmaComponents.Button { iconSource: "dialog-cancel" text: "Cancel" + onClicked: configDialog.close() } } }