diff --git a/src/lib/adblock/adblockicon.cpp b/src/lib/adblock/adblockicon.cpp index cf463dec1..a862744b2 100644 --- a/src/lib/adblock/adblockicon.cpp +++ b/src/lib/adblock/adblockicon.cpp @@ -111,7 +111,7 @@ void AdBlockIcon::createMenu(QMenu* menu) const QPair &pair = m_blockedPopups.at(i); QString address = pair.second.toString().right(55); - QString actionText = tr("%1 with (%2)").arg(address, pair.first.filter()).replace("&", "&&"); + QString actionText = tr("%1 with (%2)").arg(address, pair.first.filter()).replace('&', "&&"); QAction* action = menu->addAction(actionText, manager, SLOT(showRule())); action->setData(qVariantFromValue((void*)&pair.first)); @@ -127,7 +127,7 @@ void AdBlockIcon::createMenu(QMenu* menu) menu->addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false); foreach(const WebPage::AdBlockedEntry & entry, entries) { QString address = entry.url.toString().right(55); - QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace("&", "&&"); + QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace('&', "&&"); QAction* action = menu->addAction(actionText, manager, SLOT(showRule())); action->setData(qVariantFromValue((void*)entry.rule)); diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index 613959ea9..60d8efd3a 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -161,8 +161,8 @@ void CommandLineOptions::parseActions() const QString &url = arguments.last(); - if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-") && - (url.contains(".") || url.contains("/") || url.contains("\\"))) { + if (m_argc > 1 && !url.isEmpty() && !url.startsWith('-') && + (url.contains('.') || url.contains('/') || url.contains('\\'))) { ActionPair pair; pair.action = Qz::CL_OpenUrl; pair.text = url; diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index b807b8f7d..11d3c6e51 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -191,7 +191,7 @@ MainApplication::MainApplication(int &argc, char** argv) QSettings::setDefaultFormat(QSettings::IniFormat); if (startProfile.isEmpty()) { QSettings settings(PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat); - if (settings.value("Profiles/startProfile", "default").toString().contains("/")) { + if (settings.value("Profiles/startProfile", "default").toString().contains('/')) { m_activeProfil = PROFILEDIR + "profiles/default/"; } else { @@ -744,7 +744,7 @@ void MainApplication::startPrivateBrowsing() { QStringList args; foreach(const QString & arg, arguments()) { - if (arg.startsWith("-")) { + if (arg.startsWith('-')) { args.append(arg); } } @@ -763,7 +763,7 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const QFile file(filePath); if (!filePath.isEmpty() && file.open(QFile::ReadOnly)) { userStyle = file.readAll(); - userStyle.remove("\n"); + userStyle.remove('\n'); file.close(); } diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index ee6e2431b..8e35f2d40 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -1461,7 +1461,7 @@ void QupZilla::savePage() { QNetworkRequest request(weView()->url()); QString suggestedFileName = qz_getFileNameFromUrl(weView()->url()); - if (!suggestedFileName.contains(".")) { + if (!suggestedFileName.contains('.')) { suggestedFileName.append(".html"); } diff --git a/src/lib/autofill/autofillmodel.cpp b/src/lib/autofill/autofillmodel.cpp index 5882de188..83edd1bfc 100644 --- a/src/lib/autofill/autofillmodel.cpp +++ b/src/lib/autofill/autofillmodel.cpp @@ -211,8 +211,8 @@ void AutoFillModel::completePage(WebPage* page) for (int i = 0; i < arguments.count(); i++) { QString key = arguments.at(i).first; QString value = arguments.at(i).second; - key.replace("+", " "); - value.replace("+", " "); + key.replace('+', ' '); + value.replace('+', ' '); key = QUrl::fromEncoded(key.toUtf8()).toString(); value = QUrl::fromEncoded(value.toUtf8()).toString(); @@ -362,13 +362,13 @@ QByteArray AutoFillModel::convertWebKitFormBoundaryIfNecessary(const QByteArray QString string = rx.cap(1); pos += rx.matchedLength(); - int endOfAttributeName = string.indexOf("\""); + int endOfAttributeName = string.indexOf('"'); if (endOfAttributeName == -1) { continue; } QString attrName = string.left(endOfAttributeName); - QString attrValue = string.mid(endOfAttributeName + 1).trimmed().remove("\n"); + QString attrValue = string.mid(endOfAttributeName + 1).trimmed().remove('\n'); if (attrName.isEmpty() || attrValue.isEmpty()) { continue; diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index bf29434e1..fa99cdba2 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -160,7 +160,7 @@ void CookieManager::slotRefreshTable() QTreeWidgetItem* item; QString cookieDomain = cookie.domain(); - if (cookieDomain.startsWith(".")) { + if (cookieDomain.startsWith('.')) { cookieDomain = cookieDomain.mid(1); } diff --git a/src/lib/downloads/downloadfilehelper.cpp b/src/lib/downloads/downloadfilehelper.cpp index 55cf5f0f2..031721df7 100644 --- a/src/lib/downloads/downloadfilehelper.cpp +++ b/src/lib/downloads/downloadfilehelper.cpp @@ -238,7 +238,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply) reg.indexIn(value); path = reg.cap(1).trimmed(); - if (path.startsWith("\"") && path.endsWith("\"")) { + if (path.startsWith('"') && path.endsWith('"')) { path = path.mid(1, path.length() - 2); } } @@ -262,7 +262,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply) QString name = baseName + endName; - if (name.contains("\"")) { + if (name.contains('"')) { name.remove("\";"); } diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 15567b20a..44616ab70 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -104,7 +104,7 @@ QUrl LocationBar::createUrl() QUrl urlToLoad; //Check for Search Engine shortcut - int firstSpacePos = text().indexOf(" "); + int firstSpacePos = text().indexOf(' '); if (firstSpacePos != -1) { QString shortcut = text().left(firstSpacePos); QString searchedString = QUrl::toPercentEncoding(text().mid(firstSpacePos).trimmed()); diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index 7754536fe..4cc13143b 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -51,7 +51,7 @@ QString fileNameForCert(const QSslCertificate &cert) { QString certFileName = CertificateInfoWidget::certificateItemText(cert); - certFileName.remove(" "); + certFileName.remove(' '); certFileName.append(".crt"); certFileName = qz_filterCharsFromFilename(certFileName); return certFileName; diff --git a/src/lib/other/updater.cpp b/src/lib/other/updater.cpp index b582b5bf0..9e3bd8eb0 100644 --- a/src/lib/other/updater.cpp +++ b/src/lib/other/updater.cpp @@ -58,7 +58,7 @@ Updater::Version Updater::parseVersionFromString(const QString &string) bool Updater::isBiggerThan_SpecialSymbol(QString one, QString two) { - if (one.contains("rc") && two.contains("b")) { + if (one.contains("rc") && two.contains('b')) { return true; } @@ -74,9 +74,9 @@ bool Updater::isBiggerThan_SpecialSymbol(QString one, QString two) return false; } - if (one.contains("b")) { - int o = one.remove("b").toInt(); - int t = two.remove("b").toInt(); + if (one.contains('b')) { + int o = one.remove('b').toInt(); + int t = two.remove('b').toInt(); return o > t; } diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index 81a0a6944..4eb0f668a 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -288,7 +288,7 @@ QString SpeedDial::getOpenFileName() QString SpeedDial::urlFromUserInput(const QString &url) { - return QUrl::fromUserInput(url).toString().remove("'"); + return QUrl::fromUserInput(url).toString().remove('\''); } void SpeedDial::setBackgroundImage(const QString &image) diff --git a/src/lib/preferences/acceptlanguage.cpp b/src/lib/preferences/acceptlanguage.cpp index 92bb26eee..cfb892139 100644 --- a/src/lib/preferences/acceptlanguage.cpp +++ b/src/lib/preferences/acceptlanguage.cpp @@ -80,7 +80,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent) foreach(const QString & code, langs) { QString code_ = code; - QLocale loc = QLocale(code_.replace("-", "_")); + QLocale loc = QLocale(code_.replace('-', '_')); QString label; if (loc.language() == QLocale::C) { @@ -202,8 +202,8 @@ void AcceptLanguage::accept() QStringList langs; for (int i = 0; i < ui->listWidget->count(); i++) { QString t = ui->listWidget->item(i)->text(); - QString code = t.mid(t.indexOf("[") + 1); - code.remove("]"); + QString code = t.mid(t.indexOf('[') + 1); + code.remove(']'); langs.append(code); } diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 67bbcdabd..9df59b2b4 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -121,7 +121,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) m_actProfileName = mApp->currentProfilePath(); m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1); m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf("/")); - m_actProfileName.remove("/"); + m_actProfileName.remove('/'); ui->activeProfile->setText("" + m_actProfileName + ""); @@ -483,7 +483,7 @@ void Preferences::chooseDownPath() return; } #ifdef Q_WS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??) - userFileName.replace("\\", "/"); + userFileName.replace('\\', '/'); #endif userFileName += "/"; diff --git a/src/lib/tools/certificateinfowidget.cpp b/src/lib/tools/certificateinfowidget.cpp index 0a6490521..e5773b8df 100644 --- a/src/lib/tools/certificateinfowidget.cpp +++ b/src/lib/tools/certificateinfowidget.cpp @@ -39,7 +39,7 @@ QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string) { QString n = Qt::escape(string); - if (!n.contains("\\")) { + if (!n.contains('\\')) { return n; } diff --git a/src/lib/tools/globalfunctions.cpp b/src/lib/tools/globalfunctions.cpp index 5ce0df22f..91271cdb5 100644 --- a/src/lib/tools/globalfunctions.cpp +++ b/src/lib/tools/globalfunctions.cpp @@ -144,7 +144,7 @@ QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl) else { samePart = samePart.left(samePart.lastIndexOf("/") + 1); int slashCount = samePart.count("/") + 1; - if (samePart.startsWith("/")) { + if (samePart.startsWith('/')) { slashCount--; } if (samePart.endsWith("/")) { @@ -164,14 +164,14 @@ QString qz_urlEncodeQueryString(const QUrl &url) QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment); if (url.hasQuery()) { - returnString += "?" + url.encodedQuery(); + returnString += '?' + url.encodedQuery(); } if (url.hasFragment()) { - returnString += "#" + url.encodedFragment(); + returnString += '#' + url.encodedFragment(); } - returnString.replace(" ", "%20"); + returnString.replace(' ', "%20"); return returnString; } @@ -202,16 +202,16 @@ QString qz_ensureUniqueFilename(const QString &pathToFile) QString qz_getFileNameFromUrl(const QUrl &url) { QString fileName = url.toString(QUrl::RemoveFragment | QUrl::RemoveQuery | QUrl::RemoveScheme | QUrl::RemovePort); - if (fileName.indexOf("/") != -1) { - int pos = fileName.lastIndexOf("/"); + if (fileName.indexOf('/') != -1) { + int pos = fileName.lastIndexOf('/'); fileName = fileName.mid(pos); - fileName.remove("/"); + fileName.remove('/'); } fileName = qz_filterCharsFromFilename(fileName); if (fileName.isEmpty()) { - fileName = qz_filterCharsFromFilename(url.host().replace(".", "-")); + fileName = qz_filterCharsFromFilename(url.host().replace('.', '-')); } return fileName; @@ -221,15 +221,15 @@ QString qz_filterCharsFromFilename(const QString &name) { QString value = name; - value.replace("/", "-"); - value.remove("\\"); - value.remove(":"); - value.remove("*"); - value.remove("?"); - value.remove("\""); - value.remove("<"); - value.remove(">"); - value.remove("|"); + value.replace('/', '-'); + value.remove('\\'); + value.remove(':'); + value.remove('*'); + value.remove('?'); + value.remove('"'); + value.remove('<'); + value.remove('>'); + value.remove('|'); return value; } diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index 900258aa9..4e82bb369 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -109,13 +109,13 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) QString src = element.attribute("src"); QString alt = element.attribute("alt"); if (alt.isEmpty()) { - if (src.indexOf("/") == -1) { + if (src.indexOf('/') == -1) { alt = src; } else { int pos = src.lastIndexOf("/"); alt = src.mid(pos); - alt.remove("/"); + alt.remove('/'); } } if (src.isEmpty() || alt.isEmpty()) { @@ -250,7 +250,7 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item) if (imageUrl.scheme() == "data") { QByteArray encodedUrl = item->text(1).toUtf8(); - QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(",") + 1); + QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(',') + 1); m_activePixmap = qz_pixmapFromByteArray(imageData); } else if (imageUrl.scheme() == "file") { diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index e7f445794..53430256c 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -227,7 +227,7 @@ void TabWidget::aboutToShowTabsMenu() } else { QString title = tab->title(); - title.replace("&", "&&"); + title.replace('&', "&&"); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -479,7 +479,7 @@ void TabWidget::setTabIcon(int index, const QIcon &icon) void TabWidget::setTabText(int index, const QString &text) { QString newtext = text; - newtext.replace("&", "&&"); // Avoid Alt+letter shortcuts + newtext.replace('&', "&&"); // Avoid Alt+letter shortcuts if (WebTab* webTab = weTab(index)) { if (webTab->isPinned()) { diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 43c13729a..28bfcd5bc 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -410,7 +410,7 @@ void WebPage::setSSLCertificate(const QSslCertificate &cert) QSslCertificate WebPage::sslCertificate() { if (url().scheme() == "https" && - m_SslCert.subjectInfo(QSslCertificate::CommonName).remove("*").contains(QRegExp(url().host()))) { + m_SslCert.subjectInfo(QSslCertificate::CommonName).remove('*').contains(QRegExp(url().host()))) { return m_SslCert; } else { @@ -500,7 +500,7 @@ void WebPage::cleanBlockedObjects() //May be relative url QString relativeUrl = qz_makeRelativeUrl(mainFrameUrl, entry.url).toString(); findingStrings.append(relativeUrl); - if (relativeUrl.startsWith("/")) { + if (relativeUrl.startsWith('/')) { findingStrings.append(relativeUrl.right(relativeUrl.size() - 1)); } } diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 5147ea52d..2d428fc0e 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -397,7 +397,7 @@ void WebView::downloadPage() { QNetworkRequest request(url()); QString suggestedFileName = qz_getFileNameFromUrl(url()); - if (!suggestedFileName.contains(".")) { + if (!suggestedFileName.contains('.')) { suggestedFileName.append(".html"); } @@ -849,8 +849,8 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult menu->addAction(dictact); // #379: Remove newlines - QString selectedString = selectedText.trimmed().remove("\n"); - if (!selectedString.contains(".")) { + QString selectedString = selectedText.trimmed().remove('\n'); + if (!selectedString.contains('.')) { // Try to add .com selectedString.append(".com"); } @@ -868,7 +868,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult menu->addSeparator(); selectedText.truncate(20); // KDE is displaying new lines in menu actions ... weird -,- - selectedText.replace("\n", " ").replace("\t", ""); + selectedText.replace('\n', ' ').remove('\t'); SearchEngine engine = mApp->searchEnginesManager()->activeEngine(); Action* act = new Action(engine.icon, tr("Search \"%1 ..\" with %2").arg(selectedText, engine.name));