summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <mklapetek@kde.org>2016-02-11 03:14:29 (GMT)
committerAlexandr Akulich <akulichalexander@gmail.com>2016-09-21 13:05:33 (GMT)
commit1c6ebe036bfd641c7f147faabc1b76fe2d32c762 (patch)
treeedbec892f868b098c4c97adee72a34a9069cfe06
parent58a0da25ce92f8ee6f8bf67a35caf160e7db8aae (diff)
[declarative] Move the channel setup to setTextChannel
Since Conversation allows to be constructed as an empty object with setting the text channel later, all the setup must be also done later Reviewed-by: Alexandr Akulich <akulichalexander@gmail.com>
-rw-r--r--KTp/Declarative/conversation.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/KTp/Declarative/conversation.cpp b/KTp/Declarative/conversation.cpp
index 14eb328..6199cac 100644
--- a/KTp/Declarative/conversation.cpp
+++ b/KTp/Declarative/conversation.cpp
@@ -71,17 +71,6 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
d->pausedStateTimer = new QTimer(this);
d->pausedStateTimer->setSingleShot(true);
connect(d->pausedStateTimer, SIGNAL(timeout()), this, SLOT(onChatPausedTimerExpired()));
-
- if (channel->targetContact().isNull()) {
- d->isGroupChat = true;
- } else {
- d->isGroupChat = false;
- d->targetContact = KTp::ContactPtr::qObjectCast(channel->targetContact());
-
- connect(d->targetContact.constData(), SIGNAL(aliasChanged(QString)), SIGNAL(titleChanged()));
- connect(d->targetContact.constData(), SIGNAL(presenceChanged(Tp::Presence)), SIGNAL(presenceIconChanged()));
- connect(d->targetContact.constData(), SIGNAL(avatarDataChanged(Tp::AvatarData)), SIGNAL(avatarChanged()));
- }
}
Conversation::Conversation(QObject *parent) : QObject(parent)
@@ -97,6 +86,21 @@ void Conversation::setTextChannel(const Tp::TextChannelPtr& channel)
connect(channel.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)),
SLOT(onChannelInvalidated(Tp::DBusProxy*,QString,QString)));
Q_EMIT validityChanged(d->valid);
+
+ if (channel->targetContact().isNull()) {
+ d->isGroupChat = true;
+ } else {
+ d->isGroupChat = false;
+ d->targetContact = KTp::ContactPtr::qObjectCast(channel->targetContact());
+
+ connect(d->targetContact.constData(), SIGNAL(aliasChanged(QString)), SIGNAL(titleChanged()));
+ connect(d->targetContact.constData(), SIGNAL(presenceChanged(Tp::Presence)), SIGNAL(presenceIconChanged()));
+ connect(d->targetContact.constData(), SIGNAL(avatarDataChanged(Tp::AvatarData)), SIGNAL(avatarChanged()));
+ }
+
+ Q_EMIT avatarChanged();
+ Q_EMIT titleChanged();
+ Q_EMIT presenceIconChanged();
}
}