mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-20 06:35:51 +02:00
swarm: add sync window
Change-Id: I0727737c8a9c4998ed66065fb1011389a502b0f9
This commit is contained in:
parent
4797d7d511
commit
1355111e02
2 changed files with 29 additions and 9 deletions
|
@ -77,8 +77,10 @@ MessagesAdapter::setupChatView(const QString& convUid)
|
||||||
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId);
|
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId);
|
||||||
|
|
||||||
lrc::api::contact::Info contactInfo;
|
lrc::api::contact::Info contactInfo;
|
||||||
|
QString bestName;
|
||||||
try {
|
try {
|
||||||
contactInfo = accountInfo.contactModel->getContact(contactURI);
|
contactInfo = accountInfo.contactModel->getContact(contactURI);
|
||||||
|
bestName = accountInfo.contactModel->bestNameForContact(contactURI);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +89,18 @@ MessagesAdapter::setupChatView(const QString& convUid)
|
||||||
QMetaObject::invokeMethod(qmlObj_,
|
QMetaObject::invokeMethod(qmlObj_,
|
||||||
"setSendContactRequestButtonVisible",
|
"setSendContactRequestButtonVisible",
|
||||||
Q_ARG(QVariant, isPending));
|
Q_ARG(QVariant, isPending));
|
||||||
|
QMetaObject::invokeMethod(qmlObj_,
|
||||||
|
"setMessagingHeaderButtonsVisible",
|
||||||
|
Q_ARG(QVariant,
|
||||||
|
!(convInfo.mode != lrc::api::conversation::Mode::NON_SWARM
|
||||||
|
&& (convInfo.isRequest || convInfo.needsSyncing))));
|
||||||
|
|
||||||
setMessagesVisibility(false);
|
setMessagesVisibility(false);
|
||||||
|
setInvitation(convInfo.isRequest or convInfo.needsSyncing,
|
||||||
|
bestName,
|
||||||
|
contactURI,
|
||||||
|
convInfo.mode != lrc::api::conversation::Mode::NON_SWARM,
|
||||||
|
convInfo.needsSyncing);
|
||||||
|
|
||||||
// Type Indicator (contact). TODO: Not shown when invitation request?
|
// Type Indicator (contact). TODO: Not shown when invitation request?
|
||||||
contactIsComposing(convInfo.uid, "", false);
|
contactIsComposing(convInfo.uid, "", false);
|
||||||
|
@ -457,9 +469,11 @@ MessagesAdapter::setConversationProfileData(const lrc::api::conversation::Info&
|
||||||
try {
|
try {
|
||||||
auto& contact = accInfo->contactModel->getContact(contactUri);
|
auto& contact = accInfo->contactModel->getContact(contactUri);
|
||||||
auto bestName = accInfo->contactModel->bestNameForContact(contactUri);
|
auto bestName = accInfo->contactModel->bestNameForContact(contactUri);
|
||||||
setInvitation(contact.profileInfo.type == lrc::api::profile::Type::PENDING,
|
setInvitation(convInfo.isRequest or convInfo.needsSyncing,
|
||||||
bestName,
|
bestName,
|
||||||
contactUri);
|
contactUri,
|
||||||
|
convInfo.mode != lrc::api::conversation::Mode::NON_SWARM,
|
||||||
|
convInfo.needsSyncing);
|
||||||
if (!contact.profileInfo.avatar.isEmpty()) {
|
if (!contact.profileInfo.avatar.isEmpty()) {
|
||||||
setSenderImage(contactUri, contact.profileInfo.avatar);
|
setSenderImage(contactUri, contact.profileInfo.avatar);
|
||||||
} else {
|
} else {
|
||||||
|
@ -524,13 +538,15 @@ MessagesAdapter::requestSendMessageContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MessagesAdapter::setInvitation(bool show, const QString& contactUri, const QString& contactId)
|
MessagesAdapter::setInvitation(
|
||||||
|
bool show, const QString& contactUri, const QString& contactId, bool isSwarm, bool needsSyncing)
|
||||||
{
|
{
|
||||||
QString s
|
QString s = show ? QString::fromLatin1("showInvitation(\"%1\", \"%2\", %3, %4)")
|
||||||
= show
|
.arg(contactUri)
|
||||||
? QString::fromLatin1("showInvitation(\"%1\", \"%2\")").arg(contactUri).arg(contactId)
|
.arg(contactId)
|
||||||
|
.arg(isSwarm)
|
||||||
|
.arg(needsSyncing)
|
||||||
: QString::fromLatin1("showInvitation()");
|
: QString::fromLatin1("showInvitation()");
|
||||||
|
|
||||||
QMetaObject::invokeMethod(qmlObj_, "webViewRunJavaScript", Q_ARG(QVariant, s));
|
QMetaObject::invokeMethod(qmlObj_, "webViewRunJavaScript", Q_ARG(QVariant, s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,11 @@ protected:
|
||||||
// Run corrsponding js functions, c++ to qml.
|
// Run corrsponding js functions, c++ to qml.
|
||||||
void setMessagesVisibility(bool visible);
|
void setMessagesVisibility(bool visible);
|
||||||
void requestSendMessageContent();
|
void requestSendMessageContent();
|
||||||
void setInvitation(bool show, const QString& contactUri = {}, const QString& contactId = {});
|
void setInvitation(bool show,
|
||||||
|
const QString& contactUri = {},
|
||||||
|
const QString& contactId = {},
|
||||||
|
bool isSwarm = false,
|
||||||
|
bool needsSyncing = false);
|
||||||
void clear();
|
void clear();
|
||||||
void printHistory(ConversationModel& conversationModel, MessagesList interactions);
|
void printHistory(ConversationModel& conversationModel, MessagesList interactions);
|
||||||
void updateHistory(ConversationModel& conversationModel,
|
void updateHistory(ConversationModel& conversationModel,
|
||||||
|
|
Loading…
Add table
Reference in a new issue