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


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

The following commit has been merged in the master branch:
commit 5e449a9acec418ae67516376743d54c3f655276b
Author: Lasath Fernando <kde at lasath.org>
Date:   Thu Dec 1 09:41:55 2011 +1100

    Renamed all the classes for clarity.
    
    Added a new ConversationTarget class, that just picks apart a Tp::ContactPtr
---
 lib/CMakeLists.txt                                 |  10 +-
 lib/conversation-model.h                           |  75 ---------------
 lib/conversation-target.cpp                        | 104 +++++++++++++++++++++
 lib/{conversation.h => conversation-target.h}      |  48 +++++-----
 lib/conversation.cpp                               |  54 ++++-------
 lib/conversation.h                                 |  31 ++----
 lib/conversations-model.cpp                        |  10 +-
 lib/{conversation-model.cpp => messages-model.cpp} |  30 +++---
 lib/{conversation-model.h => messages-model.h}     |  10 +-
 lib/qml-plugins.cpp                                |   9 +-
 ...ion-watcher.cpp => telepathy-text-observer.cpp} |  22 +++--
 ...rsation-watcher.h => telepathy-text-observer.h} |  10 +-
 plasmoid/contents/ui/main.qml                      |  10 +-
 13 files changed, 217 insertions(+), 206 deletions(-)

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 6405151..e2bca3f 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -3,8 +3,7 @@ set(ktpchat_SRCS
         chat-window-style.cpp
         chat-window-style-manager.cpp
         conversation.cpp
-        conversation-model.cpp
-        conversation-watcher.cpp
+        conversation-target.cpp
         conversations-model.cpp
         adium-theme-view.cpp
         adium-theme-header-info.cpp
@@ -16,6 +15,8 @@ set(ktpchat_SRCS
         chat-text-edit.cpp
         chat-search-bar.cpp
         logmanager.cpp
+        messages-model.cpp
+        telepathy-text-observer.cpp
 )
 
 set(ktpchat_HDRS
@@ -29,9 +30,10 @@ set(ktpchat_HDRS
     chat-window-style.h
     chat-window-style-manager.h
     conversation.h
-    conversation-model.h
-    conversation-watcher.h
+    conversation-target.h
     conversations-model.h
+    messages-model.h
+    telepathy-text-observer.h
 )
 
 set(ktpchat_PRETTY_HDRS
diff --git a/lib/conversation-model.h b/lib/conversation-model.h
index e44b217..e69de29 100644
--- a/lib/conversation-model.h
+++ b/lib/conversation-model.h
@@ -1,75 +0,0 @@
-/*
-    <one line to give the library's name and an idea of what it does.>
-    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
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-
-#ifndef CONVERSATION_MODEL_H
-#define CONVERSATION_MODEL_H
-
-#include "kdetelepathychat_export.h"
-
-#include <QAbstractItemModel>
-#include <TelepathyQt4/TextChannel>
-
-
-class KDE_TELEPATHY_CHAT_EXPORT ConversationModel : public QAbstractListModel
-{
-Q_OBJECT
-// Q_PROPERTY(Tp::TextChannelPtr textChannel
-// 			READ textChannel
-// 			WRITE setTextChannel
-// 			NOTIFY textChannelChanged
-// 		  )
-
-public:
-    ConversationModel(QObject* parent = 0);
-    virtual ~ConversationModel();
-
-	enum Roles {
-		UserRole = Qt::UserRole,
-		TextRole,
-		TypeRole,
-		TimeRole
-	};
-
-    virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-    virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
-
-	Tp::TextChannelPtr textChannel();
-	void setTextChannel(Tp::TextChannelPtr channel);
-
-Q_SIGNALS:
-	void textChannelChanged(Tp::TextChannelPtr newChannel);
-
-public Q_SLOTS:
-    Tp::PendingSendMessage* sendNewMessage(QString message);
-
-private Q_SLOTS:
-    void onMessageReceived(Tp::ReceivedMessage);
-    void onMessageSent(Tp::Message,Tp::MessageSendingFlags,QString);
-    bool verifyPendingOperation(Tp::PendingOperation* op);
-
-private:
-	void setupChannelSignals(Tp::TextChannelPtr channel);
-	void removeChannelSignals(Tp::TextChannelPtr channel);
-
-	class ConversationModelPrivate;
-	ConversationModelPrivate *d;
-};
-
-#endif // CONVERSATION_MODEL_H
diff --git a/lib/conversation-target.cpp b/lib/conversation-target.cpp
new file mode 100644
index 0000000..49e52f3
--- /dev/null
+++ b/lib/conversation-target.cpp
@@ -0,0 +1,104 @@
+/*
+    <one line to give the library's name and an idea of what it does.>
+    Copyright (C) 2011  <copyright holder> <email>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "kdetelepathychat_export.h"
+
+#include "conversation-target.h"
+#include <TelepathyQt4/AvatarData>
+#include <TelepathyQt4/Presence>
+#include <KDebug>
+
+class  ConversationTarget::ConversationTargetPrivate
+{
+public:
+    Tp::ContactPtr contact;
+};
+
+ConversationTarget::ConversationTarget(Tp::ContactPtr contact) :
+        d(new ConversationTargetPrivate)
+{
+    kDebug();
+
+    if (contact) {
+        setupContactSignals(contact);
+    }
+
+    d->contact = contact;
+}
+
+void ConversationTarget::setupContactSignals(Tp::ContactPtr contact)
+{
+    connect(contact.constData(), SIGNAL(aliasChanged(QString)), SIGNAL(nickChanged(QString)));
+    connect(contact.constData(), SIGNAL(avatarDataChanged(Tp::AvatarData)), SLOT(onAvatarDataChanged(Tp::AvatarData)));
+    connect(contact.constData(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onPresenceChanged(Tp::Presence)));
+}
+
+QIcon ConversationTarget::avatar() const
+{
+    return QIcon(d->contact->avatarData().fileName);
+}
+
+QString ConversationTarget::nick() const
+{
+    return d->contact->alias();
+}
+
+QIcon ConversationTarget::presenceIcon() const
+{
+    return ChatWidget::iconForPresence(d->contact->presence().type());
+}
+
+void ConversationTarget::onPresenceChanged(Tp::Presence)
+{
+    Q_EMIT presenceIconChanged(presenceIcon());
+}
+
+void ConversationTarget::onAvatarDataChanged(Tp::AvatarData)
+{
+    Q_EMIT avatarChanged(avatar());
+}
+
+Tp::ContactPtr ConversationTarget::contact() const
+{
+    return d->contact;
+}
+
+void ConversationTarget::setContact(Tp::ContactPtr contact)
+{
+    if (d->contact) {
+        removeContactSignals(d->contact);
+    }
+
+    d->contact = contact;
+    setupContactSignals(d->contact);
+    Q_EMIT contactChanged(contact);
+}
+
+void ConversationTarget::removeContactSignals(Tp::ContactPtr contact)
+{
+    disconnect(contact.constData(), SIGNAL(aliasChanged(QString)), this, SIGNAL(nickChanged(QString)));
+    disconnect(contact.constData(), SIGNAL(avatarDataChanged(Tp::AvatarData)), this, SLOT(onAvatarDataChanged(Tp::AvatarData)));
+    disconnect(contact.constData(), SIGNAL(presenceChanged(Tp::Presence)), this, SLOT(onPresenceChanged(Tp::Presence)));
+}
+
+ConversationTarget::~ConversationTarget()
+{
+    delete d;
+}
+
diff --git a/lib/conversation.h b/lib/conversation-target.h
similarity index 63%
copy from lib/conversation.h
copy to lib/conversation-target.h
index 61ea7da..0251bb6 100644
--- a/lib/conversation.h
+++ b/lib/conversation-target.h
@@ -1,6 +1,6 @@
 /*
     <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2011  Lasath Fernando <kde at lasath.org>
+    Copyright (C) 2011  <copyright holder> <email>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -18,54 +18,54 @@
 */
 
 
-#ifndef CONVERSATION_H
-#define CONVERSATION_H
-
-#include "kdetelepathychat_export.h"
+#ifndef CONVERSATION_TARGET_H
+#define CONVERSATION_TARGET_H
 
 #include <QObject>
-#include <TelepathyQt4/Account>
-#include <TelepathyQt4/TextChannel>
-#include "conversation-model.h"
-#include <KIcon>
+#include <TelepathyQt4/Contact>
+
+#include "chat-widget.h"
+#include "kdetelepathychat_export.h"
 
-class ConversationModel;
-class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
+class KDE_TELEPATHY_CHAT_EXPORT ConversationTarget : public QObject
 {
 Q_OBJECT
 
-Q_PROPERTY(ConversationModel* model READ model NOTIFY modelChanged)
-
 Q_PROPERTY(QIcon avatar READ avatar NOTIFY avatarChanged);
 Q_PROPERTY(QString nick READ nick NOTIFY nickChanged);
 Q_PROPERTY(QIcon presenceIcon READ presenceIcon NOTIFY presenceIconChanged);
 
-public:
-    Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account);
-    Conversation(QObject* parent = 0);
-    virtual ~Conversation();
+//turns out you can't have non QObjects as properties
+// Q_PROPERTY(Tp::ContactPtr contact READ contact WRITE setContact NOTIFY contactChanged);
 
-    ConversationModel* model() const;
+public:
+    ConversationTarget( Tp::ContactPtr contact = Tp::ContactPtr());
+    virtual ~ConversationTarget();
 
     QIcon avatar() const;
     QString nick() const;
     QIcon presenceIcon() const;
 
-Q_SIGNALS:
-    void modelChanged(ConversationModel* newModel);
+    Tp::ContactPtr contact() const;
+    void setContact(Tp::ContactPtr contact);
 
+Q_SIGNALS:
     void avatarChanged(QIcon avatar);
     void nickChanged(QString nick);
     void presenceIconChanged(QIcon icon);
 
+    void contactChanged(Tp::ContactPtr contact);
+
 private Q_SLOTS:
     void onAvatarDataChanged ( Tp::AvatarData );
     void onPresenceChanged ( Tp::Presence );
-//     void onAliasChanged ( Tp::AvatarData );
 
 private:
-    class ConversationPrivate;
-    ConversationPrivate *d;
+    void setupContactSignals(Tp::ContactPtr contact);
+    void removeContactSignals(Tp::ContactPtr contact);
+
+    class ConversationTargetPrivate;
+    ConversationTargetPrivate *d;
 };
 
-#endif // CONVERSATION_H
+#endif // CONVERSATION_TARGET_H
diff --git a/lib/conversation.cpp b/lib/conversation.cpp
index 470c568..ebd319f 100644
--- a/lib/conversation.cpp
+++ b/lib/conversation.cpp
@@ -19,73 +19,53 @@
 
 
 #include "conversation.h"
-#include "conversation-model.h"
+#include "messages-model.h"
 
 #include <TelepathyQt4/TextChannel>
 #include <KDebug>
-#include "chat-widget.h"
+#include "conversation-target.h"
 
 class Conversation::ConversationPrivate
 {
 public:
-    ConversationModel* model;
+    MessagesModel* model;
+    ConversationTarget* target;
     Tp::AccountPtr account;
-    Tp::ContactPtr contact;
 };
 
-Conversation::Conversation ( Tp::TextChannelPtr channel, Tp::AccountPtr account ) :
-        d ( new ConversationPrivate )
+Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
+        d (new ConversationPrivate)
 {
     kDebug();
 
-    d->model = new ConversationModel();
-    d->model->setTextChannel ( channel );
+    d->model = new MessagesModel();
+    d->model->setTextChannel(channel);
 
-    d->account = account;
-    d->contact = channel->targetContact();
+    d->target = new ConversationTarget(channel->targetContact());
 
-    connect(d->contact.constData(), SIGNAL(aliasChanged(QString)), SIGNAL(nickChanged(QString)));
-    connect(d->contact.constData(), SIGNAL(avatarDataChanged(Tp::AvatarData)), SLOT(onAvatarDataChanged(Tp::AvatarData)));
-    connect(d->contact.constData(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onPresenceChanged(Tp::Presence)));
+    d->account = account;
 }
 
-Conversation::Conversation ( QObject* parent ) : QObject ( parent )
+Conversation::Conversation(QObject* parent) : QObject(parent)
 {
     kError() << "Conversation should not be created directly. Use ConversationWatcher instead.";
+    Q_ASSERT(false);
 }
 
-ConversationModel* Conversation::model() const
+MessagesModel* Conversation::model() const
 {
     return d->model;
 }
 
-QIcon Conversation::avatar() const
-{
-    return QIcon(d->contact->avatarData().fileName);
-}
-
-QString Conversation::nick() const
-{
-    return d->contact->alias();
-}
-
-QIcon Conversation::presenceIcon() const
+ConversationTarget* Conversation::target() const
 {
-    return ChatWidget::iconForPresence(d->contact->presence().type());
+    return d->target;
 }
 
 Conversation::~Conversation()
 {
     kDebug();
     delete d->model;
-}
-
-void Conversation::onPresenceChanged ( Tp::Presence )
-{
-    Q_EMIT presenceIconChanged(presenceIcon());
-}
-
-void Conversation::onAvatarDataChanged ( Tp::AvatarData )
-{
-    Q_EMIT avatarChanged(avatar());
+    delete d->target;
+    delete d;
 }
diff --git a/lib/conversation.h b/lib/conversation.h
index 61ea7da..2e510f8 100644
--- a/lib/conversation.h
+++ b/lib/conversation.h
@@ -26,42 +26,31 @@
 #include <QObject>
 #include <TelepathyQt4/Account>
 #include <TelepathyQt4/TextChannel>
-#include "conversation-model.h"
+// #include "conversation-model.h"
 #include <KIcon>
+#include "conversation-target.h"
 
-class ConversationModel;
+class ConversationTarget;
+class MessagesModel;
 class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
 {
 Q_OBJECT
 
-Q_PROPERTY(ConversationModel* model READ model NOTIFY modelChanged)
+Q_PROPERTY(MessagesModel* model READ model NOTIFY modelChanged);
+Q_PROPERTY(ConversationTarget* target READ target NOTIFY targetChanged);
 
-Q_PROPERTY(QIcon avatar READ avatar NOTIFY avatarChanged);
-Q_PROPERTY(QString nick READ nick NOTIFY nickChanged);
-Q_PROPERTY(QIcon presenceIcon READ presenceIcon NOTIFY presenceIconChanged);
 
 public:
     Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account);
     Conversation(QObject* parent = 0);
     virtual ~Conversation();
 
-    ConversationModel* model() const;
-
-    QIcon avatar() const;
-    QString nick() const;
-    QIcon presenceIcon() const;
+    MessagesModel* model() const;
+    ConversationTarget* target() const;
 
 Q_SIGNALS:
-    void modelChanged(ConversationModel* newModel);
-
-    void avatarChanged(QIcon avatar);
-    void nickChanged(QString nick);
-    void presenceIconChanged(QIcon icon);
-
-private Q_SLOTS:
-    void onAvatarDataChanged ( Tp::AvatarData );
-    void onPresenceChanged ( Tp::Presence );
-//     void onAliasChanged ( Tp::AvatarData );
+    void modelChanged(MessagesModel* newModel);
+    void targetChanged(ConversationTarget* target);
 
 private:
     class ConversationPrivate;
diff --git a/lib/conversations-model.cpp b/lib/conversations-model.cpp
index 677f53c..3dbeba6 100644
--- a/lib/conversations-model.cpp
+++ b/lib/conversations-model.cpp
@@ -19,22 +19,24 @@
 
 
 #include "conversations-model.h"
-#include "conversation-watcher.h"
 #include "conversation.h"
+#include "telepathy-text-observer.h"
+#include <KDebug>
 
 class ConversationsModel::ConversationsModelPrivate
 {
 public:
-    ConversationWatcher watcher;
+    TelepathyTextObserver watcher;
     QList<Conversation*> data;
 };
 
 QVariant ConversationsModel::data ( const QModelIndex& index, int role ) const
 {
-    QVariant result();
+    QVariant result;
     if(index.row() >= 0 && index.row() < d->data.count()) {
         Q_ASSERT(role == ConversationRole);
-        return QVariant::fromValue<QObject*>(d->data[index.row()]);
+        result = QVariant::fromValue<QObject*>(d->data[index.row()]);
+        kDebug() << "returning value " << result;
     }
     return result;
 }
diff --git a/lib/conversation-model.cpp b/lib/messages-model.cpp
similarity index 83%
rename from lib/conversation-model.cpp
rename to lib/messages-model.cpp
index 5b1b056..114ce2f 100644
--- a/lib/conversation-model.cpp
+++ b/lib/messages-model.cpp
@@ -18,7 +18,7 @@
 */
 
 
-#include "conversation-model.h"
+#include "messages-model.h"
 
 #include <KDebug>
 #include <TelepathyQt4/ReceivedMessage>
@@ -37,13 +37,13 @@ public:
     } type;
 };
 
