From 6278ebe966a9745154d075a7b8fb08e9566bea48 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 11 Jun 2020 19:31:07 +0200 Subject: [PATCH] - Migrate from Flatpak only if main database doesn't exists - Mark a chat as read only if there are unread messages (SDK feature) - Remove filtering on call status when loading logs --- linphone-app/src/app/paths/Paths.cpp | 12 +++++++----- .../src/components/chat/ChatModel.cpp | 19 ++++--------------- .../sip-addresses/SipAddressesModel.cpp | 13 ------------- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/linphone-app/src/app/paths/Paths.cpp b/linphone-app/src/app/paths/Paths.cpp index 7bb3a61b1..b4c03d201 100644 --- a/linphone-app/src/app/paths/Paths.cpp +++ b/linphone-app/src/app/paths/Paths.cpp @@ -302,11 +302,13 @@ static void migrateConfigurationFile (const QString &oldPath, const QString &new } void migrateFlatpakVersionFiles(){ #ifdef Q_OS_LINUX -// Copy all files - QString flatpakPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.var/app/com.belledonnecommunications.linphone/data/linphone"; - if( QDir().exists(flatpakPath)){ - qInfo() << "Migrating data from Flatpak."; - Utils::copyDir(flatpakPath, QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); + if(!filePathExists(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/linphone.db")){ +// Copy all files if linphone.db doesn't exist + QString flatpakPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.var/app/com.belledonnecommunications.linphone/data/linphone"; + if( QDir().exists(flatpakPath)){ + qInfo() << "Migrating data from Flatpak."; + Utils::copyDir(flatpakPath, QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); + } } #endif } diff --git a/linphone-app/src/components/chat/ChatModel.cpp b/linphone-app/src/components/chat/ChatModel.cpp index 42d5d2645..a8cb8fe25 100644 --- a/linphone-app/src/components/chat/ChatModel.cpp +++ b/linphone-app/src/components/chat/ChatModel.cpp @@ -628,10 +628,11 @@ void ChatModel::compose () { } void ChatModel::resetMessageCount () { - if (mChatRoom->getUnreadMessagesCount() > 0 || CoreManager::getInstance()->getMissedCallCount(getPeerAddress(), getLocalAddress())>0) { - mChatRoom->markAsRead(); + if (mChatRoom->getUnreadMessagesCount() > 0){ + mChatRoom->markAsRead();// Marking as read is only for messages. Not for calls. + emit messageCountReset(); + }else if (CoreManager::getInstance()->getMissedCallCount(getPeerAddress(), getLocalAddress())>0) emit messageCountReset(); - } } // ----------------------------------------------------------------------------- @@ -697,18 +698,6 @@ void ChatModel::removeEntry (ChatEntryData &entry) { void ChatModel::insertCall (const shared_ptr &callLog) { linphone::Call::Status status = callLog->getStatus(); - switch (status) { - case linphone::Call::Status::Aborted: - case linphone::Call::Status::EarlyAborted: - - case linphone::Call::Status::AcceptedElsewhere: - case linphone::Call::Status::DeclinedElsewhere: - - case linphone::Call::Status::Success: - case linphone::Call::Status::Missed: - case linphone::Call::Status::Declined: - break; - } auto insertEntry = [this]( const ChatEntryData &entry, diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 4f1e72d48..0a765e68d 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -577,19 +577,6 @@ void SipAddressesModel::initSipAddressesFromCalls () { for (const auto &callLog : CoreManager::getInstance()->getCore()->getCallLogs()) { const QString peerAddress(Utils::coreStringToAppString(callLog->getRemoteAddress()->asStringUriOnly())); const QString localAddress(Utils::coreStringToAppString(callLog->getLocalAddress()->asStringUriOnly())); - switch (callLog->getStatus()) { - case linphone::Call::Status::Aborted: - case linphone::Call::Status::EarlyAborted: - return; // Ignore aborted calls. - case linphone::Call::Status::AcceptedElsewhere: - case linphone::Call::Status::DeclinedElsewhere: - return; // Ignore accepted calls on other device. - case linphone::Call::Status::Success: - case linphone::Call::Status::Declined: - - case linphone::Call::Status::Missed: - break; - } ConferenceId conferenceId{ peerAddress, localAddress }; if (conferenceDone.contains(conferenceId))