diff --git a/src/accountadapter.cpp b/src/accountadapter.cpp index a516f56d82f520f5dc9079b7e73cc3c932633297..693f1da2ba5eb0bdaaca573b6b21f8b8405655e3 100644 --- a/src/accountadapter.cpp +++ b/src/accountadapter.cpp @@ -123,12 +123,13 @@ AccountAdapter::createJamiAccount(QString registeredName, emit accountAdded(showBackup, LRCInstance::accountModel().getAccountList().indexOf(accountId)); } + // set up avatar pixmap from photobooth QImage avatarImg; const bool ret = avatarImg.loadFromData( QByteArray::fromBase64(photoBoothImgBase64.toLatin1())); if (!ret) { - qDebug() << "JAMI account creation BASE64 image loading failed"; + qDebug() << "No image provided for JAMI account creation"; } else { LRCInstance::setAvatarForAccount(QPixmap::fromImage(avatarImg), accountId); } diff --git a/src/conversationsadapter.cpp b/src/conversationsadapter.cpp index 3688345e0f6374a8a2857d2218376250531a1bfa..3c3efbb5732625ca2dd4dd286ad9c6cd6be16ce1 100644 --- a/src/conversationsadapter.cpp +++ b/src/conversationsadapter.cpp @@ -147,8 +147,6 @@ void ConversationsAdapter::onCurrentAccountIdChanged() { auto accountId = LRCInstance::getCurrAccId(); - // Should be called when current account is changed. - conversationSmartListModel_->setAccount(accountId); auto& accountInfo = LRCInstance::accountModel().getAccountInfo(accountId); currentTypeFilter_ = accountInfo.profileInfo.type; @@ -276,7 +274,6 @@ ConversationsAdapter::connectConversationModel(bool updateFilter) &lrc::api::ConversationModel::filterChanged, [this]() { conversationSmartListModel_->fillConversationsList(); - conversationSmartListModel_->setAccount(LRCInstance::getCurrAccId()); updateConversationsFilterWidget(); emit updateListViewRequested(); }); @@ -286,7 +283,6 @@ ConversationsAdapter::connectConversationModel(bool updateFilter) &lrc::api::ConversationModel::newConversation, [this](const QString& convUid) { conversationSmartListModel_->fillConversationsList(); - conversationSmartListModel_->setAccount(LRCInstance::getCurrAccId()); updateConversationForNewContact(convUid); }); @@ -320,7 +316,6 @@ ConversationsAdapter::connectConversationModel(bool updateFilter) &lrc::api::ConversationModel::searchResultUpdated, [this]() { conversationSmartListModel_->fillConversationsList(); - conversationSmartListModel_->setAccount(LRCInstance::getCurrAccId()); emit updateListViewRequested(); }); diff --git a/src/mainview/components/ConversationSmartListUserImage.qml b/src/mainview/components/ConversationSmartListUserImage.qml index e8034fd3d9556b3e36be63391479b4c1ca5f0ba2..2358e165ef47d224f95c4afa99e9e9d007533814 100644 --- a/src/mainview/components/ConversationSmartListUserImage.qml +++ b/src/mainview/components/ConversationSmartListUserImage.qml @@ -38,7 +38,7 @@ Image { anchors.bottom: userImage.bottom anchors.bottomMargin: -2 - visible: Presence + visible: Presence === undefined ? false : Presence } Rectangle { diff --git a/src/mainview/components/ConversationSmartListView.qml b/src/mainview/components/ConversationSmartListView.qml index 5810d3cc2820995244ea8fb470b3b8b473d3a05a..001bed35290aff46da60f7e989239e71227e1d67 100644 --- a/src/mainview/components/ConversationSmartListView.qml +++ b/src/mainview/components/ConversationSmartListView.qml @@ -37,6 +37,8 @@ ListView { // Refresh all items within the model. function updateListView() { + if (!root.model) + return root.model.dataChanged( root.model.index(0, 0), root.model.index( diff --git a/src/mainview/components/ConversationSmartListViewItemDelegate.qml b/src/mainview/components/ConversationSmartListViewItemDelegate.qml index d54f7cffd307ef07506c8cb85b31c66f7b2f7797..12cc257d3e423aa4072f05735892c7415be3137a 100644 --- a/src/mainview/components/ConversationSmartListViewItemDelegate.qml +++ b/src/mainview/components/ConversationSmartListViewItemDelegate.qml @@ -99,7 +99,7 @@ ItemDelegate { elide: Text.ElideRight elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32) : smartListItemDelegate.width - lastInteractionPreferredWidth - text: DisplayName + text: DisplayName === undefined ? "" : DisplayName } text: textMetricsConversationSmartListUserName.elidedText font.pointSize: JamiTheme.menuFontSize @@ -113,7 +113,7 @@ ItemDelegate { font: conversationSmartListUserLastInteractionDate.font elide: Text.ElideRight elideWidth: lastInteractionPreferredWidth - text: LastInteractionDate + text: LastInteractionDate === undefined ? "" : LastInteractionDate } text: textMetricsConversationSmartListUserLastInteractionDate.elidedText diff --git a/src/smartlistmodel.cpp b/src/smartlistmodel.cpp index f863556a39a5e7419cce5eff6d1313ad2b9bd1eb..f777d488e5700fdc66e6e7a0208925436efe29dc 100644 --- a/src/smartlistmodel.cpp +++ b/src/smartlistmodel.cpp @@ -34,9 +34,7 @@ SmartListModel::SmartListModel(QObject* parent, SmartListModel::Type listModelType, const QString& convUid) : QAbstractListModel(parent) - , accountId_(accId) , listModelType_(listModelType) - , convUid_(convUid) { if (listModelType_ == Type::CONFERENCE) { setConferenceableFilter(); @@ -49,7 +47,7 @@ int SmartListModel::rowCount(const QModelIndex& parent) const { if (!parent.isValid()) { - auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_); + auto& accInfo = LRCInstance::accountModel().getAccountInfo(LRCInstance::getCurrAccId()); auto& convModel = accInfo.conversationModel; if (listModelType_ == Type::TRANSFER) { auto filterType = accInfo.profileInfo.type; @@ -85,7 +83,7 @@ SmartListModel::data(const QModelIndex& index, int role) const } try { - auto& accountInfo = LRCInstance::accountModel().getAccountInfo(accountId_); + auto& accountInfo = LRCInstance::accountModel().getAccountInfo(LRCInstance::getCurrAccId()); auto& convModel = accountInfo.conversationModel; lrc::api::conversation::Info item; if (listModelType_ == Type::TRANSFER) { @@ -172,9 +170,10 @@ void SmartListModel::setConferenceableFilter(const QString& filter) { beginResetModel(); - auto& accountInfo = LRCInstance::accountModel().getAccountInfo(accountId_); + auto& accountInfo = LRCInstance::accountModel().getAccountInfo(LRCInstance::getCurrAccId()); auto& convModel = accountInfo.conversationModel; - conferenceables_ = convModel->getConferenceableConversations(convUid_, filter); + conferenceables_ = convModel->getConferenceableConversations(LRCInstance::getCurrentConvUid(), + filter); sectionState_[tr("Calls")] = true; sectionState_[tr("Contacts")] = true; endResetModel(); @@ -406,9 +405,3 @@ SmartListModel::flags(const QModelIndex& index) const } return flags; } - -void -SmartListModel::setAccount(const QString& accountId) -{ - accountId_ = accountId; -} diff --git a/src/smartlistmodel.h b/src/smartlistmodel.h index 4f47b44b1a761fa9063f0be6fd4d9c616e9261d9..9bb56900cf6ae3da498b8bfffd7d8e2bddf2ec58 100644 --- a/src/smartlistmodel.h +++ b/src/smartlistmodel.h @@ -79,7 +79,6 @@ public: QModelIndex parent(const QModelIndex& child) const; Qt::ItemFlags flags(const QModelIndex& index) const; - Q_INVOKABLE void setAccount(const QString& accId); Q_INVOKABLE void setConferenceableFilter(const QString& filter = {}); Q_INVOKABLE void toggleSection(const QString& section); Q_INVOKABLE int currentUidSmartListModelIndex(); @@ -87,15 +86,12 @@ public: Q_INVOKABLE void updateConversation(const QString& conv); private: - QString accountId_; - QVariant getConversationItemData(const ConversationInfo& item, const AccountInfo& accountInfo, int role) const; /* * List sectioning. */ - QString convUid_; Type listModelType_; QMap<QString, bool> sectionState_; QMap<ConferenceableItem, ConferenceableValue> conferenceables_;