// WARNING: Do not remove this code, it is used for predefined/automated deployments (2016)
Folder *FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountState *accountState)
{
- Folder *folder = nullptr;
-
qCInfo(lcFolderMan) << " ` -> setting up:" << file;
QString escapedAlias(file);
// check the unescaped variant (for the case when the filename comes out
}
if (!cfgFile.isReadable()) {
qCWarning(lcFolderMan) << "Cannot read folder definition for alias " << cfgFile.filePath();
- return folder;
+ return nullptr;
}
QSettings settings(_folderConfigPath + QLatin1Char('/') + escapedAlias, QSettings::IniFormat);
const auto groups = settings.childGroups();
if (groups.isEmpty()) {
qCWarning(lcFolderMan) << "empty file:" << cfgFile.filePath();
- return folder;
+ return nullptr;
}
if (!accountState) {
folderDefinition.paused = paused;
folderDefinition.ignoreHiddenFiles = ignoreHiddenFiles;
- folder = addFolderInternal(folderDefinition, accountState, std::make_unique<VfsOff>());
- if (folder) {
+ if (const auto folder = addFolderInternal(folderDefinition, accountState, std::make_unique<VfsOff>())) {
const auto blackList = settings.value(QLatin1String("blackList")).toStringList();
if (!blackList.empty()) {
//migrate settings
}
folder->saveToSettings();
- }
- qCInfo(lcFolderMan) << "Migrated!" << folder;
- settings.sync();
- if (folder) {
+ qCInfo(lcFolderMan) << "Migrated!" << folder;
+ settings.sync();
+
return folder;
}
settings.endGroup();
settings.endGroup();
}
- return folder;
+
+ return nullptr;
}
void FolderMan::slotFolderSyncPaused(Folder *f, bool paused)