mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-04 06:03:21 +02:00
messagesadapter: fix composing connection
GitLab: https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/455 Change-Id: I91b00492dfd9ef856cdc5a620085b77c4ec6ac68
This commit is contained in:
parent
83bb6fb082
commit
cbcc0e4752
2 changed files with 16 additions and 16 deletions
|
@ -103,17 +103,6 @@ MessagesAdapter::setupChatView(const QString& convUid)
|
||||||
!convInfo.isNotASwarm(),
|
!convInfo.isNotASwarm(),
|
||||||
convInfo.needsSyncing);
|
convInfo.needsSyncing);
|
||||||
|
|
||||||
// Type Indicator (contact). TODO: Not shown when invitation request?
|
|
||||||
contactIsComposing(convInfo.uid, "", false);
|
|
||||||
connect(lrcInstance_->getCurrentConversationModel(),
|
|
||||||
&ConversationModel::composingStatusChanged,
|
|
||||||
[this](const QString& convUid, const QString& contactUri, bool isComposing) {
|
|
||||||
if (!settingsManager_->getValue(Settings::Key::EnableTypingIndicator).toBool()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
contactIsComposing(convUid, contactUri, isComposing);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Draft and message content set up.
|
// Draft and message content set up.
|
||||||
Utils::oneShotConnect(qmlObj_,
|
Utils::oneShotConnect(qmlObj_,
|
||||||
SIGNAL(sendMessageContentSaved(const QString&)),
|
SIGNAL(sendMessageContentSaved(const QString&)),
|
||||||
|
@ -138,6 +127,7 @@ MessagesAdapter::connectConversationModel()
|
||||||
QObject::disconnect(interactionRemovedConnection_);
|
QObject::disconnect(interactionRemovedConnection_);
|
||||||
QObject::disconnect(interactionStatusUpdatedConnection_);
|
QObject::disconnect(interactionStatusUpdatedConnection_);
|
||||||
QObject::disconnect(conversationUpdatedConnection_);
|
QObject::disconnect(conversationUpdatedConnection_);
|
||||||
|
QObject::disconnect(composingConnection_);
|
||||||
|
|
||||||
newInteractionConnection_
|
newInteractionConnection_
|
||||||
= QObject::connect(currentConversationModel,
|
= QObject::connect(currentConversationModel,
|
||||||
|
@ -197,6 +187,17 @@ MessagesAdapter::connectConversationModel()
|
||||||
if (auto optConv = convModel->getConversationForUid(conversationId))
|
if (auto optConv = convModel->getConversationForUid(conversationId))
|
||||||
setConversationProfileData(optConv->get());
|
setConversationProfileData(optConv->get());
|
||||||
});
|
});
|
||||||
|
composingConnection_
|
||||||
|
= connect(currentConversationModel,
|
||||||
|
&ConversationModel::composingStatusChanged,
|
||||||
|
[this](const QString& convUid, const QString& contactUri, bool isComposing) {
|
||||||
|
if (convUid != lrcInstance_->get_selectedConvUid())
|
||||||
|
return;
|
||||||
|
if (!settingsManager_->getValue(Settings::Key::EnableTypingIndicator).toBool()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
contactIsComposing(contactUri, isComposing);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -698,16 +699,14 @@ MessagesAdapter::setSendMessageContent(const QString& content)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MessagesAdapter::contactIsComposing(const QString& uid, const QString& contactUri, bool isComposing)
|
MessagesAdapter::contactIsComposing(const QString& contactUri, bool isComposing)
|
||||||
{
|
{
|
||||||
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||||
auto convInfo = convModel->getConversationForUid(lrcInstance_->get_selectedConvUid());
|
auto convInfo = convModel->getConversationForUid(lrcInstance_->get_selectedConvUid());
|
||||||
if (!convInfo)
|
if (!convInfo)
|
||||||
return;
|
return;
|
||||||
auto& conv = convInfo->get();
|
auto& conv = convInfo->get();
|
||||||
bool showIsComposing = conv.isNotASwarm()
|
bool showIsComposing = conv.participants.first() == contactUri;
|
||||||
? uid.isEmpty() && conv.participants.first() == contactUri
|
|
||||||
: uid == conv.uid;
|
|
||||||
if (showIsComposing) {
|
if (showIsComposing) {
|
||||||
QString s
|
QString s
|
||||||
= QString::fromLatin1("showTypingIndicator(`%1`, %2);").arg(contactUri).arg(isComposing);
|
= QString::fromLatin1("showTypingIndicator(`%1`, %2);").arg(contactUri).arg(isComposing);
|
||||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
||||||
void setMessagesFileContent(const QString& path);
|
void setMessagesFileContent(const QString& path);
|
||||||
void removeInteraction(const QString& interactionId);
|
void removeInteraction(const QString& interactionId);
|
||||||
void setSendMessageContent(const QString& content);
|
void setSendMessageContent(const QString& content);
|
||||||
void contactIsComposing(const QString& convUid, const QString& contactUri, bool isComposing);
|
void contactIsComposing(const QString& contactUri, bool isComposing);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void contactBanned();
|
void contactBanned();
|
||||||
|
@ -126,6 +126,7 @@ private:
|
||||||
QMetaObject::Connection interactionRemovedConnection_;
|
QMetaObject::Connection interactionRemovedConnection_;
|
||||||
QMetaObject::Connection newMessagesAvailableConnection_;
|
QMetaObject::Connection newMessagesAvailableConnection_;
|
||||||
QMetaObject::Connection conversationUpdatedConnection_;
|
QMetaObject::Connection conversationUpdatedConnection_;
|
||||||
|
QMetaObject::Connection composingConnection_;
|
||||||
|
|
||||||
AppSettingsManager* settingsManager_;
|
AppSettingsManager* settingsManager_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue