[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:21:44 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=b6858d7

The following commit has been merged in the master branch:
commit b6858d74504afd9a727f16c801fa574b41512f7c
Author: Aleix Pol <aleixpol at kde.org>
Date:   Thu Apr 12 00:51:43 2012 +0200

    Simplify some bits of the chat plasmoid's code
    
    Simplify the ConversationDelegate by actually using a Button and a QItemWidget, don't deal with plasma themes directly for no reason (if there was, I didn't see it).
    Unify the checked state of the chat views. Now there's not the problem when you press "Esc" that the Chat disappeared but the button remained pressed.
    
    REVIEW: 104543
---
 .../contents/ui/ConversationDelegate.qml           | 84 ++++---------------
 .../org.kde.ktp-chatplasmoid/contents/ui/main.qml  | 93 ++++++++++------------
 2 files changed, 58 insertions(+), 119 deletions(-)

diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ConversationDelegate.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ConversationDelegate.qml
index aa667b7..cdfff9e 100644
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ConversationDelegate.qml
+++ b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ConversationDelegate.qml
@@ -1,61 +1,39 @@
 import QtQuick 1.1
-import org.kde.telepathy.chat 0.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.qtextracomponents 0.1 as ExtraComponents
 
-Item {
-    id:base
+PlasmaComponents.Button {
+    id: base
     width: height
 
     property alias image: icon.icon
-    property alias text: icon.text
-    property bool pressed: false
-    property string overlayText: "0"
+    property alias overlayText: text.text
+    checkable: true
 
-    signal toggled
-
-    PlasmaCore.FrameSvgItem {
-        id: canvas
-
-        prefix: "normal"
-        imagePath: "widgets/tasks"
-        opacity: 1
-        anchors.fill: parent
-    }
-
-    PlasmaWidgets.IconWidget {
+    ExtraComponents.QIconItem {
         id: icon
-
-        anchors.fill: parent
-        anchors.margins: 5
-
-        orientation: Qt.Horizontal
+        anchors {
+            fill: parent
+            margins: 5
+        }
     }
 
-    Item {
-        id: notification
+    Rectangle {
         anchors {
             right: parent.right
             top: parent.top
         }
-
         width: parent.width / 3
         height: parent.height / 3
-
-        Rectangle {
-            id: background
-            anchors.fill: parent
-            color: "red"
-            radius: 3
-        }
+        color: "red"
+        radius: 3
 
         Text {
             id: text
             anchors.fill: parent
 
             font.pixelSize: parent.height
-            text: base.overlayText
+            text: "0"
             color: "white"
 
             horizontalAlignment: Text.AlignHCenter
@@ -64,38 +42,4 @@ Item {
 
         visible: base.overlayText != "0"
     }
-
-    MouseArea {
-        id: mouse
-        anchors.fill: parent
-
-        hoverEnabled: true
-        preventStealing: true
-
-        onClicked: toggle();
-    }
-
-    function toggle() {
-        base.pressed = !base.pressed;
-        base.toggled();
-    }
-
-    states: [
-        State {
-            name: "pressed"
-            when: base.pressed
-            PropertyChanges {
-                target: canvas
-                prefix: "focus"
-            }
-        },
-        State {
-            name: "hover"
-            when: mouse.containsMouse
-            PropertyChanges {
-                target: canvas
-                prefix: "hover"
-            }
-        }
-    ]
 }
\ No newline at end of file
diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/main.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/main.qml
index bfb6f1a..3a9b71f 100644
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/main.qml
+++ b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/main.qml
@@ -1,76 +1,71 @@
 import Qt 4.7
 import org.kde.telepathy.chat 0.1
 import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 import org.kde.plasma.components 0.1 as PlasmaComponents
 
+ListView {
+    id: base
+    anchors.fill: parent
+    orientation: Qt.Horizontal
+    spacing: 5
 
-Item {
+    model: handler.conversations
 
     TelepathyTextObserver {
         id: handler
     }
 
-    id: top
-    ListView {
-        id: base
-        anchors.fill: parent
-        orientation: Qt.Horizontal
+    delegate : ConversationDelegate {
+        //FIXME: rename the two variables named 'conv' as it's confusing
+        id: conv
+        anchors.top: parent.top
+        anchors.bottom: parent.bottom
 
-        model: handler.conversations
+        image: model.conversation.target.avatar
+        overlayText: model.conversation.messages.unreadCount
 
-        delegate : ConversationDelegate {
-            //FIXME: rename the two variables named 'conv' as it's confusing
-            id:conv
-            anchors.top: parent.top
-            anchors.bottom: parent.bottom
+        //FIXME: put in a loader to not slow down the model
+        PlasmaCore.Dialog {
+            id: dialog
+            //Set as a Tool window to bypass the taskbar
+            windowFlags: Qt.WindowStaysOnTopHint | Qt.Tool
+            visible: conv.checked
 
-            image: model.conversation.target.avatar
-            overlayText: model.conversation.messages.unreadCount
+            mainItem: ChatWidget {
+                width: 250
+                height: 350
+                conv: model.conversation
 
-            //FIXME: put in a loader to not slow down the model
-            PlasmaCore.Dialog {
-                id: dialog
-                //Set as a Tool window to bypass the taskbar
-                windowFlags: Qt.WindowStaysOnTopHint | Qt.Tool
-                visible: conv.pressed
-
-                mainItem: ChatWidget {
-                    width: 250
-                    height: 350
-                    conv: model.conversation
-
-                    onCloseRequested: {
-                        conv.pressed = false;
-                    }
+                onCloseRequested: {
+                    conv.checked = false;
                 }
             }
-
-            Connections {
-                target: model.conversation.messages
-                onPopoutRequested: {
-                    conv.pressed = true;
-                }
-            }
-
-            // needed to let MessageModel know when messages are visible
-            // so that it can acknowledge them properly
-            Binding {
-                target: model.conversation.messages
-                property: "visibleToUser"
-                value: conv.pressed
-            }
-
-            onToggled: {
-                if(pressed) {
+            
+            onVisibleChanged: {
+                if(visible) {
                     var point = dialog.popupPosition(conv, Qt.AlignBottom);
                     console.log("Showing dialog at (" + point.x + "," + point.y + ")");
 
                     dialog.x = point.x;
                     dialog.y = point.y;
                 }
+                conv.checked = visible
             }
         }
-    }
 
+        Connections {
+            target: model.conversation.messages
+            onPopoutRequested: {
+                conv.checked = true;
+            }
+        }
+
+        // needed to let MessageModel know when messages are visible
+        // so that it can acknowledge them properly
+        Binding {
+            target: model.conversation.messages
+            property: "visibleToUser"
+            value: dialog.visible
+        }
+    }
 }
\ No newline at end of file

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list