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

List:       kde-commits
Subject:    [kde-workspace/mart/AppletAttached] plasma: use a pointer to the task as currentTask
From:       Marco Martin <notmart () gmail ! com>
Date:       2014-01-31 17:26:21
Message-ID: E1W9HrB-0004oz-Lo () scm ! kde ! org
[Download RAW message or body]

Git commit d9bce5d90c865d1252993b02b2cea97165bc076d by Marco Martin.
Committed on 31/01/2014 at 17:25.
Pushed by mart into branch 'mart/AppletAttached'.

use a pointer to the task as currentTask

switching mechanics restored

M  +3    -1    plasma/desktop/containments/panel/contents/ui/main.qml
M  +4    -6    plasma/generic/applets/systemtray/package/contents/ui/CompactRepresentation.qml
 M  +11   -40   plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
 M  +1    -5    plasma/generic/applets/systemtray/package/contents/ui/PlasmoidItem.qml
 M  +15   -28   plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
 M  +1    -1    plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml
 M  +1    -3    plasma/generic/applets/systemtray/package/contents/ui/main.qml

http://commits.kde.org/kde-workspace/d9bce5d90c865d1252993b02b2cea97165bc076d

diff --git a/plasma/desktop/containments/panel/contents/ui/main.qml \
b/plasma/desktop/containments/panel/contents/ui/main.qml index 96c48ad..7ebe835 \
                100644
--- a/plasma/desktop/containments/panel/contents/ui/main.qml
+++ b/plasma/desktop/containments/panel/contents/ui/main.qml
@@ -230,7 +230,9 @@ function checkLastSpacer() {
                     checkLastSpacer();
                 }
             }
-
+Text{
+   text: (applet && applet.Layout ? applet.Layout.minimumWidth : "pollo")
+}
             Layout.minimumWidth: (plasmoid.formFactor != PlasmaCore.Types.Vertical ? \
(applet && applet.Layout.minimumWidth > 0 ? applet.Layout.minimumWidth : root.height) \
: root.width)  Layout.minimumHeight: (plasmoid.formFactor == \
PlasmaCore.Types.Vertical ? (applet && applet.Layout.minimumHeight > 0 ? \
applet.Layout.minimumHeight : root.width) : root.height)  
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/CompactRepresentation.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/CompactRepresentation.qml \
                index 32ad47e..2e07d3f 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/CompactRepresentation.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/CompactRepresentation.qml
