Commit 766fba5b authored by Martin Klapetek's avatar Martin Klapetek Committed by Alexander Akulich
Browse files

[declarative] Add support for contact typing notifications

parent 1f298f02
......@@ -112,6 +112,8 @@ void Conversation::setTextChannel(const Tp::TextChannelPtr &channel)
connect(channel.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)),
SLOT(onChannelInvalidated(Tp::DBusProxy*,QString,QString)));
connect(channel.data(), &Tp::TextChannel::chatStateChanged, this, &Conversation::contactTypingChanged);
if (channel->targetContact().isNull()) {
d->isGroupChat = true;
} else {
......@@ -305,3 +307,12 @@ KPeople::PersonData* Conversation::personData() const
{
return d->personData;
}
bool Conversation::isContactTyping() const
{
if (d->messages->textChannel()) {
return d->messages->textChannel()->chatState(d->targetContact) == Tp::ChannelChatStateComposing;
}
return false;
}
......@@ -44,6 +44,7 @@ class Conversation : public QObject
Q_PROPERTY(KTp::ContactPtr targetContact READ targetContact CONSTANT)
Q_PROPERTY(KPeople::PersonData *personData READ personData CONSTANT)
Q_PROPERTY(bool hasUnreadMessages READ hasUnreadMessages NOTIFY unreadMessagesChanged)
Q_PROPERTY(bool isContactTyping READ isContactTyping NOTIFY contactTypingChanged)
public:
Conversation(const Tp::TextChannelPtr &channel, const Tp::AccountPtr &account, QObject *parent = 0);
......@@ -76,6 +77,8 @@ public:
bool hasUnreadMessages() const;
bool isContactTyping() const;
Q_SIGNALS:
void validityChanged(bool isValid);
void avatarChanged();
......@@ -84,6 +87,7 @@ Q_SIGNALS:
void conversationCloseRequested();
void unreadMessagesChanged();
void lastMessageChanged();
void contactTypingChanged();
public Q_SLOTS:
void delegateToProperClient();
......
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