mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
chore: fix all occurence of range-loop-detach clazy warning
see https://github.com/KDE/clazy/blob/master/docs/checks/README-range-loop-detach.md Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
f3f7b5613e
commit
fa4848a686
@ -733,7 +733,8 @@ void ExcludedFiles::prepare(const BasePathString & basePath)
|
||||
pattern.append(appendMe);
|
||||
};
|
||||
|
||||
for (auto exclude : _allExcludes.value(basePath)) {
|
||||
const auto &allValues = _allExcludes.value(basePath);
|
||||
for (auto exclude : allValues) {
|
||||
if (exclude[0] == QLatin1Char('\n'))
|
||||
continue; // empty line
|
||||
if (exclude[0] == QLatin1Char('\r'))
|
||||
|
||||
@ -217,7 +217,7 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
legacyLocations.append({legacyCfgFileParentFolder + unbrandedCfgFileNamePath, legacyCfgFileGrandParentFolder + unbrandedCfgFileRelativePath});
|
||||
}
|
||||
|
||||
for (const auto &configFile : legacyLocations) {
|
||||
for (const auto &configFile : std::as_const(legacyLocations)) {
|
||||
auto oCSettings = std::make_unique<QSettings>(configFile, QSettings::IniFormat);
|
||||
if (oCSettings->status() != QSettings::Status::NoError) {
|
||||
qCInfo(lcAccountManager) << "Error reading legacy configuration file" << oCSettings->status();
|
||||
@ -699,7 +699,7 @@ void AccountManager::deleteAccount(OCC::AccountState *account)
|
||||
void AccountManager::updateServerHasValidSubscriptionConfig()
|
||||
{
|
||||
auto serverHasValidSubscription = false;
|
||||
for (const auto &account : _accounts) {
|
||||
for (const auto &account : std::as_const(_accounts)) {
|
||||
if (!account->account()->serverHasValidSubscription()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1143,7 +1143,8 @@ void AccountSettings::forgetEncryptionOnDeviceForAccount(const AccountPtr &accou
|
||||
|
||||
void AccountSettings::migrateCertificateForAccount(const AccountPtr &account)
|
||||
{
|
||||
for (const auto action : _ui->encryptionMessage->actions()) {
|
||||
const auto &allActions = _ui->encryptionMessage->actions();
|
||||
for (const auto action : allActions) {
|
||||
_ui->encryptionMessage->removeAction(action);
|
||||
}
|
||||
|
||||
@ -1703,7 +1704,8 @@ void AccountSettings::setupE2eEncryption()
|
||||
|
||||
void AccountSettings::forgetE2eEncryption()
|
||||
{
|
||||
for (const auto action : _ui->encryptionMessage->actions()) {
|
||||
const auto &allActions = _ui->encryptionMessage->actions();
|
||||
for (const auto action : allActions) {
|
||||
_ui->encryptionMessage->removeAction(action);
|
||||
}
|
||||
_ui->encryptionMessage->setText({});
|
||||
|
||||
@ -293,7 +293,8 @@ Application::Application(int &argc, char **argv)
|
||||
|
||||
if (_theme->doNotUseProxy()) {
|
||||
ConfigFile().setProxyType(QNetworkProxy::NoProxy);
|
||||
for (const auto &accountState : AccountManager::instance()->accounts()) {
|
||||
const auto &allAccounts = AccountManager::instance()->accounts();
|
||||
for (const auto &accountState : allAccounts) {
|
||||
if (accountState && accountState->account()) {
|
||||
accountState->account()->setProxyType(QNetworkProxy::NoProxy);
|
||||
}
|
||||
@ -401,7 +402,8 @@ Application::Application(int &argc, char **argv)
|
||||
|
||||
if (_theme->doNotUseProxy()) {
|
||||
ConfigFile().setProxyType(QNetworkProxy::NoProxy);
|
||||
for (const auto &accountState : AccountManager::instance()->accounts()) {
|
||||
const auto &allAccounts = AccountManager::instance()->accounts();
|
||||
for (const auto &accountState : allAccounts) {
|
||||
if (accountState && accountState->account()) {
|
||||
accountState->account()->setProxyType(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
@ -385,7 +385,8 @@ void FolderMan::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringLi
|
||||
const auto foldersVersion = settings->value(QLatin1String(settingsVersionC), 1).toInt();
|
||||
qCInfo(lcFolderMan) << "FolderDefinition::maxSettingsVersion:" << FolderDefinition::maxSettingsVersion();
|
||||
if (foldersVersion <= maxFoldersVersion) {
|
||||
for (const auto &folderAlias : settings->childGroups()) {
|
||||
const auto &childGroups = settings->childGroups();
|
||||
for (const auto &folderAlias : childGroups) {
|
||||
settings->beginGroup(folderAlias);
|
||||
const auto folderVersion = settings->value(QLatin1String(settingsVersionC), 1).toInt();
|
||||
if (folderVersion > FolderDefinition::maxSettingsVersion()) {
|
||||
@ -591,7 +592,7 @@ void FolderMan::setupLegacyFolder(const QString &fileNamePath, AccountState *acc
|
||||
legacyBlacklist << settings.value(QLatin1String("blackList")).toStringList();
|
||||
if (!legacyBlacklist.isEmpty()) {
|
||||
qCInfo(lcFolderMan) << "Legacy selective sync list found:" << legacyBlacklist;
|
||||
for (const auto &legacyFolder : legacyBlacklist) {
|
||||
for (const auto &legacyFolder : std::as_const(legacyBlacklist)) {
|
||||
folder->migrateBlackListPath(legacyFolder);
|
||||
}
|
||||
settings.remove(QLatin1String("blackList"));
|
||||
|
||||
@ -333,7 +333,7 @@ bool FolderStatusModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
const auto parentInfo = infoForIndex(parent);
|
||||
if (parentInfo && parentInfo->_checked != Qt::Checked) {
|
||||
auto hasUnchecked = false;
|
||||
for (const auto &sub : parentInfo->_subs) {
|
||||
for (const auto &sub : std::as_const(parentInfo->_subs)) {
|
||||
if (sub._checked != Qt::Checked) {
|
||||
hasUnchecked = true;
|
||||
break;
|
||||
@ -714,7 +714,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
}
|
||||
|
||||
std::set<QString> selectiveSyncUndecidedSet; // not QSet because it's not sorted
|
||||
for (const auto &str : selectiveSyncUndecidedList) {
|
||||
for (const auto &str : std::as_const(selectiveSyncUndecidedList)) {
|
||||
if (str.startsWith(parentInfo->_path) || parentInfo->_path == QLatin1String("/")) {
|
||||
selectiveSyncUndecidedSet.insert(str);
|
||||
}
|
||||
@ -732,7 +732,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
|
||||
QVector<SubFolderInfo> newSubs;
|
||||
newSubs.reserve(sortedSubfolders.size());
|
||||
for (const auto &path : sortedSubfolders) {
|
||||
for (const auto &path : std::as_const(sortedSubfolders)) {
|
||||
auto relativePath = path.mid(pathToRemove.size());
|
||||
if (parentInfo->_folder->isFileExcludedRelative(relativePath)) {
|
||||
continue;
|
||||
@ -781,7 +781,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
} else if (parentInfo->_checked == Qt::Checked) {
|
||||
newInfo._checked = Qt::Checked;
|
||||
} else {
|
||||
for (const auto &str : selectiveSyncBlackList) {
|
||||
for (const auto &str : std::as_const(selectiveSyncBlackList)) {
|
||||
if (str == relativePath || str == QLatin1String("/")) {
|
||||
newInfo._checked = Qt::Unchecked;
|
||||
break;
|
||||
@ -940,7 +940,7 @@ void FolderStatusModel::slotApplySelectiveSync()
|
||||
}
|
||||
//The part that changed should not be read from the DB on next sync because there might be new folders
|
||||
// (the ones that are no longer in the blacklist)
|
||||
for (const auto &it : changes) {
|
||||
for (const auto &it : std::as_const(changes)) {
|
||||
folder->journalDb()->schedulePathForRemoteDiscovery(it);
|
||||
folder->schedulePathForLocalDiscovery(it);
|
||||
}
|
||||
@ -1227,7 +1227,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders()
|
||||
qCWarning(lcFolderStatus) << "Could not read selective sync list from db.";
|
||||
return;
|
||||
}
|
||||
for (const auto &undecidedFolder : undecidedList) {
|
||||
for (const auto &undecidedFolder : std::as_const(undecidedList)) {
|
||||
blackList.removeAll(undecidedFolder);
|
||||
}
|
||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
|
||||
@ -1250,7 +1250,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders()
|
||||
}
|
||||
// The part that changed should not be read from the DB on next sync because there might be new folders
|
||||
// (the ones that are no longer in the blacklist)
|
||||
for (const auto &it : undecidedList) {
|
||||
for (const auto &it : std::as_const(undecidedList)) {
|
||||
folder->journalDb()->schedulePathForRemoteDiscovery(it);
|
||||
folder->schedulePathForLocalDiscovery(it);
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list)
|
||||
}
|
||||
QStringList sortedList = list;
|
||||
Utility::sortFilenames(sortedList);
|
||||
for (auto path : sortedList) {
|
||||
for (auto path : std::as_const(sortedList)) {
|
||||
path.remove(webdavFolder);
|
||||
|
||||
// Don't allow to select subfolders of encrypted subfolders
|
||||
|
||||
@ -287,7 +287,8 @@ void ownCloudGui::slotComputeOverallSyncStatus()
|
||||
bool allPaused = true;
|
||||
QVector<AccountStatePtr> problemAccounts;
|
||||
|
||||
for (const auto &account : AccountManager::instance()->accounts()) {
|
||||
const auto &allAccounts = AccountManager::instance()->accounts();
|
||||
for (const auto &account : allAccounts) {
|
||||
if (!account->isSignedOut()) {
|
||||
allSignedOut = false;
|
||||
}
|
||||
@ -308,7 +309,8 @@ void ownCloudGui::slotComputeOverallSyncStatus()
|
||||
QList<QString> idleFileProviderAccounts;
|
||||
|
||||
if (Mac::FileProvider::fileProviderAvailable()) {
|
||||
for (const auto &accountState : AccountManager::instance()->accounts()) {
|
||||
const auto &allAccounts = AccountManager::instance()->accounts();
|
||||
for (const auto &accountState : allAccounts) {
|
||||
const auto account = accountState->account();
|
||||
const auto userIdAtHostWithPort = account->userIdAtHostWithPort();
|
||||
if (!Mac::FileProviderSettingsController::instance()->vfsEnabledForAccount(userIdAtHostWithPort)) {
|
||||
|
||||
@ -525,7 +525,7 @@ void SelectiveSyncDialog::accept()
|
||||
//The part that changed should not be read from the DB on next sync because there might be new folders
|
||||
// (the ones that are no longer in the blacklist)
|
||||
auto blackListSet = QSet<QString>{blackList.begin(), blackList.end()};
|
||||
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
|
||||
const auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
|
||||
for (const auto &it : changes) {
|
||||
_folder->journalDb()->schedulePathForRemoteDiscovery(it);
|
||||
_folder->schedulePathForLocalDiscovery(it);
|
||||
|
||||
@ -335,7 +335,8 @@ void SettingsDialog::customizeStyle()
|
||||
QString background(palette().base().color().name());
|
||||
_toolBar->setStyleSheet(TOOLBAR_CSS().arg(background, dark, highlightColor, highlightTextColor));
|
||||
|
||||
for (const auto a : _actionGroup->actions()) {
|
||||
const auto &allActions = _actionGroup->actions();
|
||||
for (const auto a : allActions) {
|
||||
QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette());
|
||||
a->setIcon(icon);
|
||||
auto *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
|
||||
|
||||
@ -465,7 +465,10 @@ void ShareManager::createShare(const QString &path,
|
||||
[=, this](const QJsonDocument &reply) {
|
||||
// Find existing share permissions (if this was shared with us)
|
||||
Share::Permissions existingPermissions = SharePermissionAll;
|
||||
for (const auto &element : reply.object()["ocs"].toObject()["data"].toArray()) {
|
||||
const auto &replyObject = reply.object();
|
||||
const auto &ocsObject = replyObject["ocs"].toObject();
|
||||
const auto &dataArray = ocsObject["data"].toArray();
|
||||
for (const auto &element : dataArray) {
|
||||
auto map = element.toObject();
|
||||
if (map["file_target"] == path)
|
||||
existingPermissions = Share::Permissions(map["permissions"].toInt());
|
||||
@ -554,7 +557,7 @@ void ShareManager::fetchSharedWithMe(const QString &path)
|
||||
const QList<SharePtr> ShareManager::parseShares(const QJsonDocument &reply) const
|
||||
{
|
||||
qDebug() << reply;
|
||||
auto tmpShares = reply.object().value("ocs").toObject().value("data").toArray();
|
||||
const auto tmpShares = reply.object().value("ocs").toObject().value("data").toArray();
|
||||
const QString versionString = _account->serverVersion();
|
||||
qCDebug(lcSharing) << versionString << "Fetched" << tmpShares.count() << "shares";
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ bool SslDialogErrorHandler::handleErrors(QList<QSslError> errors, const QSslConf
|
||||
|
||||
// Check if this host has an active HSTS policy
|
||||
auto hstsPolicies = qnam->strictTransportSecurityHosts();
|
||||
for (const auto &policy : hstsPolicies) {
|
||||
for (const auto &policy : std::as_const(hstsPolicies)) {
|
||||
if (policy.host() == host && !policy.isExpired()) {
|
||||
// HSTS is active for this host, don't show the dialog
|
||||
qCInfo(lcSslErrorDialog) << "SSL certificate error, but HSTS is active. Rejecting connection.";
|
||||
@ -152,7 +152,7 @@ bool SslErrorDialog::checkFailingCertsKnown(const QList<QSslError> &errors)
|
||||
msg += QL("<h3>") + tr("Cannot connect securely to <i>%1</i>:").arg(host) + QL("</h3>");
|
||||
// loop over the unknown certs and line up their errors.
|
||||
msg += QL("<div id=\"ca_errors\">");
|
||||
for (const auto &cert : _unknownCerts) {
|
||||
for (const auto &cert : std::as_const(_unknownCerts)) {
|
||||
msg += QL("<div id=\"ca_error\">");
|
||||
// add the errors for this cert
|
||||
for (const auto &err : errors) {
|
||||
|
||||
@ -165,7 +165,7 @@ OCC::Activity Activity::fromActivityJson(const QJsonObject &json, const AccountP
|
||||
}
|
||||
|
||||
auto actions = json.value("actions").toArray();
|
||||
for (const auto &action : actions) {
|
||||
for (const auto &action : std::as_const(actions)) {
|
||||
activity._links.append(ActivityLink::createFomJsonObject(action.toObject()));
|
||||
}
|
||||
|
||||
|
||||
@ -664,7 +664,7 @@ void ActivityListModel::removeActivityFromActivityList(const Activity &activity)
|
||||
void ActivityListModel::removeOutdatedNotifications(const OCC::ActivityList &receivedNotifications)
|
||||
{
|
||||
ActivityList activitiesToRemove;
|
||||
for (const auto &activity : _finalList) {
|
||||
for (const auto &activity : std::as_const(_finalList)) {
|
||||
if (activity._type != Activity::NotificationType || receivedNotifications.contains(activity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -93,8 +93,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool canFetchMore(const QModelIndex &) const override;
|
||||
|
||||
ActivityList activityList() { return _finalList; }
|
||||
ActivityList errorsList() { return _notificationErrorsLists; }
|
||||
[[nodiscard]] const ActivityList& activityList() const { return _finalList; }
|
||||
[[nodiscard]] const ActivityList& errorsList() const { return _notificationErrorsLists; }
|
||||
|
||||
[[nodiscard]] AccountState *accountState() const;
|
||||
|
||||
|
||||
@ -1288,7 +1288,7 @@ void User::slotGroupFoldersFetched(QNetworkReply *reply)
|
||||
const auto obj = json.object().toVariantMap();
|
||||
const auto groupFolders = obj["ocs"].toMap()["data"].toMap();
|
||||
|
||||
for (const auto &groupFolder : groupFolders.values()) {
|
||||
for (const auto &groupFolder : groupFolders) {
|
||||
const auto groupFolderInfo = groupFolder.toMap();
|
||||
const auto mountPoint = groupFolderInfo.value(QStringLiteral("mount_point"), {}).toString();
|
||||
parseNewGroupFolderPath(mountPoint);
|
||||
@ -1836,7 +1836,8 @@ void UserAppsModel::buildAppList()
|
||||
|
||||
if (UserModel::instance()->appList().count() > 0) {
|
||||
const auto talkApp = UserModel::instance()->currentUser()->talkApp();
|
||||
for (const auto &app : UserModel::instance()->appList()) {
|
||||
const auto &allApps = UserModel::instance()->appList();
|
||||
for (const auto &app : allApps) {
|
||||
// Filter out Talk because we have a dedicated button for it
|
||||
if (talkApp && app->id() == talkApp->id() && !UserModel::instance()->currentUser()->isNcAssistantEnabled()) {
|
||||
continue;
|
||||
|
||||
@ -666,7 +666,7 @@ void Account::slotHandleSslErrors(QNetworkReply *reply, QList<QSslError> errors)
|
||||
return;
|
||||
|
||||
// Mark all involved certificates as rejected, so we don't ask the user again.
|
||||
for (const auto &error : errors) {
|
||||
for (const auto &error : std::as_const(errors)) {
|
||||
if (!_rejectedCertificates.contains(error.certificate())) {
|
||||
_rejectedCertificates.append(error.certificate());
|
||||
}
|
||||
@ -986,7 +986,8 @@ void Account::slotDirectEditingRecieved(const QJsonDocument &json)
|
||||
auto data = json.object().value("ocs").toObject().value("data").toObject();
|
||||
const auto editors = data.value("editors").toObject();
|
||||
|
||||
for (const auto &editorKey : editors.keys()) {
|
||||
const auto &allKeys = editors.keys();
|
||||
for (const auto &editorKey : allKeys) {
|
||||
auto editor = editors.value(editorKey).toObject();
|
||||
|
||||
const QString id = editor.value("id").toString();
|
||||
@ -998,11 +999,11 @@ void Account::slotDirectEditingRecieved(const QJsonDocument &json)
|
||||
|
||||
auto *directEditor = new DirectEditor(id, name);
|
||||
|
||||
for (const auto &mimeType : mimeTypes) {
|
||||
for (const auto &mimeType : std::as_const(mimeTypes)) {
|
||||
directEditor->addMimetype(mimeType.toString().toLatin1());
|
||||
}
|
||||
|
||||
for (const auto &optionalMimeType : optionalMimeTypes) {
|
||||
for (const auto &optionalMimeType : std::as_const(optionalMimeTypes)) {
|
||||
directEditor->addOptionalMimetype(optionalMimeType.toString().toLatin1());
|
||||
}
|
||||
|
||||
|
||||
@ -3095,7 +3095,8 @@ QList<QSslError> CertificateInformation::verify() const
|
||||
auto result = QSslCertificate::verify({_certificate});
|
||||
|
||||
auto hasNeededExtendedKeyUsageExtension = false;
|
||||
for (const auto &oneExtension : _certificate.extensions()) {
|
||||
const auto &allExtensions = _certificate.extensions();
|
||||
for (const auto &oneExtension : allExtensions) {
|
||||
if (oneExtension.oid() == QStringLiteral("2.5.29.37")) {
|
||||
const auto extendedKeyUsageList = oneExtension.value().toList();
|
||||
for (const auto &oneExtendedKeyUsageValue : extendedKeyUsageList) {
|
||||
|
||||
@ -224,7 +224,7 @@ void DiscoveryPhase::markPermanentDeletionRequests()
|
||||
{
|
||||
// since we don't know in advance which files/directories need to be permanently deleted,
|
||||
// we have to look through all of them at the end of the run
|
||||
for (const auto &originalPath : _permanentDeletionRequests) {
|
||||
for (const auto &originalPath : std::as_const(_permanentDeletionRequests)) {
|
||||
const auto it = _deletedItem.find(originalPath);
|
||||
if (it == _deletedItem.end()) {
|
||||
qCWarning(lcDiscovery) << "didn't find an item for" << originalPath << "(yet)";
|
||||
@ -591,7 +591,7 @@ void DiscoverySingleDirectoryJob::metadataReceived(const QJsonDocument &json, in
|
||||
// hence, we need to find its path and pass to any subfolder's metadata, so it will fetch the top level metadata when needed
|
||||
// see https://github.com/nextcloud/end_to_end_encryption_rfc/blob/v2.1/RFC.md
|
||||
auto topLevelFolderPath = QStringLiteral("/");
|
||||
for (const QString &topLevelPath : _topLevelE2eeFolderPaths) {
|
||||
for (const QString &topLevelPath : std::as_const(_topLevelE2eeFolderPaths)) {
|
||||
if (_subPath == topLevelPath) {
|
||||
topLevelFolderPath = QStringLiteral("/");
|
||||
break;
|
||||
|
||||
@ -749,7 +749,7 @@ void OwncloudPropagator::processE2eeMetadataMigration(const SyncFileItemPtr &ite
|
||||
if (foundDirectory.second) {
|
||||
topLevelitem = foundDirectory.second->_item;
|
||||
if (!foundDirectory.second->_subJobs._jobsToDo.isEmpty()) {
|
||||
for (const auto jobToDo : foundDirectory.second->_subJobs._jobsToDo) {
|
||||
for (const auto jobToDo : std::as_const(foundDirectory.second->_subJobs._jobsToDo)) {
|
||||
if (const auto foundExistingUpdateMigratedE2eeMetadataJob = qobject_cast<UpdateMigratedE2eeMetadataJob *>(jobToDo)) {
|
||||
existingUpdateJob = foundExistingUpdateMigratedE2eeMetadataJob;
|
||||
break;
|
||||
|
||||
@ -404,7 +404,8 @@ FakePropfindReply::FakePropfindReply(FileInfo &remoteRootFileInfo, QNetworkAcces
|
||||
xml.writeEndElement(); // resourcetype
|
||||
|
||||
auto totalSize = 0;
|
||||
for (const auto &child : fileInfo.children.values()) {
|
||||
const auto &allValues = fileInfo.children.values();
|
||||
for (const auto &child : allValues) {
|
||||
totalSize += child.size;
|
||||
}
|
||||
xml.writeTextElement(ocUri, QStringLiteral("size"), QString::number(totalSize));
|
||||
@ -573,13 +574,13 @@ QVector<FileInfo *> FakePutMultiFileReply::performMultiPart(FileInfo &remoteRoot
|
||||
const QString boundaryValue = QStringLiteral("--") + contentType.mid(boundaryPosition, contentType.length() - boundaryPosition - 1) + QStringLiteral("\r\n");
|
||||
auto stringPutPayloadRef = QString{stringPutPayload}.left(stringPutPayload.size() - 2 - boundaryValue.size());
|
||||
auto allParts = stringPutPayloadRef.split(boundaryValue, Qt::SkipEmptyParts);
|
||||
for (const auto &onePart : allParts) {
|
||||
for (const auto &onePart : std::as_const(allParts)) {
|
||||
auto headerEndPosition = onePart.indexOf(QStringLiteral("\r\n\r\n"));
|
||||
auto onePartHeaderPart = onePart.left(headerEndPosition);
|
||||
auto onePartBody = onePart.mid(headerEndPosition + 4, onePart.size() - headerEndPosition - 6);
|
||||
auto onePartHeaders = onePartHeaderPart.split(QStringLiteral("\r\n"));
|
||||
QMap<QString, QString> allHeaders;
|
||||
for(const auto &oneHeader : onePartHeaders) {
|
||||
for(const auto &oneHeader : std::as_const(onePartHeaders)) {
|
||||
auto headerParts = oneHeader.split(QStringLiteral(": "));
|
||||
allHeaders[headerParts.at(0).toLower()] = headerParts.at(1);
|
||||
}
|
||||
@ -1438,7 +1439,8 @@ void FakeFolder::toDisk(QDir &dir, const FileInfo &templateFi)
|
||||
|
||||
void FakeFolder::fromDisk(QDir &dir, FileInfo &templateFi)
|
||||
{
|
||||
for(const auto &diskChild : dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot)) {
|
||||
const auto &allEntries = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||
for(const auto &diskChild : allEntries) {
|
||||
if (diskChild.isDir()) {
|
||||
QDir subDir = dir;
|
||||
subDir.cd(diskChild.fileName());
|
||||
|
||||
@ -287,7 +287,7 @@ private slots:
|
||||
// verify that office files for locking got detected by the watcher
|
||||
QScopedPointer<QSignalSpy> locksImposedSpy(new QSignalSpy(_watcher.data(), &FolderWatcher::filesLockImposed));
|
||||
|
||||
for (const auto &officeFile : listOfOfficeFiles) {
|
||||
for (const auto &officeFile : std::as_const(listOfOfficeFiles)) {
|
||||
touch(officeFile);
|
||||
QVERIFY(waitForPathChanged(officeFile));
|
||||
}
|
||||
@ -328,7 +328,7 @@ private slots:
|
||||
for (const auto &officeLockFile : listOfOfficeLockFiles) {
|
||||
rm(officeLockFile);
|
||||
}
|
||||
for (const auto &officeFile : listOfOfficeFiles) {
|
||||
for (const auto &officeFile : std::as_const(listOfOfficeFiles)) {
|
||||
rm(officeFile);
|
||||
}
|
||||
}
|
||||
@ -343,7 +343,7 @@ private slots:
|
||||
|
||||
const QStringList listOfOfficeLockFiles = {QString(_rootPath + "/.~lock.document.docx#"), QString(_rootPath + "/.~lock.document.odt#")};
|
||||
|
||||
for (const auto &officeFile : listOfOfficeFiles) {
|
||||
for (const auto &officeFile : std::as_const(listOfOfficeFiles)) {
|
||||
touch(officeFile);
|
||||
}
|
||||
for (const auto &officeLockFile : listOfOfficeLockFiles) {
|
||||
@ -386,7 +386,7 @@ private slots:
|
||||
}
|
||||
|
||||
// cleanup
|
||||
for (const auto &officeFile : listOfOfficeFiles) {
|
||||
for (const auto &officeFile : std::as_const(listOfOfficeFiles)) {
|
||||
rm(officeFile);
|
||||
}
|
||||
for (const auto &officeLockFile : listOfOfficeLockFiles) {
|
||||
|
||||
@ -93,7 +93,7 @@ private slots:
|
||||
QJsonObject fakeFileDropPart;
|
||||
|
||||
QJsonArray fileDropUsers;
|
||||
for (const auto &folderUser : metadata->_folderUsers) {
|
||||
for (const auto &folderUser : std::as_const(metadata->_folderUsers)) {
|
||||
QJsonObject fileDropUser;
|
||||
fileDropUser.insert("userId", folderUser.userId);
|
||||
fileDropUser.insert("encryptedFiledropKey", QString::fromUtf8(folderUser.encryptedMetadataKey.toBase64()));
|
||||
|
||||
@ -309,7 +309,7 @@ private slots:
|
||||
auto conflicts = findConflicts(fakeFolder.currentLocalState().children["A"]);
|
||||
QByteArray a1conflict;
|
||||
QByteArray a2conflict;
|
||||
for (const auto & conflict : conflicts) {
|
||||
for (const auto & conflict : std::as_const(conflicts)) {
|
||||
if (conflict.contains("a1"))
|
||||
a1conflict = conflict.toUtf8();
|
||||
if (conflict.contains("a2"))
|
||||
@ -564,7 +564,7 @@ private slots:
|
||||
QVERIFY(conflicts.size() == 2);
|
||||
QVERIFY(conflicts[0].contains("A (conflicted copy"));
|
||||
QVERIFY(conflicts[1].contains("B (conflicted copy"));
|
||||
for (const auto& conflict : conflicts)
|
||||
for (const auto& conflict : std::as_const(conflicts))
|
||||
QDir(fakeFolder.localPath() + conflict).removeRecursively();
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
|
||||
@ -602,7 +602,7 @@ private slots:
|
||||
auto conflicts = findConflicts(fakeFolder.currentLocalState());
|
||||
QVERIFY(conflicts.size() == 1);
|
||||
QVERIFY(conflicts[0].contains("A (conflicted copy"));
|
||||
for (const auto& conflict : conflicts)
|
||||
for (const auto& conflict : std::as_const(conflicts))
|
||||
QDir(fakeFolder.localPath() + conflict).removeRecursively();
|
||||
|
||||
QVERIFY(fakeFolder.syncEngine().isAnotherSyncNeeded() == ImmediateFollowUp);
|
||||
|
||||
@ -666,7 +666,7 @@ private slots:
|
||||
auto currentLocal = fakeFolder.currentLocalState();
|
||||
auto conflicts = findConflicts(currentLocal.children["A4"]);
|
||||
QCOMPARE(conflicts.size(), 1);
|
||||
for (const auto& c : conflicts) {
|
||||
for (const auto& c : std::as_const(conflicts)) {
|
||||
QCOMPARE(currentLocal.find(c)->contentChar, 'L');
|
||||
local.remove(c);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user