const auto trailSlashFolderPath = trailingSlashPath(folderPath);
const auto journal = journalDb();
+ // Add the entry to the whitelist if it is neither in the blacklist or whitelist already
+ bool ok1 = false;
+ bool ok2 = false;
+ auto blacklist = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok1);
+ auto whitelist = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok2);
+ if (ok1 && ok2 && !blacklist.contains(trailSlashFolderPath) && !whitelist.contains(trailSlashFolderPath)) {
+ whitelist.append(trailSlashFolderPath);
+ journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, whitelist);
+ }
+
auto undecidedListQueryOk = false;
auto undecidedList = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &undecidedListQueryOk);
if (undecidedListQueryOk) {
existingFolderNowBigActivity._message = tr("Would you like to stop syncing this folder?");
existingFolderNowBigActivity._accName = _accountState->account()->displayName();
existingFolderNowBigActivity._folder = alias();
+ existingFolderNowBigActivity._file = cleanPath() + '/' + trailSlashFolderPath;
existingFolderNowBigActivity._links = {blacklistActivityLink, whitelistActivityLink};
existingFolderNowBigActivity._id = qHash(existingFolderNowBigActivity._file);
return;
}
- folder->whitelistPath(path);
+ const QString folderPath = folder->cleanPath() + QLatin1Char('/');
+ const auto relPath = path.mid(folderPath.length());
+ folder->whitelistPath(relPath);
}
void FolderMan::blacklistFolderPath(const QString &path)
return;
}
- folder->blacklistPath(path);
+ const QString folderPath = folder->cleanPath() + QLatin1Char('/');
+ const auto relPath = path.mid(folderPath.length());
+ folder->blacklistPath(relPath);
}
QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const AccountPtr acc)
/** Returns the folder which the file or directory stored in path is in */
Folder *folderForPath(const QString &path);
+ // Takes local file paths and finds the corresponding folder, adding to correct selective sync list
void whitelistFolderPath(const QString &path);
void blacklistFolderPath(const QString &path);
(activity._syncFileItemStatus == SyncFileItem::Conflict || activity._syncFileItemStatus == SyncFileItem::FileNameClash)) {
slotTriggerDefaultAction(activityIndex);
return;
- } else if (action._verb == "WHITELIST_FOLDER" && !activity._folder.isEmpty()) {
- FolderMan::instance()->whitelistFolderPath(activity._folder);
+ } else if (action._verb == "WHITELIST_FOLDER" && !activity._file.isEmpty()) { // _folder == folder alias/name, _file == folder/file path
+ FolderMan::instance()->whitelistFolderPath(activity._file);
removeActivityFromActivityList(activity);
- } else if (action._verb == "BLACKLIST_FOLDER" && !activity._folder.isEmpty()) {
- FolderMan::instance()->blacklistFolderPath(activity._folder);
+ return;
+ } else if (action._verb == "BLACKLIST_FOLDER" && !activity._file.isEmpty()) {
+ FolderMan::instance()->blacklistFolderPath(activity._file);
removeActivityFromActivityList(activity);
+ return;
}
emit sendNotificationRequest(activity._accName, action._link, action._verb, activityIndex);