correctly load containment config ui

This commit is contained in:
Marco Martin 2013-04-25 15:07:02 +02:00
parent 5efb247935
commit 7be9da07b4
7 changed files with 61 additions and 17 deletions

View File

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

View File

@ -125,7 +125,7 @@ public:
ConfigView(Plasma::Applet *applet, QWindow *parent = 0);
virtual ~ConfigView();
void init();
virtual void init();
ConfigModel *configModel() const;

View File

@ -30,6 +30,7 @@
#include <KLocalizedString>
#include <Plasma/Corona>
#include <Plasma/PluginLoader>
@ -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) {

View File

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

View File

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

View File

@ -0,0 +1,47 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* 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
}

View File

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