[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=2807861
The following commit has been merged in the master branch:
commit 2807861183d443ffb5f17b248bd9c08c3ce7f85d
Author: Lasath Fernando <kde at lasath.org>
Date: Sat Nov 26 13:45:45 2011 +1100
Made the plasmoid work
The plasmoid seems to ignore the first message sent to it, but everthing else displays fine.
---
lib/conversation-model.cpp | 29 ++++++++++++++++++++++++-----
lib/conversation-model.h | 1 +
lib/conversation-watcher.cpp | 5 ++---
lib/conversation.cpp | 5 ++++-
lib/conversation.h | 4 ++--
plasmoid/contents/ui/main.qml | 35 +++++++++++++++++++++++++++++++++--
6 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/lib/conversation-model.cpp b/lib/conversation-model.cpp
index 0c6f003..d6bf810 100644
--- a/lib/conversation-model.cpp
+++ b/lib/conversation-model.cpp
@@ -47,6 +47,14 @@ ConversationModel::ConversationModel(QObject* parent):
QAbstractListModel(parent),
d(new ConversationModelPrivate)
{
+ kDebug();
+
+ QHash<int, QByteArray> roles;
+ roles[UserRole] = "user";
+ roles[TextRole] = "text";
+ roles[TimeRole] = "time";
+ roles[TypeRole] = "type";
+ setRoleNames(roles);
}
Tp::TextChannelPtr ConversationModel::textChannel()
@@ -58,19 +66,20 @@ void ConversationModel::setupChannelSignals(Tp::TextChannelPtr channel)
{
QObject::connect(channel.constData(),
SIGNAL(messageReceived(Tp::ReceivedMessage)),
- SLOT(messageReceived(Tp::ReceivedMessage)));
+ SLOT(onMessageReceived(Tp::ReceivedMessage)));
QObject::connect(channel.constData(),
SIGNAL(messageSent(Tp::Message,Tp::MessageSendingFlags,QString)),
- SLOT(messageSent(Tp::Message,Tp::MessageSendingFlags,QString)));
+ SLOT(onMessageSent(Tp::Message,Tp::MessageSendingFlags,QString)));
}
void ConversationModel::setTextChannel(Tp::TextChannelPtr channel)
{
+ kDebug();
setupChannelSignals(channel);
+
if(d->textChannel) {
removeChannelSignals(channel);
}
-
d->textChannel = channel;
textChannelChanged(channel);
@@ -78,12 +87,13 @@ void ConversationModel::setTextChannel(Tp::TextChannelPtr channel)
void ConversationModel::onMessageReceived(Tp::ReceivedMessage message)
{
+ kDebug();
beginInsertRows(QModelIndex(), d->messages.count(), d->messages.count());
MessageItem newMessage = {
message.sender()->alias(),
message.text(),
- message.sent(),
+ message.received(),
MessageItem::Incoming
};
@@ -110,6 +120,7 @@ void ConversationModel::onMessageSent(Tp::Message message, Tp::MessageSendingFla
QVariant ConversationModel::data(const QModelIndex& index, int role) const
{
+ kDebug();
QVariant result;
if(!index.isValid()) {
@@ -138,8 +149,10 @@ QVariant ConversationModel::data(const QModelIndex& index, int role) const
int ConversationModel::rowCount(const QModelIndex& parent) const
{
+ kDebug() << "size =" << d->messages.size();
Q_UNUSED(parent);
- return d->messages.count();
+
+ return d->messages.size();
}
void ConversationModel::removeChannelSignals(Tp::TextChannelPtr channel)
@@ -156,4 +169,10 @@ void ConversationModel::removeChannelSignals(Tp::TextChannelPtr channel)
);
}
+ConversationModel::~ConversationModel()
+{
+ kDebug();
+ delete d;
+}
+
#include "moc_conversation-model.cpp"
diff --git a/lib/conversation-model.h b/lib/conversation-model.h
index 0706378..06affa6 100644
--- a/lib/conversation-model.h
+++ b/lib/conversation-model.h
@@ -38,6 +38,7 @@ Q_OBJECT
public:
ConversationModel(QObject* parent = 0);
+ virtual ~ConversationModel();
enum Roles {
UserRole = Qt::UserRole,
diff --git a/lib/conversation-watcher.cpp b/lib/conversation-watcher.cpp
index bb3ef38..61e41b0 100644
--- a/lib/conversation-watcher.cpp
+++ b/lib/conversation-watcher.cpp
@@ -60,8 +60,8 @@ public:
Q_ASSERT(textChannel);
- Conversation con(textChannel, account);
- m_parent->newConversation(&con);
+ Conversation *con = new Conversation(textChannel, account);
+ m_parent->newConversation(con);
}
ConversationClientObserver(ConversationWatcher *parent) :
@@ -113,7 +113,6 @@ ConversationWatcher::ConversationWatcher() :
}
-
ConversationWatcher::~ConversationWatcher()
{
}
diff --git a/lib/conversation.cpp b/lib/conversation.cpp
index d38dd0e..fc96d91 100644
--- a/lib/conversation.cpp
+++ b/lib/conversation.cpp
@@ -34,6 +34,8 @@ public:
Conversation::Conversation ( Tp::TextChannelPtr channel, Tp::AccountPtr account ) :
d ( new ConversationPrivate )
{
+ kDebug();
+
d->model = new ConversationModel();
d->model->setTextChannel ( channel );
@@ -45,13 +47,14 @@ Conversation::Conversation ( QObject* parent ) : QObject ( parent )
kError() << "Conversation should not be created directly. Use ConversationWater instead.";
}
-const ConversationModel* Conversation::model() const
+ConversationModel* Conversation::model() const
{
return d->model;
}
Conversation::~Conversation()
{
+ kDebug();
delete d->model;
}
diff --git a/lib/conversation.h b/lib/conversation.h
index 56de377..b68800f 100644
--- a/lib/conversation.h
+++ b/lib/conversation.h
@@ -32,14 +32,14 @@ class ConversationModel;
class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
{
Q_OBJECT
-Q_PROPERTY(const ConversationModel* model READ model NOTIFY modelChanged)
+Q_PROPERTY(ConversationModel* model READ model NOTIFY modelChanged)
public:
Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account);
Conversation(QObject* parent = 0);
virtual ~Conversation();
- const ConversationModel* model() const;
+ ConversationModel* model() const;
Q_SIGNALS:
void modelChanged(ConversationModel* newModel);
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 2b9c184..9e388d1 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -4,16 +4,47 @@ import org.kde.telepathy.declarativeplugins 0.1 as KTelepathy
Item {
id:main
+ Component {
+ id: textDelegate
+
+ Item {
+ Text {
+ id: header
+ width: view.width
+ wrapMode: Text.Wrap
+
+ text: "[" + Qt.formatTime(model.time) + "] " + model.user + " :"
+ }
+ Text {
+ id: body
+
+ anchors.top: header.bottom
+ width: view.width
+
+ wrapMode: Text.Wrap
+ text: model.text
+ }
+
+ height: header.height + body.height
+ }
+ }
+
ListView {
id: view
+
anchors.fill: parent
+ anchors.margins: 5
+
+ clip: true
+
+ delegate: textDelegate
}
KTelepathy.ConversationWatcher {
id:watcher
onNewConversation: {
- console.log("SOMETHINGAHPPENDED!");
- console.log(con.model);
+ console.log("New Convo!");
+ view.model = con.model;
}
}
}
\ No newline at end of file
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list