Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-08-11 16:37:05 +0300
committerHannah von Reth <hannah.vonreth@owncloud.com>2022-08-11 19:53:07 +0300
commit61f8ba64d13436296314ffc66cb226cd4acc97b0 (patch)
tree76e10b9251917fe3e59d8471eb24869605903b37
parent9980dd2cfc50dddf80038d175e48eeb9822554df (diff)
Apply strict strings to all our codework/strcit_strings
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/modules/OCApplyCommonSettings.cmake13
-rw-r--r--src/csync/CMakeLists.txt11
-rw-r--r--src/gui/CMakeLists.txt8
-rw-r--r--src/gui/aboutdialog.cpp2
-rw-r--r--src/gui/accountmanager.cpp79
-rw-r--r--src/gui/accountsettings.cpp6
-rw-r--r--src/gui/activitywidget.cpp10
-rw-r--r--src/gui/application.cpp15
-rw-r--r--src/gui/creds/httpcredentialsgui.cpp5
-rw-r--r--src/gui/folder.cpp36
-rw-r--r--src/gui/folderman.cpp14
-rw-r--r--src/gui/folderstatusmodel.cpp10
-rw-r--r--src/gui/folderwatcher_linux.cpp2
-rw-r--r--src/gui/folderwizard/CMakeLists.txt12
-rw-r--r--src/gui/guiutility_unix.cpp3
-rw-r--r--src/gui/ignorelisteditor.cpp4
-rw-r--r--src/gui/loginrequireddialog/CMakeLists.txt12
-rw-r--r--src/gui/navigationpanehelper.cpp14
-rw-r--r--src/gui/newwizard/CMakeLists.txt11
-rw-r--r--src/gui/openfilemanager.cpp4
-rw-r--r--src/gui/owncloudgui.cpp4
-rw-r--r--src/gui/protocolwidget.cpp2
-rw-r--r--src/gui/selectivesyncdialog.cpp14
-rw-r--r--src/gui/servernotificationhandler.cpp2
-rw-r--r--src/gui/sharee.cpp10
-rw-r--r--src/gui/sharelinkwidget.cpp2
-rw-r--r--src/gui/sharemanager.cpp14
-rw-r--r--src/gui/shareusergroupwidget.cpp2
-rw-r--r--src/gui/socketapi/socketapi.cpp66
-rw-r--r--src/gui/socketapi/socketapi.h8
-rw-r--r--src/gui/socketapi/socketapi_p.h6
-rw-r--r--src/gui/spaces/CMakeLists.txt11
-rw-r--r--src/gui/systray.cpp26
-rw-r--r--src/gui/tlserrordialog.cpp2
-rw-r--r--src/gui/translations.cpp2
-rw-r--r--src/gui/updater/ocupdater.cpp8
-rw-r--r--src/libsync/CMakeLists.txt12
-rw-r--r--src/libsync/networkjobs.cpp4
-rw-r--r--src/libsync/networkjobs.h2
40 files changed, 227 insertions, 242 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e95689fda..c9b35ad0f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,7 @@ include(CTest)
include(OCConfigPluginDir)
include(OCBundleResources)
+include(OCApplyCommonSettings)
if (EXISTS "${PROJECT_SOURCE_DIR}/branding")
set(OEM_THEME_DIR "${PROJECT_SOURCE_DIR}/branding" CACHE STRING "The directory containing a custom theme")
diff --git a/cmake/modules/OCApplyCommonSettings.cmake b/cmake/modules/OCApplyCommonSettings.cmake
new file mode 100644
index 000000000..d933469b7
--- /dev/null
+++ b/cmake/modules/OCApplyCommonSettings.cmake
@@ -0,0 +1,13 @@
+function(apply_common_target_settings targetNamme)
+ target_compile_definitions(${targetNamme}
+ PRIVATE
+ QT_NO_CAST_TO_ASCII
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_URL_CAST_FROM_STRING
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_USE_QSTRINGBUILDER
+ QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
+ QT_DEPRECATED_WARNINGS
+ QT_NO_FOREACH
+ )
+endfunction()
diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt
index d846f280d..7b9eb3292 100644
--- a/src/csync/CMakeLists.txt
+++ b/src/csync/CMakeLists.txt
@@ -35,16 +35,7 @@ target_include_directories(csync
$<INSTALL_INTERFACE:include>
)
-target_compile_definitions(csync
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+apply_common_target_settings(csync)
if(TOKEN_AUTH_ONLY)
message("Compiling with token authentication")
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 52ef54b81..9426d5995 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -119,12 +119,8 @@ target_link_libraries(owncloudCore
qt5keychain
newwizard folderwizard spaces loginrequireddialog
libsync)
-target_compile_definitions(owncloudCore
- PUBLIC QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+
+apply_common_target_settings(owncloudCore)
add_subdirectory(spaces)
diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp
index 178aa60eb..b4bea2d9e 100644
--- a/src/gui/aboutdialog.cpp
+++ b/src/gui/aboutdialog.cpp
@@ -41,7 +41,7 @@ AboutDialog::~AboutDialog()
void AboutDialog::openBrowser(const QString &s)
{
- Utility::openBrowser(s, this);
+ Utility::openBrowser(QUrl(s), this);
}
void AboutDialog::openBrowserFromUrl(const QUrl &s)
diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp
index fda60e8aa..1d724c0d0 100644
--- a/src/gui/accountmanager.cpp
+++ b/src/gui/accountmanager.cpp
@@ -25,9 +25,21 @@
#include <QNetworkAccessManager>
namespace {
-const char urlC[] = "url";
-const char userC[] = "user";
-const char httpUserC[] = "http_user";
+auto urlC()
+{
+ return QStringLiteral("url");
+}
+
+auto userC()
+{
+ return QStringLiteral("user");
+}
+
+auto httpUserC()
+{
+ return QStringLiteral("http_user");
+}
+
auto defaultSyncRootC()
{
return QStringLiteral("default_sync_root");
@@ -48,9 +60,20 @@ const QString userUUIDC()
return QStringLiteral("uuid");
}
-static const char caCertsKeyC[] = "CaCertificates";
-static const char accountsC[] = "Accounts";
-static const char versionC[] = "version";
+auto caCertsKeyC()
+{
+ return QStringLiteral("CaCertificates");
+}
+
+auto accountsC()
+{
+ return QStringLiteral("Accounts");
+}
+
+auto versionC()
+{
+ return QStringLiteral("version");
+}
auto capabilitesC()
{
@@ -78,7 +101,7 @@ bool AccountManager::restore()
QStringList skipSettingsKeys;
backwardMigrationSettingsKeys(&skipSettingsKeys, &skipSettingsKeys);
- auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
+ auto settings = ConfigFile::settingsWithGroup(accountsC());
if (settings->status() != QSettings::NoError) {
qCWarning(lcAccountManager) << "Could not read settings from" << settings->fileName()
<< settings->status();
@@ -94,7 +117,7 @@ bool AccountManager::restore()
// If there are no accounts, check the old format.
const auto &childGroups = settings->childGroups();
if (childGroups.isEmpty()
- && !settings->contains(QLatin1String(versionC))) {
+ && !settings->contains(versionC())) {
restoreFromLegacySettings();
return true;
}
@@ -120,13 +143,13 @@ bool AccountManager::restore()
void AccountManager::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringList *ignoreKeys)
{
- auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
- const int accountsVersion = settings->value(QLatin1String(versionC)).toInt();
+ auto settings = ConfigFile::settingsWithGroup(accountsC());
+ const int accountsVersion = settings->value(versionC()).toInt();
if (accountsVersion <= maxAccountsVersion) {
const auto &childGroups = settings->childGroups();
for (const auto &accountId : childGroups) {
settings->beginGroup(accountId);
- const int accountVersion = settings->value(QLatin1String(versionC), 1).toInt();
+ const int accountVersion = settings->value(versionC(), 1).toInt();
if (accountVersion > maxAccountVersion) {
ignoreKeys->append(settings->group());
}
@@ -154,8 +177,8 @@ bool AccountManager::restoreFromLegacySettings()
// Now try to open the original ownCloud settings to see if they exist.
QString oCCfgFile = QDir::fromNativeSeparators(settings->fileName());
// replace the last two segments with ownCloud/owncloud.cfg
- oCCfgFile = oCCfgFile.left(oCCfgFile.lastIndexOf('/'));
- oCCfgFile = oCCfgFile.left(oCCfgFile.lastIndexOf('/'));
+ oCCfgFile = oCCfgFile.left(oCCfgFile.lastIndexOf(QLatin1Char('/')));
+ oCCfgFile = oCCfgFile.left(oCCfgFile.lastIndexOf(QLatin1Char('/')));
oCCfgFile += QLatin1String("/ownCloud/owncloud.cfg");
qCInfo(lcAccountManager) << logPrefix
@@ -172,11 +195,11 @@ bool AccountManager::restoreFromLegacySettings()
// Check the theme url to see if it is the same url that the oC config was for
QString overrideUrl = Theme::instance()->overrideServerUrlV2();
if (!overrideUrl.isEmpty()) {
- if (overrideUrl.endsWith('/')) {
+ if (overrideUrl.endsWith(QLatin1Char('/'))) {
overrideUrl.chop(1);
}
- QString oCUrl = oCSettings->value(QLatin1String(urlC)).toString();
- if (oCUrl.endsWith('/')) {
+ QString oCUrl = oCSettings->value(urlC()).toString();
+ if (oCUrl.endsWith(QLatin1Char('/'))) {
oCUrl.chop(1);
}
@@ -204,8 +227,8 @@ bool AccountManager::restoreFromLegacySettings()
void AccountManager::save(bool saveCredentials)
{
- auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
- settings->setValue(QLatin1String(versionC), maxAccountsVersion);
+ auto settings = ConfigFile::settingsWithGroup(accountsC());
+ settings->setValue(versionC(), maxAccountsVersion);
for (const auto &acc : qAsConst(_accounts)) {
settings->beginGroup(acc->account()->id());
saveAccountHelper(acc->account().data(), *settings, saveCredentials);
@@ -220,7 +243,7 @@ void AccountManager::save(bool saveCredentials)
void AccountManager::saveAccount(Account *a)
{
qCDebug(lcAccountManager) << "Saving account" << a->url().toString();
- auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
+ auto settings = ConfigFile::settingsWithGroup(accountsC());
settings->beginGroup(a->id());
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
settings->endGroup();
@@ -242,8 +265,8 @@ QStringList AccountManager::accountNames() const
void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool saveCredentials)
{
- settings.setValue(QLatin1String(versionC), maxAccountVersion);
- settings.setValue(QLatin1String(urlC), acc->_url.toString());
+ settings.setValue(versionC(), maxAccountVersion);
+ settings.setValue(urlC(), acc->_url.toString());
settings.setValue(davUserC(), acc->_davUser);
settings.setValue(davUserDisplyNameC(), acc->_displayName);
settings.setValue(userUUIDC(), acc->uuid());
@@ -267,8 +290,8 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
}
// HACK: Save http_user also as user
- if (acc->_settingsMap.contains(httpUserC))
- settings.setValue(userC, acc->_settingsMap.value(httpUserC));
+ if (acc->_settingsMap.contains(httpUserC()))
+ settings.setValue(userC(), acc->_settingsMap.value(httpUserC()));
}
// Save accepted certificates.
@@ -280,14 +303,14 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
certs += cert.toPem() + '\n';
}
if (!certs.isEmpty()) {
- settings.setValue(QLatin1String(caCertsKeyC), certs);
+ settings.setValue(caCertsKeyC(), certs);
}
settings.endGroup();
}
AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
{
- auto urlConfig = settings.value(QLatin1String(urlC));
+ auto urlConfig = settings.value(urlC());
if (!urlConfig.isValid()) {
// No URL probably means a corrupted entry in the account settings
qCWarning(lcAccountManager) << "No URL for account " << settings.group();
@@ -305,7 +328,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
acc->setDefaultSyncRoot(settings.value(defaultSyncRootC()).toString());
// We want to only restore settings for that auth type and the user value
- acc->_settingsMap.insert(QLatin1String(userC), settings.value(userC));
+ acc->_settingsMap.insert(userC(), settings.value(userC()));
const QString authTypePrefix = QStringLiteral("http_");
const auto childKeys = settings.childKeys();
for (const auto &key : childKeys) {
@@ -317,7 +340,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
// now the server cert, it is in the general group
settings.beginGroup(QStringLiteral("General"));
- const auto certs = QSslCertificate::fromData(settings.value(caCertsKeyC).toByteArray());
+ const auto certs = QSslCertificate::fromData(settings.value(caCertsKeyC()).toByteArray());
qCInfo(lcAccountManager) << "Restored: " << certs.count() << " unknown certs.";
acc->setApprovedCerts(certs);
settings.endGroup();
@@ -366,7 +389,7 @@ void AccountManager::deleteAccount(AccountStatePtr account)
account->account()->credentials()->forgetSensitiveData();
account->account()->credentialManager()->clear();
- auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
+ auto settings = ConfigFile::settingsWithGroup(accountsC());
settings->remove(account->account()->id());
emit accountRemoved(account);
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 8b566f196..d42374a93 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -306,7 +306,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
path += info->_path;
}
menu->addAction(CommonStrings::showInWebBrowser(), [path, davUrl = info->_folder->webDavUrl(), this] {
- fetchPrivateLinkUrl(_accountState->account(), davUrl, path, this, [](const QString &url) {
+ fetchPrivateLinkUrl(_accountState->account(), davUrl, path, this, [](const QUrl &url) {
Utility::openBrowser(url, nullptr);
});
});
@@ -936,13 +936,13 @@ void AccountSettings::refreshSelectiveSyncStatus()
msg += QLatin1String(", ");
}
QString myFolder = (it);
- if (myFolder.endsWith('/')) {
+ if (myFolder.endsWith(QLatin1Char('/'))) {
myFolder.chop(1);
}
QModelIndex theIndx = _model->indexForPath(folder, myFolder);
if (theIndx.isValid()) {
msg += QStringLiteral("<a href=\"%1?folder=%2\">%1</a>")
- .arg(Utility::escape(myFolder), QUrl::toPercentEncoding(folder->id()));
+ .arg(Utility::escape(myFolder), QString::fromUtf8(QUrl::toPercentEncoding(QString::fromUtf8(folder->id()))));
} else {
msg += myFolder; // no link because we do not know the index yet.
}
diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index f89ac058a..72deb1b0f 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -324,10 +324,12 @@ void ActivityWidget::slotSendNotificationRequest(const QString &accountName, con
qCInfo(lcActivity) << "Server Notification Request " << verb << link << "on account" << accountName;
NotificationWidget *theSender = qobject_cast<NotificationWidget *>(sender());
- const QStringList validVerbs = { QStringLiteral("GET"),
- QStringLiteral("PUT"),
- QStringLiteral("POST"),
- QStringLiteral("DELETE") };
+ const QList<QByteArray> validVerbs = {
+ QByteArrayLiteral("GET"),
+ QByteArrayLiteral("PUT"),
+ QByteArrayLiteral("POST"),
+ QByteArrayLiteral("DELETE")
+ };
if (validVerbs.contains(verb)) {
if (auto acc = AccountManager::instance()->account(accountName)) {
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 64ccb604e..7c0fa4441 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -26,7 +26,6 @@
#include "common/asserts.h"
#include "common/version.h"
#include "common/vfs.h"
-#include "config.h"
#include "configfile.h"
#include "connectionvalidator.h"
#include "creds/abstractcredentials.h"
@@ -124,7 +123,7 @@ void migrateConfigFile(const QCoreApplication *app)
const auto filesList = QDir(oldDir).entryInfoList(QDir::Files);
qCInfo(lcApplication) << Q_FUNC_INFO << "Will move the individual files" << filesList;
for (const auto &fileInfo : filesList) {
- if (!QFile::rename(fileInfo.canonicalFilePath(), confDir + "/" + fileInfo.fileName())) {
+ if (!QFile::rename(fileInfo.canonicalFilePath(), confDir + QLatin1Char('/') + fileInfo.fileName())) {
qCWarning(lcApplication) << Q_FUNC_INFO << "Fallback move of " << fileInfo.fileName() << "also failed";
} else {
// we found a suitable config directory to migrate, hence we can stop here
@@ -184,7 +183,7 @@ bool Application::configVersionMigration()
QMessageBox box(
QMessageBox::Warning,
- APPLICATION_SHORTNAME,
+ Theme::instance()->appNameGUI(),
tr("Some settings were configured in newer versions of this client and "
"use features that are not available in this version.<br>"
"<br>"
@@ -234,7 +233,7 @@ Application::Application(int &argc, char **argv)
{
#ifdef Q_OS_WIN
// Ensure OpenSSL config file is only loaded from app directory
- const QString opensslConf = QCoreApplication::applicationDirPath() + QString("/openssl.cnf");
+ const QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf");
qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());
#elif defined(Q_OS_LINUX)
#if defined(OC_PLUGIN_DIR)
@@ -511,7 +510,7 @@ AccountStatePtr Application::addNewAccount(AccountPtr newAccount)
#ifdef Q_OS_MAC
// Don't auto start when not being 'installed'
shouldSetAutoStart = shouldSetAutoStart
- && QCoreApplication::applicationDirPath().startsWith("/Applications/");
+ && QCoreApplication::applicationDirPath().startsWith(QLatin1String("/Applications/"));
#endif
if (shouldSetAutoStart) {
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
@@ -578,7 +577,7 @@ static void displayHelpText(const QString &t, std::ostream &stream = std::cout)
stream << qUtf8Printable(t) << std::endl;
#ifdef Q_OS_WIN
// No console on Windows.
- QString spaces(80, ' '); // Add a line of non-wrapped space to make the messagebox wide enough.
+ QString spaces(80, QLatin1Char(' ')); // Add a line of non-wrapped space to make the messagebox wide enough.
QString text = QStringLiteral("<qt><pre style='white-space:pre-wrap'>")
+ t.toHtmlEscaped() + QStringLiteral("</pre><pre>") + spaces + QStringLiteral("</pre></qt>");
QMessageBox::information(0, Theme::instance()->appNameGUI(), text);
@@ -611,8 +610,8 @@ void Application::parseOptions(const QStringList &arguments)
return option;
};
- auto showSettingsOption = addOption({ { "s", "showsettings" }, tr("Show the settings dialog while starting.") });
- auto quitInstanceOption = addOption({ { "q", "quit" }, tr("Quit the running instance.") });
+ auto showSettingsOption = addOption({ { QStringLiteral("s"), QStringLiteral("showsettings") }, tr("Show the settings dialog while starting.") });
+ auto quitInstanceOption = addOption({ { QStringLiteral("q"), QStringLiteral("quit") }, tr("Quit the running instance.") });
auto logFileOption = addOption({ QStringLiteral("logfile"), tr("Write log to file (use - to write to stdout)."), QStringLiteral("filename") });
auto logDirOption = addOption({ QStringLiteral("logdir"), tr("Write each sync log output in a new file in folder."), QStringLiteral("name") });
auto logFlushOption = addOption({ QStringLiteral("logflush"), tr("Flush the log file after every write.") });
diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp
index d25aad8de..c35b5295d 100644
--- a/src/gui/creds/httpcredentialsgui.cpp
+++ b/src/gui/creds/httpcredentialsgui.cpp
@@ -136,11 +136,8 @@ void HttpCredentialsGui::showDialog()
QString HttpCredentialsGui::requestAppPasswordText(const Account *account)
{
- auto baseUrl = account->url().toString();
- if (baseUrl.endsWith('/'))
- baseUrl.chop(1);
return tr("<a href=\"%1\">Click here</a> to request an app password from the web interface.")
- .arg(Utility::concatUrlPath(baseUrl, QStringLiteral("/index.php/settings/personal?sectionid=security#apppasswords")).toString());
+ .arg(Utility::concatUrlPath(account->url(), QStringLiteral("/index.php/settings/personal?sectionid=security#apppasswords")).toString());
}
QUrl HttpCredentialsGui::authorisationLink() const
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index e7f30d44e..9c0fe60be 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -201,8 +201,8 @@ bool Folder::checkLocalPath()
if (_canonicalLocalPath.isEmpty()) {
qCWarning(lcFolder) << "Broken symlink:" << _definition.localPath();
_canonicalLocalPath = _definition.localPath();
- } else if (!_canonicalLocalPath.endsWith('/')) {
- _canonicalLocalPath.append('/');
+ } else if (!_canonicalLocalPath.endsWith(QLatin1Char('/'))) {
+ _canonicalLocalPath.append(QLatin1Char('/'));
}
QString error;
@@ -273,13 +273,13 @@ QString Folder::shortGuiLocalPath() const
{
QString p = _definition.localPath();
QString home = QDir::homePath();
- if (!home.endsWith('/')) {
- home.append('/');
+ if (!home.endsWith(QLatin1Char('/'))) {
+ home.append(QLatin1Char('/'));
}
if (p.startsWith(home)) {
p = p.mid(home.length());
}
- if (p.length() > 1 && p.endsWith('/')) {
+ if (p.length() > 1 && p.endsWith(QLatin1Char('/'))) {
p.chop(1);
}
return QDir::toNativeSeparators(p);
@@ -665,8 +665,7 @@ void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
//
// We do this before checking for our own sync-related changes to make
// extra sure to not miss relevant changes.
- const auto relativePathBytes = relativePath.toUtf8();
- _localDiscoveryTracker->addTouchedPath(relativePathBytes);
+ _localDiscoveryTracker->addTouchedPath(relativePath);
// The folder watcher fires a lot of bogus notifications during
// a sync operation, both for actual user files and the database
@@ -685,7 +684,7 @@ void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
SyncJournalFileRecord record;
- _journal.getFileRecord(relativePathBytes, &record);
+ _journal.getFileRecord(relativePath.toUtf8(), &record);
if (reason != ChangeReason::UnLock) {
// Check that the mtime/size actually changed or there was
// an attribute change (pin state) that caused the notification
@@ -822,7 +821,7 @@ void Folder::saveToSettings() const
settings->beginGroup(settingsGroup);
// Note: Each of these groups might have a "version" tag, but that's
// currently unused.
- settings->beginGroup(_definition.id());
+ settings->beginGroup(QString::fromUtf8(_definition.id()));
FolderDefinition::save(*settings, _definition);
settings->sync();
@@ -832,14 +831,15 @@ void Folder::saveToSettings() const
void Folder::removeFromSettings() const
{
auto settings = _accountState->settings();
+ const QString id = QString::fromUtf8(_definition.id());
settings->beginGroup(QStringLiteral("Folders"));
- settings->remove(_definition.id());
+ settings->remove(id);
settings->endGroup();
settings->beginGroup(QStringLiteral("Multifolders"));
- settings->remove(_definition.id());
+ settings->remove(id);
settings->endGroup();
settings->beginGroup(QStringLiteral("FoldersWithPlaceholders"));
- settings->remove(_definition.id());
+ settings->remove(id);
}
bool Folder::isFileExcludedAbsolute(const QString &fullPath) const
@@ -901,10 +901,10 @@ void Folder::wipeForRemoval()
}
// Also remove other db related files
- QFile::remove(stateDbFile + ".ctmp");
- QFile::remove(stateDbFile + "-shm");
- QFile::remove(stateDbFile + "-wal");
- QFile::remove(stateDbFile + "-journal");
+ QFile::remove(stateDbFile + QStringLiteral(".ctmp"));
+ QFile::remove(stateDbFile + QStringLiteral("-shm"));
+ QFile::remove(stateDbFile + QStringLiteral("-wal"));
+ QFile::remove(stateDbFile + QStringLiteral("-journal"));
_vfs->stop();
_vfs->unregisterFolder();
@@ -1182,7 +1182,7 @@ void Folder::slotNextSyncFullLocalDiscovery()
void Folder::schedulePathForLocalDiscovery(const QString &relativePath)
{
- _localDiscoveryTracker->addTouchedPath(relativePath.toUtf8());
+ _localDiscoveryTracker->addTouchedPath(relativePath);
}
void Folder::slotFolderConflicts(Folder *folder, const QStringList &conflictPaths)
@@ -1214,7 +1214,7 @@ void Folder::warnOnNewExcludedItem(const SyncJournalFileRecord &record, QStringV
auto blacklist = _journal.getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
if (!ok)
return;
- if (!blacklist.contains(path + "/"))
+ if (!blacklist.contains(path + QLatin1Char('/')))
return;
const auto message = fi.isDir()
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 530042cde..40875b9da 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -1005,8 +1005,8 @@ QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const Acco
// We'll be comparing against Folder::remotePath which always starts with /
QString serverPath = relPath;
- if (!serverPath.startsWith('/'))
- serverPath.prepend('/');
+ if (!serverPath.startsWith(QLatin1Char('/')))
+ serverPath.prepend(QLatin1Char('/'));
for (auto *folder : _folders) {
if (acc != nullptr && folder->accountState()->account() != acc) {
@@ -1015,7 +1015,7 @@ QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const Acco
if (!serverPath.startsWith(folder->remotePath()))
continue;
- QString path = folder->cleanPath() + '/';
+ QString path = folder->cleanPath() + QLatin1Char('/');
path += serverPath.midRef(folder->remotePathTrailingSlash().length());
if (QFile::exists(path)) {
re.append(path);
@@ -1267,7 +1267,7 @@ static QString canonicalPath(const QString &path)
return path;
}
- return canonicalPath(parentPath) + '/' + selFile.fileName();
+ return canonicalPath(parentPath) + QLatin1Char('/') + selFile.fileName();
}
return selFile.canonicalFilePath();
}
@@ -1277,9 +1277,9 @@ QString FolderMan::checkPathValidityForNewFolder(const QString &path) const
// check if the local directory isn't used yet in another ownCloud sync
const auto cs = Utility::fsCaseSensitivity();
- const QString userDir = QDir::cleanPath(canonicalPath(path)) + '/';
+ const QString userDir = QDir::cleanPath(canonicalPath(path)) + QLatin1Char('/');
for (auto f : _folders) {
- const QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + '/';
+ const QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + QLatin1Char('/');
if (QString::compare(folderDir, userDir, cs) == 0) {
return tr("There is already a sync from the server to this local folder. "
@@ -1444,7 +1444,7 @@ Folder *FolderMan::addFolderFromWizard(AccountStatePtr accountStatePtr, const QS
Folder *FolderMan::addFolderFromFolderWizardResult(AccountStatePtr accountStatePtr, const FolderWizard::Result &config)
{
- return addFolderFromWizard(accountStatePtr, config.localPath, config.remotePath, config.davUrl.toString(), config.displayName, config.useVirtualFiles);
+ return addFolderFromWizard(accountStatePtr, config.localPath, config.remotePath, config.davUrl, config.displayName, config.useVirtualFiles);
}
QString FolderMan::suggestSyncFolder(const QUrl &server, const QString &displayName)
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 831f1e9cc..03678992b 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -43,7 +43,7 @@ namespace {
static QString removeTrailingSlash(const QString &s)
{
- if (s.endsWith('/')) {
+ if (s.endsWith(QLatin1Char('/'))) {
return s.left(s.size() - 1);
}
return s;
@@ -429,7 +429,7 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) cons
return QModelIndex();
}
- int slashPos = path.lastIndexOf('/');
+ int slashPos = path.lastIndexOf(QLatin1Char('/'));
if (slashPos == -1) {
// first level folder
for (int i = 0; i < _folders.size(); ++i) {
@@ -657,8 +657,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
QUrl url = parentInfo->_folder->remoteUrl();
QString pathToRemove = url.path();
- if (!pathToRemove.endsWith('/'))
- pathToRemove += '/';
+ if (!pathToRemove.endsWith(QLatin1Char('/')))
+ pathToRemove += QLatin1Char('/');
QStringList selectiveSyncBlackList;
bool ok1 = true;
@@ -703,7 +703,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
newInfo._size = job->sizes().value(path);
newInfo._isExternal = permissionMap.value(removeTrailingSlash(path)).toString().contains(QLatin1String("M"));
newInfo._path = relativePath;
- newInfo._name = removeTrailingSlash(relativePath).split('/').last();
+ newInfo._name = removeTrailingSlash(relativePath).split(QLatin1Char('/')).last();
if (relativePath.isEmpty())
continue;
diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp
index 0391d3d34..0c887bc3f 100644
--- a/src/gui/folderwatcher_linux.cpp
+++ b/src/gui/folderwatcher_linux.cpp
@@ -200,7 +200,7 @@ void FolderWatcherPrivate::removeFoldersBelow(const QString &path)
if (it == _pathToWatch.end())
return;
- const QString pathSlash = path + '/';
+ const QString pathSlash = path + QLatin1Char('/');
// Remove the entry and all subentries
while (it != _pathToWatch.end()) {
diff --git a/src/gui/folderwizard/CMakeLists.txt b/src/gui/folderwizard/CMakeLists.txt
index 70549a14e..b5bfabc91 100644
--- a/src/gui/folderwizard/CMakeLists.txt
+++ b/src/gui/folderwizard/CMakeLists.txt
@@ -14,13 +14,5 @@ add_library(folderwizard STATIC
target_link_libraries(folderwizard PUBLIC Qt5::Widgets libsync)
set_target_properties(folderwizard PROPERTIES AUTOUIC ON AUTORCC ON)
-target_compile_definitions(folderwizard
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+apply_common_target_settings(folderwizard)
+
diff --git a/src/gui/guiutility_unix.cpp b/src/gui/guiutility_unix.cpp
index e3f409c3e..7d91d3fb8 100644
--- a/src/gui/guiutility_unix.cpp
+++ b/src/gui/guiutility_unix.cpp
@@ -29,8 +29,7 @@ void Utility::startShellIntegration()
QString Utility::socketApiSocketPath()
{
- QString runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
- return runtimeDir + "/" + Theme::instance()->appName() + "/socket";
+ return QStringLiteral("%1/%2/socket").arg(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation), Theme::instance()->appName());
}
} // namespace OCC
diff --git a/src/gui/ignorelisteditor.cpp b/src/gui/ignorelisteditor.cpp
index 6a29229b6..f5ff92168 100644
--- a/src/gui/ignorelisteditor.cpp
+++ b/src/gui/ignorelisteditor.cpp
@@ -104,7 +104,7 @@ void IgnoreListEditor::slotUpdateLocalIgnoreList()
QByteArray prepend;
if (deletableItem->checkState() == Qt::Checked) {
prepend = "]";
- } else if (patternItem->text().startsWith('#')) {
+ } else if (patternItem->text().startsWith(QLatin1Char('#'))) {
prepend = "\\";
}
ignores.write(prepend + patternItem->text().toUtf8() + '\n');
@@ -167,7 +167,7 @@ void IgnoreListEditor::readIgnoreFile(const QString &file, bool global)
}
bool deletable = false;
- if (line.startsWith(']')) {
+ if (line.startsWith(QLatin1Char(']'))) {
deletable = true;
line = line.mid(1);
}
diff --git a/src/gui/loginrequireddialog/CMakeLists.txt b/src/gui/loginrequireddialog/CMakeLists.txt
index 43ecef8af..6119d99f8 100644
--- a/src/gui/loginrequireddialog/CMakeLists.txt
+++ b/src/gui/loginrequireddialog/CMakeLists.txt
@@ -13,13 +13,5 @@ add_library(loginrequireddialog STATIC
target_link_libraries(loginrequireddialog PUBLIC Qt5::Widgets libsync)
set_target_properties(loginrequireddialog PROPERTIES AUTOUIC ON AUTORCC ON)
target_include_directories(loginrequireddialog PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
-target_compile_definitions(loginrequireddialog
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+apply_common_target_settings(loginrequireddialog)
+
diff --git a/src/gui/navigationpanehelper.cpp b/src/gui/navigationpanehelper.cpp
index 969b34abb..c671fe359 100644
--- a/src/gui/navigationpanehelper.cpp
+++ b/src/gui/navigationpanehelper.cpp
@@ -85,14 +85,14 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
entriesToRemove.removeOne(folder->navigationPaneClsid());
QString clsidStr = folder->navigationPaneClsid().toString();
- QString clsidPath = QString() % "Software\\Classes\\CLSID\\" % clsidStr;
- QString clsidPathWow64 = QString() % "Software\\Classes\\Wow6432Node\\CLSID\\" % clsidStr;
- QString namespacePath = QString() % "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\" % clsidStr;
+ QString clsidPath = QStringLiteral("Software\\Classes\\CLSID\\%1").arg(clsidStr);
+ QString clsidPathWow64 = QStringLiteral("Software\\Classes\\Wow6432Node\\CLSID\\%1").arg(clsidStr);
+ QString namespacePath = QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\%1").arg(clsidStr);
QString title = folder->displayName();
// Write the account name in the sidebar only when using more than one account.
if (AccountManager::instance()->accounts().size() > 1)
- title = title % " - " % folder->accountState()->account()->displayName();
+ title = title % QStringLiteral(" - ") % folder->accountState()->account()->displayName();
QString iconPath = QDir::toNativeSeparators(qApp->applicationFilePath());
QString targetFolderPath = QDir::toNativeSeparators(folder->cleanPath());
@@ -143,9 +143,9 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
// Then remove anything that isn't in our folder list anymore.
for (const auto &clsid : qAsConst(entriesToRemove)) {
QString clsidStr = clsid.toString();
- QString clsidPath = QString() % "Software\\Classes\\CLSID\\" % clsidStr;
- QString clsidPathWow64 = QString() % "Software\\Classes\\Wow6432Node\\CLSID\\" % clsidStr;
- QString namespacePath = QString() % "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\" % clsidStr;
+ QString clsidPath = QStringLiteral("Software\\Classes\\CLSID\\%1").arg(clsidStr);
+ QString clsidPathWow64 = QStringLiteral("Software\\Classes\\Wow6432Node\\CLSID\\%1").arg(clsidStr);
+ QString namespacePath = QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\%1").arg(clsidStr);
qCInfo(lcNavPane) << "Explorer Cloud storage provider: now unused, removing own CLSID" << clsidStr;
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, clsidPath);
diff --git a/src/gui/newwizard/CMakeLists.txt b/src/gui/newwizard/CMakeLists.txt
index f8055318b..7824a5d34 100644
--- a/src/gui/newwizard/CMakeLists.txt
+++ b/src/gui/newwizard/CMakeLists.txt
@@ -57,13 +57,4 @@ add_library(newwizard STATIC
target_link_libraries(newwizard PUBLIC Qt5::Widgets libsync)
set_target_properties(newwizard PROPERTIES AUTOUIC ON AUTORCC ON)
target_include_directories(newwizard PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
-target_compile_definitions(newwizard
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+apply_common_target_settings(newwizard)
diff --git a/src/gui/openfilemanager.cpp b/src/gui/openfilemanager.cpp
index faaacff20..d7a391cdb 100644
--- a/src/gui/openfilemanager.cpp
+++ b/src/gui/openfilemanager.cpp
@@ -41,7 +41,7 @@ static QStringList xdgDataDirs()
// local location
QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME"));
if (xdgDataHome.isEmpty()) {
- xdgDataHome = QDir::homePath() + "/.local/share";
+ xdgDataHome = QDir::homePath() + QStringLiteral("/.local/share");
}
dirs.prepend(xdgDataHome);
return dirs;
@@ -131,7 +131,7 @@ void showInFileManager(const QString &localPath)
QString pathToOpen = QFileInfo(localPath).absolutePath();
bool canHandleFile = false; // assume dumb fm
- args = exec.split(' ');
+ args = exec.split(QLatin1Char(' '));
if (args.count() > 0)
app = args.takeFirst();
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 8527f6ebd..5d9094919 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -572,7 +572,7 @@ void ownCloudGui::setupContextMenu()
|| desktopSession.contains("plasma")
|| desktopSession.contains("kde");
QObject *platformMenu = reinterpret_cast<QObject *>(_tray->contextMenu()->platformMenu());
- if (isKde && platformMenu && platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) {
+ if (isKde && platformMenu && platformMenu->metaObject()->className() == QByteArrayLiteral("QDBusPlatformMenu")) {
_workaroundManualVisibility = true;
_workaroundNoAboutToShowUpdate = true;
}
@@ -930,7 +930,7 @@ void ownCloudGui::slotUpdateProgress(Folder *folder, const ProgressInfo &progres
QString timeStr = QTime::currentTime().toString(QStringLiteral("hh:mm"));
QString actionText = tr("%1 (%2, %3)").arg(progress._lastCompletedItem._file, kindStr, timeStr);
QAction *action = new QAction(actionText, this);
- QString fullPath = folder->path() + '/' + progress._lastCompletedItem._file;
+ QString fullPath = folder->path() + QLatin1Char('/') + progress._lastCompletedItem._file;
if (QFile(fullPath).exists()) {
connect(action, &QAction::triggered, this, [this, fullPath] { this->slotOpenPath(fullPath); });
} else {
diff --git a/src/gui/protocolwidget.cpp b/src/gui/protocolwidget.cpp
index a8f3cac7a..30af24c7a 100644
--- a/src/gui/protocolwidget.cpp
+++ b/src/gui/protocolwidget.cpp
@@ -130,7 +130,7 @@ void ProtocolWidget::showContextMenu(QWidget *parent, ProtocolItemModel *model,
}
// "Open in Browser" action
{
- fetchPrivateLinkUrl(data.folder()->accountState()->account(), data.folder()->webDavUrl(), data.folder()->remotePathTrailingSlash() + data.path(), parent, [parent, menu = QPointer<QMenu>(menu)](const QString &url) {
+ fetchPrivateLinkUrl(data.folder()->accountState()->account(), data.folder()->webDavUrl(), data.folder()->remotePathTrailingSlash() + data.path(), parent, [parent, menu = QPointer<QMenu>(menu)](const QUrl &url) {
// as fetchPrivateLinkUrl is async we need to check the menu still exists
if (menu) {
menu->addAction(CommonStrings::showInWebBrowser(), parent, [url, parent] {
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index 45d552a08..2d68cd010 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -144,7 +144,7 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p
QFileIconProvider prov;
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
if (pathTrail.size() == 0) {
- if (path.endsWith('/')) {
+ if (path.endsWith(QLatin1Char('/'))) {
path.chop(1);
}
parent->setToolTip(0, path);
@@ -157,7 +157,7 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p
|| parent->checkState(0) == Qt::PartiallyChecked) {
item->setCheckState(0, Qt::Checked);
for (const auto &str : qAsConst(_oldBlackList)) {
- if (str == path || str == QLatin1String("/")) {
+ if (str == path || str == QLatin1Char('/')) {
item->setCheckState(0, Qt::Unchecked);
break;
} else if (str.startsWith(path)) {
@@ -235,11 +235,11 @@ void SelectiveSyncWidget::slotUpdateDirectories(QStringList list)
for (auto path : qAsConst(list)) {
auto size = job ? job->sizes().value(path) : 0;
path.remove(pathToRemove);
- const QStringList paths = path.split('/', Qt::SkipEmptyParts);
+ const QStringList paths = path.split(QLatin1Char('/'), Qt::SkipEmptyParts);
if (paths.isEmpty())
continue;
- if (!path.endsWith('/')) {
- path.append('/');
+ if (!path.endsWith(QLatin1Char('/'))) {
+ path.append(QLatin1Char('/'));
}
recursiveInsert(root, paths, path, size);
}
@@ -348,7 +348,7 @@ QStringList SelectiveSyncWidget::createBlackList(QTreeWidgetItem *root) const
switch (root->checkState(0)) {
case Qt::Unchecked:
- return QStringList(root->data(0, Qt::UserRole).toString() + "/");
+ return QStringList(root->data(0, Qt::UserRole).toString() + QLatin1Char('/'));
case Qt::Checked:
return QStringList();
case Qt::PartiallyChecked:
@@ -419,7 +419,7 @@ SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, Folder *folder, QWi
init(account);
QStringList selectiveSyncList = _folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
if (ok) {
- _selectiveSync->setFolderInfo(_folder->remotePath(), _folder->id(), selectiveSyncList);
+ _selectiveSync->setFolderInfo(_folder->remotePath(), QStringLiteral("/"), selectiveSyncList);
} else {
_okButton->setEnabled(false);
}
diff --git a/src/gui/servernotificationhandler.cpp b/src/gui/servernotificationhandler.cpp
index 22073fbb6..e6b753a2e 100644
--- a/src/gui/servernotificationhandler.cpp
+++ b/src/gui/servernotificationhandler.cpp
@@ -94,7 +94,7 @@ void ServerNotificationHandler::slotNotificationsReceived(JsonApiJob *job, const
// https://github.com/owncloud/notifications/blob/master/docs/ocs-endpoint-v1.md#deleting-a-notification-for-a-user
ActivityLink al;
al._label = tr("Dismiss");
- al._link = Utility::concatUrlPath(accountState->account()->url(), notificationsPath + "/" + QString::number(id)).toString();
+ al._link = Utility::concatUrlPath(Utility::concatUrlPath(accountState->account()->url(), notificationsPath), QString::number(id)).toString();
al._verb = "DELETE";
al._isPrimary = false;
linkList.append(al);
diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp
index d22060fe8..908e3863c 100644
--- a/src/gui/sharee.cpp
+++ b/src/gui/sharee.cpp
@@ -72,10 +72,10 @@ void ShareeModel::fetch(const QString &search, const ShareeSet &blacklist)
_search = search;
_shareeBlacklist = blacklist;
const JsonApiJob::UrlQuery query {
- { "search", search },
- { "itemType", _type },
- { "page", "1" },
- { "perPage", "50" }
+ { QStringLiteral("search"), search },
+ { QStringLiteral("itemType"), _type },
+ { QStringLiteral("page"), QStringLiteral("1") },
+ { QStringLiteral("perPage"), QStringLiteral("50") }
};
auto *job = new JsonApiJob(_account, QStringLiteral("ocs/v1.php/apps/files_sharing/api/v1/sharees"), query, {}, this);
@@ -229,7 +229,7 @@ QVariant ShareeModel::data(const QModelIndex &index, int role) const
// the full name and the user name and thus we include both
// in the output here. But we need to take care this string
// doesn't leak to the user.
- return QString(sharee->displayName() + " (" + sharee->shareWith() + ")");
+ return QStringLiteral("%1 (%2)").arg(sharee->displayName(), sharee->shareWith());
} else if (role == Qt::UserRole) {
return QVariant::fromValue(sharee);
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp
index b7590a36f..580ae6244 100644
--- a/src/gui/sharelinkwidget.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -572,7 +572,7 @@ void ShareLinkWidget::slotCheckBoxExpireClicked()
void ShareLinkWidget::emailShareLink(const QUrl &url)
{
- QString fileName = _sharePath.mid(_sharePath.lastIndexOf('/') + 1);
+ QString fileName = _sharePath.mid(_sharePath.lastIndexOf(QLatin1Char('/')) + 1);
Utility::openEmailComposer(
tr("I shared %1 with you").arg(fileName),
url.toString(),
diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp
index fa4e5e58d..5768aed8e 100644
--- a/src/gui/sharemanager.cpp
+++ b/src/gui/sharemanager.cpp
@@ -34,7 +34,7 @@ static void updateFolder(const AccountPtr &account, const QString &path)
if (f->accountState()->account() != account)
continue;
auto folderPath = f->remotePath();
- if (path.startsWith(folderPath) && (path == folderPath || folderPath.endsWith('/') || path[folderPath.size()] == '/')) {
+ if (path.startsWith(folderPath) && (path == folderPath || folderPath.endsWith(QLatin1Char('/')) || path[folderPath.size()] == QLatin1Char('/'))) {
// Workaround the fact that the server does not invalidate the etags of parent directories
// when something is shared.
auto relative = path.midRef(f->remotePathTrailingSlash().length());
@@ -129,7 +129,7 @@ QUrl LinkShare::getLink() const
QUrl LinkShare::getDirectDownloadLink() const
{
QUrl url = _url;
- url.setPath(url.path() + "/download");
+ url.setPath(url.path() + QStringLiteral("/download"));
return url;
}
@@ -359,15 +359,7 @@ void ShareManager::fetchShares(const QString &path)
QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QJsonObject &data)
{
- QUrl url;
-
- // From ownCloud server 8.2 the url field is always set for public shares
- if (data.contains(QStringLiteral("url"))) {
- url = QUrl(data.value(QStringLiteral("url")).toString());
- } else {
- // From ownCloud server version 8 on, a different share link scheme is used.
- url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("index.php/s/") + data.value(QStringLiteral("token")).toString())).toString();
- }
+ const QUrl url(data.value(QStringLiteral("url")).toString());
QDate expireDate;
if (data.value(QStringLiteral("expiration")).isString()) {
diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index 41adf3aeb..f8a0982ba 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -322,7 +322,7 @@ void ShareUserGroupWidget::displayError(int code, const QString &message)
void ShareUserGroupWidget::slotPrivateLinkOpenBrowser()
{
- Utility::openBrowser(_privateLinkUrl, this);
+ Utility::openBrowser(QUrl(_privateLinkUrl), this);
}
void ShareUserGroupWidget::slotPrivateLinkCopy()
diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp
index 6603434b0..61aa8d95a 100644
--- a/src/gui/socketapi/socketapi.cpp
+++ b/src/gui/socketapi/socketapi.cpp
@@ -317,18 +317,18 @@ void SocketApi::slotReadSocket()
qCInfo(lcSocketApi) << "Received SocketAPI message <--" << line << "from" << socket;
const int argPos = line.indexOf(QLatin1Char(':'));
- const QByteArray command = line.midRef(0, argPos).toUtf8().toUpper();
+ const QString command = line.mid(0, argPos).toUpper();
const int indexOfMethod = [&] {
QByteArray functionWithArguments = QByteArrayLiteral("command_");
- if (command.startsWith("ASYNC_")) {
- functionWithArguments += command + QByteArrayLiteral("(QSharedPointer<SocketApiJob>)");
- } else if (command.startsWith("V2/")) {
- functionWithArguments += QByteArrayLiteral("V2_") + command.mid(3) + QByteArrayLiteral("(QSharedPointer<SocketApiJobV2>)");
+ if (command.startsWith(QLatin1String("ASYNC_"))) {
+ functionWithArguments += command.toUtf8() + QByteArrayLiteral("(QSharedPointer<SocketApiJob>)");
+ } else if (command.startsWith(QLatin1String("V2/"))) {
+ functionWithArguments += QByteArrayLiteral("V2_") + command.mid(3).toUtf8() + QByteArrayLiteral("(QSharedPointer<SocketApiJobV2>)");
} else {
- functionWithArguments += command + QByteArrayLiteral("(QString,SocketListener*)");
+ functionWithArguments += command.toUtf8() + QByteArrayLiteral("(QString,SocketListener*)");
}
- Q_ASSERT(staticQtMetaObject.normalizedSignature(functionWithArguments) == functionWithArguments);
- const auto out = staticMetaObject.indexOfMethod(functionWithArguments);
+ Q_ASSERT(staticQtMetaObject.normalizedSignature(functionWithArguments.constData()) == functionWithArguments);
+ const auto out = staticMetaObject.indexOfMethod(functionWithArguments.constData());
if (out == -1) {
listener->sendError(QStringLiteral("Function %1 not found").arg(QString::fromUtf8(functionWithArguments)));
}
@@ -337,8 +337,8 @@ void SocketApi::slotReadSocket()
}();
const auto argument = argPos != -1 ? line.midRef(argPos + 1) : QStringRef();
- if (command.startsWith("ASYNC_")) {
- auto arguments = argument.split('|');
+ if (command.startsWith(QLatin1String("ASYNC_"))) {
+ auto arguments = argument.split(QLatin1Char('|'));
if (arguments.size() != 2) {
listener->sendError(QStringLiteral("argument count is wrong"));
return;
@@ -359,7 +359,7 @@ void SocketApi::slotReadSocket()
<< "with argument:" << argument;
socketApiJob->reject(QStringLiteral("command not found"));
}
- } else if (command.startsWith("V2/")) {
+ } else if (command.startsWith(QLatin1String("V2/"))) {
QJsonParseError error;
const auto json = QJsonDocument::fromJson(argument.toUtf8(), &error).object();
if (error.error != QJsonParseError::NoError) {
@@ -523,8 +523,8 @@ void SocketApi::processShareRequest(const QString &localFile, SocketListener *li
void SocketApi::broadcastStatusPushMessage(const QString &systemPath, SyncFileStatus fileStatus)
{
QString msg = buildMessage(QStringLiteral("STATUS"), systemPath, fileStatus.toSocketAPIString());
- Q_ASSERT(!systemPath.endsWith('/'));
- uint directoryHash = qHash(systemPath.left(systemPath.lastIndexOf('/')));
+ Q_ASSERT(!systemPath.endsWith(QLatin1Char('/')));
+ uint directoryHash = qHash(systemPath.left(systemPath.lastIndexOf(QLatin1Char('/'))));
for (const auto &listener : qAsConst(_listeners)) {
listener->sendMessageIfDirectoryMonitored(msg, directoryHash);
}
@@ -547,7 +547,7 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString &argument, SocketList
} else {
// The user probably visited this directory in the file shell.
// Let the listener know that it should now send status pushes for sibblings of this file.
- QString directory = fileData.localPath.left(fileData.localPath.lastIndexOf('/'));
+ QString directory = fileData.localPath.left(fileData.localPath.lastIndexOf(QLatin1Char('/')));
listener->registerMonitoredDirectory(qHash(directory));
statusString = fileData.syncFileStatus().toSocketAPIString();
@@ -680,14 +680,14 @@ void SocketApi::command_COPY_PUBLIC_LINK(const QString &localFile, SocketListene
AccountPtr account = fileData.folder->accountState()->account();
auto job = new GetOrCreatePublicLinkShare(account, fileData.serverRelativePath, this);
connect(job, &GetOrCreatePublicLinkShare::done, this,
- [](const QString &url) { copyUrlToClipboard(url); });
+ [](const QString &url) { copyUrlToClipboard(QUrl(url)); });
connect(job, &GetOrCreatePublicLinkShare::error, this,
[=]() { emit shareCommandReceived(fileData.serverRelativePath, fileData.localPath, ShareDialogStartPage::PublicLinks); });
job->run();
}
// Fetches the private link url asynchronously and then calls the target slot
-void SocketApi::fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QString &url)> &targetFun)
+void SocketApi::fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QUrl &url)> &targetFun)
{
auto fileData = FileData::get(localFile);
if (!fileData.folder) {
@@ -724,7 +724,7 @@ void SocketApi::command_OPEN_PRIVATE_LINK(const QString &localFile, SocketListen
void SocketApi::command_OPEN_PRIVATE_LINK_VERSIONS(const QString &localFile, SocketListener *)
{
- auto openVersionsLink = [](const QString &link) {
+ auto openVersionsLink = [](const QUrl &link) {
QUrl url(link);
QUrlQuery query(url);
query.addQueryItem(QStringLiteral("details"), QStringLiteral("versionsTabView"));
@@ -734,9 +734,9 @@ void SocketApi::command_OPEN_PRIVATE_LINK_VERSIONS(const QString &localFile, Soc
fetchPrivateLinkUrlHelper(localFile, openVersionsLink);
}
-void SocketApi::copyUrlToClipboard(const QString &link)
+void SocketApi::copyUrlToClipboard(const QUrl &link)
{
- QApplication::clipboard()->setText(link);
+ QApplication::clipboard()->setText(link.toString());
}
void SocketApi::command_MAKE_AVAILABLE_LOCALLY(const QString &filesArg, SocketListener *)
@@ -810,7 +810,7 @@ void SocketApi::command_MOVE_ITEM(const QString &localFile, SocketListener *)
// If it's a conflict, we want to save it under the base name by default
if (Utility::isConflictFile(defaultDirAndName)) {
- defaultDirAndName = fileData.folder->journalDb()->conflictFileBaseName(fileData.folderRelativePath.toUtf8());
+ defaultDirAndName = QString::fromUtf8(fileData.folder->journalDb()->conflictFileBaseName(fileData.folderRelativePath.toUtf8()));
}
// If the parent doesn't accept new files, go to the root of the sync folder
@@ -896,30 +896,30 @@ void SocketApi::command_V2_GET_CLIENT_ICON(const QSharedPointer<SocketApiJobV2>
job->success({ { QStringLiteral("png"), QString::fromUtf8(data) } });
}
-void SocketApi::emailPrivateLink(const QString &link)
+void SocketApi::emailPrivateLink(const QUrl &link)
{
Utility::openEmailComposer(
tr("I shared something with you"),
- link,
+ link.toString(),
nullptr);
}
-void OCC::SocketApi::openPrivateLink(const QString &link)
+void OCC::SocketApi::openPrivateLink(const QUrl &link)
{
Utility::openBrowser(link, nullptr);
}
void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *listener)
{
- static std::array<std::pair<const char *, QString>, 5> strings { {
- { "SHARE_MENU_TITLE", tr("Share...") },
- { "CONTEXT_MENU_TITLE", Theme::instance()->appNameGUI() },
- { "COPY_PRIVATE_LINK_MENU_TITLE", tr("Copy private link to clipboard") },
- { "EMAIL_PRIVATE_LINK_MENU_TITLE", tr("Send private link by email...") },
+ static std::array<std::pair<QString, QString>, 5> strings { {
+ { QStringLiteral("SHARE_MENU_TITLE"), tr("Share...") },
+ { QStringLiteral("CONTEXT_MENU_TITLE"), Theme::instance()->appNameGUI() },
+ { QStringLiteral("COPY_PRIVATE_LINK_MENU_TITLE"), tr("Copy private link to clipboard") },
+ { QStringLiteral("EMAIL_PRIVATE_LINK_MENU_TITLE"), tr("Send private link by email...") },
} };
listener->sendMessage(QStringLiteral("GET_STRINGS:BEGIN"));
for (auto key_value : strings) {
- if (argument.isEmpty() || argument == QLatin1String(key_value.first)) {
+ if (argument.isEmpty() || argument == key_value.first) {
listener->sendMessage(QStringLiteral("STRING:%1:%2").arg(key_value.first, key_value.second));
}
}
@@ -1013,7 +1013,7 @@ SyncJournalFileRecord SocketApi::FileData::journalRecord() const
SocketApi::FileData SocketApi::FileData::parentFolder() const
{
- return FileData::get(QFileInfo(localPath).dir().path().toUtf8());
+ return FileData::get(QFileInfo(localPath).dir().path());
}
void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListener *listener)
@@ -1371,7 +1371,7 @@ void SocketApiJob::resolve(const QString &response)
void SocketApiJob::resolve(const QJsonObject &response)
{
- resolve(QJsonDocument { response }.toJson());
+ resolve(QString::fromUtf8(QJsonDocument { response }.toJson()));
}
void SocketApiJob::reject(const QString &response)
@@ -1379,7 +1379,7 @@ void SocketApiJob::reject(const QString &response)
_socketListener->sendMessage(QStringLiteral("REJECT|") + _jobId + QLatin1Char('|') + response);
}
-SocketApiJobV2::SocketApiJobV2(const QSharedPointer<SocketListener> &socketListener, const QByteArray &command, const QJsonObject &arguments)
+SocketApiJobV2::SocketApiJobV2(const QSharedPointer<SocketListener> &socketListener, const QString &command, const QJsonObject &arguments)
: _socketListener(socketListener)
, _command(command)
, _jobId(arguments[QStringLiteral("id")].toString())
@@ -1404,7 +1404,7 @@ void SocketApiJobV2::doFinish(const QJsonObject &obj) const
if (!_warning.isEmpty()) {
data[QStringLiteral("warning")] = _warning;
}
- _socketListener->sendMessage(_command + QStringLiteral("_RESULT:") + QJsonDocument(data).toJson(QJsonDocument::Compact));
+ _socketListener->sendMessage(_command + QStringLiteral("_RESULT:") + QString::fromUtf8(QJsonDocument(data).toJson(QJsonDocument::Compact)));
Q_EMIT finished();
}
diff --git a/src/gui/socketapi/socketapi.h b/src/gui/socketapi/socketapi.h
index 01174d859..7120885be 100644
--- a/src/gui/socketapi/socketapi.h
+++ b/src/gui/socketapi/socketapi.h
@@ -71,9 +71,9 @@ private slots:
void slotNewConnection();
void slotReadSocket();
- static void copyUrlToClipboard(const QString &link);
- static void emailPrivateLink(const QString &link);
- static void openPrivateLink(const QString &link);
+ static void copyUrlToClipboard(const QUrl &link);
+ static void emailPrivateLink(const QUrl &link);
+ static void openPrivateLink(const QUrl &link);
private:
// Helper structure for getting information on a file
@@ -136,7 +136,7 @@ private:
Q_INVOKABLE void command_V2_GET_CLIENT_ICON(const QSharedPointer<SocketApiJobV2> &job) const;
// Fetch the private link and call targetFun
- void fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QString &url)> &targetFun);
+ void fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QUrl &url)> &targetFun);
/** Sends translated/branded strings that may be useful to the integration */
Q_INVOKABLE void command_GET_STRINGS(const QString &argument, SocketListener *listener);
diff --git a/src/gui/socketapi/socketapi_p.h b/src/gui/socketapi/socketapi_p.h
index fd7ee953d..a8c98c8e2 100644
--- a/src/gui/socketapi/socketapi_p.h
+++ b/src/gui/socketapi/socketapi_p.h
@@ -142,13 +142,13 @@ class SocketApiJobV2 : public QObject
{
Q_OBJECT
public:
- explicit SocketApiJobV2(const QSharedPointer<SocketListener> &socketListener, const QByteArray &command, const QJsonObject &arguments);
+ explicit SocketApiJobV2(const QSharedPointer<SocketListener> &socketListener, const QString &command, const QJsonObject &arguments);
void success(const QJsonObject &response) const;
void failure(const QString &error) const;
const QJsonObject &arguments() const { return _arguments; }
- QByteArray command() const { return _command; }
+ QString command() const { return _command; }
QString warning() const;
void setWarning(const QString &warning);
@@ -160,7 +160,7 @@ private:
void doFinish(const QJsonObject &obj) const;
QSharedPointer<SocketListener> _socketListener;
- const QByteArray _command;
+ const QString _command;
QString _jobId;
QJsonObject _arguments;
QString _warning;
diff --git a/src/gui/spaces/CMakeLists.txt b/src/gui/spaces/CMakeLists.txt
index ae24f4d19..6f29a71a1 100644
--- a/src/gui/spaces/CMakeLists.txt
+++ b/src/gui/spaces/CMakeLists.txt
@@ -2,13 +2,4 @@ add_library(spaces STATIC
spacesmodel.cpp spacesbrowser.cpp spacesbrowser.ui)
target_link_libraries(spaces PUBLIC Qt5::Widgets libsync)
set_target_properties(spaces PROPERTIES AUTOUIC ON AUTORCC ON)
-target_compile_definitions(spaces
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+apply_common_target_settings(spaces)
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp
index e25c89023..f43d42e94 100644
--- a/src/gui/systray.cpp
+++ b/src/gui/systray.cpp
@@ -21,9 +21,23 @@
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusPendingCall>
-#define NOTIFICATIONS_SERVICE "org.freedesktop.Notifications"
-#define NOTIFICATIONS_PATH "/org/freedesktop/Notifications"
-#define NOTIFICATIONS_IFACE "org.freedesktop.Notifications"
+
+namespace {
+auto NOTIFICATIONS_SERVICE_C()
+{
+ return QStringLiteral("org.freedesktop.Notifications");
+}
+
+auto NOTIFICATIONS_PATH_C()
+{
+ return QStringLiteral("/org/freedesktop/Notifications");
+}
+
+auto NOTIFICATIONS_IFACE_C()
+{
+ return QStringLiteral("org.freedesktop.Notifications");
+}
+}
#endif
namespace OCC {
@@ -60,10 +74,10 @@ void Systray::showMessage(const QString &title, const QString &message, const QI
sendOsXUserNotification(title, message);
#else
#ifdef USE_FDO_NOTIFICATIONS
- if (QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) {
- QList<QVariant> args = QList<QVariant>() << APPLICATION_NAME << quint32(0) << APPLICATION_ICON_NAME
+ if (QDBusInterface(NOTIFICATIONS_SERVICE_C(), NOTIFICATIONS_PATH_C(), NOTIFICATIONS_IFACE_C()).isValid()) {
+ QList<QVariant> args = QList<QVariant>() << Theme::instance()->appNameGUI() << quint32(0) << QStringLiteral(APPLICATION_ICON_NAME)
<< title << message << QStringList() << QVariantMap() << qint32(-1);
- QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE, QStringLiteral("Notify"));
+ QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE_C(), NOTIFICATIONS_PATH_C(), NOTIFICATIONS_IFACE_C(), QStringLiteral("Notify"));
method.setArguments(args);
QDBusConnection::sessionBus().asyncCall(method);
} else
diff --git a/src/gui/tlserrordialog.cpp b/src/gui/tlserrordialog.cpp
index ce598e621..4ffa0e1f5 100644
--- a/src/gui/tlserrordialog.cpp
+++ b/src/gui/tlserrordialog.cpp
@@ -57,7 +57,7 @@ TlsErrorDialog::~TlsErrorDialog()
QString TlsErrorDialog::describeCertificateHtml(const QSslCertificate &certificate)
{
auto formatFingerprint = [certificate](QCryptographicHash::Algorithm algorithm) {
- return Utility::escape(certificate.digest(algorithm).toHex());
+ return Utility::escape(QString::fromUtf8(certificate.digest(algorithm).toHex()));
};
auto formatInfo = [](const QStringList &stringList) {
diff --git a/src/gui/translations.cpp b/src/gui/translations.cpp
index 5f0bbaa8d..49d2eb4e8 100644
--- a/src/gui/translations.cpp
+++ b/src/gui/translations.cpp
@@ -52,7 +52,7 @@ namespace Translations {
QSet<QString> availableTranslations;
// calculate a glob pattern which can be used in the iterator below to match only translations files
- QString pattern = translationsFilePrefix() + "*" + translationsFileSuffix();
+ const QString pattern = translationsFilePrefix() + QLatin1Char('*') + translationsFileSuffix();
QDirIterator it(Translations::translationsDirectoryPath(), QStringList() << pattern);
diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp
index e1baf33c9..51facc012 100644
--- a/src/gui/updater/ocupdater.cpp
+++ b/src/gui/updater/ocupdater.cpp
@@ -216,13 +216,13 @@ void OCUpdater::slotStartInstaller()
return QDir::toNativeSeparators(path);
};
- QString msiLogFile = ConfigFile::configPath() + "msi.log";
+ QString msiLogFile = ConfigFile::configPath() + QStringLiteral("msi.log");
const QString command = QStringLiteral("&{msiexec /norestart /passive /i '%1' /L*V '%2'| Out-Null ; &'%3'}")
.arg(preparePathForPowershell(updateFile),
preparePathForPowershell(msiLogFile),
preparePathForPowershell(QCoreApplication::applicationFilePath()));
- QProcess::startDetached(QStringLiteral("powershell.exe"), QStringList { "-Command", command });
+ QProcess::startDetached(QStringLiteral("powershell.exe"), QStringList { QStringLiteral("-Command"), command });
}
}
@@ -238,7 +238,7 @@ void OCUpdater::checkForUpdate()
void OCUpdater::slotOpenUpdateUrl()
{
- QDesktopServices::openUrl(_updateInfo.web());
+ QDesktopServices::openUrl(QUrl(_updateInfo.web()));
}
bool OCUpdater::updateSucceeded() const
@@ -381,7 +381,7 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
if (url.isEmpty()) {
showNoUrlDialog(info);
} else {
- _targetFile = ConfigFile::configPath() + url.mid(url.lastIndexOf('/') + 1);
+ _targetFile = ConfigFile::configPath() + url.mid(url.lastIndexOf(QLatin1Char('/')) + 1);
if (QFile::exists(_targetFile)) {
setDownloadState(DownloadComplete);
} else {
diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt
index 7d7e0d1fa..e90d27d1c 100644
--- a/src/libsync/CMakeLists.txt
+++ b/src/libsync/CMakeLists.txt
@@ -89,16 +89,8 @@ target_link_libraries(libsync
Qt5::Concurrent
ZLIB::ZLIB
)
-target_compile_definitions(libsync
- PRIVATE QT_NO_CAST_TO_ASCII
- QT_NO_CAST_FROM_ASCII
- QT_NO_URL_CAST_FROM_STRING
- QT_NO_CAST_FROM_BYTEARRAY
- QT_USE_QSTRINGBUILDER
- QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
- QT_DEPRECATED_WARNINGS
- QT_NO_FOREACH
-)
+
+apply_common_target_settings(libsync)
target_link_libraries(libsync PUBLIC $<BUILD_INTERFACE:OpenAPI::LibreGraphAPI>)
add_subdirectory(graphapi)
diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp
index 801ad33ab..42f374b74 100644
--- a/src/libsync/networkjobs.cpp
+++ b/src/libsync/networkjobs.cpp
@@ -596,7 +596,7 @@ void SimpleNetworkJob::newReplyHook(QNetworkReply *reply)
}
void fetchPrivateLinkUrl(AccountPtr account, const QUrl &baseUrl, const QString &remotePath, QObject *target,
- std::function<void(const QString &url)> targetFun)
+ std::function<void(const QUrl &url)> targetFun)
{
if (account->capabilities().privateLinkPropertyAvailable()) {
// Retrieve the new link by PROPFIND
@@ -606,7 +606,7 @@ void fetchPrivateLinkUrl(AccountPtr account, const QUrl &baseUrl, const QString
QObject::connect(job, &PropfindJob::result, target, [=](const QMap<QString, QString> &result) {
auto privateLinkUrl = result[QStringLiteral("privatelink")];
if (!privateLinkUrl.isEmpty()) {
- targetFun(privateLinkUrl);
+ targetFun(QUrl(privateLinkUrl));
}
});
job->start();
diff --git a/src/libsync/networkjobs.h b/src/libsync/networkjobs.h
index e612fecd5..f9497edca 100644
--- a/src/libsync/networkjobs.h
+++ b/src/libsync/networkjobs.h
@@ -287,7 +287,7 @@ private:
* loop and never directly.
*/
void OWNCLOUDSYNC_EXPORT fetchPrivateLinkUrl(AccountPtr account, const QUrl &baseUrl, const QString &remotePath, QObject *target,
- std::function<void(const QString &url)> targetFun);
+ std::function<void(const QUrl &url)> targetFun);
} // namespace OCC