[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-framework] src/shell: use just a combobox
From:       Marco Martin <notmart () gmail ! com>
Date:       2013-08-13 12:44:38
Message-ID: E1V9Dxm-0005v7-9y () scm ! kde ! org
[Download RAW message or body]

Git commit 4c2a1046c215aca0971a3b9e18042c1d5420acef by Marco Martin.
Committed on 13/08/2013 at 12:44.
Pushed by mart into branch 'master'.

use just a combobox

M  +1    -0    src/shell/configview.cpp
M  +14   -62   src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentAppearance.qml


http://commits.kde.org/plasma-framework/4c2a1046c215aca0971a3b9e18042c1d5420acef

diff --git a/src/shell/configview.cpp b/src/shell/configview.cpp
index f3562a0..a6f9f47 100644
--- a/src/shell/configview.cpp
+++ b/src/shell/configview.cpp
@@ -167,6 +167,7 @@ QVariant ConfigModel::get(int row) const
 
     value["name"] = m_categories.at(row)->name();
     value["icon"] = m_categories.at(row)->icon();
+    value["pluginName"] = m_categories.at(row)->pluginName();
     if (m_appletInterface) {
         value["source"] = \
QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("ui", \
m_categories.at(row)->source()));  } else {
diff --git a/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentAppearance.qml \
b/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentAppearance.qml
 index 690126c..f215b76 100644
--- a/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentAppearance.qml
                
+++ b/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentAppearance.qml
 @@ -17,7 +17,6 @@
  */
 
 import QtQuick 2.0
-import org.kde.plasma.extras 2.0 as PlasmaExtras
 import org.kde.plasma.configuration 2.0
 import QtQuick.Controls 1.0 as QtControls
 import QtQuick.Layouts 1.0
@@ -26,9 +25,6 @@ ColumnLayout {
     id: root
 
     spacing: _m
-    PlasmaExtras.Title {
-        text: "Plugins"
-    }
 
 //BEGIN functions
     function saveConfig() {
@@ -49,68 +45,19 @@ ColumnLayout {
     }
 //END functions
 
-    ListView {
-        id: categoriesView
-        anchors {
-            left: parent.left
-            right: parent.right
-        }
-        height: 100
-        orientation: ListView.Horizontal 
-
-        model: configDialog.wallpaperConfigModel
-        delegate: ConfigCategoryDelegate {
-            id: delegate
-            current: categoriesView.currentIndex == index
-            anchors {
-                top: parent.top
-                bottom: parent.bottom
-                left: undefined
-                right: undefined
-            }
-            width: 64
-            onClicked: {
-                configDialog.currentWallpaper = model.pluginName
-                if (categoriesView.currentIndex == index) {
-                    return
-                } else {
-                    categoriesView.currentIndex = index;
-                    main.sourceFile = model.source
-                    root.restoreConfig()
-                }
-            }
-            onCurrentChanged: {
-                categoriesView.currentIndex = index
-                if (current) {
-                    categoriesView.currentIndex = index
-                }
-            }
-            Component.onCompleted: {
-                if (configDialog.currentWallpaper == model.pluginName) {
-                    loadWallpaperTimer.pendingCurrent = model
-                    loadWallpaperTimer.restart()
-                }
-            }
-        }
-        highlight: Rectangle {
-            color: theme.highlightColor
-        }
-        Timer {
-            id: loadWallpaperTimer
-            interval: 100
-            property variant pendingCurrent
-            onTriggered: {
-                if (pendingCurrent) {
-                    categoriesView.currentIndex = pendingCurrent.index
-                    main.sourceFile = pendingCurrent.source
-                    root.restoreConfig()
-                }
+    Component.onCompleted: {
+        for (var i = 0; i < configDialog.wallpaperConfigModel.count; ++i) {
+            var data = configDialog.wallpaperConfigModel.get(i);
+            for(var j in data) print(j)
+            if (configDialog.currentWallpaper == data.pluginName) {
+                pluginCombobox.currentIndex = i
+                break;
             }
         }
     }
 
     Row {
-        spacing: 10
+        spacing: 4
         QtControls.Label {
             anchors.verticalCenter: pluginCombobox.verticalCenter
             text: "Wallpaper plugin:"
@@ -119,6 +66,11 @@ ColumnLayout {
             id: pluginCombobox
             model: configDialog.wallpaperConfigModel
             textRole: "name"
+            onCurrentIndexChanged: {
+                var model = configDialog.wallpaperConfigModel.get(currentIndex)
+                main.sourceFile = model.source
+                root.restoreConfig()
+            }
         }
     }
 
@@ -126,7 +78,7 @@ ColumnLayout {
         id: main
         Layout.fillHeight: true;
         anchors {
-            left: categoriesView.left;
+            left: parent.left;
             right: parent.right;
         }
         property string sourceFile


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic