mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-31 20:23:30 +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.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.
|
||||
Utils::oneShotConnect(qmlObj_,
|
||||
SIGNAL(sendMessageContentSaved(const QString&)),
|
||||
|
@ -138,6 +127,7 @@ MessagesAdapter::connectConversationModel()
|
|||
QObject::disconnect(interactionRemovedConnection_);
|
||||
QObject::disconnect(interactionStatusUpdatedConnection_);
|
||||
QObject::disconnect(conversationUpdatedConnection_);
|
||||
QObject::disconnect(composingConnection_);
|
||||
|
||||
newInteractionConnection_
|
||||
= QObject::connect(currentConversationModel,
|
||||
|
@ -197,6 +187,17 @@ MessagesAdapter::connectConversationModel()
|
|||
if (auto optConv = convModel->getConversationForUid(conversationId))
|
||||
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
|
||||
|
@ -698,16 +699,14 @@ MessagesAdapter::setSendMessageContent(const QString& content)
|
|||
}
|
||||
|
||||
void
|
||||
MessagesAdapter::contactIsComposing(const QString& uid, const QString& contactUri, bool isComposing)
|
||||
MessagesAdapter::contactIsComposing(const QString& contactUri, bool isComposing)
|
||||
{
|
||||
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||
auto convInfo = convModel->getConversationForUid(lrcInstance_->get_selectedConvUid());
|
||||
if (!convInfo)
|
||||
return;
|
||||
auto& conv = convInfo->get();
|
||||
bool showIsComposing = conv.isNotASwarm()
|
||||
? uid.isEmpty() && conv.participants.first() == contactUri
|
||||
: uid == conv.uid;
|
||||
bool showIsComposing = conv.participants.first() == contactUri;
|
||||
if (showIsComposing) {
|
||||
QString s
|
||||
= QString::fromLatin1("showTypingIndicator(`%1`, %2);").arg(contactUri).arg(isComposing);
|
||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
|||
void setMessagesFileContent(const QString& path);
|
||||
void removeInteraction(const QString& interactionId);
|
||||
void setSendMessageContent(const QString& content);
|
||||
void contactIsComposing(const QString& convUid, const QString& contactUri, bool isComposing);
|
||||
void contactIsComposing(const QString& contactUri, bool isComposing);
|
||||
|
||||
Q_SIGNALS:
|
||||
void contactBanned();
|
||||
|
@ -126,6 +126,7 @@ private:
|
|||
QMetaObject::Connection interactionRemovedConnection_;
|
||||
QMetaObject::Connection newMessagesAvailableConnection_;
|
||||
QMetaObject::Connection conversationUpdatedConnection_;
|
||||
QMetaObject::Connection composingConnection_;
|
||||
|
||||
AppSettingsManager* settingsManager_;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue