[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:47 UTC 2016


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

The following commit has been merged in the master branch:
commit 45ddf33b3cc3692538e8fecd3e148ed559300b31
Author: Aleix Pol <aleixpol at kde.org>
Date:   Tue Apr 17 16:36:22 2012 +0200

    Improve and simplify Chat Delegates
    
    Changes the TextDelegate to just display the text messages, puts the name on the section delegate
    For outgoing chats, leaves the same text color and puts a background color to differenciate
    
    REVIEW: 104635
---
 plasmoid/declarative-plugin/messages-model.cpp     |  9 ---
 plasmoid/declarative-plugin/messages-model.h       |  3 +-
 .../contents/ui/ChatWidget.qml                     |  8 +--
 .../contents/ui/IncomingDelegate.qml               |  5 --
 .../contents/ui/OutgoingDelegate.qml               |  9 ++-
 .../contents/ui/TextDelegate.qml                   | 66 ++++++++++------------
 6 files changed, 41 insertions(+), 59 deletions(-)

diff --git a/plasmoid/declarative-plugin/messages-model.cpp b/plasmoid/declarative-plugin/messages-model.cpp
index 92cd930..a097150 100644
--- a/plasmoid/declarative-plugin/messages-model.cpp
+++ b/plasmoid/declarative-plugin/messages-model.cpp
@@ -62,7 +62,6 @@ MessagesModel::MessagesModel(QObject *parent):
     roles[TextRole] = "text";
     roles[TimeRole] = "time";
     roles[TypeRole] = "type";
-    roles[ContinuingRole] = "continuing";
     setRoleNames(roles);
 
     d->visible = false;
@@ -204,14 +203,6 @@ QVariant MessagesModel::data(const QModelIndex& index, int role) const
         case TimeRole:
             result = requestedData->time;
             break;
-        case ContinuingRole:
-            if(index.row() > 0 &&
-                d->messages[index.row() - 1].user == requestedData->user) {
-                    result = true;
-            } else {
-                result = false;
-            }
-            break;
         };
     } else {
         kError() << "Attempting to access data at invalid index (" << index << ")";
diff --git a/plasmoid/declarative-plugin/messages-model.h b/plasmoid/declarative-plugin/messages-model.h
index 4df6d11..233bbfb 100644
--- a/plasmoid/declarative-plugin/messages-model.h
+++ b/plasmoid/declarative-plugin/messages-model.h
@@ -40,8 +40,7 @@ public:
         UserRole = Qt::UserRole,
         TextRole,
         TypeRole,
-        TimeRole,
-        ContinuingRole //FIXME: Come up with a better name for this
+        TimeRole
     };
 
     enum MessageType {
diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ChatWidget.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ChatWidget.qml
index 41e16fd..30efb4d 100644
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ChatWidget.qml
+++ b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/ChatWidget.qml
@@ -87,16 +87,14 @@ Item {
             leftMargin: 5
         }
         boundsBehavior: Flickable.StopAtBounds
+        section.property: "user"
+        section.delegate: PlasmaComponents.Label { text: section; font.bold: true; anchors.right: parent.right}
         clip: true
 
         delegate: Loader {
             Component.onCompleted: {
                 console.log(model.type);
                 switch(model.type) {
-                    case MessagesModel.MessageTypeIncoming:
-//                             console.log("Type: MessagesModel::MessageTypeIncoming");
-                        source = "IncomingDelegate.qml";
-                        break;
                     case MessagesModel.MessageTypeOutgoing:
 //                             console.log("Type: MessagesModel::MessageTypeOutgoing");
                         source = "OutgoingDelegate.qml"
@@ -105,8 +103,8 @@ Item {
 //                             console.log("Type: MessagesModel::MessageTypeAction");
                         source = "ActionDelegate.qml";
                         break;
+                    case MessagesModel.MessageTypeIncoming:
                     default:
-//                             console.log("ERROR: UNKNOWN MESSAGE TYPE! Defaulting to fallback handler");
                         source = "TextDelegate.qml";
                 }
             }
diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/IncomingDelegate.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/IncomingDelegate.qml
deleted file mode 100644
index dc16431..0000000
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/IncomingDelegate.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import org.kde.plasma.core 0.1 as PlasmaCore
-
-TextDelegate {
-    textColor: theme.textColor
-}
\ No newline at end of file
diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/OutgoingDelegate.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/OutgoingDelegate.qml
index 4dd8165..79bb681 100644
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/OutgoingDelegate.qml
+++ b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/OutgoingDelegate.qml
@@ -1,5 +1,10 @@
-import org.kde.plasma.core 0.1 as PlasmaCore
+import QtQuick 1.0
 
 TextDelegate {
-    textColor: theme.highlightColor
+    Rectangle {
+        color: theme.viewBackgroundColor
+        anchors.fill: parent
+        z: parent.z-1
+        opacity: 0.7
+    }
 }
\ No newline at end of file
diff --git a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/TextDelegate.qml b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/TextDelegate.qml
index b205d77..36b80bc 100644
--- a/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/TextDelegate.qml
+++ b/plasmoid/org.kde.ktp-chatplasmoid/contents/ui/TextDelegate.qml
@@ -1,46 +1,40 @@
-import Qt 4.7
+import QtQuick 1.0
 import org.kde.plasma.components 0.1 as PlasmaComponents
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.telepathy.chat 0.1
 
-Item {
-    property color textColor: "black"
+PlasmaComponents.Label {
+    id: body
+    wrapMode: Text.Wrap
+    width: view.width
 
-    PlasmaComponents.Label {
-        id: header
-
-        width: view.width
-        wrapMode: Text.Wrap
-
-        color: textColor
-        text: "<b>[" + Qt.formatTime(model.time) + "] " + model.user + " :</b>"
+    text: model.text
+    textFormat: Text.RichText
+    height: paintedHeight
 
-        verticalAlignment: Text.AlignBottom
-
-        visible: !model.continuing
-        Component.onCompleted: {
-            if(model.continuing) {
-                height = 0;
-            }
-        }
+    onLinkActivated: {
+        console.log("opening link: " + link);
+        plasmoid.openUrl(link);
     }
-    PlasmaComponents.Label {
-        id: body
 
-        anchors.top: header.bottom
-        width: view.width
-        wrapMode: Text.Wrap
-
-        color: textColor
-        text: model.text
-        textFormat: Text.RichText
-        height: paintedHeight
-
-        onLinkActivated: {
-            console.log("opening link: " + link);
-            plasmoid.openUrl(link);
+    //Hover to display the time when hovering a message
+    PlasmaComponents.Label {
+        text: Qt.formatTime(model.time)
+        anchors {
+            top: parent.top
+            right: parent.right
         }
+        Rectangle {
+            color: theme.backgroundColor
+            anchors.fill: parent
+            z: parent.z-1
+            opacity: 0.8
+            radius: 5
+        }
+        visible: mouseArea.containsMouse
     }
 
-    height: header.height + body.height
+    MouseArea {
+        id: mouseArea
+        anchors.fill: parent
+        hoverEnabled: true
+    }
 }
\ No newline at end of file

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list