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


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

The following commit has been merged in the master branch:
commit 7f13d2dd2d21df9771aa6e4d03437969e9f0ebe3
Author: Lasath Fernando <kde at lasath.org>
Date:   Sat Dec 3 00:13:19 2011 +1100

    Added a dialog
    
    Plus optimization in MessagesModel
---
 lib/messages-model.cpp              |  14 ++--
 plasmoid/contents/ui/ChatWidget.qml | 132 +++++++++++++++++++-----------------
 plasmoid/contents/ui/main.qml       |  31 +++++++--
 3 files changed, 103 insertions(+), 74 deletions(-)

diff --git a/lib/messages-model.cpp b/lib/messages-model.cpp
index d87f454..989752e 100644
--- a/lib/messages-model.cpp
+++ b/lib/messages-model.cpp
@@ -65,7 +65,7 @@ bool MessagesModel::verifyPendingOperation ( Tp::PendingOperation* op )
 {
     bool success = !op->isError();
     if(!success) {
-        kWarning() << op->errorName() + QLatin1Char(':') + op->errorMessage();
+        kWarning() << op->errorName() << "+" << op->errorMessage();
     }
     return success;
 }
@@ -96,7 +96,8 @@ void MessagesModel::setTextChannel(Tp::TextChannelPtr channel)
 void MessagesModel::onMessageReceived(Tp::ReceivedMessage message)
 {
     kDebug();
-    beginInsertRows(QModelIndex(), d->messages.count(), d->messages.count());
+    int length = rowCount();
+    beginInsertRows(QModelIndex(), length, length);
 
     MessageItem newMessage = {
         message.sender()->alias(),
@@ -113,7 +114,8 @@ void MessagesModel::onMessageSent(Tp::Message message, Tp::MessageSendingFlags f
 {
     Q_UNUSED(flags);
     Q_UNUSED(token);
-    beginInsertRows(QModelIndex(), d->messages.count(), d->messages.count());
+    int length = rowCount();
+    beginInsertRows(QModelIndex(), length, length);
 
     MessageItem newMessage = {
         tr("Me"),   //FIXME : use actual nickname from Tp::AccountPtr
@@ -157,20 +159,20 @@ QVariant MessagesModel::data(const QModelIndex& index, int role) const
 
 int MessagesModel::rowCount(const QModelIndex& parent) const
 {
-    kDebug() << "size =" << d->messages.size();
     Q_UNUSED(parent);
-
     return d->messages.size();
 }
 
 Tp::PendingSendMessage* MessagesModel::sendNewMessage ( QString message )
 {
     Tp::PendingSendMessage* msg = 0;
+
     if(message.isEmpty()) {
         kWarning() << "Attempting to send empty string";
     } else {
         msg = d->textChannel->send(message);
-        connect(msg, SIGNAL(finished(Tp::PendingOperation*)), SLOT(verifyPendingOperation(Tp::PendingOperation*)));
+        connect(msg, SIGNAL(finished(Tp::PendingOperation*)),
+                SLOT(verifyPendingOperation(Tp::PendingOperation*)));
     }
 
     return msg;
diff --git a/plasmoid/contents/ui/ChatWidget.qml b/plasmoid/contents/ui/ChatWidget.qml
index 71b0bfd..d966f32 100644
--- a/plasmoid/contents/ui/ChatWidget.qml
+++ b/plasmoid/contents/ui/ChatWidget.qml
@@ -3,7 +3,7 @@ import org.kde.telepathy.declarativeplugins 0.1
 import org.kde.plasma.core 0.1 as PlasmaCore
 import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 
-Item {
+/*PlasmaCore.Dialog {
     id:main
 
     function derp() {
@@ -11,85 +11,89 @@ Item {
         return true;
     }
 
+
+    mainItem: */
+Item {
     property Conversation conv
 
-    PlasmaWidgets.IconWidget {
-        id: title
-        text: conv.nick
-        icon: conv.avatar
-        anchors.top: parent.top
-        anchors.left: parent.left; anchors.right: parent.right
-//         anchors.bottom: chatArea.top
-        height: 12
-        orientation: Qt.Horizontal
-    }
+        PlasmaWidgets.IconWidget {
+            id: title
+            text: conv.target.nick
+            icon: conv.target.avatar
+            anchors.top: parent.top
+            anchors.left: parent.left; anchors.right: parent.right
+    //         anchors.bottom: chatArea.top
+            height: 12
+            orientation: Qt.Horizontal
+        }
 
-    Item {
-        id:chatArea
+        Item {
+            id:chatArea
 
-//         anchors.top: parent.top
-        anchors.top: title.bottom
-        anchors.left: parent.left; anchors.right: parent.right
-        anchors.bottom: input.top
-        anchors.margins: 5
+    //         anchors.top: parent.top
+            anchors.top: title.bottom
+            anchors.left: parent.left; anchors.right: parent.right
+            anchors.bottom: input.top
+            anchors.margins: 5
 
-        Rectangle {
-            anchors.fill: chatArea
-        }
+            Rectangle {
+                anchors.fill: chatArea
+            }
 
-        ListView {
-            id: view
+            ListView {
+                id: view
 
-            anchors.fill: parent
-            clip: true
+                anchors.fill: parent
+                clip: true
 
-            delegate: TextDelegate {}
-            model: conv.model
-            ListView.onAdd: {
-                derp();
+                delegate: TextDelegate {}
+                model: conv.model
+                ListView.onAdd: {
+                    derp();
+                }
             }
-        }
 
-        //used states here because it'll make a scrollbar (dis)appear later on
-        states: [
-            State {
-                name: "static"
-            },
-            State {
-                name: "auto-scrolling"
-                PropertyChanges {
-                    target: view.model
-                    restoreEntryValues: true
-                    onRowsInserted: {
-                        view.positionViewAtEnd();
+            //used states here because it'll make a scrollbar (dis)appear later on
+            states: [
+                State {
+                    name: "static"
+                },
+                State {
+                    name: "auto-scrolling"
+                    PropertyChanges {
+                        target: view.model
+                        restoreEntryValues: true
+                        onRowsInserted: {
+                            view.positionViewAtEnd();
+                        }
                     }
                 }
-            }
-        ]
+            ]
 
-    }
+        }
 
-    PlasmaWidgets.LineEdit {
-        id: input
+        PlasmaWidgets.LineEdit {
+            id: input
 
-//         anchors.top: view.bottom
-        anchors.left: parent.left; anchors.right: parent.right
-        anchors.bottom: parent.bottom
+    //         anchors.top: view.bottom
+            anchors.left: parent.left; anchors.right: parent.right
+            anchors.bottom: parent.bottom
 
-        onReturnPressed: {
-            view.model.sendNewMessage(text);
-            text = "";
+            onReturnPressed: {
+                view.model.sendNewMessage(text);
+                text = "";
+            }
         }
     }
 
-    ConversationWatcher {
-        id:watcher
-        onNewConversation: {
-            console.log("New Convo!");
-            conv = con;
-//             conv.model = con.model;
-//             view.model.rowsInserted.connect(view.positionViewAtEnd);
-            chatArea.state = "auto-scrolling";
-        }
-    }
-}
\ No newline at end of file
+//     ConversationWatcher {
+//         id:watcher
+//         onNewConversation: {
+//             console.log("New Convo!");
+//             conv = con;
+// //             conv.model = con.model;
+// //             view.model.rowsInserted.connect(view.positionViewAtEnd);
+//             chatArea.state = "auto-scrolling";
+//         }
+//     }
+// }
\ No newline at end of file
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 10b31bf..560e187 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -11,14 +11,37 @@ Item {
 
         model: convos
         delegate : Item {
-            PlasmaWidgets.SvgWidget {
-                elementID: "widgets/frame.svg"
-                anchors.fill: parent
-            }
+//             PlasmaWidgets.SvgWidget {
+//                 elementID: "widgets/frame.svg"
+//                 anchors.fill: parent
+//             }
             PlasmaWidgets.IconWidget {
+                id: icon
                 text: model.conversation.target.nick
                 icon: model.conversation.target.presenceIcon
                 anchors.fill: parent
+
+//                 Component {
+//                     id: chatComp
+
+//                 }
+                property Component popout: PlasmaCore.Dialog {
+                        mainItem: ChatWidget {
+                            width: 200
+                            height: 400
+                            conv: model.conversation
+                        }
+                    }
+
+                onClicked: {
+                    var dialog = popout.createObject(base, {});
+                    console.log(dialog);
+                    var point = dialog.popupPosition(icon, Qt.AlignTop);
+                    console.log("Showing dialog at (" + point.x + "," + point.y + ")");
+                    dialog.x = point.x;
+                    dialog.y = point.y;
+                    dialog.animatedShow(PlasmaCore.Up);
+                }
             }
         }
     }

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list