From 7be9da07b4f6ff54a2ecb24a06032360d8a6208c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 25 Apr 2013 15:07:02 +0200 Subject: [PATCH] correctly load containment config ui --- src/shell/configview.cpp | 2 +- src/shell/configview.h | 2 +- src/shell/containmentconfigview.cpp | 6 +++ src/shell/containmentconfigview.h | 2 + ...figuration.qml => AppletConfiguration.qml} | 16 +------ .../components/ContainmentConfiguration.qml | 47 +++++++++++++++++++ src/shell/shellpackage.cpp | 3 +- 7 files changed, 61 insertions(+), 17 deletions(-) rename src/shell/qmlpackages/desktop/contents/components/{Configuration.qml => AppletConfiguration.qml} (94%) create mode 100644 src/shell/qmlpackages/desktop/contents/components/ContainmentConfiguration.qml diff --git a/src/shell/configview.cpp b/src/shell/configview.cpp index 00646c0c2..50f9dbd61 100644 --- a/src/shell/configview.cpp +++ b/src/shell/configview.cpp @@ -302,7 +302,7 @@ ConfigView::~ConfigView() void ConfigView::init() { - setSource(QUrl::fromLocalFile(m_applet->containment()->corona()->package().filePath("configurationui"))); + setSource(QUrl::fromLocalFile(m_applet->containment()->corona()->package().filePath("appletconfigurationui"))); } ConfigModel *ConfigView::configModel() const diff --git a/src/shell/configview.h b/src/shell/configview.h index 064e54a6e..a4c7ffb3c 100644 --- a/src/shell/configview.h +++ b/src/shell/configview.h @@ -125,7 +125,7 @@ public: ConfigView(Plasma::Applet *applet, QWindow *parent = 0); virtual ~ConfigView(); - void init(); + virtual void init(); ConfigModel *configModel() const; diff --git a/src/shell/containmentconfigview.cpp b/src/shell/containmentconfigview.cpp index e73f561fa..b26a70bfa 100644 --- a/src/shell/containmentconfigview.cpp +++ b/src/shell/containmentconfigview.cpp @@ -30,6 +30,7 @@ #include +#include #include @@ -56,6 +57,11 @@ ContainmentConfigView::~ContainmentConfigView() { } +void ContainmentConfigView::init() +{ + setSource(QUrl::fromLocalFile(m_containment->containment()->corona()->package().filePath("containmentconfigurationui"))); +} + ConfigModel *ContainmentConfigView::wallpaperConfigModel() { if (!m_wallpaperConfigModel) { diff --git a/src/shell/containmentconfigview.h b/src/shell/containmentconfigview.h index b1ee6b8ed..19f719c4a 100644 --- a/src/shell/containmentconfigview.h +++ b/src/shell/containmentconfigview.h @@ -41,6 +41,8 @@ public: ContainmentConfigView(Plasma::Containment *interface, QWindow *parent = 0); virtual ~ContainmentConfigView(); + virtual void init(); + ConfigModel *wallpaperConfigModel(); QString currentWallpaper() const; void setCurrentWallpaper(const QString &wallpaper); diff --git a/src/shell/qmlpackages/desktop/contents/components/Configuration.qml b/src/shell/qmlpackages/desktop/contents/components/AppletConfiguration.qml similarity index 94% rename from src/shell/qmlpackages/desktop/contents/components/Configuration.qml rename to src/shell/qmlpackages/desktop/contents/components/AppletConfiguration.qml index bfd68f1a6..0bab3fa70 100644 --- a/src/shell/qmlpackages/desktop/contents/components/Configuration.qml +++ b/src/shell/qmlpackages/desktop/contents/components/AppletConfiguration.qml @@ -36,7 +36,8 @@ Rectangle { //END properties //BEGIN model - property ConfigModel globalConfigModel: plasmoid.containmentType !== undefined ? globalContainmentConfigModel : globalAppletConfigModel + property ConfigModel globalConfigModel: globalAppletConfigModel + ConfigModel { id: globalAppletConfigModel ConfigCategory { @@ -45,19 +46,6 @@ Rectangle { source: "ConfigurationShortcuts.qml" } } - ConfigModel { - id: globalContainmentConfigModel - ConfigCategory { - name: "Appearance" - icon: "preferences-desktop-wallpaper" - source: "ConfigurationContainmentAppearance.qml" - } - ConfigCategory { - name: "Mouse Actions" - icon: "preferences-desktop-mouse" - source: "ConfigurationContainmentActions.qml" - } - } //END model //BEGIN functions diff --git a/src/shell/qmlpackages/desktop/contents/components/ContainmentConfiguration.qml b/src/shell/qmlpackages/desktop/contents/components/ContainmentConfiguration.qml new file mode 100644 index 000000000..c500657b0 --- /dev/null +++ b/src/shell/qmlpackages/desktop/contents/components/ContainmentConfiguration.qml @@ -0,0 +1,47 @@ +/* + * Copyright 2013 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.configuration 2.0 + + +AppletConfiguration { + id: root + +//BEGIN model + globalConfigModel: globalContainmentConfigModel + + ConfigModel { + id: globalContainmentConfigModel + ConfigCategory { + name: "Appearance" + icon: "preferences-desktop-wallpaper" + source: "ConfigurationContainmentAppearance.qml" + } + ConfigCategory { + name: "Mouse Actions" + icon: "preferences-desktop-mouse" + source: "ConfigurationContainmentActions.qml" + } + } +//END model + +} diff --git a/src/shell/shellpackage.cpp b/src/shell/shellpackage.cpp index 3d9c6e5c7..623021649 100644 --- a/src/shell/shellpackage.cpp +++ b/src/shell/shellpackage.cpp @@ -45,7 +45,8 @@ void ShellPackageStructure::initPackage(Plasma::Package *package) package->addFileDefinition("appleterror", "components/AppletError.qml", i18n("Error message shown when an applet fails to load")); package->addFileDefinition("compactapplet", "components/CompactApplet.qml", i18n("QML component that shows an applet in a popup")); - package->addFileDefinition("configurationui", "components/Configuration.qml", i18n("QML component for the configuration dialog")); + package->addFileDefinition("appletconfigurationui", "components/AppletConfiguration.qml", i18n("QML component for the configuration dialog for applets")); + package->addFileDefinition("containmentconfigurationui", "components/ContainmentConfiguration.qml", i18n("QML component for the configuration dialog for containments")); package->addFileDefinition("defaultcompactrepresentation", "components/DefaultCompactRepresentation.qml", i18n("Compact representation of an applet when collapsed in a popup, for instance as an icon. applets can override this component.")); package->addFileDefinition("widgetexplorer", "explorer/WidgetExplorer.qml", i18n("Widgets explorer UI")); package->addFileDefinition("panelconfigurationui", "components/PanelConfiguration.qml", i18n("Panel configuration UI"));