@@ -32,8 +32,8 @@ QtExtraComponents.MouseEventListener {
 
     Layout.minimumWidth: !root.vertical ? computeDimension() : \
                computeDimensionHeight()
     Layout.minimumHeight: root.vertical ? computeDimension() : \
                computeDimensionHeight()
-    Layout.maximumWidth: minimumWidth
-    Layout.maximumHeight: minimumHeight
+    Layout.maximumWidth: Layout.minimumWidth
+    Layout.maximumHeight: Layout.minimumHeight
 
     Layout.fillWidth: false
     Layout.fillHeight: false
@@ -49,8 +49,8 @@ QtExtraComponents.MouseEventListener {
         running: false
         repeat: false
         onTriggered: {
-            //print("hidetimer triggered, collapsing " + (root.currentTask == "") )
-            if (root.currentTask == "") {
+            //print("hidetimer triggered, collapsing " + (root.expandedTask == null) \
) +            if (root.expandedTask == null) {
                 plasmoid.expanded = false
             }
         }
@@ -84,8 +84,6 @@ QtExtraComponents.MouseEventListener {
         anchors.fill: parent
         onClicked: {
             plasmoid.expanded = true;
-            root.currentTask = "";
-            root.expandedItem = null
         }
     }
 
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml \
                index f5c2893..d6d81cc 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
                
+++ b/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
 @@ -28,42 +28,16 @@ Item {
 
     anchors.margins: units.largeSpacing
 
-    function checkTask(task) {
-        if (task.taskItemExpanded == null) return;
-        var isthis = (task.taskId == root.currentTask);
-        if (!isthis) {
-            task.expandApplet(false);
-        } else {
-            root.currentName = task.name;
-        }
-    }
-
-    function clearExpanded() {
-        var _hidden = host.hiddenTasks;
-        for (var i = 0; i < _hidden.length; i++) {
-            checkTask(_hidden[i]);
-        }
-        var _shown = host.shownTasks;
-        for (i = 0; i < _shown.length; i++) {
-            checkTask(_shown[i]);
-        }
-    }
-
     Connections {
         target: root
-        onExpandedItemChanged: {
-            print(root.expandedItem)
-            if (root.expandedItem != null) {
-                root.expandedItem.parent = expandedItemContainer;
-                root.expandedItem.anchors.fill = expandedItemContainer;
-                expandedItemContainer.replace(root.expandedItem);
+        onExpandedTaskChanged: {
+            if (root.expandedTask) {
+                root.expandedTask.taskItemExpanded.parent = expandedItemContainer;
+                root.expandedTask.taskItemExpanded.anchors.fill = \
expandedItemContainer; +                \
expandedItemContainer.replace(root.expandedTask.taskItemExpanded);  } else {
-                if (expandedItemContainer.currentPage != null) {
-                    expandedItemContainer.clear();
-                }
-                root.currentTask = "";
+                expandedItemContainer.clear();
             }
-            clearExpanded();
         }
     }
 
@@ -75,11 +49,8 @@ Item {
             right: expandedItemContainer.left
         }
         onClicked: {
-            clearExpanded();
             expandedItemContainer.clear();
-            root.currentTask = ""
-            root.currentName = ""
-            root.expandedItem = null;
+            root.expandedTask = null;
         }
     }
 
@@ -108,7 +79,7 @@ Item {
         id: separator
 
         width: lineSvg.elementSize("vertical-line").width;
-        visible: root.expandedItem != null
+        visible: root.expandedTask != null
 
         anchors {
             right: expandedItemContainer.left;
@@ -128,7 +99,7 @@ Item {
         id: snHeading
 
         level: 1
-        opacity: root.currentTask != "" ? 0 : 0.8
+        opacity: root.expandedTask != null ? 0 : 0.8
         Behavior on opacity { NumberAnimation {} }
 
         anchors {
@@ -144,7 +115,7 @@ Item {
         id: snHeadingExpanded
 
         level: 1
-        opacity: root.currentTask != "" ? 0.8 : 0
+        opacity: root.expandedTask != null ? 0.8 : 0
         Behavior on opacity { NumberAnimation {} }
 
         anchors {
@@ -152,7 +123,7 @@ Item {
             left: expandedItemContainer.left
             right: parent.right
         }
-        text: root.currentName
+        text: root.expandedTask ? root.expandedTask.name : ""
     }
 
     PlasmaComponents.PageStack {
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/PlasmoidItem.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/PlasmoidItem.qml index \
                b4517d6..0eb1687 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/PlasmoidItem.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/PlasmoidItem.qml
@@ -35,10 +35,6 @@ Item {
         anchors {
             fill: parent
         }
-        onClicked: {
-            print("PlasmoidItem.qml clicked: "  + plasmoid.expanded);
-            //plasmoid.expanded = !plasmoid.expanded;
-            expandApplet(true);
-        }
+        onClicked: expanded = true;
     }
 }
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml index \
                37b5c5e..4ca778a 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
@@ -35,7 +35,7 @@ QtExtraComponents.MouseEventListener {
     hoverEnabled: true
 
     property variant task: null
-    property bool isCurrentTask: (root.currentTask == taskId)
+    property bool isCurrentTask: (root.expandedTask == modelData)
 
     property bool isHiddenItem: false
 
@@ -56,15 +56,15 @@ QtExtraComponents.MouseEventListener {
         running: false
         repeat: false
         onTriggered: {
-            print("hidetimer triggered, collapsing " + (root.currentTask == "") )
-            if (root.currentTask == "") {
+            print("hidetimer triggered, collapsing " + (root.expandedTask == null) )
+            if (root.expandedTask == null) {
                 plasmoid.expanded = false
             }
         }
     }
 
     // opacity is raised when: plasmoid is collapsed, we are the current task, or \
                it's hovered
-    opacity: (containsMouse || !plasmoid.expanded || root.currentTask == taskId) || \
(plasmoid.expanded && root.currentTask == "") ? 1.0 : 0.6 +    opacity: \
(containsMouse || !plasmoid.expanded || isCurrentTask) || (plasmoid.expanded && \
root.expandedTask == null) ? 1.0 : 0.6  Behavior on opacity { NumberAnimation { \
duration: 150 } }  
     property int taskStatus: status
@@ -99,35 +99,22 @@ QtExtraComponents.MouseEventListener {
 
 
     property bool isExpanded: expanded
+
     onIsExpandedChanged: {
-        if (!expandedItem) {
-            return;
-        }
-        print("AAA"+expanded+root.expandedItem+expandedItem)
-        expandedItem.visible = false;
         if (expanded) {
-            root.currentTask = taskId;
-            root.expandedItem = expandedItem;
-        } else {
-            // release
-            root.currentTask = ""
-            root.expandedItem = null;
+            var task;
+            if (root.expandedTask) {
+                task = root.expandedTask;
+            }
+            root.expandedTask = modelData;
+            if (task) {
+                task.expanded = false;
+            }
+        } else if (root.expandedTask == modelData) {
+            root.expandedTask = null;
         }
     }
-    onExpandedItemChanged: {
-        if (!expandedItem) {
-            return;
-        }
 
-        /*if (expanded && root.expandedItem == expandedItem) {
-            root.expandedItem.visible = false;
-            root.currentTask = taskId;
-            root.expandedItem = expandedItem;
-            expandedItem.visible = true;
-        } else {
-            expandedItem.visible = false;
-        }*/
-    }
 
     PulseAnimation {
         targetItem: taskItemContainer
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml index \
                7c4a494..130f885 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml
@@ -28,7 +28,7 @@ TaskDelegate {
     id: taskListDelegate
     objectName: "taskListDelegate"
 
-    snExpanded: (root.currentTask == "")
+    snExpanded: (root.expandedTask == null)
 
     width: snExpanded ? parent.width : height * 1.5 // be a bit more lenient to \
input  height: (root.baseSize * 2)
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/main.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/main.qml index \
                c0421c1..eb2bbe4 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/main.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/main.qml
@@ -48,9 +48,7 @@ Item {
 
     property bool debug: plasmoid.configuration.debug
 
-    property Item expandedItem: null
-    property string currentTask: ""
-    property string currentName: ""
+    property QtObject expandedTask: null;
 
 
     function togglePopup() {


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

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