From: Olivier Goffart Date: Thu, 23 Feb 2017 13:54:17 +0000 (+0100) Subject: Verify that all strings are properly escaped (#5558) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~797^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7bfe0613827aa7cee93a77ccbedab9b07ea9ca78;p=nextcloud-desktop.git Verify that all strings are properly escaped (#5558) - I checked every occurence of a '%2' and make correct use of the QString::arg overload that takes several argument instead of chaining them, because the first argument can contains a '%1' - I tried to look for every label that they either use plain text or richtext and escape the user provided strings in there. --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 0fb32cfbf..48bbb496b 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -552,10 +552,12 @@ void AccountSettings::slotAccountStateChanged(int state) _model->slotUpdateFolderState(folder); } - QString server = QString::fromLatin1("%2").arg(account->url().toString(), safeUrl.toString()); + QString server = QString::fromLatin1("%2") + .arg(Utility::escape(account->url().toString()), + Utility::escape(safeUrl.toString())); QString serverWithUser = server; if (AbstractCredentials *cred = account->credentials()) { - serverWithUser = tr("%1 as %2").arg(server, cred->user()); + serverWithUser = tr("%1 as %2").arg(server, Utility::escape(cred->user())); } if (state == AccountState::Connected) { @@ -569,13 +571,14 @@ void AccountSettings::slotAccountStateChanged(int state) } else if (state == AccountState::SignedOut) { showConnectionLabel( tr("Signed out from %1.").arg(serverWithUser) ); } else { - showConnectionLabel( tr("No connection to %1 at %2.") - .arg(Theme::instance()->appNameGUI(), - server), _accountState->connectionErrors() ); + showConnectionLabel(tr("No connection to %1 at %2.") + .arg(Utility::escape(Theme::instance()->appNameGUI()), server), + _accountState->connectionErrors()); } } else { // ownCloud is not yet configured. - showConnectionLabel( tr("No %1 connection configured.").arg(Theme::instance()->appNameGUI()) ); + showConnectionLabel(tr("No %1 connection configured.") + .arg(Utility::escape(Theme::instance()->appNameGUI()))); } /* Allow to expand the item if the account is connected. */ @@ -664,7 +667,8 @@ void AccountSettings::refreshSelectiveSyncStatus() } QModelIndex theIndx = _model->indexForPath(folder, myFolder); if(theIndx.isValid()) { - msg += QString::fromLatin1("%1").arg(myFolder).arg(folder->alias()); + msg += QString::fromLatin1("%1") + .arg(Utility::escape(myFolder), Utility::escape(folder->alias())); } else { msg += myFolder; // no link because we do not know the index yet. } diff --git a/src/gui/accountsettings.ui b/src/gui/accountsettings.ui index f100d3752..bae5d945f 100644 --- a/src/gui/accountsettings.ui +++ b/src/gui/accountsettings.ui @@ -41,6 +41,9 @@ Connected with <server> as <user> + + Qt::RichText + true @@ -75,6 +78,9 @@ Storage space: ... + + Qt::PlainText + false @@ -145,6 +151,9 @@ Unchecked folders will be <b>removed</b> from your local file system and will not be synchronized to this computer anymore + + Qt::RichText + true diff --git a/src/gui/activityitemdelegate.cpp b/src/gui/activityitemdelegate.cpp index e625b9736..171b5895e 100644 --- a/src/gui/activityitemdelegate.cpp +++ b/src/gui/activityitemdelegate.cpp @@ -142,9 +142,9 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QString timeStr; if ( accountOnline ) { - timeStr = tr("%1 on %2").arg(timeText).arg(accountRole); + timeStr = tr("%1 on %2").arg(timeText, accountRole); } else { - timeStr = tr("%1 on %2 (disconnected)").arg(timeText).arg(accountRole); + timeStr = tr("%1 on %2 (disconnected)").arg(timeText, accountRole); QPalette p = option.palette; painter->setPen(p.color(QPalette::Disabled, QPalette::Text)); } diff --git a/src/gui/activitywidget.ui b/src/gui/activitywidget.ui index 79d9a963b..97765347a 100644 --- a/src/gui/activitywidget.ui +++ b/src/gui/activitywidget.ui @@ -25,6 +25,9 @@ TextLabel + + Qt::PlainText + @@ -64,6 +67,9 @@ TextLabel + + Qt::RichText + @@ -87,6 +93,9 @@ TextLabel + + Qt::RichText + diff --git a/src/gui/authenticationdialog.cpp b/src/gui/authenticationdialog.cpp index 70f901e06..1d05e7264 100644 --- a/src/gui/authenticationdialog.cpp +++ b/src/gui/authenticationdialog.cpp @@ -30,6 +30,7 @@ AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString & setWindowTitle(tr("Authentication Required")); QVBoxLayout *lay = new QVBoxLayout(this); QLabel *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain)); + label->setTextFormat(Qt::PlainText); lay->addWidget(label); QFormLayout *form = new QFormLayout; diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 4eae28f67..18d2f2b12 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -383,16 +383,16 @@ void Folder::createGuiLog( const QString& filename, LogStatus status, int count, break; case LogStatusRename: if( count > 1 ) { - text = tr("%1 has been renamed to %2 and %n other file(s) have been renamed.", "", count-1).arg(file).arg(renameTarget); + text = tr("%1 has been renamed to %2 and %n other file(s) have been renamed.", "", count-1).arg(file, renameTarget); } else { - text = tr("%1 has been renamed to %2.", "%1 and %2 name files.").arg(file).arg(renameTarget); + text = tr("%1 has been renamed to %2.", "%1 and %2 name files.").arg(file, renameTarget); } break; case LogStatusMove: if( count > 1 ) { - text = tr("%1 has been moved to %2 and %n other file(s) have been moved.", "", count-1).arg(file).arg(renameTarget); + text = tr("%1 has been moved to %2 and %n other file(s) have been moved.", "", count-1).arg(file, renameTarget); } else { - text = tr("%1 has been moved to %2.").arg(file).arg(renameTarget); + text = tr("%1 has been moved to %2.").arg(file, renameTarget); } break; case LogStatusConflict: diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index ebd9ab0b7..65ff918d5 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -164,10 +164,11 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const { const auto &x = static_cast(index.internalPointer())->_subs[index.row()]; switch (role) { - case Qt::ToolTipRole: case Qt::DisplayRole: //: Example text: "File.txt (23KB)" return x._size < 0 ? x._name : tr("%1 (%2)").arg(x._name, Utility::octetsToString(x._size)); + case Qt::ToolTipRole: + return QString(QLatin1String("") + Utility::escape(x._size < 0 ? x._name : tr("%1 (%2)").arg(x._name, Utility::octetsToString(x._size))) + QLatin1String("")); case Qt::CheckStateRole: return x._checked; case Qt::DecorationRole: diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index b786591c0..8a15c8739 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -65,7 +65,7 @@ FolderWizardLocalPath::FolderWizardLocalPath(const AccountPtr& account) connect(_ui.localFolderChooseBtn, SIGNAL(clicked()), this, SLOT(slotChooseLocalFolder())); _ui.localFolderChooseBtn->setToolTip(tr("Click to select a local folder to sync.")); - QString defaultPath = QString::fromLatin1( "%1/%2").arg( QDir::homePath() ).arg(Theme::instance()->appName() ); + QString defaultPath = QDir::homePath() + QLatin1Char('/') + Theme::instance()->appName(); _ui.localFolderLineEdit->setText( QDir::toNativeSeparators( defaultPath ) ); _ui.localFolderLineEdit->setToolTip(tr("Enter the path to the local folder.")); @@ -441,7 +441,8 @@ bool FolderWizardRemotePath::isComplete() const if (QDir::cleanPath(dir) == QDir::cleanPath(curDir)) { warnStrings.append(tr("This folder is already being synced.")); } else if (dir.startsWith(curDir + QLatin1Char('/'))) { - warnStrings.append(tr("You are already syncing %1, which is a parent folder of %2.").arg(curDir).arg(dir)); + warnStrings.append(tr("You are already syncing %1, which is a parent folder of %2.").arg( + Utility::escape(curDir), Utility::escape(dir))); } if (curDir == QLatin1String("/")) { diff --git a/src/gui/folderwizardsourcepage.ui b/src/gui/folderwizardsourcepage.ui index cccb4c164..7522792be 100644 --- a/src/gui/folderwizardsourcepage.ui +++ b/src/gui/folderwizardsourcepage.ui @@ -126,7 +126,7 @@ - Qt::AutoText + Qt::RichText 3 diff --git a/src/gui/folderwizardtargetpage.ui b/src/gui/folderwizardtargetpage.ui index 0a9ad5aa9..5dcefc73f 100644 --- a/src/gui/folderwizardtargetpage.ui +++ b/src/gui/folderwizardtargetpage.ui @@ -110,7 +110,7 @@ TextLabel - Qt::AutoText + Qt::RichText true diff --git a/src/gui/owncloudsetuppage.ui b/src/gui/owncloudsetuppage.ui index 6190119d0..8ae99d351 100644 --- a/src/gui/owncloudsetuppage.ui +++ b/src/gui/owncloudsetuppage.ui @@ -35,6 +35,9 @@ TextLabel + + Qt::RichText + @@ -155,6 +158,9 @@ TextLabel + + Qt::RichText + diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index bf67c9acf..53e360e41 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -178,10 +178,10 @@ void OwncloudSetupWizard::slotOwnCloudFoundAuth(const QUrl& url, const QVariantM auto serverVersion = CheckServerJob::version(info); _ocWizard->appendToConfigurationLog(tr("Successfully connected to %1: %2 version %3 (%4)

") - .arg(url.toString()) - .arg(Theme::instance()->appNameGUI()) - .arg(CheckServerJob::versionString(info)) - .arg(serverVersion)); + .arg(Utility::escape(url.toString()), + Utility::escape(Theme::instance()->appNameGUI()), + Utility::escape(CheckServerJob::versionString(info)), + Utility::escape(serverVersion))); _ocWizard->account()->setServerVersion(serverVersion); @@ -212,9 +212,9 @@ void OwncloudSetupWizard::slotNoOwnCloudFoundAuth(QNetworkReply *reply) msg = tr("Invalid URL"); } else { msg = tr("Failed to connect to %1 at %2:
%3") - .arg(Theme::instance()->appNameGUI(), - reply->url().toString(), - reply->errorString()); + .arg(Utility::escape(Theme::instance()->appNameGUI()), + Utility::escape(reply->url().toString()), + Utility::escape(reply->errorString())); } bool isDowngradeAdvised = checkDowngradeAdvised(reply); @@ -244,9 +244,10 @@ void OwncloudSetupWizard::slotNoOwnCloudFoundAuth(QNetworkReply *reply) void OwncloudSetupWizard::slotNoOwnCloudFoundAuthTimeout(const QUrl&url) { - _ocWizard->displayError(tr("Timeout while trying to connect to %1 at %2.") - .arg(Theme::instance()->appNameGUI(), - url.toString()), false); + _ocWizard->displayError( + tr("Timeout while trying to connect to %1 at %2.") + .arg(Utility::escape(Theme::instance()->appNameGUI()), Utility::escape(url.toString())), + false); } void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url ) @@ -307,7 +308,7 @@ void OwncloudSetupWizard::slotAuthError() } errorMsg = tr("The authenticated request to the server was redirected to " "'%1'. The URL is bad, the server is misconfigured.") - .arg(redirectUrl.toString()); + .arg(Utility::escape(redirectUrl.toString())); // A 404 is actually a success: we were authorized to know that the folder does // not exist. It will be created later... @@ -320,7 +321,7 @@ void OwncloudSetupWizard::slotAuthError() if (!_ocWizard->account()->credentials()->stillValid(reply)) { errorMsg = tr("Access forbidden by server. To verify that you have proper access, " "click here to access the service with your browser.") - .arg(_ocWizard->account()->url().toString()); + .arg(Utility::escape(_ocWizard->account()->url().toString())); } else { errorMsg = errorMessage(reply->errorString(), reply->readAll()); } @@ -369,7 +370,9 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString& localFo if( fi.exists() ) { // there is an existing local folder. If its non empty, it can only be synced if the // ownCloud is newly created. - _ocWizard->appendToConfigurationLog( tr("Local sync folder %1 already exists, setting it up for sync.

").arg(localFolder)); + _ocWizard->appendToConfigurationLog( + tr("Local sync folder %1 already exists, setting it up for sync.

") + .arg(Utility::escape(localFolder))); } else { QString res = tr("Creating local sync folder %1...").arg(localFolder); if( fi.mkpath( localFolder ) ) { @@ -379,7 +382,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString& localFo } else { res += tr("failed."); qDebug() << "Failed to create " << fi.path(); - _ocWizard->displayError(tr("Could not create local folder %1").arg(localFolder), false); + _ocWizard->displayError(tr("Could not create local folder %1").arg(Utility::escape(localFolder)), false); nextStep = false; } _ocWizard->appendToConfigurationLog( res ); @@ -415,7 +418,7 @@ void OwncloudSetupWizard::slotRemoteFolderExists(QNetworkReply *reply) } if( !ok ) { - _ocWizard->displayError(error, false); + _ocWizard->displayError(Utility::escape(error), false); } finalizeSetup( ok ); @@ -455,8 +458,8 @@ void OwncloudSetupWizard::slotCreateRemoteFolderFinished( QNetworkReply::Network _remoteFolder.clear(); success = false; } else { - _ocWizard->appendToConfigurationLog( tr("Remote folder %1 creation failed with error %2.").arg(_remoteFolder).arg(error)); - _ocWizard->displayError( tr("Remote folder %1 creation failed with error %2.").arg(_remoteFolder).arg(error), false ); + _ocWizard->appendToConfigurationLog( tr("Remote folder %1 creation failed with error %2.").arg(Utility::escape(_remoteFolder)).arg(error)); + _ocWizard->displayError( tr("Remote folder %1 creation failed with error %2.").arg(Utility::escape(_remoteFolder)).arg(error), false ); _remoteFolder.clear(); success = false; } @@ -472,8 +475,9 @@ void OwncloudSetupWizard::finalizeSetup( bool success ) const QString localFolder = _ocWizard->property("localFolder").toString(); if( success ) { if( !(localFolder.isEmpty() || _remoteFolder.isEmpty() )) { - _ocWizard->appendToConfigurationLog( tr("A sync connection from %1 to remote directory %2 was set up.") - .arg(localFolder).arg(_remoteFolder)); + _ocWizard->appendToConfigurationLog( + tr("A sync connection from %1 to remote directory %2 was set up.") + .arg(localFolder, _remoteFolder)); } _ocWizard->appendToConfigurationLog( QLatin1String(" ")); _ocWizard->appendToConfigurationLog( QLatin1String("

") diff --git a/src/gui/protocolwidget.ui b/src/gui/protocolwidget.ui index 247604308..143c2d627 100644 --- a/src/gui/protocolwidget.ui +++ b/src/gui/protocolwidget.ui @@ -19,6 +19,9 @@ TextLabel + + Qt::PlainText + diff --git a/src/gui/proxyauthdialog.ui b/src/gui/proxyauthdialog.ui index d71d392a5..cf640f1b3 100644 --- a/src/gui/proxyauthdialog.ui +++ b/src/gui/proxyauthdialog.ui @@ -73,6 +73,9 @@ TextLabel + + Qt::PlainText + diff --git a/src/gui/proxyauthhandler.cpp b/src/gui/proxyauthhandler.cpp index 6d304966a..a3f0fba7e 100644 --- a/src/gui/proxyauthhandler.cpp +++ b/src/gui/proxyauthhandler.cpp @@ -58,8 +58,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( return; } - QString key = QString::fromLatin1("%1:%2").arg( - proxy.hostName(), QString::number(proxy.port())); + QString key = proxy.hostName() + QLatin1Char(':') + QString::number(proxy.port()); // If the proxy server has changed, forget what we know. if (key != _proxy) { diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 499fb3e0a..2e084c7ac 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -252,7 +252,7 @@ void SettingsDialog::customizeStyle() QString altBase(palette().alternateBase().color().name()); QString dark(palette().dark().color().name()); QString background(palette().base().color().name()); - _toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(background).arg(dark).arg(highlightColor).arg(altBase)); + _toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(background,dark,highlightColor,altBase)); Q_FOREACH(QAction *a, _actionGroup->actions()) { QIcon icon = createColorAwareIcon(a->property("iconPath").toString()); diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui index 7b5fca8b8..051a526ba 100644 --- a/src/gui/sharedialog.ui +++ b/src/gui/sharedialog.ui @@ -27,6 +27,9 @@ share label + + Qt::PlainText + @@ -46,6 +49,9 @@ ownCloud Path: + + Qt::PlainText + diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 116cea703..456c02be7 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -321,7 +321,7 @@ void ShareLinkWidget::redrawElidedUrl() const QUrl realUrl(_shareUrl); QString elidedUrl = fm.elidedText(_shareUrl, Qt::ElideRight, linkLengthPixel); - u = QString("%2").arg(realUrl.toString(QUrl::None)).arg(elidedUrl); + u = QString("%2").arg(Utility::escape(realUrl.toString(QUrl::None)), Utility::escape(elidedUrl)); } _ui->_labelShareLink->setText(u); } diff --git a/src/gui/sharelinkwidget.ui b/src/gui/sharelinkwidget.ui index 718207488..581887e19 100644 --- a/src/gui/sharelinkwidget.ui +++ b/src/gui/sharelinkwidget.ui @@ -76,6 +76,9 @@ TextLabel + + Qt::PlainText + diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp index 406626d3b..08f2092d5 100644 --- a/src/gui/sharemanager.cpp +++ b/src/gui/sharemanager.cpp @@ -345,7 +345,7 @@ QSharedPointer ShareManager::parseLinkShare(const QVariantMap &data) url = QUrl(data.value("url").toString()); } else if (_account->serverVersionInt() >= (8 << 16)) { // From ownCloud server version 8 on, a different share link scheme is used. - url = QUrl(Utility::concatUrlPath(_account->url(), QString("index.php/s/%1").arg(data.value("token").toString())).toString()); + url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("index.php/s/") + data.value("token").toString())).toString(); } else { QList> queryArgs; queryArgs.append(qMakePair(QString("service"), QString("files"))); diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui index 79ca850f0..9122fef05 100644 --- a/src/gui/shareusergroupwidget.ui +++ b/src/gui/shareusergroupwidget.ui @@ -67,6 +67,9 @@ Placeholder for Error text + + Qt::PlainText + true diff --git a/src/gui/sharewidget.ui b/src/gui/sharewidget.ui index a6b044590..02d1c7040 100644 --- a/src/gui/sharewidget.ui +++ b/src/gui/sharewidget.ui @@ -36,6 +36,9 @@ TextLabel + + Qt::PlainText + diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp index 93b157f1c..7fe0ec052 100644 --- a/src/gui/sslbutton.cpp +++ b/src/gui/sslbutton.cpp @@ -58,7 +58,9 @@ static QString addCertDetailsField(const QString &key, const QString &value) if (value.isEmpty()) return QString(); - return QString::fromLatin1("%1%2").arg(key).arg(value); + return QLatin1String("") + key + + QLatin1String(")") + value + + QLatin1String(""); } @@ -162,7 +164,9 @@ QMenu* SslButton::buildCertMenu(QMenu *parent, const QSslCertificate& cert, // create label first QLabel *label = new QLabel(parent); label->setStyleSheet(QLatin1String("QLabel { padding: 8px; background-color: #fff; }")); + label->setTextFormat(Qt::RichText); label->setText(details); + // plug label into widget action QWidgetAction *action = new QWidgetAction(parent); action->setDefaultWidget(label); diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index b6aa88c45..18a4cf53c 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -339,7 +339,8 @@ void NSISUpdater::showDialog(const UpdateInfo &info) QLabel *lbl = new QLabel; QString txt = tr("

A new version of the %1 Client is available.

" "

%2 is available for download. The installed version is %3.

") - .arg(Theme::instance()->appNameGUI()).arg(info.versionString()).arg(clientVersion()); + .arg(Utility::escape(Theme::instance()->appNameGUI()), + Utility::escape(info.versionString()), Utility::escape(clientVersion())); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index 8de9ee339..5a3c56641 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -156,10 +156,10 @@ void OwncloudAdvancedSetupPage::updateStatus() if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) { t = ""; } else { - t = tr("%1 folder '%2' is synced to local folder '%3'") - .arg(Theme::instance()->appName()).arg(_remoteFolder) - .arg(QDir::toNativeSeparators(locFolder)); - _ui.rSyncEverything->setText(tr("Sync the folder '%1'").arg(_remoteFolder)); + t = Utility::escape(tr("%1 folder '%2' is synced to local folder '%3'") + .arg(Theme::instance()->appName(), _remoteFolder, + QDir::toNativeSeparators(locFolder))); + _ui.rSyncEverything->setText(tr("Sync the folder '%1'").arg(_remoteFolder)); } const bool dirNotEmpty(QDir(locFolder).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).count() > 0); diff --git a/src/gui/wizard/owncloudadvancedsetuppage.ui b/src/gui/wizard/owncloudadvancedsetuppage.ui index ccf891d96..a36704c38 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.ui +++ b/src/gui/wizard/owncloudadvancedsetuppage.ui @@ -31,6 +31,9 @@ TextLabel + + Qt::RichText + Qt::AlignCenter @@ -249,6 +252,9 @@ TextLabel + + Qt::PlainText +
@@ -351,6 +357,9 @@ TextLabel + + Qt::PlainText + @@ -385,6 +394,9 @@ Status message + + Qt::RichText + Qt::AlignCenter @@ -401,6 +413,9 @@ TextLabel + + Qt::RichText + diff --git a/src/gui/wizard/owncloudhttpcredspage.ui b/src/gui/wizard/owncloudhttpcredspage.ui index 0af5e5597..9fd445f35 100644 --- a/src/gui/wizard/owncloudhttpcredspage.ui +++ b/src/gui/wizard/owncloudhttpcredspage.ui @@ -22,6 +22,9 @@ TextLabel + + Qt::RichText + Qt::AlignCenter @@ -89,6 +92,9 @@ Error Label + + Qt::RichText + true @@ -124,6 +130,9 @@ TextLabel + + Qt::RichText + @@ -131,6 +140,9 @@ TextLabel + + Qt::RichText + true diff --git a/src/gui/wizard/owncloudsetupnocredspage.ui b/src/gui/wizard/owncloudsetupnocredspage.ui index cbeeb5246..8b00cb570 100644 --- a/src/gui/wizard/owncloudsetupnocredspage.ui +++ b/src/gui/wizard/owncloudsetupnocredspage.ui @@ -31,6 +31,9 @@ TextLabel + + Qt::RichText + Qt::AlignCenter @@ -156,6 +159,9 @@ Error Label + + Qt::RichText + true @@ -189,6 +195,9 @@ TextLabel + + Qt::RichText + diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 39f6303f6..2132ced72 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -185,14 +185,14 @@ QVariant ConfigFile::getPolicySetting(const QString &setting, const QVariant& de if (Utility::isWindows()) { // check for policies first and return immediately if a value is found. QSettings userPolicy(QString::fromLatin1("HKEY_CURRENT_USER\\Software\\Policies\\%1\\%2") - .arg(APPLICATION_VENDOR).arg(Theme::instance()->appName()), + .arg(APPLICATION_VENDOR, Theme::instance()->appName()), QSettings::NativeFormat); if(userPolicy.contains(setting)) { return userPolicy.value(setting); } QSettings machinePolicy(QString::fromLatin1("HKEY_LOCAL_MACHINE\\Software\\Policies\\%1\\%2") - .arg(APPLICATION_VENDOR).arg(APPLICATION_NAME), + .arg(APPLICATION_VENDOR, APPLICATION_NAME), QSettings::NativeFormat); if(machinePolicy.contains(setting)) { return machinePolicy.value(setting); @@ -257,7 +257,7 @@ QString ConfigFile::excludeFileFromSystem() fi.setFile( QCoreApplication::applicationDirPath(), exclFile ); #endif #ifdef Q_OS_UNIX - fi.setFile( QString( SYSCONFDIR "/%1").arg(Theme::instance()->appName()), exclFile ); + fi.setFile(QString(SYSCONFDIR "/" + Theme::instance()->appName()), exclFile); if ( ! fi.exists() ) { // Prefer to return the preferred path! Only use the fallback location // if the other path does not exist and the fallback is valid. @@ -489,8 +489,8 @@ QVariant ConfigFile::getValue(const QString& param, const QString& group, systemSetting = systemSettings.value(param, defaultValue); } else { // Windows QSettings systemSettings(QString::fromLatin1("HKEY_LOCAL_MACHINE\\Software\\%1\\%2") - .arg(APPLICATION_VENDOR).arg(Theme::instance()->appName()), - QSettings::NativeFormat); + .arg(APPLICATION_VENDOR, Theme::instance()->appName()), + QSettings::NativeFormat); if (!group.isEmpty()) { systemSettings.beginGroup(group); } diff --git a/src/libsync/owncloudtheme.cpp b/src/libsync/owncloudtheme.cpp index 55ed2261d..7b3805707 100644 --- a/src/libsync/owncloudtheme.cpp +++ b/src/libsync/owncloudtheme.cpp @@ -27,6 +27,7 @@ #include "version.h" #include "config.h" +#include "utility.h" namespace OCC { @@ -53,9 +54,9 @@ QString ownCloudTheme::about() const "ownCloud and the ownCloud Logo are registered trademarks of ownCloud GmbH " "in the United States, other countries, or both.

" ) - .arg(MIRALL_VERSION_STRING) - .arg("https://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) - .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)); + .arg(Utility::escape(MIRALL_VERSION_STRING), + Utility::escape("https://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)), + Utility::escape(MIRALL_STRINGIFY(APPLICATION_DOMAIN))); devString += gitSHA1(); return devString; diff --git a/src/libsync/utility.cpp b/src/libsync/utility.cpp index 052ba1d17..7868aeb5a 100644 --- a/src/libsync/utility.cpp +++ b/src/libsync/utility.cpp @@ -180,8 +180,7 @@ static QLatin1String platform() QByteArray Utility::userAgentString() { QString re = QString::fromLatin1("Mozilla/5.0 (%1) mirall/%2") - .arg(platform()) - .arg(QLatin1String(MIRALL_VERSION_STRING)); + .arg(platform(), QLatin1String(MIRALL_VERSION_STRING)); QLatin1String appName(APPLICATION_SHORTNAME);