From eb6d76f6baa74b59762984de7f9b239f4c689547 Mon Sep 17 00:00:00 2001 From: blacksun Date: Mon, 24 Jun 2019 17:44:37 +0000 Subject: [PATCH] Fix unwanted restore dialog who appear for the current project git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5936 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetapp.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 897b2402d..5f340b0a4 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1787,13 +1787,17 @@ void QETApp::buildSystemTrayMenu() { */ void QETApp::checkBackupFiles() { - QList stale_files = KAutoSaveFile::allStaleFiles(); + QList stale_files = KAutoSaveFile::allStaleFiles(); //Remove from the list @stale_files, the stales file of opened project const QList sf = stale_files; - for (KAutoSaveFile *kasf : sf) { - for (QETProject *project : registeredProjects().values()) { - if (kasf->managedFile() == QUrl::fromLocalFile(project->filePath())) { + for (KAutoSaveFile *kasf : sf) + { + for (QETProject *project : registeredProjects().values()) + { + //We must to adjust with the flag QUrl::StripTrailingSlash to compar a path formated like the path returned by KAutoSaveFile + const QString path = QUrl::fromLocalFile(project->filePath()).adjusted(QUrl::RemoveScheme | QUrl::StripTrailingSlash).path(); + if (kasf->managedFile() == path) { stale_files.removeOne(kasf); } } @@ -1811,8 +1815,14 @@ void QETApp::checkBackupFiles() text.append(tr("Les fichiers de restauration suivant on été trouvé,
" "Voulez-vous les ouvrir ?

")); } - for(const KAutoSaveFile *kasf : stale_files) { - text.append("
" + kasf->managedFile().path()); + for(const KAutoSaveFile *kasf : stale_files) + { +#ifdef Q_OS_WIN + //Remove the first character '/' before the name of the drive + text.append("
" + kasf->managedFile().path().remove(0,1)); +#else + text.append("
" + kasf->managedFile().path()); +#endif } //Open backup file