diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-09-06 15:13:01 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-09-06 16:44:06 +0300 |
commit | 1b5925c327c01bbff65de4059d1153c9d6574ba9 (patch) | |
tree | 69250ddfb5938f1995cd7d94daf63769cae86eb3 /src/gui/folderman.cpp | |
parent | b4f61d0ba844286a45bc93bd5cf797944f8941d9 (diff) |
Warn if we encounter an unsupported configuration
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r-- | src/gui/folderman.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 652085f9d..8de0ec6fc 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -36,8 +36,16 @@ #include <QSet> #include <QNetworkProxy> -static const char versionC[] = "version"; -static const int maxFoldersVersion = 1; +namespace { +const char versionC[] = "version"; +const int maxFoldersVersion = 1; + +int numberOfSyncJournals(const QString &path) +{ + return QDir(path).entryList({ QStringLiteral(".sync_*.db"), QStringLiteral("._sync_*.db") }, QDir::Hidden | QDir::Files).size(); +} + +} namespace OCC { Q_LOGGING_CATEGORY(lcFolderMan, "gui.folder.manager", QtInfoMsg) @@ -1331,7 +1339,7 @@ static QString checkPathValidityRecursive(const QString &path) Utility::NtfsPermissionLookupRAII ntfs_perm; #endif const QFileInfo selFile(path); - if (!QDir(path).entryList({ QStringLiteral(".sync_*.db"), QStringLiteral("._sync_*.db") }, QDir::Hidden | QDir::Files).isEmpty()) { + if (numberOfSyncJournals(selFile.filePath()) != 0) { return FolderMan::tr("The folder %1 is used in a folder sync connection!").arg(QDir::toNativeSeparators(selFile.filePath())); } @@ -1474,5 +1482,15 @@ void FolderMan::restartApplication() } } +Result<void, QString> FolderMan::unsupportedConfiguration(const QString &path) const +{ + if (numberOfSyncJournals(path) > 1) { + return tr("Multiple accounts are sharing the folder %1.\n" + "This configuration is know to lead to dataloss and is no longer supported.\n" + "Please consider removing this folder from the account and adding it again.") + .arg(path); + } + return {}; +} } // namespace OCC |