constexpr auto settingsFoldersC = "Folders";
constexpr auto settingsVersionC = "version";
constexpr auto maxFoldersVersion = 1;
+const char versionC[] = "version";
+
+int numberOfSyncJournals(const QString &path)
+{
+ return QDir(path).entryList({ QStringLiteral(".sync_*.db"), QStringLiteral("._sync_*.db") }, QDir::Hidden | QDir::Files).size();
+}
+
}
namespace OCC {
Utility::NtfsPermissionLookupRAII ntfs_perm;
#endif
const QFileInfo selFile(path);
+ if (numberOfSyncJournals(selFile.filePath()) != 0) {
+ return FolderMan::tr("The folder %1 is used in a folder sync connection!").arg(QDir::toNativeSeparators(selFile.filePath()));
+ }
if (!FileSystem::fileExists(path)) {
QString parentPath = selFile.dir().path();
return unsupportedConfiguration(path) && Vfs::checkAvailability(path, mode);
}
+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
/** Whether or not vfs is supported in the location. */
bool checkVfsAvailability(const QString &path, Vfs::Mode mode = bestAvailableVfsMode()) const;
+ /** If the folder configuration is no longer supported this will return an error string */
+ Result<void, QString> unsupportedConfiguration(const QString &path) const;
signals:
/**
* signal to indicate a folder has changed its sync state.
return (folder->syncResult().hasUnresolvedConflicts())
? QStringList(tr("There are unresolved conflicts. Click for details."))
: QStringList();
- case FolderStatusDelegate::FolderErrorMsg:
- return folder->syncResult().errorStrings();
+ case FolderStatusDelegate::FolderErrorMsg: {
+ auto errors = folder->syncResult().errorStrings();
+ const auto legacyError = FolderMan::instance()->unsupportedConfiguration(folder->path());
+ if (!legacyError) {
+ // the error message might contain new lines, the delegate only expect multiple single line values
+ errors.append(legacyError.error().split(QLatin1Char('\n')));
+ }
+ return errors;
+ }
case FolderStatusDelegate::FolderInfoMsg:
return folder->virtualFilesEnabled() && folder->vfs().mode() != Vfs::Mode::WindowsCfApi
? QStringList(tr("Virtual file support is enabled."))
bool FolderWizardSelectiveSync::validatePage()
{
const auto mode = bestAvailableVfsMode();
- const bool useVirtualFiles = (Theme::instance()->forceVirtualFilesOption() && mode == Vfs::WindowsCfApi) || (_virtualFilesCheckBox && _virtualFilesCheckBox->isChecked());
+ const bool useVirtualFiles = (mode == Vfs::WindowsCfApi) || (_virtualFilesCheckBox && _virtualFilesCheckBox->isChecked());
if (useVirtualFiles) {
const auto availability = Vfs::checkAvailability(wizard()->field(QStringLiteral("sourceFolder")).toString(), mode);
if (!availability) {