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

List:       kde-commits
Subject:    [kde-workspace/mart/AppletAttached] plasma/generic/applets/systemtray: correctly load plasmoids
From:       Marco Martin <notmart () gmail ! com>
Date:       2014-01-31 17:26:20
Message-ID: E1W9HrA-0004oz-FN () scm ! kde ! org
[Download RAW message or body]

Git commit 66f085f905edea54f18f2f1ff2d60ba90de7df6e by Marco Martin.
Committed on 31/01/2014 at 14:30.
Pushed by mart into branch 'mart/AppletAttached'.

correctly load plasmoids

M  +2    -1    plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
 M  +25   -10   plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
 M  +2    -2    plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml
 M  +2    -1    plasma/generic/applets/systemtray/package/contents/ui/main.qml
M  +4    -1    plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp
 M  +11   -1    plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp
 M  +1    -0    plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.h
 M  +4    -0    plasma/generic/applets/systemtray/plugin/task.cpp
M  +4    -0    plasma/generic/applets/systemtray/plugin/task.h

http://commits.kde.org/kde-workspace/66f085f905edea54f18f2f1ff2d60ba90de7df6e

diff --git a/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml \
                index b3213bb..f5c2893 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
                
+++ b/plasma/generic/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
 @@ -52,6 +52,7 @@ Item {
     Connections {
         target: root
         onExpandedItemChanged: {
+            print(root.expandedItem)
             if (root.expandedItem != null) {
                 root.expandedItem.parent = expandedItemContainer;
                 root.expandedItem.anchors.fill = expandedItemContainer;
@@ -107,13 +108,13 @@ Item {
         id: separator
 
         width: lineSvg.elementSize("vertical-line").width;
-        height: parent.width;
         visible: root.expandedItem != null
 
         anchors {
             right: expandedItemContainer.left;
             rightMargin: units.largeSpacing
             bottom: parent.bottom;
+            top: parent.top;
         }
         elementId: "vertical-line";
 
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml index \
                1d0efdb..37b5c5e 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/TaskDelegate.qml
@@ -43,13 +43,6 @@ QtExtraComponents.MouseEventListener {
         //print("******************* Task changed:" + task.taskId + " " + task.name)
     }
 
-    Connections {
-        target: task
-        onExpandedChanged: {
-            print("FFFFFFFF"+expanded+"  "+task.name)
-        }
-        
-    }
 
     onClicked: {
         if (taskType == SystemTray.Task.TypePlasmoid) {
@@ -104,16 +97,37 @@ QtExtraComponents.MouseEventListener {
         }
     }
 
-    onExpandedItemChanged: {
-        if (expandedItem && root.expandedItem != expandedItem) {
+
+    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 if (root.currentTask == taskId) {
+        } else {
             // release
             root.currentTask = ""
             root.expandedItem = 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
@@ -151,6 +165,7 @@ QtExtraComponents.MouseEventListener {
         } else if (taskItem != undefined) {
             sniLoader.source = "PlasmoidItem.qml";
             taskItem.parent = taskItemContainer;
+            taskItem.z = 999;
             updatePlasmoidGeometry();
         }
     }
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/TaskListDelegate.qml index \
                1cb72c2..7c4a494 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"
 
-    property bool expanded: (root.currentTask == "")
+    snExpanded: (root.currentTask == "")
 
     width: snExpanded ? parent.width : height * 1.5 // be a bit more lenient to \
input  height: (root.baseSize * 2)
@@ -52,7 +52,7 @@ TaskDelegate {
             right: parent.right
             verticalCenter: parent.verticalCenter
         }
-        opacity: taskListDelegate.expanded ? 1 : 0
+        opacity: snExpanded ? 1 : 0
         Behavior on opacity { NumberAnimation { duration: 250 } }
         text: name
         elide: Text.ElideRight
diff --git a/plasma/generic/applets/systemtray/package/contents/ui/main.qml \
b/plasma/generic/applets/systemtray/package/contents/ui/main.qml index \
                be79f0a..c0421c1 100644
--- a/plasma/generic/applets/systemtray/package/contents/ui/main.qml
+++ b/plasma/generic/applets/systemtray/package/contents/ui/main.qml
@@ -33,7 +33,7 @@ Item {
 
     property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical)
 
-    Layout.minimumWidth: minimumHeight * 1.333
+    Layout.minimumWidth: Layout.minimumHeight * 1.333
     Layout.minimumHeight: theme.mSize(theme.defaultFont).height * 14
 
     Layout.preferredWidth: Layout.minimumWidth * 1.5
@@ -52,6 +52,7 @@ Item {
     property string currentTask: ""
     property string currentName: ""
 
+
     function togglePopup() {
         print("toggle popup => " + !plasmoid.expanded);
         if (!plasmoid.expanded) {
diff --git a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp \
b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp \
                index ec41c08..7b1c69c 100644
--- a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp
                
+++ b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp
 @@ -82,7 +82,10 @@ void PlasmoidProtocol::init()
     foreach (const KPluginInfo &info, applets) {
         KService::Ptr service = info.service();
         //HACK
-        if (info.pluginName() == "org.kde.plasma.mediacontroller" && \
!blacklist.contains(info.pluginName()) && \
service->property("X-Plasma-NotificationArea", QVariant::Bool).toBool()) { +        \
if (/*(info.pluginName()=="org.kde.plasma.mediacontroller" || +            \
info.pluginName()=="org.kde.plasma.notifications" || +            \
info.pluginName()=="org.kde.plasma.batterymonitor")&&*/ +            \
!blacklist.contains(info.pluginName()) && \
                service->property("X-Plasma-NotificationArea", \
                QVariant::Bool).toBool()) {
             // if we already have a plugin with this exact name in it, then check if \
it is the  // same plugin and skip it if it is indeed already listed
             if (sortedApplets.contains(info.name())) {
diff --git a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp \
b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp index \
                9bf7ef5..3339d0e 100644
--- a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp
+++ b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp
@@ -51,7 +51,7 @@ PlasmoidTask::PlasmoidTask(QQuickItem* rootItem, const QString \
                &packageName, con
     m_taskGraphicsObject = m_taskItem->property("graphicObject").value<QQuickItem \
*>();  
     if (m_taskGraphicsObject) {
-        //QMetaObject::invokeMethod(m_taskGraphicsObject, "init", \
Qt::DirectConnection); +        QMetaObject::invokeMethod(m_taskGraphicsObject, \
                "init", Qt::DirectConnection);
         qWarning()<<m_taskGraphicsObject->property("compactRepresentationItem");
         qWarning()<<m_taskGraphicsObject->property("fullRepresentationItem");
         
@@ -158,6 +158,7 @@ QString PlasmoidTask::taskId() const
 QQuickItem* PlasmoidTask::taskItem()
 {
     if (m_taskGraphicsObject) {
+        qWarning()<<"BBBBB"<<m_taskGraphicsObject<<m_taskGraphicsObject->property("title");
  return m_taskGraphicsObject;
     }
     return new QQuickItem();//m_taskItem;
@@ -192,6 +193,15 @@ void PlasmoidTask::syncStatus(QString newStatus)
     setStatus(status);
 }
 
+bool PlasmoidTask::expanded() const
+{
+    if (m_taskGraphicsObject) {
+        return m_taskGraphicsObject->property("expanded").toBool();
+    } else {
+        return false;
+    }
+}
+
 void PlasmoidTask::syncExpanded(bool expanded)
 {
     emit expandedChanged(expanded);
diff --git a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.h \
b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.h index \
                61253eb..90b81b1 100644
--- a/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.h
+++ b/plasma/generic/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.h
@@ -67,6 +67,7 @@ public:
     virtual QIcon icon() const;
     virtual bool isWidget() const;
     virtual TaskType type() const { return TypePlasmoid; };
+    virtual bool expanded() const;
 
     QString iconName() const { return m_iconName; }
     KPluginInfo pluginInfo() const;
diff --git a/plasma/generic/applets/systemtray/plugin/task.cpp \
b/plasma/generic/applets/systemtray/plugin/task.cpp index b56e5f9..8d89239 100644
--- a/plasma/generic/applets/systemtray/plugin/task.cpp
+++ b/plasma/generic/applets/systemtray/plugin/task.cpp
@@ -117,6 +117,10 @@ void Task::setShown(bool show)
     }
 }
 
+bool Task::expanded() const
+{
+    return false;
+}
 
 QQuickItem* Task::taskItem() const
 {
diff --git a/plasma/generic/applets/systemtray/plugin/task.h \
b/plasma/generic/applets/systemtray/plugin/task.h index b562a15..4a52859 100644
--- a/plasma/generic/applets/systemtray/plugin/task.h
+++ b/plasma/generic/applets/systemtray/plugin/task.h
@@ -53,6 +53,7 @@ class Task : public QObject
     Q_PROPERTY(Status status READ status NOTIFY changedStatus)
     Q_PROPERTY(QString name READ name NOTIFY changedName)
     Q_PROPERTY(Category category READ category NOTIFY changedCategory)
+    Q_PROPERTY(bool expanded READ expanded NOTIFY expandedChanged)
 
 public:
     enum Status {
@@ -158,6 +159,8 @@ public:
      */
     Status status() const;
 
+    virtual bool expanded() const;
+
     /**
      * This function must always return type of task (an integer value). This value \
                must always be
      * the same for each call of function.
@@ -179,6 +182,7 @@ Q_SIGNALS:
     void taskItemChanged();
     void taskItemExpandedChanged();
     void expandedChanged(bool expanded);
+
     /**
      * Special signal for changed status
      */


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

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