- 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
This commit is contained in:
Julien Wadel 2020-06-11 19:31:07 +02:00
parent 647c28b514
commit 6278ebe966
3 changed files with 11 additions and 33 deletions

View file

@ -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
}

View file

@ -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<linphone::CallLog> &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,

View file

@ -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))