From: Claudio Cambra Date: Tue, 4 Jul 2023 15:33:00 +0000 (+0800) Subject: Clean up AccountSettings::refreshSelectiveSyncStatus X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~92^2^2~57^2~39 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a97bdb95eef8bfec377995dfc98538a7c92c65b4;p=nextcloud-desktop.git Clean up AccountSettings::refreshSelectiveSyncStatus Signed-off-by: Claudio Cambra --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index b4ca6b3b7..623d8e8e1 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1480,38 +1480,44 @@ void AccountSettings::folderTerminateSyncAndUpdateBlackList(const QStringList &b void AccountSettings::refreshSelectiveSyncStatus() { - QString msg; + QString unsyncedMsg; + auto cnt = 0; const auto folders = FolderMan::instance()->map().values(); + _ui->bigFolderUi->setVisible(false); + for (const auto folder : folders) { if (folder->accountState() != _accountState) { continue; } auto ok = false; + auto blacklistOk = false; const auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok); + const auto blacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &blacklistOk); + for (const auto &it : undecidedList) { // FIXME: add the folder alias in a hoover hint. // folder->alias() + QLatin1String("/") if (cnt++) { - msg += QLatin1String(", "); + unsyncedMsg += QStringLiteral(", "); } - auto myFolder = (it); - if (myFolder.endsWith('/')) { - myFolder.chop(1); - } - const auto theIndx = _model->indexForPath(folder, myFolder); - if (theIndx.isValid()) { - msg += QString::fromLatin1("%1") - .arg(Utility::escape(myFolder), Utility::escape(folder->alias())); + + const auto folderWithoutTrailingSlash = it.endsWith('/') ? it.left(it.length() - 1) : it; + + const auto folderIdx = _model->indexForPath(folder, folderWithoutTrailingSlash); + if (folderIdx.isValid()) { + const auto escapedFolderString = Utility::escape(folderWithoutTrailingSlash); + const auto escapedFolderName = Utility::escape(folder->alias()); + unsyncedMsg += QStringLiteral("%1").arg(escapedFolderString, escapedFolderName); } else { - msg += myFolder; // no link because we do not know the index yet. + unsyncedMsg += folderWithoutTrailingSlash; // no link because we do not know the index yet. } } } - if (!msg.isEmpty()) { + if (!unsyncedMsg.isEmpty()) { ConfigFile cfg; const auto info = !cfg.confirmExternalStorage() ? tr("There are folders that were not synchronized because they are too big: ") : @@ -1519,7 +1525,7 @@ void AccountSettings::refreshSelectiveSyncStatus() tr("There are folders that were not synchronized because they are external storages: ") : tr("There are folders that were not synchronized because they are too big or external storages: "); - _ui->selectiveSyncNotification->setText(info + msg); + _ui->selectiveSyncNotification->setText(info + unsyncedMsg); _ui->bigFolderUi->setVisible(true); } }