Skip to content

Commit

Permalink
Clean up FolderMan::setupFolderFromOldConfigFile.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <hello@camila.codes>
  • Loading branch information
Camila committed Sep 12, 2023
1 parent 8193db6 commit cbfb60d
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,23 +565,19 @@ void FolderMan::setupFolderFromOldConfigFile(const QString &fileNamePath, Accoun

if (const auto folder = addFolderInternal(folderDefinition, accountState, std::make_unique<VfsOff>())) {
auto ok = true;
if (const auto legacyBlacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
&ok); ok && !legacyBlacklist.isEmpty()) {
auto legacyBlacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
&ok);
if (!ok) {
qCInfo(lcFolderMan) << "There was a problem retriving the database selective sync for " << folder;
}

legacyBlacklist << settings.value(QLatin1String("blackList")).toStringList();
if (!legacyBlacklist.isEmpty()) {
qCInfo(lcFolderMan) << "Legacy selective sync list found:" << legacyBlacklist;
for (const auto &legacyFolder : legacyBlacklist) {
folder->migrateBlackListPath(legacyFolder);
}
} else {
qCInfo(lcFolderMan) << "There was a problem retriving the database selective sync for " << folder;
}

const auto settingLegacyBlacklist = settings.value(QLatin1String("blackList")).toStringList();
if (!settingLegacyBlacklist.empty()) {
// migrate settings
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, settingLegacyBlacklist);
settings.remove(QLatin1String("blackList"));
// FIXME: If you remove this codepath, you need to provide another way to do
// this via theme.h or the normal FolderMan::setupFolders
}

folder->saveToSettings();
Expand Down

0 comments on commit cbfb60d

Please sign in to comment.