Commit 1c6ebe03 authored by Martin Klapetek's avatar Martin Klapetek Committed by Alexander Akulich

[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: Alexander Akulich's avatarAlexandr Akulich <akulichalexander@gmail.com>
parent 58a0da25
......@@ -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();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment