From 03576d48e8cb8121de8c73c8abd5bc3b5feac0b2 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 7 May 2025 11:03:28 +0200 Subject: [PATCH] scroll to first unread message + mark as read --- Linphone/core/account/AccountCore.cpp | 8 +++-- Linphone/core/account/AccountCore.hpp | 1 + Linphone/core/chat/ChatCore.cpp | 18 +++++++--- Linphone/core/chat/ChatCore.hpp | 3 ++ Linphone/core/chat/ChatList.cpp | 5 ++- Linphone/core/chat/ChatList.hpp | 1 + Linphone/core/chat/ChatProxy.cpp | 3 +- .../core/chat/message/ChatMessageCore.cpp | 16 +++++++++ .../core/chat/message/ChatMessageCore.hpp | 8 +++++ .../core/chat/message/ChatMessageList.cpp | 7 ++++ .../core/chat/message/ChatMessageProxy.cpp | 11 ++++++ .../core/chat/message/ChatMessageProxy.hpp | 1 + Linphone/model/account/AccountModel.cpp | 6 ++-- Linphone/model/chat/ChatModel.cpp | 10 ++++++ .../model/chat/message/ChatMessageModel.cpp | 10 ++++++ .../model/chat/message/ChatMessageModel.hpp | 4 +++ Linphone/model/core/CoreModel.hpp | 1 + .../Display/Chat/ChatMessagesListView.qml | 34 ++++++++----------- .../Display/Contact/ContactListItem.qml | 6 ++-- .../NotificationReceivedMessage.qml | 8 ++--- .../view/Page/Form/Chat/SelectedChatView.qml | 2 +- 21 files changed, 122 insertions(+), 41 deletions(-) diff --git a/Linphone/core/account/AccountCore.cpp b/Linphone/core/account/AccountCore.cpp index 0aac0d32f..2c60f91aa 100644 --- a/Linphone/core/account/AccountCore.cpp +++ b/Linphone/core/account/AccountCore.cpp @@ -48,8 +48,7 @@ AccountCore::AccountCore(const std::shared_ptr &account) : QO mPictureUri = Utils::coreStringToAppString(params->getPictureUri()); mRegistrationState = LinphoneEnums::fromLinphone(account->getState()); mIsDefaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount() == account; - // mUnreadNotifications = account->getUnreadChatMessageCount() + account->getMissedCallsCount(); // TODO - mUnreadNotifications = account->getMissedCallsCount(); + mUnreadNotifications = account->getMissedCallsCount() + account->getUnreadChatMessageCount(); mDisplayName = Utils::coreStringToAppString(identityAddress->getDisplayName()); if (mDisplayName.isEmpty()) { mDisplayName = ToolModel::getDisplayName(identityAddress); @@ -236,7 +235,6 @@ void AccountCore::setSelf(QSharedPointer me) { mAccountModelConnection->makeConnectToCore(&AccountCore::lRefreshNotifications, [this]() { mAccountModelConnection->invokeToModel([this]() { mAccountModel->refreshUnreadNotifications(); }); }); - mCoreModelConnection = SafeConnection::create(me, CoreModel::getInstance()); mAccountModelConnection->makeConnectToCore(&AccountCore::unreadCallNotificationsChanged, [this]() { mAccountModelConnection->invokeToModel([this]() { CoreModel::getInstance()->unreadNotificationsChanged(); }); }); @@ -269,6 +267,10 @@ void AccountCore::setSelf(QSharedPointer me) { mAccountModelConnection->makeConnectToModel(&AccountModel::voicemailAddressChanged, [this](QString value) { mAccountModelConnection->invokeToCore([this, value]() { setVoicemailAddress(value); }); }); + + mCoreModelConnection = SafeConnection::create(me, CoreModel::getInstance()); + mCoreModelConnection->makeConnectToModel(&CoreModel::messageReadInChatRoom, + [this] { mAccountModel->refreshUnreadNotifications(); }); } void AccountCore::reset(const AccountCore &accountCore) { diff --git a/Linphone/core/account/AccountCore.hpp b/Linphone/core/account/AccountCore.hpp index 0cf824a09..95e7a3739 100644 --- a/Linphone/core/account/AccountCore.hpp +++ b/Linphone/core/account/AccountCore.hpp @@ -203,6 +203,7 @@ signals: void lSetPictureUri(QString pictureUri); void lSetDefaultAccount(); void lResetMissedCalls(); + void lResetUnreadMessages(); void lRefreshNotifications(); void lSetDisplayName(QString displayName); void lSetDialPlan(QVariantMap internationalPrefix); diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index a85a49b0f..78101f695 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -64,6 +64,9 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec } } mUnreadMessagesCount = chatRoom->getUnreadMessagesCount(); + connect(this, &ChatCore::unreadMessagesCountChanged, this, [this] { + if (mUnreadMessagesCount == 0) emit lMarkAsRead(); + }); mChatModel = Utils::makeQObject_ptr(chatRoom); mChatModel->setSelf(mChatModel); mLastMessageInHistory = mChatModel->getLastMessageInHistory(); @@ -93,7 +96,6 @@ void ChatCore::setSelf(QSharedPointer me) { }); mChatModelConnection->makeConnectToModel(&ChatModel::historyDeleted, [this]() { mChatModelConnection->invokeToCore([this]() { - qDebug() << log().arg("history deleted for chatRoom") << this; clearMessagesList(); Utils::showInformationPopup(tr("Supprimé"), tr("L'historique des messages a été supprimé."), true); }); @@ -104,6 +106,12 @@ void ChatCore::setSelf(QSharedPointer me) { mChatModelConnection->invokeToCore([this, count] { setUnreadMessagesCount(count); }); }); }); + mChatModelConnection->makeConnectToCore(&ChatCore::lUpdateLastUpdatedTime, [this]() { + mChatModelConnection->invokeToModel([this]() { + auto time = mChatModel->getLastUpdateTime(); + mChatModelConnection->invokeToCore([this, time]() { setLastUpdatedTime(time); }); + }); + }); mChatModelConnection->makeConnectToCore(&ChatCore::lDelete, [this]() { mChatModelConnection->invokeToModel([this]() { mChatModel->deleteChatRoom(); }); @@ -117,6 +125,7 @@ void ChatCore::setSelf(QSharedPointer me) { if (mChatModel->getMonitor() != chatRoom) return; emit lUpdateLastMessage(); emit lUpdateUnreadCount(); + emit lUpdateLastUpdatedTime(); auto message = eventLog->getChatMessage(); qDebug() << "EVENT LOG RECEIVED IN CHATROOM" << mChatModel->getTitle(); if (message) { @@ -133,6 +142,7 @@ void ChatCore::setSelf(QSharedPointer me) { if (mChatModel->getMonitor() != chatRoom) return; emit lUpdateLastMessage(); emit lUpdateUnreadCount(); + emit lUpdateLastUpdatedTime(); qDebug() << "EVENT LOGS RECEIVED IN CHATROOM" << mChatModel->getTitle(); QList> list; for (auto &m : chatMessages) { @@ -281,13 +291,13 @@ void ChatCore::appendMessagesToMessageList(QList mChatMessageList.append(message); ++nbAdded; } - if (nbAdded > 0) emit messageListChanged(); + if (nbAdded > 0) emit messagesInserted(list); } void ChatCore::appendMessageToMessageList(QSharedPointer message) { if (mChatMessageList.contains(message)) return; mChatMessageList.append(message); - emit messageListChanged(); + emit messagesInserted({message}); } void ChatCore::removeMessagesFromMessageList(QList> list) { @@ -298,7 +308,7 @@ void ChatCore::removeMessagesFromMessageList(QList 0) emit messageListChanged(); + if (nbRemoved > 0) emit messageRemoved(); } void ChatCore::clearMessagesList() { diff --git a/Linphone/core/chat/ChatCore.hpp b/Linphone/core/chat/ChatCore.hpp index 130c11d60..296ab5c5a 100644 --- a/Linphone/core/chat/ChatCore.hpp +++ b/Linphone/core/chat/ChatCore.hpp @@ -94,6 +94,8 @@ signals: void peerAddressChanged(QString address); void unreadMessagesCountChanged(int count); void messageListChanged(); + void messagesInserted(QList> list); + void messageRemoved(); void avatarUriChanged(); void deleted(); void composingUserChanged(); @@ -104,6 +106,7 @@ signals: void lMarkAsRead(); void lUpdateLastMessage(); void lUpdateUnreadCount(); + void lUpdateLastUpdatedTime(); void lSendTextMessage(QString message); void lCompose(); diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index e5d9ee8b7..07f3726f5 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -68,7 +68,9 @@ void ChatList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, chats]() { for (auto &chat : getSharedList()) { - if (chat) disconnect(chat.get(), &ChatCore::deleted, this, nullptr); + if (chat) { + disconnect(chat.get(), &ChatCore::deleted, this, nullptr); + } } for (auto &chat : *chats) { connect(chat.get(), &ChatCore::deleted, this, [this, chat] { @@ -77,6 +79,7 @@ void ChatList::setSelf(QSharedPointer me) { // really has removed the item, then emit specific signal emit chatRemoved(chat ? new ChatGui(chat) : nullptr); }); + connect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, [this] { emit chatUpdated(); }); } mustBeInMainThread(getClassName()); resetData(*chats); diff --git a/Linphone/core/chat/ChatList.hpp b/Linphone/core/chat/ChatList.hpp index 963a3dcdb..c37f1ce52 100644 --- a/Linphone/core/chat/ChatList.hpp +++ b/Linphone/core/chat/ChatList.hpp @@ -48,6 +48,7 @@ signals: void filterChanged(QString filter); void chatRemoved(ChatGui *chat); void chatAdded(); + void chatUpdated(); private: QString mFilter; diff --git a/Linphone/core/chat/ChatProxy.cpp b/Linphone/core/chat/ChatProxy.cpp index 1e802209e..089b2d91a 100644 --- a/Linphone/core/chat/ChatProxy.cpp +++ b/Linphone/core/chat/ChatProxy.cpp @@ -44,7 +44,8 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) { connect(this, &ChatProxy::filterTextChanged, newChatList, [this, newChatList] { emit newChatList->filterChanged(getFilterText()); }); connect(newChatList, &ChatList::chatRemoved, this, &ChatProxy::chatRemoved); - connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); }); + // connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); }); + connect(newChatList, &ChatList::chatUpdated, this, [this] { invalidate(); }); } auto firstList = new SortFilterList(model, Qt::AscendingOrder); setSourceModels(firstList); diff --git a/Linphone/core/chat/message/ChatMessageCore.cpp b/Linphone/core/chat/message/ChatMessageCore.cpp index 07c8c75dd..b08fad041 100644 --- a/Linphone/core/chat/message/ChatMessageCore.cpp +++ b/Linphone/core/chat/message/ChatMessageCore.cpp @@ -53,6 +53,7 @@ ChatMessageCore::ChatMessageCore(const std::shared_ptr &c auto chatroom = chatmessage->getChatRoom(); mIsFromChatGroup = chatroom->hasCapability((int)linphone::ChatRoom::Capabilities::Conference) && !chatroom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne); + mIsRead = chatmessage->isRead(); } ChatMessageCore::~ChatMessageCore() { @@ -67,6 +68,10 @@ void ChatMessageCore::setSelf(QSharedPointer me) { Utils::showInformationPopup(tr("Supprimé"), tr("Message supprimé"), true); emit deleted(); }); + mChatMessageModelConnection->makeConnectToCore(&ChatMessageCore::lMarkAsRead, [this] { + mChatMessageModelConnection->invokeToModel([this] { mChatMessageModel->markAsRead(); }); + }); + mChatMessageModelConnection->makeConnectToModel(&ChatMessageModel::messageRead, [this]() { setIsRead(true); }); } QDateTime ChatMessageCore::getTimestamp() const { @@ -119,6 +124,17 @@ bool ChatMessageCore::isFromChatGroup() const { return mIsFromChatGroup; } +bool ChatMessageCore::isRead() const { + return mIsRead; +} + +void ChatMessageCore::setIsRead(bool read) { + if (mIsRead != read) { + mIsRead = read; + emit isReadChanged(read); + } +} + std::shared_ptr ChatMessageCore::getModel() const { return mChatMessageModel; } \ No newline at end of file diff --git a/Linphone/core/chat/message/ChatMessageCore.hpp b/Linphone/core/chat/message/ChatMessageCore.hpp index 788a70769..79744bf89 100644 --- a/Linphone/core/chat/message/ChatMessageCore.hpp +++ b/Linphone/core/chat/message/ChatMessageCore.hpp @@ -42,6 +42,7 @@ class ChatMessageCore : public QObject, public AbstractObject { Q_PROPERTY(QString fromName READ getFromName CONSTANT) Q_PROPERTY(bool isRemoteMessage READ isRemoteMessage CONSTANT) Q_PROPERTY(bool isFromChatGroup READ isFromChatGroup CONSTANT) + Q_PROPERTY(bool isRead READ isRead WRITE setIsRead NOTIFY isReadChanged) public: static QSharedPointer create(const std::shared_ptr &chatmessage); @@ -64,15 +65,21 @@ public: bool isRemoteMessage() const; bool isFromChatGroup() const; + bool isRead() const; + void setIsRead(bool read); + std::shared_ptr getModel() const; signals: void timestampChanged(QDateTime timestamp); void textChanged(QString text); + void isReadChanged(bool read); void isRemoteMessageChanged(bool isRemote); void lDelete(); void deleted(); + void lMarkAsRead(); + void readChanged(); private: DECLARE_ABSTRACT_OBJECT QString mText; @@ -84,6 +91,7 @@ private: QDateTime mTimestamp; bool mIsRemoteMessage = false; bool mIsFromChatGroup = false; + bool mIsRead = false; std::shared_ptr mChatMessageModel; QSharedPointer> mChatMessageModelConnection; }; diff --git a/Linphone/core/chat/message/ChatMessageList.cpp b/Linphone/core/chat/message/ChatMessageList.cpp index 502729076..c71064987 100644 --- a/Linphone/core/chat/message/ChatMessageList.cpp +++ b/Linphone/core/chat/message/ChatMessageList.cpp @@ -70,6 +70,13 @@ void ChatMessageList::setChatCore(QSharedPointer core) { if (mChatCore) disconnect(mChatCore.get(), &ChatCore::messageListChanged, this, nullptr); mChatCore = core; if (mChatCore) connect(mChatCore.get(), &ChatCore::messageListChanged, this, &ChatMessageList::lUpdate); + if (mChatCore) + connect(mChatCore.get(), &ChatCore::messagesInserted, this, + [this](QList> list) { + for (auto &message : list) { + add(message); + } + }); emit chatChanged(); } } diff --git a/Linphone/core/chat/message/ChatMessageProxy.cpp b/Linphone/core/chat/message/ChatMessageProxy.cpp index 339ceffea..6abc2a1de 100644 --- a/Linphone/core/chat/message/ChatMessageProxy.cpp +++ b/Linphone/core/chat/message/ChatMessageProxy.cpp @@ -67,6 +67,17 @@ ChatMessageGui *ChatMessageProxy::getChatMessageAtIndex(int i) { return nullptr; } +int ChatMessageProxy::findFirstUnreadIndex() { + int n = getCount(); + for (int i = 0; i < n; ++i) { + auto chat = getItemAt(i); + if (chat && !chat->isRead()) { + return i; + } + } + return std::max(0, n - 1); +} + bool ChatMessageProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { // auto l = getItemAtSource(sourceRow); // return l != nullptr; diff --git a/Linphone/core/chat/message/ChatMessageProxy.hpp b/Linphone/core/chat/message/ChatMessageProxy.hpp index 659f3cd1d..082769d17 100644 --- a/Linphone/core/chat/message/ChatMessageProxy.hpp +++ b/Linphone/core/chat/message/ChatMessageProxy.hpp @@ -45,6 +45,7 @@ public: void setSourceModel(QAbstractItemModel *sourceModel) override; Q_INVOKABLE ChatMessageGui *getChatMessageAtIndex(int index); + Q_INVOKABLE int findFirstUnreadIndex(); signals: void chatChanged(); diff --git a/Linphone/model/account/AccountModel.cpp b/Linphone/model/account/AccountModel.cpp index f4f4ee3d0..e11e7b63e 100644 --- a/Linphone/model/account/AccountModel.cpp +++ b/Linphone/model/account/AccountModel.cpp @@ -151,13 +151,11 @@ std::shared_ptr AccountModel::getAccount() const { void AccountModel::resetMissedCallsCount() { mMonitor->resetMissedCallsCount(); - emit unreadNotificationsChanged(0 /*mMonitor->getUnreadChatMessageCount()*/, - mMonitor->getMissedCallsCount()); // TODO + emit unreadNotificationsChanged(mMonitor->getUnreadChatMessageCount(), mMonitor->getMissedCallsCount()); } void AccountModel::refreshUnreadNotifications() { - emit unreadNotificationsChanged(0 /*mMonitor->getUnreadChatMessageCount()*/, - mMonitor->getMissedCallsCount()); // TODO + emit unreadNotificationsChanged(mMonitor->getUnreadChatMessageCount(), mMonitor->getMissedCallsCount()); } int AccountModel::getMissedCallsCount() const { diff --git a/Linphone/model/chat/ChatModel.cpp b/Linphone/model/chat/ChatModel.cpp index 78d155a27..5ec1f6348 100644 --- a/Linphone/model/chat/ChatModel.cpp +++ b/Linphone/model/chat/ChatModel.cpp @@ -34,10 +34,17 @@ ChatModel::ChatModel(const std::shared_ptr &chatroom, QObjec : ::Listener(chatroom, parent) { lDebug() << "[ChatModel] new" << this << " / SDKModel=" << chatroom.get(); mustBeInLinphoneThread(getClassName()); + auto coreModel = CoreModel::getInstance(); + if (coreModel) + connect(coreModel.get(), &CoreModel::messageReadInChatRoom, this, + [this](std::shared_ptr chatroom) { + if (chatroom == mMonitor) emit messagesRead(); + }); } ChatModel::~ChatModel() { mustBeInLinphoneThread("~" + getClassName()); + disconnect(CoreModel::getInstance().get(), &CoreModel::messageReadInChatRoom, this, nullptr); } QDateTime ChatModel::getLastUpdateTime() { @@ -106,6 +113,9 @@ int ChatModel::getUnreadMessagesCount() const { void ChatModel::markAsRead() { mMonitor->markAsRead(); + for (auto &message : getHistory()) { + message->markAsRead(); + } emit messagesRead(); } diff --git a/Linphone/model/chat/message/ChatMessageModel.cpp b/Linphone/model/chat/message/ChatMessageModel.cpp index 1c0880fce..18cd64cb9 100644 --- a/Linphone/model/chat/message/ChatMessageModel.cpp +++ b/Linphone/model/chat/message/ChatMessageModel.cpp @@ -68,6 +68,16 @@ ChatMessageModel::onFileTransferSend(const std::shared_ptrisRead(); +} + +void ChatMessageModel::markAsRead() { + mMonitor->markAsRead(); + emit messageRead(); + emit CoreModel::getInstance()->messageReadInChatRoom(mMonitor->getChatRoom()); +} + void ChatMessageModel::deleteMessageFromChatRoom() { auto chatRoom = mMonitor->getChatRoom(); if (chatRoom) { diff --git a/Linphone/model/chat/message/ChatMessageModel.hpp b/Linphone/model/chat/message/ChatMessageModel.hpp index bf7db2109..b01fbcf6a 100644 --- a/Linphone/model/chat/message/ChatMessageModel.hpp +++ b/Linphone/model/chat/message/ChatMessageModel.hpp @@ -44,10 +44,14 @@ public: QString getFromAddress() const; QString getToAddress() const; + bool isRead() const; + void markAsRead(); + void deleteMessageFromChatRoom(); signals: void messageDeleted(); + void messageRead(); private: DECLARE_ABSTRACT_OBJECT diff --git a/Linphone/model/core/CoreModel.hpp b/Linphone/model/core/CoreModel.hpp index 5cd242a39..52b19c46d 100644 --- a/Linphone/model/core/CoreModel.hpp +++ b/Linphone/model/core/CoreModel.hpp @@ -82,6 +82,7 @@ signals: void requestRestart(); void enabledLdapAddressBookSaved(); void magicSearchResultReceived(QString filter); + void messageReadInChatRoom(std::shared_ptr chatRoom); private: QString mConfigPath; diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index 445d6339f..85b367008 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -14,41 +14,35 @@ ListView { property color backgroundColor spacing: Math.round(4 * DefaultStyle.dp) - // Component.onCompleted: positionViewAtIndex(chatMessageProxy.findFirstUnreadIndex(), ListView.Visible) - - onAtYEndChanged: if (atYEnd) chat.core.lMarkAsRead(); - - onChatChanged: if (visible) { + Component.onCompleted: { var index = chatMessageProxy.findFirstUnreadIndex() - console.log("visible, first unread at index", index) - mainItem.positionViewAtIndex(index, ListView.Visible) + positionViewAtIndex(index, ListView.End) + var chatMessage = chatMessageProxy.getChatMessageAtIndex(index) + if (chatMessage && !chatMessage.core.isRead) chatMessage.core.lMarkAsRead() } - - RoundButton { + + Button { + visible: !mainItem.atYEnd icon.source: AppIcons.downArrow - // Layout.preferredWidth: 40 * DefaultStyle.dp - // Layout.preferredHeight: 40 * DefaultStyle.dp + leftPadding: Math.round(16 * DefaultStyle.dp) + rightPadding: Math.round(16 * DefaultStyle.dp) + topPadding: Math.round(16 * DefaultStyle.dp) + bottomPadding: Math.round(16 * DefaultStyle.dp) anchors.bottom: parent.bottom anchors.right: parent.right anchors.bottomMargin: Math.round(18 * DefaultStyle.dp) anchors.rightMargin: Math.round(18 * DefaultStyle.dp) onClicked: { var index = chatMessageProxy.findFirstUnreadIndex() - console.log("clicked, first unread at index", index) - mainItem.positionViewAtIndex(index, ListView.Visible) - // var chatMessage = chatMessageProxy.getChatMessageAtIndex(index) - // if (chatMessage && !chatMessage.core.isRead) chatMessage.core.lMarkAsRead() + mainItem.positionViewAtIndex(index, ListView.End) + var chatMessage = chatMessageProxy.getChatMessageAtIndex(index) + if (chatMessage && !chatMessage.core.isRead) chatMessage.core.lMarkAsRead() } } model: ChatMessageProxy { id: chatMessageProxy chatGui: mainItem.chat - onCountChanged: { - var indexToSelect = mainItem.currentIndex - mainItem.currentIndex = -1 - mainItem.currentIndex = indexToSelect - } } header: Item { diff --git a/Linphone/view/Control/Display/Contact/ContactListItem.qml b/Linphone/view/Control/Display/Contact/ContactListItem.qml index 6190a9a9d..abfbee528 100644 --- a/Linphone/view/Control/Display/Contact/ContactListItem.qml +++ b/Linphone/view/Control/Display/Contact/ContactListItem.qml @@ -33,8 +33,8 @@ FocusScope { // Use directly previous initial property real itemsRightMargin: Math.round(39 * DefaultStyle.dp) - property var displayName: searchResultItem.core.fullName - property string initial: displayName ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' + property string displayName: searchResultItem? searchResultItem.core.fullName : "" + property string initial: displayName != "" ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' signal clicked(var mouse) signal contactDeletionRequested(FriendGui contact) @@ -49,7 +49,7 @@ FocusScope { verticalAlignment: Text.AlignVCenter width: Math.round(20 * DefaultStyle.dp) opacity: previousInitial != mainItem.initial ? 1 : 0 - text: mainItem.initial + text: mainItem.initial || "" color: DefaultStyle.main2_400 font { pixelSize: Math.round(20 * DefaultStyle.dp) diff --git a/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml b/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml index 7ca2efa3f..3bed2be77 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml @@ -15,10 +15,10 @@ Notification { overriddenWidth: Math.round(400 * DefaultStyle.dp) overriddenHeight: content.height - property string avatarUri: notificationData && notificationData.avatarUri - property string chatRoomName: notificationData && notificationData.chatRoomName - property string remoteAddress: notificationData && notificationData.remoteAddress - property string message: notificationData && notificationData.message + property string avatarUri: notificationData ? notificationData.avatarUri : "" + property string chatRoomName: notificationData ? notificationData.chatRoomName : "" + property string remoteAddress: notificationData ? notificationData.remoteAddress : "" + property string message: notificationData ? notificationData.message : "" Popup { id: content diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index c85e6fcb7..ed0517ef4 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -18,7 +18,7 @@ RowLayout { onChatChanged: { // TODO : call when all messages read after scroll to unread feature available - if (chat) chat.core.lMarkAsRead() + // if (chat) chat.core.lMarkAsRead() } MainRightPanel { id: splitPanel