diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index cae496780074f..0b852625414cc 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -315,7 +315,7 @@ int main(int argc, char **argv) #ifdef Q_OS_WIN // Ensure OpenSSL config file is only loaded from app directory - QString opensslConf = QCoreApplication::applicationDirPath() + QString("/openssl.cnf"); + QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf"); qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit()); #endif diff --git a/src/gui/application.cpp b/src/gui/application.cpp index f05f222a351bf..68bcdc1d233ba 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -235,7 +235,7 @@ Application::Application(int &argc, char **argv) #ifdef Q_OS_WIN // Ensure OpenSSL config file is only loaded from app directory - QString opensslConf = QCoreApplication::applicationDirPath() + QString("/openssl.cnf"); + QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf"); qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit()); // Set up event listener for Windows theme changing diff --git a/src/gui/cloudproviders/cloudproviderwrapper.cpp b/src/gui/cloudproviders/cloudproviderwrapper.cpp index 4ff2313c44cc1..39d24b7956f5b 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.cpp +++ b/src/gui/cloudproviders/cloudproviderwrapper.cpp @@ -36,7 +36,7 @@ CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, int { GMenuModel *model = nullptr; GActionGroup *action_group = nullptr; - QString accountName = QString("Folder/%1").arg(folderId); + QString accountName = QStringLiteral("Folder/%1").arg(folderId); _cloudProvider = CLOUD_PROVIDERS_PROVIDER_EXPORTER(cloudprovider); _cloudProviderAccount = cloud_providers_account_exporter_new(_cloudProvider, accountName.toUtf8().data()); @@ -170,7 +170,7 @@ void CloudProviderWrapper::slotUpdateProgress(const QString &folder, const Progr void CloudProviderWrapper::updateStatusText(QString statusText) { - QString status = QString("%1 - %2").arg(_folder->accountState()->stateString(_folder->accountState()->state()), statusText); + QString status = QStringLiteral("%1 - %2").arg(_folder->accountState()->stateString(_folder->accountState()->state()), statusText); cloud_providers_account_exporter_set_status_details(_cloudProviderAccount, status.toUtf8().data()); } diff --git a/src/gui/creds/flow2auth.cpp b/src/gui/creds/flow2auth.cpp index f90873dbc6793..b3cc7c937ac41 100644 --- a/src/gui/creds/flow2auth.cpp +++ b/src/gui/creds/flow2auth.cpp @@ -198,7 +198,7 @@ void Flow2Auth::slotPollTimerTimeout() req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); auto requestBody = new QBuffer; - QUrlQuery arguments(QString("token=%1").arg(_pollToken)); + QUrlQuery arguments(QStringLiteral("token=%1").arg(_pollToken)); requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1()); auto job = _account->sendRequest("POST", _pollEndpoint, req, requestBody); diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 2a314c3faec65..1bcb5dc06f3b9 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -752,7 +752,7 @@ QString ShareModel::avatarUrlForShare(const SharePtr &share) const const auto provider = QStringLiteral("image://tray-image-provider/"); const auto userId = share->getShareWith()->shareWith(); const auto avatarUrl = Utility::concatUrlPath(_accountState->account()->url(), - QString("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(64))).toString(); + QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(64))).toString(); return QString(provider + avatarUrl); } @@ -1403,7 +1403,7 @@ QString ShareModel::generatePassword() static const QRegularExpression lowercaseMatch("[a-z]"); static const QRegularExpression uppercaseMatch("[A-Z]"); static const QRegularExpression numberMatch("[0-9]"); - static const QRegularExpression specialCharMatch(QString("[%1]").arg(specialChars.data())); + static const QRegularExpression specialCharMatch(QStringLiteral("[%1]").arg(specialChars.data())); static const std::map matchMap{ {lowercaseAlphabet, lowercaseMatch}, diff --git a/src/gui/foldercreationdialog.cpp b/src/gui/foldercreationdialog.cpp index a245c9f4dc461..05158ee9fbf4e 100644 --- a/src/gui/foldercreationdialog.cpp +++ b/src/gui/foldercreationdialog.cpp @@ -45,7 +45,7 @@ FolderCreationDialog::FolderCreationDialog(const QString &destination, QWidget * ui->newFolderNameEdit->setText(suggestedFolderNamePrefix); } else { for (unsigned int i = 2; i < std::numeric_limits::max(); ++i) { - const QString suggestedPostfix = QString(" (%1)").arg(i); + const QString suggestedPostfix = QStringLiteral(" (%1)").arg(i); if (!QDir(newFolderFullPath + suggestedPostfix).exists()) { ui->newFolderNameEdit->setText(suggestedFolderNamePrefix + suggestedPostfix); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index f712cf92cffdc..a06a161a218ef 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -219,7 +219,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const case Qt::DisplayRole: if (folderInfo->_hasError) { return {tr("Error while loading the list of folders from the server.") - + QString("\n") + + QStringLiteral("\n") + folderInfo->_lastErrorString}; } else { return tr("Fetching folder list from server …"); diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index 2eee30c1ab093..8ec9a71d06baf 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -33,7 +33,7 @@ void OcsShareJob::getShares(const QString &path, const QMap &p setVerb("GET"); addParam(QString::fromLatin1("path"), path); - addParam(QString::fromLatin1("reshares"), QString("true")); + addParam(QString::fromLatin1("reshares"), QStringLiteral("true")); for (auto it = std::cbegin(params); it != std::cend(params); ++it) { addParam(it.key(), it.value()); diff --git a/src/gui/remotewipe.cpp b/src/gui/remotewipe.cpp index 3d285637fb497..7a146ce1bab65 100644 --- a/src/gui/remotewipe.cpp +++ b/src/gui/remotewipe.cpp @@ -58,7 +58,7 @@ void RemoteWipe::startCheckJobWithAppPassword(QString pwd){ request.setUrl(requestUrl); request.setSslConfiguration(_account->getOrCreateSslConfig()); auto requestBody = new QBuffer; - QUrlQuery arguments(QString("token=%1").arg(_appPassword)); + QUrlQuery arguments(QStringLiteral("token=%1").arg(_appPassword)); requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1()); _networkReplyCheck = _networkManager.post(request, requestBody); QObject::connect(&_networkManager, &QNetworkAccessManager::sslErrors, @@ -79,16 +79,16 @@ void RemoteWipe::checkJobSlot() jsonParseError.error != QJsonParseError::NoError) { QString errorFromJson = json["error"].toString(); if (!errorFromJson.isEmpty()) { - qCWarning(lcRemoteWipe) << QString("Error returned from the server: %1") + qCWarning(lcRemoteWipe) << QStringLiteral("Error returned from the server: %1") .arg(errorFromJson.toHtmlEscaped()); } else if (_networkReplyCheck->error() != QNetworkReply::NoError) { - qCWarning(lcRemoteWipe) << QString("There was an error accessing the 'token' endpoint:
%1") + qCWarning(lcRemoteWipe) << QStringLiteral("There was an error accessing the 'token' endpoint:
%1") .arg(_networkReplyCheck->errorString().toHtmlEscaped()); } else if (jsonParseError.error != QJsonParseError::NoError) { - qCWarning(lcRemoteWipe) << QString("Could not parse the JSON returned from the server:
%1") + qCWarning(lcRemoteWipe) << QStringLiteral("Could not parse the JSON returned from the server:
%1") .arg(jsonParseError.errorString()); } else { - qCWarning(lcRemoteWipe) << QString("The reply from the server did not contain all expected fields"); + qCWarning(lcRemoteWipe) << QStringLiteral("The reply from the server did not contain all expected fields"); } // check for wipe request @@ -136,7 +136,7 @@ void RemoteWipe::notifyServerSuccessJob(AccountState *accountState, bool dataWip request.setUrl(requestUrl); request.setSslConfiguration(_account->getOrCreateSslConfig()); auto requestBody = new QBuffer; - QUrlQuery arguments(QString("token=%1").arg(_appPassword)); + QUrlQuery arguments(QStringLiteral("token=%1").arg(_appPassword)); requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1()); _networkReplySuccess = _networkManager.post(request, requestBody); QObject::connect(_networkReplySuccess, &QNetworkReply::finished, this, @@ -153,16 +153,16 @@ void RemoteWipe::notifyServerSuccessJobSlot() jsonParseError.error != QJsonParseError::NoError) { QString errorFromJson = json["error"].toString(); if (!errorFromJson.isEmpty()) { - qCWarning(lcRemoteWipe) << QString("Error returned from the server: %1") + qCWarning(lcRemoteWipe) << QStringLiteral("Error returned from the server: %1") .arg(errorFromJson.toHtmlEscaped()); } else if (_networkReplySuccess->error() != QNetworkReply::NoError) { - qCWarning(lcRemoteWipe) << QString("There was an error accessing the 'success' endpoint:
%1") + qCWarning(lcRemoteWipe) << QStringLiteral("There was an error accessing the 'success' endpoint:
%1") .arg(_networkReplySuccess->errorString().toHtmlEscaped()); } else if (jsonParseError.error != QJsonParseError::NoError) { - qCWarning(lcRemoteWipe) << QString("Could not parse the JSON returned from the server:
%1") + qCWarning(lcRemoteWipe) << QStringLiteral("Could not parse the JSON returned from the server:
%1") .arg(jsonParseError.errorString()); } else { - qCWarning(lcRemoteWipe) << QString("The reply from the server did not contain all expected fields."); + qCWarning(lcRemoteWipe) << QStringLiteral("The reply from the server did not contain all expected fields."); } } diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index bd68063fa2978..c000ae8fbf9d7 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -1167,13 +1167,13 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis { "EMAIL_PRIVATE_LINK_MENU_TITLE", tr("Send private link by email …") }, { "CONTEXT_MENU_ICON", APPLICATION_ICON_NAME }, } }; - listener->sendMessage(QString("GET_STRINGS:BEGIN")); + listener->sendMessage(QStringLiteral("GET_STRINGS:BEGIN")); for (const auto& key_value : strings) { if (argument.isEmpty() || argument == QLatin1String(key_value.first)) { - listener->sendMessage(QString("STRING:%1:%2").arg(key_value.first, key_value.second)); + listener->sendMessage(QStringLiteral("STRING:%1:%2").arg(key_value.first, key_value.second)); } } - listener->sendMessage(QString("GET_STRINGS:END")); + listener->sendMessage(QStringLiteral("GET_STRINGS:END")); } void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, SharingContextItemEncryptedFlag itemEncryptionFlag, SharingContextItemRootEncryptedFolderFlag rootE2eeFolderFlag) @@ -1364,7 +1364,7 @@ SocketApi::FileData SocketApi::FileData::parentFolder() const void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListener *listener) { - listener->sendMessage(QString("GET_MENU_ITEMS:BEGIN"), true); + listener->sendMessage(QStringLiteral("GET_MENU_ITEMS:BEGIN"), true); const QStringList files = split(argument); // Find the common sync folder. @@ -1522,7 +1522,7 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe } } - listener->sendMessage(QString("GET_MENU_ITEMS:END")); + listener->sendMessage(QStringLiteral("GET_MENU_ITEMS:END")); } DirectEditor* SocketApi::getDirectEditorForLocalFile(const QString &localFile) diff --git a/src/gui/syncrunfilelog.cpp b/src/gui/syncrunfilelog.cpp index 5610fb6a02ff7..4150d1f92615b 100644 --- a/src/gui/syncrunfilelog.cpp +++ b/src/gui/syncrunfilelog.cpp @@ -52,7 +52,7 @@ void SyncRunFileLog::start(const QString &folderPath) if(QString::compare(folderPath,line,Qt::CaseSensitive)!=0) { depthIndex++; if(depthIndex <= length) { - filenameSingle = folderPath.split(QLatin1String("/")).at(length - depthIndex) + QString("_") /// + filenameSingle = folderPath.split(QLatin1String("/")).at(length - depthIndex) + QStringLiteral("_") /// + filenameSingle; filename = logpath+ QLatin1String("/") + filenameSingle + QLatin1String("_sync.log"); } diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index f2fc26ba1e18a..4016ef2567d2a 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -342,7 +342,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const case AccountRole: return a._accName; case PointInTimeRole: - //return a._id == -1 ? "" : QString("%1 - %2").arg(Utility::timeAgoInWords(a._dateTime.toLocalTime()), a._dateTime.toLocalTime().toString(Qt::DefaultLocaleShortDate)); + //return a._id == -1 ? "" : QStringLiteral("%1 - %2").arg(Utility::timeAgoInWords(a._dateTime.toLocalTime()), a._dateTime.toLocalTime().toString(Qt::DefaultLocaleShortDate)); return a._id == -1 ? "" : Utility::timeAgoInWords(a._dateTime.toLocalTime()); case AccountConnectedRole: return (ast && ast->isConnected()); diff --git a/src/gui/tray/unifiedsearchresultslistmodel.cpp b/src/gui/tray/unifiedsearchresultslistmodel.cpp index 6ec9a7a2a6382..f28c8ce464846 100644 --- a/src/gui/tray/unifiedsearchresultslistmodel.cpp +++ b/src/gui/tray/unifiedsearchresultslistmodel.cpp @@ -383,7 +383,7 @@ void UnifiedSearchResultsListModel::slotSearchTermEditingFinished() &UnifiedSearchResultsListModel::slotSearchTermEditingFinished); if (!_accountState || !_accountState->account()) { - qCCritical(lcUnifiedSearch) << QString("Account state is invalid. Could not start search!"); + qCCritical(lcUnifiedSearch) << QStringLiteral("Account state is invalid. Could not start search!"); return; } @@ -401,14 +401,14 @@ void UnifiedSearchResultsListModel::slotFetchProvidersFinished(const QJsonDocume const auto job = qobject_cast(sender()); if (!job) { - qCCritical(lcUnifiedSearch) << QString("Failed to fetch providers.").arg(_searchTerm); + qCCritical(lcUnifiedSearch) << QStringLiteral("Failed to fetch providers.").arg(_searchTerm); _errorString += tr("Failed to fetch providers.") + QLatin1Char('\n'); emit errorStringChanged(); return; } if (statusCode != 200) { - qCCritical(lcUnifiedSearch) << QString("%1: Failed to fetch search providers for '%2'. Error: %3") + qCCritical(lcUnifiedSearch) << QStringLiteral("%1: Failed to fetch search providers for '%2'. Error: %3") .arg(statusCode) .arg(_searchTerm) .arg(job->errorString()); @@ -446,7 +446,7 @@ void UnifiedSearchResultsListModel::slotSearchForProviderFinished(const QJsonDoc const auto job = qobject_cast(sender()); if (!job) { - qCCritical(lcUnifiedSearch) << QString("Search has failed for '%2'.").arg(_searchTerm); + qCCritical(lcUnifiedSearch) << QStringLiteral("Search has failed for '%2'.").arg(_searchTerm); _errorString += tr("Search has failed for '%2'.").arg(_searchTerm) + QLatin1Char('\n'); emit errorStringChanged(); return; @@ -471,7 +471,7 @@ void UnifiedSearchResultsListModel::slotSearchForProviderFinished(const QJsonDoc } if (statusCode != 200) { - qCCritical(lcUnifiedSearch) << QString("%1: Search has failed for '%2'. Error: %3") + qCCritical(lcUnifiedSearch) << QStringLiteral("%1: Search has failed for '%2'. Error: %3") .arg(statusCode) .arg(_searchTerm) .arg(job->errorString()); diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index e44cae12f6fda..b5f6ad49ddf84 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -221,7 +221,7 @@ void OCUpdater::slotStartInstaller() }; QString msiLogFile = cfg.configPath() + "msi.log"; - QString command = QString("&{msiexec /i '%1' /L*V '%2'| Out-Null ; &'%3'}") + QString command = QStringLiteral("&{msiexec /i '%1' /L*V '%2'| Out-Null ; &'%3'}") .arg(preparePathForPowershell(updateFile)) .arg(preparePathForPowershell(msiLogFile)) .arg(preparePathForPowershell(QCoreApplication::applicationFilePath())); diff --git a/src/gui/updater/updateinfo.cpp b/src/gui/updater/updateinfo.cpp index 55512374a1f57..76a7ac36c2d47 100644 --- a/src/gui/updater/updateinfo.cpp +++ b/src/gui/updater/updateinfo.cpp @@ -90,7 +90,7 @@ UpdateInfo UpdateInfo::parseString(const QString &xml, bool *ok) if (!doc.setContent(xml, false, &errorMsg, &errorLine, &errorCol)) { qCWarning(lcUpdater).noquote().nospace() << errorMsg << " at " << errorLine << "," << errorCol << "\n" << xml.split("\n").value(errorLine-1) << "\n" - << QString(" ").repeated(errorCol - 1) << "^\n" + << QStringLiteral(" ").repeated(errorCol - 1) << "^\n" << "->" << xml << "<-"; if (ok) *ok = false; diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index 87f63d59197a8..9dabe299bd8e6 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -157,7 +157,7 @@ void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int second _statusUpdateSkipCount--; break; } - _ui.statusLabel->setText(tr("Waiting for authorization") + QString("… (%1)").arg(secondsLeft)); + _ui.statusLabel->setText(tr("Waiting for authorization") + QStringLiteral("… (%1)").arg(secondsLeft)); stopSpinner(true); break; case Flow2Auth::statusPollNow: diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 708949f759a6d..b50c5c2012cf5 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -63,7 +63,7 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent) const auto serverObject = serverJson.toObject(); const auto serverName = serverObject.value("name").toString(); const auto serverUrl = serverObject.value("url").toString(); - const auto serverDisplayString = QString("%1 (%2)").arg(serverName, serverUrl); + const auto serverDisplayString = QStringLiteral("%1 (%2)").arg(serverName, serverUrl); _ui.comboBox->addItem(serverDisplayString, serverUrl); } } else if (theme->forceOverrideServerUrl()) { diff --git a/src/gui/wizard/welcomepage.cpp b/src/gui/wizard/welcomepage.cpp index 1228f51599d87..fa706fbcd4052 100644 --- a/src/gui/wizard/welcomepage.cpp +++ b/src/gui/wizard/welcomepage.cpp @@ -71,8 +71,8 @@ void WelcomePage::styleSlideShow() _ui->slideShow->addSlide(wizardTalkIconFileName, tr("Screensharing, online meetings & web conferences")); const auto isDarkBackground = Theme::isDarkColor(backgroundColor); - _ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), isDarkBackground)); - _ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), isDarkBackground)); + _ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QStringLiteral("control-next.svg"), isDarkBackground)); + _ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QStringLiteral("control-prev.svg"), isDarkBackground)); } void WelcomePage::setupSlideShow() diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp index f08b135823f79..3ff6dd2c37b30 100644 --- a/src/libsync/abstractnetworkjob.cpp +++ b/src/libsync/abstractnetworkjob.cpp @@ -359,7 +359,7 @@ void AbstractNetworkJob::start() _timer.start(); const QUrl url = account()->url(); - const QString displayUrl = QString("%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path()); + const QString displayUrl = QStringLiteral("%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path()); QString parentMetaObjectName = parent() ? parent()->metaObject()->className() : ""; qCInfo(lcNetworkJob) << metaObject()->className() << "created for" << displayUrl << "+" << path() << parentMetaObjectName; diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 401e22ae9a038..02edfc60aad8c 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -156,7 +156,7 @@ void Account::setAvatar(const QImage &img) QString Account::displayName() const { - QString dn = QString("%1@%2").arg(credentials()->user(), _url.host()); + QString dn = QStringLiteral("%1@%2").arg(credentials()->user(), _url.host()); int port = url().port(); if (port > 0 && port != 80 && port != 443) { dn.append(QLatin1Char(':')); diff --git a/src/libsync/clientproxy.cpp b/src/libsync/clientproxy.cpp index 2deba9d546943..48c277de626d1 100644 --- a/src/libsync/clientproxy.cpp +++ b/src/libsync/clientproxy.cpp @@ -78,7 +78,7 @@ const char *ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type) QString ClientProxy::printQNetworkProxy(const QNetworkProxy &proxy) { - return QString("%1://%2:%3").arg(proxyTypeToCStr(proxy.type())).arg(proxy.hostName()).arg(proxy.port()); + return QStringLiteral("%1://%2:%3").arg(proxyTypeToCStr(proxy.type())).arg(proxy.hostName()).arg(proxy.port()); } void ClientProxy::setupQtProxyFromConfig() diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 7e62925c79d29..6f2c152ed134f 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -449,7 +449,7 @@ QString ConfigFile::backup(const QString &fileName) const } QString backupFile = - QString("%1.backup_%2%3") + QStringLiteral("%1.backup_%2%3") .arg(baseFilePath) .arg(QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss")) .arg(versionString); diff --git a/src/libsync/creds/keychainchunk.cpp b/src/libsync/creds/keychainchunk.cpp index dc2fff401dba6..115c4321dbdc8 100644 --- a/src/libsync/creds/keychainchunk.cpp +++ b/src/libsync/creds/keychainchunk.cpp @@ -205,7 +205,7 @@ void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob) return; } - const QString keyWithIndex = _key + (index > 0 ? (QString(".") + QString::number(index)) : QString()); + const QString keyWithIndex = _key + (index > 0 ? (QStringLiteral(".") + QString::number(index)) : QString()); const QString kck = _account ? AbstractCredentials::keychainKey( _account->url().toString(), keyWithIndex, @@ -313,7 +313,7 @@ void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob) #if defined(Q_OS_WIN) // try to fetch next chunk if (_chunkCount < KeychainChunk::MaxChunks) { - const QString keyWithIndex = _key + QString(".") + QString::number(_chunkCount); + const QString keyWithIndex = _key + QStringLiteral(".") + QString::number(_chunkCount); const QString kck = _account ? AbstractCredentials::keychainKey( _account->url().toString(), keyWithIndex, @@ -442,7 +442,7 @@ void DeleteJob::slotDeleteJobDone(QKeychain::Job *incomingJob) #if defined(Q_OS_WIN) // try to delete next chunk if (_chunkCount < KeychainChunk::MaxChunks) { - const QString keyWithIndex = _key + QString(".") + QString::number(_chunkCount); + const QString keyWithIndex = _key + QStringLiteral(".") + QString::number(_chunkCount); const QString kck = _account ? AbstractCredentials::keychainKey( _account->url().toString(), keyWithIndex, diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index ee7f7ae3a847a..3982f6cbef1ff 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -450,7 +450,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent if (containsForbiddenCharacters) { reasonString = tr("Reason: the filename contains a forbidden character (%1).").arg(forbiddenCharMatch); } - item->_errorString = reasonString.isEmpty() ? errorString : QString("%1 %2").arg(errorString, reasonString); + item->_errorString = reasonString.isEmpty() ? errorString : QStringLiteral("%1 %2").arg(errorString, reasonString); item->_status = SyncFileItem::FileNameInvalidOnServer; break; } diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 78356f8c92f3d..0ed448a5c46a7 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -796,9 +796,9 @@ AvatarJob::AvatarJob(AccountPtr account, const QString &userId, int size, QObjec : AbstractNetworkJob(account, QString(), parent) { if (account->serverVersionInt() >= Account::makeServerVersion(10, 0, 0)) { - _avatarUrl = Utility::concatUrlPath(account->url(), QString("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(size))); + _avatarUrl = Utility::concatUrlPath(account->url(), QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(size))); } else { - _avatarUrl = Utility::concatUrlPath(account->url(), QString("index.php/avatar/%1/%2").arg(userId, QString::number(size))); + _avatarUrl = Utility::concatUrlPath(account->url(), QStringLiteral("index.php/avatar/%1/%2").arg(userId, QString::number(size))); } } diff --git a/src/libsync/nextcloudtheme.cpp b/src/libsync/nextcloudtheme.cpp index 2a709564c6e4a..cae0e68da6eeb 100644 --- a/src/libsync/nextcloudtheme.cpp +++ b/src/libsync/nextcloudtheme.cpp @@ -35,7 +35,7 @@ NextcloudTheme::NextcloudTheme() QString NextcloudTheme::wizardUrlHint() const { - return QString("https://try.nextcloud.com"); + return QStringLiteral("https://try.nextcloud.com"); } } diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 9fcc3988fb78e..067e6d0a58e46 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -1093,7 +1093,7 @@ namespace { // Anonymous namespace for the recall feature int chownErr = chown(fileName.toLocal8Bit().constData(), -1, fi.groupId()); if (chownErr) { // TODO: Consider further error handling! - qCWarning(lcPropagateDownload) << QString("preserveGroupOwnership: chown error %1: setting group %2 failed on file %3").arg(chownErr).arg(fi.groupId()).arg(fileName); + qCWarning(lcPropagateDownload) << QStringLiteral("preserveGroupOwnership: chown error %1: setting group %2 failed on file %3").arg(chownErr).arg(fi.groupId()).arg(fileName); } #else Q_UNUSED(fileName); @@ -1290,7 +1290,7 @@ void PropagateDownloadFile::downloadFinished() emit propagator()->touchedFile(filename); // The fileChanged() check is done above to generate better error messages. if (!FileSystem::uncheckedRenameReplace(_tmpFile.fileName(), filename, &error)) { - qCWarning(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(filename); + qCWarning(lcPropagateDownload) << QStringLiteral("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(filename); // If the file is locked, we want to retry this sync when it // becomes available again, otherwise try again directly if (FileSystem::isFileLocked(filename)) { diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index 32e1192f3fa2f..d7f189417a447 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -50,7 +50,7 @@ QUrl PropagateUploadFileNG::chunkUrl(const int chunk) const constexpr auto maxChunkDigits = 5; // Chunk V2: max num of chunks is 10000 // We need to do add leading 0 because the server orders the chunk alphabetically - const auto chunkNumString = QString("%1").arg(chunk, maxChunkDigits, 10, QChar('0')); + const auto chunkNumString = QStringLiteral("%1").arg(chunk, maxChunkDigits, 10, QChar('0')); return Utility::concatUrlPath(chunkUploadFolderUrl(), chunkNumString); } diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index 6bab06305b756..31b2703eeed6d 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -115,7 +115,7 @@ void PropagateUploadFileV1::startNextChunk() // XOR with chunk size to make sure everything goes well if chunk size changes between runs uint transid = _transferId ^ uint(chunkSize()); qCInfo(lcPropagateUploadV1) << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid; - path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk); + path += QStringLiteral("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk); headers[QByteArrayLiteral("OC-Chunked")] = QByteArrayLiteral("1"); diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index a483d2c066383..aa9e87c1b8c01 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -567,7 +567,7 @@ bool createSyncRootRegistryKeys(const QString &providerName, const QString &fold // syncRootId should be: [storage provider ID]![Windows SID]![Account ID]![FolderAlias] (FolderAlias is a custom part added here to be able to register multiple sync folders for the same account) // folder registry keys go like: Nextcloud!S-1-5-21-2096452760-2617351404-2281157308-1001!user@nextcloud.lan:8080!0, Nextcloud!S-1-5-21-2096452760-2617351404-2281157308-1001!user@nextcloud.lan:8080!1, etc. for each sync folder - const auto syncRootId = QString("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias); + const auto syncRootId = QStringLiteral("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias); const QString providerSyncRootIdRegistryKey = syncRootManagerRegKey + QStringLiteral("\\") + syncRootId; const QString providerSyncRootIdUserSyncRootsRegistryKey = providerSyncRootIdRegistryKey + QStringLiteral(R"(\UserSyncRoots\)"); @@ -615,7 +615,7 @@ bool deleteSyncRootRegistryKey(const QString &syncRootPath, const QString &provi return false; } - const auto currentUserSyncRootIdPattern = QString("%1!%2!%3").arg(providerName).arg(windowsSid).arg(accountDisplayName); + const auto currentUserSyncRootIdPattern = QStringLiteral("%1!%2!%3").arg(providerName).arg(windowsSid).arg(accountDisplayName); bool result = true; @@ -689,7 +689,7 @@ void unregisterSyncRootShellExtensions(const QString &providerName, const QStrin return; } - const auto syncRootId = QString("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias); + const auto syncRootId = QStringLiteral("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(folderAlias); const QString providerSyncRootIdRegistryKey = syncRootManagerRegKey + QStringLiteral("\\") + syncRootId; @@ -755,7 +755,7 @@ bool OCC::CfApiWrapper::isAnySyncRoot(const QString &providerName, const QString return false; } - const auto syncRootPrefix = QString("%1!%2!%3!").arg(providerName).arg(windowsSid).arg(accountDisplayName); + const auto syncRootPrefix = QStringLiteral("%1!%2!%3!").arg(providerName).arg(windowsSid).arg(accountDisplayName); if (Utility::registryKeyExists(HKEY_LOCAL_MACHINE, syncRootManagerRegKey)) { bool foundSyncRoots = false; diff --git a/src/libsync/vfs/cfapi/shellext/customstateprovider.cpp b/src/libsync/vfs/cfapi/shellext/customstateprovider.cpp index 8f7a2266fa4b8..baa92cfbb8266 100644 --- a/src/libsync/vfs/cfapi/shellext/customstateprovider.cpp +++ b/src/libsync/vfs/cfapi/shellext/customstateprovider.cpp @@ -84,8 +84,8 @@ CustomStateProvider::GetItemProperties(hstring const &itemPath) winrt::Windows::Storage::Provider::StorageProviderItemProperty itemProperty; itemProperty.Id(stateValue); - itemProperty.Value(QString("Value%1").arg(stateValue).toStdWString()); - itemProperty.IconResource(QString(_dllFilePath + QString(",%1").arg(QString::number(stateValue))).toStdWString()); + itemProperty.Value(QStringLiteral("Value%1").arg(stateValue).toStdWString()); + itemProperty.IconResource(QString(_dllFilePath + QStringLiteral(",%1").arg(QString::number(stateValue))).toStdWString()); properties.push_back(std::move(itemProperty)); } } diff --git a/src/libsync/vfs/suffix/vfs_suffix.cpp b/src/libsync/vfs/suffix/vfs_suffix.cpp index 59c868b31fb69..b1c9dcea997f6 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.cpp +++ b/src/libsync/vfs/suffix/vfs_suffix.cpp @@ -95,13 +95,13 @@ Result VfsSuffix::createPlaceholder(const SyncFileItem &item) QString fn = _setupParams.filesystemPath + item._file; if (!fn.endsWith(fileSuffix())) { ASSERT(false, "vfs file isn't ending with suffix"); - return QString("vfs file isn't ending with suffix"); + return QStringLiteral("vfs file isn't ending with suffix"); } QFile file(fn); if (file.exists() && file.size() > 1 && !FileSystem::verifyFileUnchanged(fn, item._size, item._modtime)) { - return QString("Cannot create a placeholder because a file with the placeholder name already exist"); + return QStringLiteral("Cannot create a placeholder because a file with the placeholder name already exist"); } if (!file.open(QFile::ReadWrite | QFile::Truncate)) diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index 49cdac710338b..866d49124ccc3 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -614,18 +614,18 @@ struct ItemCompletedSpy : QSignalSpy { // QTest::toString overloads namespace OCC { inline char *toString(const SyncFileStatus &s) { - return QTest::toString(QString("SyncFileStatus(" + s.toSocketAPIString() + ")")); + return QTest::toString(QStringLiteral("SyncFileStatus(" + s.toSocketAPIString() + ")")); } } inline void addFiles(QStringList &dest, const FileInfo &fi) { if (fi.isDir) { - dest += QString("%1 - dir").arg(fi.path()); + dest += QStringLiteral("%1 - dir").arg(fi.path()); foreach (const FileInfo &fi, fi.children) addFiles(dest, fi); } else { - dest += QString("%1 - %2 %3-bytes").arg(fi.path()).arg(fi.size).arg(fi.contentChar); + dest += QStringLiteral("%1 - %2 %3-bytes").arg(fi.path()).arg(fi.size).arg(fi.contentChar); } } @@ -635,7 +635,7 @@ inline QString toStringNoElide(const FileInfo &fi) foreach (const FileInfo &fi, fi.children) addFiles(files, fi); files.sort(); - return QString("FileInfo with %1 files(\n\t%2\n)").arg(files.size()).arg(files.join("\n\t")); + return QStringLiteral("FileInfo with %1 files(\n\t%2\n)").arg(files.size()).arg(files.join("\n\t")); } inline char *toString(const FileInfo &fi) @@ -647,7 +647,7 @@ inline void addFilesDbData(QStringList &dest, const FileInfo &fi) { // could include etag, permissions etc, but would need extra work if (fi.isDir) { - dest += QString("%1 - %2 %3 %4").arg( + dest += QStringLiteral("%1 - %2 %3 %4").arg( fi.name, fi.isDir ? "dir" : "file", QString::number(fi.lastModified.toSecsSinceEpoch()), @@ -655,7 +655,7 @@ inline void addFilesDbData(QStringList &dest, const FileInfo &fi) foreach (const FileInfo &fi, fi.children) addFilesDbData(dest, fi); } else { - dest += QString("%1 - %2 %3 %4 %5").arg( + dest += QStringLiteral("%1 - %2 %3 %4 %5").arg( fi.name, fi.isDir ? "dir" : "file", QString::number(fi.size), @@ -669,5 +669,5 @@ inline char *printDbData(const FileInfo &fi) QStringList files; foreach (const FileInfo &fi, fi.children) addFilesDbData(files, fi); - return QTest::toString(QString("FileInfo with %1 files(%2)").arg(files.size()).arg(files.join(", "))); + return QTest::toString(QStringLiteral("FileInfo with %1 files(%2)").arg(files.size()).arg(files.join(", "))); } diff --git a/test/testcfapishellextensionsipc.cpp b/test/testcfapishellextensionsipc.cpp index 12af7724c1cbd..3b823097adbdf 100644 --- a/test/testcfapishellextensionsipc.cpp +++ b/test/testcfapishellextensionsipc.cpp @@ -241,7 +241,7 @@ private slots: std::thread t1([&] { VfsShellExtensions::ThumbnailProviderIpc thumbnailProviderIpc; thumbnailReplyData = thumbnailProviderIpc.fetchThumbnailForFile( - fakeFolder.localPath() + QString("A/photos/wrong.jpg"), QSize(256, 256)); + fakeFolder.localPath() + QStringLiteral("A/photos/wrong.jpg"), QSize(256, 256)); QMetaObject::invokeMethod(&loop, &QEventLoop::quit, Qt::QueuedConnection); }); loop.exec(); diff --git a/test/testchunkingng.cpp b/test/testchunkingng.cpp index 87612fab538a1..20126ee452867 100644 --- a/test/testchunkingng.cpp +++ b/test/testchunkingng.cpp @@ -100,7 +100,7 @@ private slots: const auto chunkingId = fakeFolder.uploadState().children.first().name; const auto chunkMap = fakeFolder.uploadState().children.first().children; const auto firstChunkName = chunkMap.first().name; - const auto expectedChunkName = QString("%1").arg(1, 5, 10, QChar('0')); + const auto expectedChunkName = QStringLiteral("%1").arg(1, 5, 10, QChar('0')); QCOMPARE(firstChunkName, expectedChunkName); } @@ -232,7 +232,7 @@ private slots: // Add a chunk that makes the file completely uploaded const auto testChunkNameNum = chunkMap.count() + 1; // Chunk nums start at 1 with Chunk V2, so size() == last num, add 1 - const auto testChunkName = QString("%1").arg(testChunkNameNum, 5, 10, QChar('0')); + const auto testChunkName = QStringLiteral("%1").arg(testChunkNameNum, 5, 10, QChar('0')); const auto testChunkSize = size - uploadedSize; fakeFolder.uploadState().children.first().insert(testChunkName, testChunkSize); @@ -285,7 +285,7 @@ private slots: // Add a chunk that makes the file more than completely uploaded const auto testChunkNameNum = chunkMap.count() + 1; // Chunk nums start at 1 with Chunk V2, so size() == last num, add 1 - const auto testChunkName = QString("%1").arg(testChunkNameNum, 5, 10, QChar('0')); + const auto testChunkName = QStringLiteral("%1").arg(testChunkNameNum, 5, 10, QChar('0')); const auto testChunkSize = size - uploadedSize + 100; fakeFolder.uploadState().children.first().insert(testChunkName, testChunkSize); diff --git a/test/testdownload.cpp b/test/testdownload.cpp index 62108f457b51a..97df1c0983965 100644 --- a/test/testdownload.cpp +++ b/test/testdownload.cpp @@ -82,7 +82,7 @@ private slots: QVERIFY(!fakeFolder.syncOnce()); // The sync must fail because not all the file was downloaded QCOMPARE(getItem(completeSpy, "A/a0")->_status, SyncFileItem::SoftError); - QCOMPARE(getItem(completeSpy, "A/a0")->_errorString, QString("The file could not be downloaded completely.")); + QCOMPARE(getItem(completeSpy, "A/a0")->_errorString, QStringLiteral("The file could not be downloaded completely.")); QVERIFY(fakeFolder.syncEngine().isAnotherSyncNeeded()); // Now, we need to restart, this time, it should resume. diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index ea525748447bf..2fd33c990dd8a 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -715,7 +715,7 @@ private slots: void testAddExcludeFilePath_addSameFilePath_listSizeDoesNotIncrease() { excludedFiles.reset(new ExcludedFiles()); - const auto filePath = QString("exclude/.sync-exclude.lst"); + const auto filePath = QStringLiteral("exclude/.sync-exclude.lst"); excludedFiles->addExcludeFilePath(filePath); excludedFiles->addExcludeFilePath(filePath); @@ -727,8 +727,8 @@ private slots: { excludedFiles.reset(new ExcludedFiles()); - const auto filePath1 = QString("exclude1/.sync-exclude.lst"); - const auto filePath2 = QString("exclude2/.sync-exclude.lst"); + const auto filePath1 = QStringLiteral("exclude1/.sync-exclude.lst"); + const auto filePath2 = QStringLiteral("exclude2/.sync-exclude.lst"); excludedFiles->addExcludeFilePath(filePath1); excludedFiles->addExcludeFilePath(filePath2); diff --git a/test/testfolderwatcher.cpp b/test/testfolderwatcher.cpp index 10d945b5de5d7..598c361a76c44 100644 --- a/test/testfolderwatcher.cpp +++ b/test/testfolderwatcher.cpp @@ -17,7 +17,7 @@ void touch(const QString &file) OCC::Utility::writeRandomFile(file); #else QString cmd; - cmd = QString("touch %1").arg(file); + cmd = QStringLiteral("touch %1").arg(file); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); #endif @@ -29,7 +29,7 @@ void mkdir(const QString &file) QDir dir; dir.mkdir(file); #else - QString cmd = QString("mkdir %1").arg(file); + QString cmd = QStringLiteral("mkdir %1").arg(file); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); #endif @@ -41,7 +41,7 @@ void rmdir(const QString &file) QDir dir; dir.rmdir(file); #else - QString cmd = QString("rmdir %1").arg(file); + QString cmd = QStringLiteral("rmdir %1").arg(file); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); #endif @@ -52,7 +52,7 @@ void rm(const QString &file) #ifdef Q_OS_WIN QFile::remove(file); #else - QString cmd = QString("rm %1").arg(file); + QString cmd = QStringLiteral("rm %1").arg(file); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); #endif @@ -63,7 +63,7 @@ void mv(const QString &file1, const QString &file2) #ifdef Q_OS_WIN QFile::rename(file1, file2); #else - QString cmd = QString("mv %1 %2").arg(file1, file2); + QString cmd = QStringLiteral("mv %1 %2").arg(file1, file2); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); #endif @@ -158,7 +158,7 @@ private slots: void testACreate() { // create a new file QString file(_rootPath + "/foo.txt"); QString cmd; - cmd = QString("echo \"xyz\" > \"%1\"").arg(file); + cmd = QStringLiteral("echo \"xyz\" > \"%1\"").arg(file); qDebug() << "Command: " << cmd; system(cmd.toLocal8Bit()); diff --git a/test/testinotifywatcher.cpp b/test/testinotifywatcher.cpp index 204939f9132c6..bb87c4b4aa839 100644 --- a/test/testinotifywatcher.cpp +++ b/test/testinotifywatcher.cpp @@ -62,7 +62,7 @@ private slots: void cleanupTestCase() { if( _root.startsWith(QDir::tempPath() )) { - system( QString("rm -rf %1").arg(_root).toLocal8Bit() ); + system( QStringLiteral("rm -rf %1").arg(_root).toLocal8Bit() ); } } }; diff --git a/test/testlockfile.cpp b/test/testlockfile.cpp index ce91016f7ae09..720c768389eb5 100644 --- a/test/testlockfile.cpp +++ b/test/testlockfile.cpp @@ -768,8 +768,8 @@ private slots: fakeFolder.syncEngine().account()->setCapabilities({{"files", QVariantMap{{"locking", QByteArray{"1.0"}}}}}); QSignalSpy lockFileDetectedNewlyUploadedSpy(&fakeFolder.syncEngine(), &OCC::SyncEngine::lockFileDetected); - fakeFolder.localModifier().insert(testDocumentsDirName + QString("/") + testLockFileName); - fakeFolder.localModifier().insert(testDocumentsDirName + QString("/") + testFileName); + fakeFolder.localModifier().insert(testDocumentsDirName + QStringLiteral("/") + testLockFileName); + fakeFolder.localModifier().insert(testDocumentsDirName + QStringLiteral("/") + testFileName); QVERIFY(fakeFolder.syncOnce()); diff --git a/test/testnetrcparser.cpp b/test/testnetrcparser.cpp index f826edd8db536..3c32f00763bd3 100644 --- a/test/testnetrcparser.cpp +++ b/test/testnetrcparser.cpp @@ -55,10 +55,10 @@ private slots: NetrcParser parser(testfileC); QEXPECT_FAIL("", "test currently broken, eventually will be fixed", Abort); QVERIFY(parser.parse()); - QCOMPARE(parser.find("foo"), qMakePair(QString("bar"), QString("baz"))); - QCOMPARE(parser.find("broken"), qMakePair(QString("bar2"), QString())); - QCOMPARE(parser.find("funnysplit"), qMakePair(QString("bar3"), QString("baz3"))); - QCOMPARE(parser.find("frob"), qMakePair(QString("user with spaces"), QString("space pwd"))); + QCOMPARE(parser.find("foo"), qMakePair(QStringLiteral("bar"), QStringLiteral("baz"))); + QCOMPARE(parser.find("broken"), qMakePair(QStringLiteral("bar2"), QString())); + QCOMPARE(parser.find("funnysplit"), qMakePair(QStringLiteral("bar3"), QStringLiteral("baz3"))); + QCOMPARE(parser.find("frob"), qMakePair(QStringLiteral("user with spaces"), QStringLiteral("space pwd"))); } void testEmptyNetrc() { @@ -71,8 +71,8 @@ private slots: NetrcParser parser(testfileWithDefaultC); QEXPECT_FAIL("", "test currently broken, eventually will be fixed", Abort); QVERIFY(parser.parse()); - QCOMPARE(parser.find("foo"), qMakePair(QString("bar"), QString("baz"))); - QCOMPARE(parser.find("dontknow"), qMakePair(QString("user"), QString("pass"))); + QCOMPARE(parser.find("foo"), qMakePair(QStringLiteral("bar"), QStringLiteral("baz"))); + QCOMPARE(parser.find("dontknow"), qMakePair(QStringLiteral("user"), QStringLiteral("pass"))); } void testInvalidNetrc() { diff --git a/test/testselectivesync.cpp b/test/testselectivesync.cpp index 2af525007009b..6ec7a5dd32928 100644 --- a/test/testselectivesync.cpp +++ b/test/testselectivesync.cpp @@ -65,7 +65,7 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QCOMPARE(newBigFolder.count(), 1); - QCOMPARE(newBigFolder.first()[0].toString(), QString("A/newBigDir")); + QCOMPARE(newBigFolder.first()[0].toString(), QStringLiteral("A/newBigDir")); QCOMPARE(newBigFolder.first()[1].toBool(), false); newBigFolder.clear(); @@ -75,7 +75,7 @@ private slots: auto oldSync = fakeFolder.currentLocalState(); // syncing again should do the same - fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QString("A/newBigDir")); + fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QStringLiteral("A/newBigDir")); QVERIFY(fakeFolder.syncOnce()); QCOMPARE(fakeFolder.currentLocalState(), oldSync); QCOMPARE(newBigFolder.count(), 1); // (since we don't have a real Folder, the files were not added to any list) @@ -86,7 +86,7 @@ private slots: // Simulate that we accept all files by setting a wildcard white list fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, QStringList() << QLatin1String("/")); - fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QString("A/newBigDir")); + fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QStringLiteral("A/newBigDir")); QVERIFY(fakeFolder.syncOnce()); QCOMPARE(newBigFolder.count(), 0); QCOMPARE(sizeRequests.count(), 0); diff --git a/test/testsharemodel.cpp b/test/testsharemodel.cpp index 5d8800985b905..041fd5f73ce65 100644 --- a/test/testsharemodel.cpp +++ b/test/testsharemodel.cpp @@ -371,7 +371,7 @@ private slots: // Check correct user avatar const auto avatarUrl = shareIndex.data(ShareModel::AvatarUrlRole).toString(); - const auto relativeAvatarPath = QString("remote.php/dav/avatars/%1/%2.png").arg(_testUserShareDefinition.shareShareWith, QString::number(64)); + const auto relativeAvatarPath = QStringLiteral("remote.php/dav/avatars/%1/%2.png").arg(_testUserShareDefinition.shareShareWith, QString::number(64)); const auto expectedAvatarPath = Utility::concatUrlPath(helper.account->url(), relativeAvatarPath).toString(); const QString expectedUrl(QStringLiteral("image://tray-image-provider/") + expectedAvatarPath); QCOMPARE(avatarUrl, expectedUrl); diff --git a/test/testsyncconflict.cpp b/test/testsyncconflict.cpp index ce358feeddb66..eb8b938b0a9b3 100644 --- a/test/testsyncconflict.cpp +++ b/test/testsyncconflict.cpp @@ -138,7 +138,7 @@ private slots: QCOMPARE(Utility::conflictFileBaseNameFromPattern(conflictMap[a1FileId].toUtf8()), QByteArray("A/a1")); // Check that the conflict file contains the username - QVERIFY(conflictMap[a1FileId].contains(QString("(conflicted copy %1 ").arg(fakeFolder.syncEngine().account()->davDisplayName()))); + QVERIFY(conflictMap[a1FileId].contains(QStringLiteral("(conflicted copy %1 ").arg(fakeFolder.syncEngine().account()->davDisplayName()))); QCOMPARE(remote.find(conflictMap[a1FileId])->contentChar, 'L'); QCOMPARE(remote.find("A/a1")->contentChar, 'R'); diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index c46a9f7ab0143..f554c64abba82 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -721,7 +721,7 @@ private slots: // Begin Test mismatch recalculation--------------------------------------------------------------------------------- const auto prevServerVersion = fakeFolder.account()->serverVersion(); - fakeFolder.account()->setServerVersion(QString("%1.0.0").arg(fakeFolder.account()->checksumRecalculateServerVersionMinSupportedMajor())); + fakeFolder.account()->setServerVersion(QStringLiteral("%1.0.0").arg(fakeFolder.account()->checksumRecalculateServerVersionMinSupportedMajor())); // Mismatched OC-Checksum and X-Recalculate-Hash is not supported -> sync must fail isChecksumRecalculateSupported = false; diff --git a/test/testutility.cpp b/test/testutility.cpp index efd6e684cc11b..b1013d3cc3d04 100644 --- a/test/testutility.cpp +++ b/test/testutility.cpp @@ -39,29 +39,29 @@ private slots: void testOctetsToString() { QLocale::setDefault(QLocale("en")); - QCOMPARE(octetsToString(999) , QString("999 B")); - QCOMPARE(octetsToString(1024) , QString("1 KB")); - QCOMPARE(octetsToString(1110) , QString("1 KB")); - QCOMPARE(octetsToString(1364) , QString("1 KB")); - - QCOMPARE(octetsToString(9110) , QString("9 KB")); - QCOMPARE(octetsToString(9910) , QString("10 KB")); - QCOMPARE(octetsToString(9999) , QString("10 KB")); - QCOMPARE(octetsToString(10240) , QString("10 KB")); - - QCOMPARE(octetsToString(123456) , QString("121 KB")); - QCOMPARE(octetsToString(1234567) , QString("1.2 MB")); - QCOMPARE(octetsToString(12345678) , QString("12 MB")); - QCOMPARE(octetsToString(123456789) , QString("118 MB")); - QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QString("4.7 GB")); - - QCOMPARE(octetsToString(1), QString("1 B")); - QCOMPARE(octetsToString(2), QString("2 B")); - QCOMPARE(octetsToString(1024), QString("1 KB")); - QCOMPARE(octetsToString(1024*1024), QString("1 MB")); - QCOMPARE(octetsToString(1024LL*1024*1024), QString("1 GB")); - QCOMPARE(octetsToString(1024LL*1024*1024*1024), QString("1 TB")); - QCOMPARE(octetsToString(1024LL*1024*1024*1024 * 5), QString("5 TB")); + QCOMPARE(octetsToString(999) , QStringLiteral("999 B")); + QCOMPARE(octetsToString(1024) , QStringLiteral("1 KB")); + QCOMPARE(octetsToString(1110) , QStringLiteral("1 KB")); + QCOMPARE(octetsToString(1364) , QStringLiteral("1 KB")); + + QCOMPARE(octetsToString(9110) , QStringLiteral("9 KB")); + QCOMPARE(octetsToString(9910) , QStringLiteral("10 KB")); + QCOMPARE(octetsToString(9999) , QStringLiteral("10 KB")); + QCOMPARE(octetsToString(10240) , QStringLiteral("10 KB")); + + QCOMPARE(octetsToString(123456) , QStringLiteral("121 KB")); + QCOMPARE(octetsToString(1234567) , QStringLiteral("1.2 MB")); + QCOMPARE(octetsToString(12345678) , QStringLiteral("12 MB")); + QCOMPARE(octetsToString(123456789) , QStringLiteral("118 MB")); + QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QStringLiteral("4.7 GB")); + + QCOMPARE(octetsToString(1), QStringLiteral("1 B")); + QCOMPARE(octetsToString(2), QStringLiteral("2 B")); + QCOMPARE(octetsToString(1024), QStringLiteral("1 KB")); + QCOMPARE(octetsToString(1024*1024), QStringLiteral("1 MB")); + QCOMPARE(octetsToString(1024LL*1024*1024), QStringLiteral("1 GB")); + QCOMPARE(octetsToString(1024LL*1024*1024*1024), QStringLiteral("1 TB")); + QCOMPARE(octetsToString(1024LL*1024*1024*1024 * 5), QStringLiteral("5 TB")); } void testLaunchOnStartup() @@ -88,35 +88,35 @@ private slots: QDateTime current = QDateTime::currentDateTimeUtc(); - QCOMPARE(durationToDescriptiveString2(0), QString("0 second(s)") ); - QCOMPARE(durationToDescriptiveString2(5), QString("0 second(s)") ); - QCOMPARE(durationToDescriptiveString2(1000), QString("1 second(s)") ); - QCOMPARE(durationToDescriptiveString2(1005), QString("1 second(s)") ); - QCOMPARE(durationToDescriptiveString2(56123), QString("56 second(s)") ); - QCOMPARE(durationToDescriptiveString2(90*sec), QString("1 minute(s) 30 second(s)") ); - QCOMPARE(durationToDescriptiveString2(3*hour), QString("3 hour(s)") ); - QCOMPARE(durationToDescriptiveString2(3*hour + 20*sec), QString("3 hour(s)") ); - QCOMPARE(durationToDescriptiveString2(3*hour + 70*sec), QString("3 hour(s) 1 minute(s)") ); - QCOMPARE(durationToDescriptiveString2(3*hour + 100*sec), QString("3 hour(s) 2 minute(s)") ); + QCOMPARE(durationToDescriptiveString2(0), QStringLiteral("0 second(s)") ); + QCOMPARE(durationToDescriptiveString2(5), QStringLiteral("0 second(s)") ); + QCOMPARE(durationToDescriptiveString2(1000), QStringLiteral("1 second(s)") ); + QCOMPARE(durationToDescriptiveString2(1005), QStringLiteral("1 second(s)") ); + QCOMPARE(durationToDescriptiveString2(56123), QStringLiteral("56 second(s)") ); + QCOMPARE(durationToDescriptiveString2(90*sec), QStringLiteral("1 minute(s) 30 second(s)") ); + QCOMPARE(durationToDescriptiveString2(3*hour), QStringLiteral("3 hour(s)") ); + QCOMPARE(durationToDescriptiveString2(3*hour + 20*sec), QStringLiteral("3 hour(s)") ); + QCOMPARE(durationToDescriptiveString2(3*hour + 70*sec), QStringLiteral("3 hour(s) 1 minute(s)") ); + QCOMPARE(durationToDescriptiveString2(3*hour + 100*sec), QStringLiteral("3 hour(s) 2 minute(s)") ); QCOMPARE(durationToDescriptiveString2(current.msecsTo(current.addYears(4).addMonths(5).addDays(2).addSecs(23*60*60))), - QString("4 year(s) 5 month(s)") ); + QStringLiteral("4 year(s) 5 month(s)") ); QCOMPARE(durationToDescriptiveString2(current.msecsTo(current.addDays(2).addSecs(23*60*60))), - QString("2 day(s) 23 hour(s)") ); - - QCOMPARE(durationToDescriptiveString1(0), QString("0 second(s)") ); - QCOMPARE(durationToDescriptiveString1(5), QString("0 second(s)") ); - QCOMPARE(durationToDescriptiveString1(1000), QString("1 second(s)") ); - QCOMPARE(durationToDescriptiveString1(1005), QString("1 second(s)") ); - QCOMPARE(durationToDescriptiveString1(56123), QString("56 second(s)") ); - QCOMPARE(durationToDescriptiveString1(90*sec), QString("2 minute(s)") ); - QCOMPARE(durationToDescriptiveString1(3*hour), QString("3 hour(s)") ); - QCOMPARE(durationToDescriptiveString1(3*hour + 20*sec), QString("3 hour(s)") ); - QCOMPARE(durationToDescriptiveString1(3*hour + 70*sec), QString("3 hour(s)") ); - QCOMPARE(durationToDescriptiveString1(3*hour + 100*sec), QString("3 hour(s)") ); + QStringLiteral("2 day(s) 23 hour(s)") ); + + QCOMPARE(durationToDescriptiveString1(0), QStringLiteral("0 second(s)") ); + QCOMPARE(durationToDescriptiveString1(5), QStringLiteral("0 second(s)") ); + QCOMPARE(durationToDescriptiveString1(1000), QStringLiteral("1 second(s)") ); + QCOMPARE(durationToDescriptiveString1(1005), QStringLiteral("1 second(s)") ); + QCOMPARE(durationToDescriptiveString1(56123), QStringLiteral("56 second(s)") ); + QCOMPARE(durationToDescriptiveString1(90*sec), QStringLiteral("2 minute(s)") ); + QCOMPARE(durationToDescriptiveString1(3*hour), QStringLiteral("3 hour(s)") ); + QCOMPARE(durationToDescriptiveString1(3*hour + 20*sec), QStringLiteral("3 hour(s)") ); + QCOMPARE(durationToDescriptiveString1(3*hour + 70*sec), QStringLiteral("3 hour(s)") ); + QCOMPARE(durationToDescriptiveString1(3*hour + 100*sec), QStringLiteral("3 hour(s)") ); QCOMPARE(durationToDescriptiveString1(current.msecsTo(current.addYears(4).addMonths(5).addDays(2).addSecs(23*60*60))), - QString("4 year(s)") ); + QStringLiteral("4 year(s)") ); QCOMPARE(durationToDescriptiveString1(current.msecsTo(current.addDays(2).addSecs(23*60*60))), - QString("3 day(s)") ); + QStringLiteral("3 day(s)") ); }