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


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

The following commit has been merged in the master branch:
commit 8eb0f7a3505bb96a7db3d45bda0bc6d40b9e73a4
Author: Lasath Fernando <kde at lasath.org>
Date:   Tue Jan 3 18:03:30 2012 +1100

    Made Conversation inherit Queable and made the chat plasmoid in QML to get it to popout properly.
---
 lib/CMakeLists.txt                  |  2 ++
 lib/conversation-que-manager.cpp    | 37 ++++++++++++++++++++++---------------
 lib/conversation-que-manager.h      | 10 ++++++----
 lib/conversation.cpp                | 16 ++++++++++++++--
 lib/conversation.h                  |  8 +++++++-
 lib/messages-model.cpp              |  7 +++++--
 plasmoid/contents/ui/ChatWidget.qml |  2 +-
 plasmoid/contents/ui/main.qml       | 11 +++++++++++
 8 files changed, 68 insertions(+), 25 deletions(-)

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 25991b3..ce63431 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -5,6 +5,7 @@ set(ktpchat_SRCS
         conversation.cpp
         conversation-target.cpp
         conversations-model.cpp
+        conversation-que-manager.cpp
         adium-theme-view.cpp
         adium-theme-header-info.cpp
         adium-theme-message-info.cpp
@@ -32,6 +33,7 @@ set(ktpchat_HDRS
     chat-window-style-manager.h
     conversation.h
     conversation-target.h
+    conversation-que-manager.h
     conversations-model.h
     messages-model.h
 #     static-conversation.h
diff --git a/lib/conversation-que-manager.cpp b/lib/conversation-que-manager.cpp
index ceeabdb..8ac5083 100644
--- a/lib/conversation-que-manager.cpp
+++ b/lib/conversation-que-manager.cpp
@@ -1,6 +1,5 @@
 /*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  <copyright holder> <email>
+    Copyright (C) 2011  Lasath Fernando <kde at lasath.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -19,22 +18,25 @@
 
 
 #include "conversation-que-manager.h"
+#include <KDebug>
 
-
-
-Queable::Queable(ConversationQueManager* que)
+void Queable::push()
 {
-    if(que) {
-        m_queManager = que;
-    } else {
-        m_queManager = ConversationQueManager::instance();
+    if(!m_queManager->que.contains(this)) {
+        m_queManager->que.append(this);
     }
 }
 
-void Queable::push()
+Queable::~Queable()
 {
-    if(!m_queManager->que.contains(this)) {
-        m_queManager->que.append(this);
+
+}
+
+Queable::Queable(ConversationQueManager* que)
+    : m_queManager(que)
+{
+    if(!que) {
+        m_queManager = ConversationQueManager::instance();
     }
 }
 
@@ -43,7 +45,7 @@ ConversationQueManager* ConversationQueManager::instance()
     static ConversationQueManager* m_instance = 0;
 
     if(!m_instance) {
-        m_instance = ConversationQueManager();
+        m_instance = new ConversationQueManager();
     }
 
     return m_instance;
@@ -51,15 +53,20 @@ ConversationQueManager* ConversationQueManager::instance()
 
 ConversationQueManager::ConversationQueManager(QObject* parent): QObject(parent)
 {
+    kDebug();
+
     //FIXME: think of a good name for this. What did Kopete call it?
-    m_gloablAction = new KAction("cycle-unread-conversations");
-    m_gloablAction->setGlobalShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
+    m_gloablAction = new KAction(this);
+    m_gloablAction->setObjectName(QLatin1String("next-unread-conversation"));
+    m_gloablAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_J), KAction::ActiveShortcut | KAction::DefaultShortcut, KAction::NoAutoloading);
 
     connect(m_gloablAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(popConversation()));
 }
 
 void ConversationQueManager::popConversation()
 {
+    kDebug();
+
     if(!que.isEmpty()) {
         que.takeLast()->pop();
     }
diff --git a/lib/conversation-que-manager.h b/lib/conversation-que-manager.h
index 94ae6c7..dc8243f 100644
--- a/lib/conversation-que-manager.h
+++ b/lib/conversation-que-manager.h
@@ -1,6 +1,5 @@
 /*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  <copyright holder> <email>
+    Copyright (C) 2011  Lasath Fernando <kde at lasath.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -24,21 +23,24 @@
 #include <QtCore/QObject>
 #include <KAction>
 
+class ConversationQueManager;
 class Queable {
     friend class ConversationQueManager;
 public:
-    explicit Queable(ConversationQueManager* que = 0);
-
+    Queable(ConversationQueManager* que = 0);
 private:
     ConversationQueManager* m_queManager;
 
 protected:
+    virtual ~Queable();
+
     void push();
     virtual void pop() = 0;
 };
 
 class ConversationQueManager : public QObject
 {
+Q_OBJECT
     friend class Queable;
 public:
     static ConversationQueManager* instance();
diff --git a/lib/conversation.cpp b/lib/conversation.cpp
index 54373cf..8eb40a2 100644
--- a/lib/conversation.cpp
+++ b/lib/conversation.cpp
@@ -29,10 +29,11 @@ class Conversation::ConversationPrivate
 public:
     MessagesModel* model;
     ConversationTarget* target;
-    Tp::AccountPtr account;
+//     Tp::AccountPtr account;
 };
 
 Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
+        Queable(),
         d (new ConversationPrivate)
 {
     kDebug();
@@ -42,7 +43,8 @@ Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
 
     d->target = new ConversationTarget(channel->targetContact());
 
-    d->account = account;
+    connect(model(), SIGNAL(unreadCountChanged(int)), SLOT(onUnreadMessagesChanged()));
+//     d->account = account;
 }
 
 Conversation::Conversation(QObject* parent) : QObject(parent)
@@ -61,6 +63,16 @@ ConversationTarget* Conversation::target() const
     return d->target;
 }
 
+void Conversation::onUnreadMessagesChanged()
+{
+    push();
+}
+
+void Conversation::pop()
+{
+    Q_EMIT popoutRequested();
+}
+
 Conversation::~Conversation()
 {
     kDebug();
diff --git a/lib/conversation.h b/lib/conversation.h
index 71c1835..f07c81c 100644
--- a/lib/conversation.h
+++ b/lib/conversation.h
@@ -27,10 +27,11 @@
 #include <TelepathyQt/TextChannel>
 // #include "conversation-model.h"
 #include <KIcon>
+#include "conversation-que-manager.h"
 
 class ConversationTarget;
 class MessagesModel;
-class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
+class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject, public Queable
 {
 Q_OBJECT
 
@@ -49,6 +50,11 @@ public:
 Q_SIGNALS:
     void modelChanged(MessagesModel* newModel);
     void targetChanged(ConversationTarget* target);
+    void popoutRequested();
+
+private Q_SLOTS:
+    virtual void pop();
+    void onUnreadMessagesChanged();
 
 private:
     class ConversationPrivate;
diff --git a/lib/messages-model.cpp b/lib/messages-model.cpp
index 6bb515e..35b1e6d 100644
--- a/lib/messages-model.cpp
+++ b/lib/messages-model.cpp
@@ -37,7 +37,7 @@ public:
     } type;
 
     MessageItem(QString user, QString text, QDateTime time, MessageType type, QString messageId)
-     : user(user), text(text), time(time), type(type), id(messageId)
+     : user(user), text(text), time(time), id(messageId), type(type)
     {
         if(this->text.endsWith(QLatin1String("
"))) {
             this->text.chop(1);
@@ -252,7 +252,7 @@ void MessagesModel::setVisibleToUser(bool visible)
 
     if(d->visible != visible) {
         d->visible = visible;
-        Q_EMIT visibleToUserChanged(visible);
+        Q_EMIT visibleToUserChanged(d->visible);
     }
 
     if(visible) {
@@ -276,6 +276,9 @@ void MessagesModel::printallmessages()
     Q_FOREACH(MessageItem msg, d->messages) {
         kDebug() << msg.text;
     }
+    beginResetModel();
+    d->messages.clear();
+    endResetModel();
 }
 
 #include "moc_messages-model.cpp"
diff --git a/plasmoid/contents/ui/ChatWidget.qml b/plasmoid/contents/ui/ChatWidget.qml
index a5286cf..6aabd45 100644
--- a/plasmoid/contents/ui/ChatWidget.qml
+++ b/plasmoid/contents/ui/ChatWidget.qml
@@ -71,7 +71,7 @@ Item {
             bottom: input.top
 
             leftMargin: 5
-            rightMargin: leftMargin
+            rightMargin: chatArea.anchors.leftMargin
         }
 
 //         PlasmaComponents.Highlight { anchors.fill: chatArea }
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 99cbf4b..8111a54 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -36,6 +36,8 @@ Item {
                     height: 350
                     conv: model.conversation
 
+                    visible: model.conversation.model.visibleToUser
+
                     onCloseRequested: conv.popupApplet()
                     onConversationEndRequested: {
                         model.conversation.model.printallmessages();
@@ -43,6 +45,11 @@ Item {
                 }
             }
 
+            Connections {
+                target: model.conversation
+                onPopoutRequested: popupApplet();
+            }
+
             function popupApplet() {
                 if(dialog.visible == false) {
                     var point = dialog.popupPosition(conv, Qt.AlignBottom);
@@ -63,6 +70,10 @@ Item {
         }
     }
 
+    function derp() {
+        console.log("deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrp!");
+    }
+
 //     height: parent.height
 //     width: 60
 }
\ No newline at end of file

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list