-class ConversationModel::ConversationModelPrivate {
+class MessagesModel::ConversationModelPrivate {
 public:
     Tp::TextChannelPtr textChannel;
     QList<MessageItem> messages;
 };
 
-ConversationModel::ConversationModel(QObject* parent):
+MessagesModel::MessagesModel(QObject* parent):
     QAbstractListModel(parent),
     d(new ConversationModelPrivate)
 {
@@ -57,12 +57,12 @@ ConversationModel::ConversationModel(QObject* parent):
     setRoleNames(roles);
 }
 
-Tp::TextChannelPtr ConversationModel::textChannel()
+Tp::TextChannelPtr MessagesModel::textChannel()
 {
     return d->textChannel;
 }
 
-bool ConversationModel::verifyPendingOperation ( Tp::PendingOperation* op )
+bool MessagesModel::verifyPendingOperation ( Tp::PendingOperation* op )
 {
     bool success = !op->isError();
     if(!success) {
@@ -71,7 +71,7 @@ bool ConversationModel::verifyPendingOperation ( Tp::PendingOperation* op )
     return success;
 }
 
-void ConversationModel::setupChannelSignals(Tp::TextChannelPtr channel)
+void MessagesModel::setupChannelSignals(Tp::TextChannelPtr channel)
 {
     QObject::connect(channel.constData(),
                     SIGNAL(messageReceived(Tp::ReceivedMessage)),
@@ -81,7 +81,7 @@ void ConversationModel::setupChannelSignals(Tp::TextChannelPtr channel)
                     SLOT(onMessageSent(Tp::Message,Tp::MessageSendingFlags,QString)));
 }
 
-void ConversationModel::setTextChannel(Tp::TextChannelPtr channel)
+void MessagesModel::setTextChannel(Tp::TextChannelPtr channel)
 {
     kDebug();
     setupChannelSignals(channel);
@@ -94,7 +94,7 @@ void ConversationModel::setTextChannel(Tp::TextChannelPtr channel)
     textChannelChanged(channel);
 }
 
-void ConversationModel::onMessageReceived(Tp::ReceivedMessage message)
+void MessagesModel::onMessageReceived(Tp::ReceivedMessage message)
 {
     kDebug();
     beginInsertRows(QModelIndex(), d->messages.count(), d->messages.count());
@@ -110,7 +110,7 @@ void ConversationModel::onMessageReceived(Tp::ReceivedMessage message)
     endInsertRows();
 }
 
-void ConversationModel::onMessageSent(Tp::Message message, Tp::MessageSendingFlags flags, QString token)
+void MessagesModel::onMessageSent(Tp::Message message, Tp::MessageSendingFlags flags, QString token)
 {
     Q_UNUSED(flags);
     Q_UNUSED(token);
@@ -127,7 +127,7 @@ void ConversationModel::onMessageSent(Tp::Message message, Tp::MessageSendingFla
     endInsertRows();
 }
 
-QVariant ConversationModel::data(const QModelIndex& index, int role) const
+QVariant MessagesModel::data(const QModelIndex& index, int role) const
 {
     kDebug();
     QVariant result;
@@ -156,7 +156,7 @@ QVariant ConversationModel::data(const QModelIndex& index, int role) const
     return result;
 }
 
-int ConversationModel::rowCount(const QModelIndex& parent) const
+int MessagesModel::rowCount(const QModelIndex& parent) const
 {
     kDebug() << "size =" << d->messages.size();
     Q_UNUSED(parent);
@@ -164,7 +164,7 @@ int ConversationModel::rowCount(const QModelIndex& parent) const
     return d->messages.size();
 }
 
-Tp::PendingSendMessage* ConversationModel::sendNewMessage ( QString message )
+Tp::PendingSendMessage* MessagesModel::sendNewMessage ( QString message )
 {
     Tp::PendingSendMessage* msg = 0;
     if(message.isEmpty()) {
@@ -177,7 +177,7 @@ Tp::PendingSendMessage* ConversationModel::sendNewMessage ( QString message )
     return msg;
 }
 
-void ConversationModel::removeChannelSignals(Tp::TextChannelPtr channel)
+void MessagesModel::removeChannelSignals(Tp::TextChannelPtr channel)
 {
     QObject::disconnect(channel.constData(),
                         SIGNAL(messageReceived(Tp::ReceivedMessage)),
@@ -191,10 +191,10 @@ void ConversationModel::removeChannelSignals(Tp::TextChannelPtr channel)
                     );
 }
 
-ConversationModel::~ConversationModel()
+MessagesModel::~MessagesModel()
 {
     kDebug();
     delete d;
 }
 
-#include "moc_conversation-model.cpp"
+#include "moc_messages-model.cpp"
diff --git a/lib/conversation-model.h b/lib/messages-model.h
similarity index 90%
copy from lib/conversation-model.h
copy to lib/messages-model.h
index e44b217..a2c6c22 100644
--- a/lib/conversation-model.h
+++ b/lib/messages-model.h
@@ -18,8 +18,8 @@
 */
 
 
-#ifndef CONVERSATION_MODEL_H
-#define CONVERSATION_MODEL_H
+#ifndef MESSAGES_MODEL_H
+#define MESSAGES_MODEL_H
 
 #include "kdetelepathychat_export.h"
 
@@ -27,7 +27,7 @@
 #include <TelepathyQt4/TextChannel>
 
 
-class KDE_TELEPATHY_CHAT_EXPORT ConversationModel : public QAbstractListModel
+class KDE_TELEPATHY_CHAT_EXPORT MessagesModel : public QAbstractListModel
 {
 Q_OBJECT
 // Q_PROPERTY(Tp::TextChannelPtr textChannel
@@ -37,8 +37,8 @@ Q_OBJECT
 // 		  )
 
 public:
-    ConversationModel(QObject* parent = 0);
-    virtual ~ConversationModel();
+    MessagesModel(QObject* parent = 0);
+    virtual ~MessagesModel();
 
 	enum Roles {
 		UserRole = Qt::UserRole,
diff --git a/lib/qml-plugins.cpp b/lib/qml-plugins.cpp
index 6889074..2d2166b 100644
--- a/lib/qml-plugins.cpp
+++ b/lib/qml-plugins.cpp
@@ -21,15 +21,18 @@
 #include "qml-plugins.h"
 
 #include <QtDeclarative/QDeclarativeItem>
+#include "messages-model.h"
 #include "conversation.h"
-#include "conversation-watcher.h"
+#include "telepathy-text-observer.h"
 #include "conversations-model.h"
+#include "conversation-target.h"
 
 void QmlPlugins::registerTypes ( const char* uri )
 {
-    qmlRegisterType<ConversationWatcher> ( uri, 0, 1, "ConversationWatcher" );
+    qmlRegisterType<TelepathyTextObserver> ( uri, 0, 1, "TelepathyTextObserver" );
+    qmlRegisterType<ConversationTarget>(uri, 0, 1, "ConversationTarget");
     qmlRegisterType<Conversation>(uri, 0, 1, "Conversation");
-    qmlRegisterType<ConversationModel> ( uri, 0, 1, "ConversationModel" );
+    qmlRegisterType<MessagesModel> ( uri, 0, 1, "MessagesModel" );
     qmlRegisterType<ConversationsModel>(uri, 0, 1, "ConversationsModel");
 }
 
diff --git a/lib/conversation-watcher.cpp b/lib/telepathy-text-observer.cpp
similarity index 92%
rename from lib/conversation-watcher.cpp
rename to lib/telepathy-text-observer.cpp
index 61e41b0..5b772c0 100644
--- a/lib/conversation-watcher.cpp
+++ b/lib/telepathy-text-observer.cpp
@@ -18,13 +18,13 @@
 */
 
 
-#include "conversation-watcher.h"
+#include "telepathy-text-observer.h"
+#include "conversation.h"
 
 #include <KDebug>
 
 #include <TelepathyQt4/ChannelClassSpec>
 #include <TelepathyQt4/TextChannel>
-#include "conversation.h"
 #include <TelepathyQt4/ClientRegistrar>
 
 
@@ -35,7 +35,7 @@ static inline Tp::ChannelClassSpecList channelClassList()
                                       << Tp::ChannelClassSpec::textChatroom();
 }
 
-class ConversationWatcher::ConversationClientObserver :
+class TelepathyTextObserver::ConversationClientObserver :
     public Tp::AbstractClientObserver
 {
 public:
@@ -64,17 +64,21 @@ public:
         m_parent->newConversation(con);
     }
 
-    ConversationClientObserver(ConversationWatcher *parent) :
+    ConversationClientObserver(TelepathyTextObserver
+ *parent) :
         AbstractClientObserver(channelClassList()),
         m_parent(parent)
     {
     }
 
-    ConversationWatcher *m_parent;
+    TelepathyTextObserver
+ *m_parent;
     Tp::ClientRegistrarPtr registrar;
 };
 
-ConversationWatcher::ConversationWatcher() :
+TelepathyTextObserver
+::TelepathyTextObserver
+() :
     d(new ConversationClientObserver(this))
 {
     kDebug();
@@ -113,8 +117,10 @@ ConversationWatcher::ConversationWatcher() :
 }
 
 
-ConversationWatcher::~ConversationWatcher()
+TelepathyTextObserver
+::~TelepathyTextObserver
+()
 {
 }
 
-#include "moc_conversation-watcher.cpp"
+// #include "moc_conversation-watcher.cpp"
diff --git a/lib/conversation-watcher.h b/lib/telepathy-text-observer.h
similarity index 85%
rename from lib/conversation-watcher.h
rename to lib/telepathy-text-observer.h
index 3ea80c0..703bf76 100644
--- a/lib/conversation-watcher.h
+++ b/lib/telepathy-text-observer.h
@@ -18,21 +18,21 @@
 */
 
 
-#ifndef CONVERSATION_WATCHER_H
-#define CONVERSATION_WATCHER_H
+#ifndef TELEPATHY_TEXT_OBSERVER_H
+#define TELEPATHY_TEXT_OBSERVER_H
 
 #include "kdetelepathychat_export.h"
 #include <TelepathyQt4/AbstractClient>
 
 class Conversation;
 
-class KDE_TELEPATHY_CHAT_EXPORT ConversationWatcher : public QObject
+class KDE_TELEPATHY_CHAT_EXPORT TelepathyTextObserver : public QObject
 {
 Q_OBJECT
 
 public:
-    ConversationWatcher();
-    ~ConversationWatcher();
+    TelepathyTextObserver();
+    ~TelepathyTextObserver();
 
 Q_SIGNALS:
 	void newConversation(Conversation *con);
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 788a62e..10b31bf 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -15,11 +15,11 @@ Item {
                 elementID: "widgets/frame.svg"
                 anchors.fill: parent
             }
-                PlasmaWidgets.IconWidget {
-                    text: model.conversation.nick
-                    icon: model.conversation.presenceIcon
-                    anchors.fill: parent
-                }
+            PlasmaWidgets.IconWidget {
+                text: model.conversation.target.nick
+                icon: model.conversation.target.presenceIcon
+                anchors.fill: parent
+            }
         }
     }
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list