From da15e5868d115b2eae8c8c2507f33fa2e57a37df Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 30 Dec 2013 13:43:48 +0100 Subject: [PATCH] [CodingStyle] Don't use references when assigning to local variable Let the compiler do the optimization --- src/lib/adblock/adblockicon.cpp | 14 +++---- src/lib/adblock/adblockmanager.cpp | 8 ++-- src/lib/adblock/adblockrule.cpp | 16 ++++---- src/lib/adblock/adblocksearchtree.cpp | 6 +-- src/lib/adblock/adblocksubscription.cpp | 2 +- src/lib/app/commandlineoptions.cpp | 2 +- src/lib/app/mainapplication.cpp | 16 ++++---- src/lib/app/profileupdater.cpp | 8 ++-- src/lib/app/qupzilla.cpp | 40 +++++++++---------- src/lib/autofill/autofill.cpp | 2 +- src/lib/autofill/pageformcompleter.cpp | 30 +++++++------- .../databaseencryptedpasswordbackend.cpp | 2 +- .../databasepasswordbackend.cpp | 2 +- src/lib/autofill/passwordmanager.cpp | 2 +- src/lib/bookmarks/bookmarksmanager.cpp | 2 +- src/lib/cookies/cookiejar.cpp | 8 ++-- src/lib/cookies/cookiemanager.cpp | 12 +++--- src/lib/history/history.cpp | 4 +- src/lib/history/historymodel.cpp | 14 +++---- src/lib/history/historyview.cpp | 2 +- .../completer/locationcompleterdelegate.cpp | 10 ++--- .../completer/locationcompletermodel.cpp | 6 +-- src/lib/navigation/locationbar.cpp | 14 +++---- src/lib/navigation/navigationbar.cpp | 4 +- src/lib/navigation/siteicon.cpp | 4 +- src/lib/network/networkmanager.cpp | 10 ++--- src/lib/network/networkproxyfactory.cpp | 2 +- .../schemehandlers/adblockschemehandler.cpp | 4 +- .../schemehandlers/fileschemehandler.cpp | 18 ++++----- .../schemehandlers/ftpschemehandler.cpp | 2 +- .../schemehandlers/qupzillaschemehandler.cpp | 2 +- src/lib/opensearch/searchenginesmanager.cpp | 2 +- src/lib/other/clearprivatedata.cpp | 10 ++--- src/lib/other/iconchooser.cpp | 4 +- src/lib/other/pagescreen.cpp | 22 +++++----- src/lib/other/statusbarmessage.cpp | 2 +- src/lib/other/useragentmanager.cpp | 2 +- .../qtwebkit/spellcheck/spellcheckdialog.cpp | 6 +-- .../plugins/qtwebkit/spellcheck/speller.cpp | 10 ++--- src/lib/plugins/speeddial.cpp | 12 +++--- src/lib/popupwindow/popupwebview.cpp | 4 +- src/lib/preferences/pluginlistdelegate.cpp | 8 ++-- src/lib/preferences/sslmanager.cpp | 2 +- src/lib/preferences/useragentdialog.cpp | 4 +- src/lib/rss/rssnotification.cpp | 16 ++++---- src/lib/sidebar/bookmarkssidebar.cpp | 4 +- src/lib/tools/actioncopy.cpp | 4 +- src/lib/tools/combotabbar.cpp | 2 +- .../html5permissionsmanager.cpp | 2 +- src/lib/tools/listitemdelegate.cpp | 2 +- src/lib/tools/plaineditwithlines.cpp | 4 +- src/lib/tools/qztools.cpp | 10 ++--- src/lib/webview/siteinfo.cpp | 2 +- src/lib/webview/tabbar.cpp | 2 +- src/lib/webview/tabbedwebview.cpp | 6 +-- src/lib/webview/tabwidget.cpp | 6 +-- src/lib/webview/webpage.cpp | 34 ++++++++-------- src/lib/webview/webview.cpp | 28 ++++++------- src/main/main.cpp | 2 +- .../AccessKeysNavigation/akn_handler.cpp | 4 +- .../gnomekeyringpasswordbackend.cpp | 2 +- .../GreaseMonkey/gm_addscriptdialog.cpp | 6 +-- src/plugins/GreaseMonkey/gm_downloader.cpp | 8 ++-- src/plugins/GreaseMonkey/gm_manager.cpp | 12 +++--- src/plugins/GreaseMonkey/gm_plugin.cpp | 2 +- src/plugins/GreaseMonkey/gm_script.cpp | 6 +-- src/plugins/GreaseMonkey/gm_urlmatcher.cpp | 2 +- .../settings/gm_settingslistdelegate.cpp | 6 +-- .../settings/gm_settingslistwidget.cpp | 2 +- .../kwalletpasswordbackend.cpp | 2 +- src/plugins/PIM/PIM_handler.cpp | 10 ++--- .../StatusBarIcons/sbi_networkicondialog.cpp | 2 +- .../StatusBarIcons/sbi_networkmanager.cpp | 2 +- 73 files changed, 273 insertions(+), 273 deletions(-) diff --git a/src/lib/adblock/adblockicon.cpp b/src/lib/adblock/adblockicon.cpp index 1c66ad463..c1660e715 100644 --- a/src/lib/adblock/adblockicon.cpp +++ b/src/lib/adblock/adblockicon.cpp @@ -47,8 +47,8 @@ void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url) { int index = ruleString.lastIndexOf(QLatin1String(" (")); - const QString &subscriptionName = ruleString.left(index); - const QString &filter = ruleString.mid(index + 2, ruleString.size() - index - 3); + const QString subscriptionName = ruleString.left(index); + const QString filter = ruleString.mid(index + 2, ruleString.size() - index - 3); AdBlockSubscription* subscription = AdBlockManager::instance()->subscriptionByName(subscriptionName); if (filter.isEmpty() || !subscription) { return; @@ -105,15 +105,15 @@ void AdBlockIcon::createMenu(QMenu* menu) AdBlockCustomList* customList = manager->customList(); WebPage* page = p_QupZilla->weView()->page(); - const QUrl &pageUrl = page->url(); + const QUrl pageUrl = page->url(); menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog())); menu->addSeparator(); if (!pageUrl.host().isEmpty() && m_enabled && manager->canRunOnScheme(pageUrl.scheme())) { - const QString &host = page->url().host().contains(QLatin1String("www.")) ? pageUrl.host().mid(4) : pageUrl.host(); - const QString &hostFilter = QString("@@||%1^$document").arg(host); - const QString &pageFilter = QString("@@|%1|$document").arg(pageUrl.toString()); + const QString host = page->url().host().contains(QLatin1String("www.")) ? pageUrl.host().mid(4) : pageUrl.host(); + const QString hostFilter = QString("@@||%1^$document").arg(host); + const QString pageFilter = QString("@@|%1|$document").arg(pageUrl.toString()); QAction* act = menu->addAction(tr("Disable on %1").arg(host)); act->setCheckable(true); @@ -176,7 +176,7 @@ void AdBlockIcon::toggleCustomFilter() return; } - const QString &filter = action->data().toString(); + const QString filter = action->data().toString(); AdBlockManager* manager = AdBlockManager::instance(); AdBlockCustomList* customList = manager->customList(); diff --git a/src/lib/adblock/adblockmanager.cpp b/src/lib/adblock/adblockmanager.cpp index 89009ad6c..5db64accb 100644 --- a/src/lib/adblock/adblockmanager.cpp +++ b/src/lib/adblock/adblockmanager.cpp @@ -86,9 +86,9 @@ QNetworkReply* AdBlockManager::block(const QNetworkRequest &request) QElapsedTimer timer; timer.start(); #endif - const QString &urlString = request.url().toEncoded().toLower(); - const QString &urlDomain = request.url().host().toLower(); - const QString &urlScheme = request.url().scheme().toLower(); + const QString urlString = request.url().toEncoded().toLower(); + const QString urlDomain = request.url().host().toLower(); + const QString urlScheme = request.url().scheme().toLower(); if (!isEnabled() || !canRunOnScheme(urlScheme)) { return 0; @@ -231,7 +231,7 @@ void AdBlockManager::load() continue; } - const QString &absolutePath = adblockDir.absoluteFilePath(fileName); + const QString absolutePath = adblockDir.absoluteFilePath(fileName); QFile file(absolutePath); if (!file.open(QFile::ReadOnly)) { continue; diff --git a/src/lib/adblock/adblockrule.cpp b/src/lib/adblock/adblockrule.cpp index c068bc3a5..a9d3cb8da 100644 --- a/src/lib/adblock/adblockrule.cpp +++ b/src/lib/adblock/adblockrule.cpp @@ -62,8 +62,8 @@ static QString toSecondLevelDomain(const QUrl &url) { #if QT_VERSION >= 0x040800 - const QString &topLevelDomain = url.topLevelDomain(); - const QString &urlHost = url.host(); + const QString topLevelDomain = url.topLevelDomain(); + const QString urlHost = url.host(); if (topLevelDomain.isEmpty() || urlHost.isEmpty()) { return QString(); @@ -189,8 +189,8 @@ bool AdBlockRule::urlMatch(const QUrl &url) const return false; } - const QString &encodedUrl = url.toEncoded(); - const QString &domain = url.host(); + const QString encodedUrl = url.toEncoded(); + const QString domain = url.host(); return networkMatch(QNetworkRequest(url), domain, encodedUrl); } @@ -299,15 +299,15 @@ bool AdBlockRule::matchDomain(const QString &domain) const bool AdBlockRule::matchThirdParty(const QNetworkRequest &request) const { - const QString &referer = request.attribute(QNetworkRequest::Attribute(QNetworkRequest::User + 151), QString()).toString(); + const QString referer = request.attribute(QNetworkRequest::Attribute(QNetworkRequest::User + 151), QString()).toString(); if (referer.isEmpty()) { return false; } // Third-party matching should be performed on second-level domains - const QString &refererHost = toSecondLevelDomain(QUrl(referer)); - const QString &host = toSecondLevelDomain(request.url()); + const QString refererHost = toSecondLevelDomain(QUrl(referer)); + const QString host = toSecondLevelDomain(request.url()); bool match = refererHost != host; @@ -573,7 +573,7 @@ QStringList AdBlockRule::parseRegExpFilter(const QString &parsedFilter) const list.removeDuplicates(); for (int i = 0; i < list.length(); ++i) { - const QString &part = list.at(i); + const QString part = list.at(i); if (part.length() < 2) { list.removeAt(i); diff --git a/src/lib/adblock/adblocksearchtree.cpp b/src/lib/adblock/adblocksearchtree.cpp index 125e8300e..300bfb313 100644 --- a/src/lib/adblock/adblocksearchtree.cpp +++ b/src/lib/adblock/adblocksearchtree.cpp @@ -42,7 +42,7 @@ bool AdBlockSearchTree::add(const AdBlockRule* rule) return false; } - const QString &filter = rule->m_matchString; + const QString filter = rule->m_matchString; int len = filter.size(); if (len <= 0) { @@ -53,7 +53,7 @@ bool AdBlockSearchTree::add(const AdBlockRule* rule) Node* node = m_root; for (int i = 0; i < len; ++i) { - const QChar &c = filter.at(i); + const QChar c = filter.at(i); if (!node->children.contains(c)) { Node* n = new Node; n->c = c; @@ -104,7 +104,7 @@ const AdBlockRule* AdBlockSearchTree::prefixSearch(const QNetworkRequest &reques Node* node = m_root->children[c]; for (int i = 1; i < len; ++i) { - const QChar &c = (++string)[0]; + const QChar c = (++string)[0]; if (node->rule && node->rule->networkMatch(request, domain, urlString)) { return node->rule; diff --git a/src/lib/adblock/adblocksubscription.cpp b/src/lib/adblock/adblocksubscription.cpp index afa415efa..b0d6b6330 100644 --- a/src/lib/adblock/adblocksubscription.cpp +++ b/src/lib/adblock/adblocksubscription.cpp @@ -528,7 +528,7 @@ bool AdBlockCustomList::removeRule(int offset) } AdBlockRule* rule = m_rules.at(offset); - const QString &filter = rule->filter(); + const QString filter = rule->filter(); m_rules.remove(offset); populateCache(); diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index d721b55c5..f8ac03aa7 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -68,7 +68,7 @@ void CommandLineOptions::parseActions() { using namespace std; - const QStringList &arguments = QCoreApplication::arguments(); + const QStringList arguments = QCoreApplication::arguments(); if (arguments.isEmpty()) { return; } diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 7cb1f27d1..720b7150e 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -539,12 +539,12 @@ void MainApplication::receiveAppMessage(QString message) QUrl actUrl; if (message.startsWith(QLatin1String("URL:"))) { - const QUrl &url = QUrl::fromUserInput(message.mid(4)); + const QUrl url = QUrl::fromUserInput(message.mid(4)); addNewTab(url); actWin = getWindow(); } else if (message.startsWith(QLatin1String("ACTION:"))) { - const QString &text = message.mid(7); + const QString text = message.mid(7); if (text == QLatin1String("NewTab")) { addNewTab(); } @@ -685,7 +685,7 @@ void MainApplication::loadTheme(const QString &name) << THEMESDIR; foreach (const QString &path, themePaths) { - const QString &theme = path + name + "/"; + const QString theme = path + name + "/"; if (QFile::exists(theme + "main.css")) { m_activeThemePath = theme; break; @@ -954,10 +954,10 @@ QNetworkDiskCache* MainApplication::networkCache() { if (!m_networkCache) { Settings settings; - const QString &basePath = settings.value("Web-Browser-Settings/CachePath", - QString("%1networkcache/").arg(m_activeProfil)).toString(); + const QString basePath = settings.value("Web-Browser-Settings/CachePath", + QString("%1networkcache/").arg(m_activeProfil)).toString(); - const QString &cachePath = QString("%1/%2-Qt%3/").arg(basePath, qWebKitVersion(), qVersion()); + const QString cachePath = QString("%1/%2-Qt%3/").arg(basePath, qWebKitVersion(), qVersion()); m_networkCache = new QNetworkDiskCache(this); m_networkCache->setCacheDirectory(cachePath); } @@ -1089,8 +1089,8 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const file.close(); } - const QString &encodedStyle = userStyle.toLatin1().toBase64(); - const QString &dataString = QString("data:text/css;charset=utf-8;base64,%1").arg(encodedStyle); + const QString encodedStyle = userStyle.toLatin1().toBase64(); + const QString dataString = QString("data:text/css;charset=utf-8;base64,%1").arg(encodedStyle); return QUrl(dataString); } diff --git a/src/lib/app/profileupdater.cpp b/src/lib/app/profileupdater.cpp index 67503f177..3373feccf 100644 --- a/src/lib/app/profileupdater.cpp +++ b/src/lib/app/profileupdater.cpp @@ -106,12 +106,12 @@ void ProfileUpdater::copyDataToProfile() QFile browseData(m_profilePath + "browsedata.db"); if (browseData.exists()) { - const QString &browseDataBackup = QzTools::ensureUniqueFilename(m_profilePath + "browsedata-backup.db"); - const QString &settingsBackup = QzTools::ensureUniqueFilename(m_profilePath + "settings-backup.ini"); + const QString browseDataBackup = QzTools::ensureUniqueFilename(m_profilePath + "browsedata-backup.db"); + const QString settingsBackup = QzTools::ensureUniqueFilename(m_profilePath + "settings-backup.ini"); browseData.copy(browseDataBackup); QFile(m_profilePath + "settings.ini").copy(settingsBackup); - const QString &text = "Incompatible profile version has been detected. To avoid losing your profile data, they were " - "backed up in following directories:

" + browseDataBackup + "
" + settingsBackup + "
"; + const QString text = "Incompatible profile version has been detected. To avoid losing your profile data, they were " + "backed up in following directories:

" + browseDataBackup + "
" + settingsBackup + "
"; QMessageBox::warning(0, "QupZilla: Incompatible profile version", text); } diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 5655727bf..ef9e4de3f 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -799,7 +799,7 @@ void QupZilla::loadSettings() bool makeTransparent = settings.value("useTransparentBackground", false).toBool(); m_sideBarWidth = settings.value("SideBarWidth", 250).toInt(); m_webViewWidth = settings.value("WebViewWidth", 2000).toInt(); - const QString &activeSideBar = settings.value("SideBar", "None").toString(); + const QString activeSideBar = settings.value("SideBar", "None").toString(); // Make sure both menubar and navigationbar are not hidden // Fixes #781 @@ -1033,8 +1033,8 @@ void QupZilla::aboutToShowBookmarksMenu() query.exec("SELECT title, url, icon FROM bookmarks WHERE folder='bookmarksMenu'"); while (query.next()) { QString title = query.value(0).toString(); - const QUrl &url = query.value(1).toUrl(); - const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); + const QUrl url = query.value(1).toUrl(); + const QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -1053,8 +1053,8 @@ void QupZilla::aboutToShowBookmarksMenu() query.exec("SELECT title, url, icon FROM bookmarks WHERE folder='bookmarksToolbar'"); while (query.next()) { QString title = query.value(0).toString(); - const QUrl &url = query.value(1).toUrl(); - const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); + const QUrl url = query.value(1).toUrl(); + const QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -1073,7 +1073,7 @@ void QupZilla::aboutToShowBookmarksMenu() query.exec("SELECT name FROM folders"); while (query.next()) { - const QString &folderName = query.value(0).toString(); + const QString folderName = query.value(0).toString(); Menu* tempFolder = new Menu(folderName, m_menuBookmarks); tempFolder->setIcon(QIcon(style()->standardIcon(QStyle::SP_DirOpenIcon))); @@ -1083,8 +1083,8 @@ void QupZilla::aboutToShowBookmarksMenu() query2.exec(); while (query2.next()) { QString title = query2.value(0).toString(); - const QUrl &url = query2.value(1).toUrl(); - const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query2.value(2).toByteArray())); + const QUrl url = query2.value(1).toUrl(); + const QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query2.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -1107,8 +1107,8 @@ void QupZilla::aboutToShowBookmarksMenu() query.exec("SELECT title, url, icon FROM bookmarks WHERE folder='unsorted'"); while (query.next()) { QString title = query.value(0).toString(); - const QUrl &url = query.value(1).toUrl(); - const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); + const QUrl url = query.value(1).toUrl(); + const QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -1170,7 +1170,7 @@ void QupZilla::aboutToShowHistoryRecentMenu() QSqlQuery query; query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15"); while (query.next()) { - const QUrl &url = query.value(1).toUrl(); + const QUrl url = query.value(1).toUrl(); QString title = query.value(0).toString(); if (title.length() > 40) { title.truncate(40); @@ -1290,7 +1290,7 @@ void QupZilla::aboutToShowEncodingMenu() QList available = QTextCodec::availableCodecs(); qSort(available); - const QString &activeCodec = mApp->webSettings()->defaultTextEncoding(); + const QString activeCodec = mApp->webSettings()->defaultTextEncoding(); foreach (const QByteArray &name, available) { QTextCodec* codec = QTextCodec::codecForName(name); @@ -1353,7 +1353,7 @@ void QupZilla::changeEncoding(QObject* obj) } if (QAction* action = qobject_cast(obj)) { - const QString &encoding = action->data().toString(); + const QString encoding = action->data().toString(); mApp->webSettings()->setDefaultTextEncoding(encoding); Settings settings; @@ -1502,7 +1502,7 @@ void QupZilla::loadActionUrlInNewNotSelectedTab(QObject* obj) void QupZilla::loadFolderBookmarks(Menu* menu) { - const QString &folder = BookmarksModel::fromTranslatedFolder(menu->title()); + const QString folder = BookmarksModel::fromTranslatedFolder(menu->title()); if (folder.isEmpty()) { return; } @@ -1816,12 +1816,12 @@ void QupZilla::searchOnPage() void QupZilla::openFile() { - const QString &fileTypes = QString("%1(*.html *.htm *.shtml *.shtm *.xhtml);;" - "%2(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff);;" - "%3(*.txt);;" - "%4(*.*)").arg(tr("HTML files"), tr("Image files"), tr("Text files"), tr("All files")); + const QString fileTypes = QString("%1(*.html *.htm *.shtml *.shtm *.xhtml);;" + "%2(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff);;" + "%3(*.txt);;" + "%4(*.*)").arg(tr("HTML files"), tr("Image files"), tr("Text files"), tr("All files")); - const QString &filePath = QzTools::getOpenFileName("MainWindow-openFile", this, tr("Open file..."), QDir::homePath(), fileTypes); + const QString filePath = QzTools::getOpenFileName("MainWindow-openFile", this, tr("Open file..."), QDir::homePath(), fileTypes); if (!filePath.isEmpty()) { loadAddress(QUrl::fromLocalFile(filePath)); @@ -2154,7 +2154,7 @@ void QupZilla::keyPressEvent(QKeyEvent* event) return; } if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) { - const QUrl &url = mApp->plugins()->speedDial()->urlForShortcut(number - 1); + const QUrl url = mApp->plugins()->speedDial()->urlForShortcut(number - 1); if (url.isValid()) { loadAddress(url); return; diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index 6f4065342..08553d537 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -212,7 +212,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa return; } - const QUrl &siteUrl = webPage->url(); + const QUrl siteUrl = webPage->url(); if (!isStoringEnabled(siteUrl)) { return; diff --git a/src/lib/autofill/pageformcompleter.cpp b/src/lib/autofill/pageformcompleter.cpp index f41144c7c..b29de71ba 100644 --- a/src/lib/autofill/pageformcompleter.cpp +++ b/src/lib/autofill/pageformcompleter.cpp @@ -43,28 +43,28 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons return formData; } - const QueryItems &queryItems = createQueryItems(data); + const QueryItems queryItems = createQueryItems(data); if (queryItems.isEmpty()) { return formData; } - const QWebElementCollection &allForms = getAllElementsFromPage("form"); + const QWebElementCollection allForms = getAllElementsFromPage("form"); // Find form that contains password value sent in data foreach (const QWebElement &formElement, allForms) { bool found = false; - const QWebElementCollection &inputs = formElement.findAll("input[type=\"password\"]"); + const QWebElementCollection inputs = formElement.findAll("input[type=\"password\"]"); foreach (QWebElement inputElement, inputs) { - const QString &passName = inputElement.attribute("name"); - const QString &passValue = inputElement.evaluateJavaScript("this.value").toString(); + const QString passName = inputElement.attribute("name"); + const QString passValue = inputElement.evaluateJavaScript("this.value").toString(); if (queryItemsContains(queryItems, passName, passValue)) { // Set passwordValue if not empty (to make it possible extract forms without username field) passwordValue = passValue; - const QueryItem &item = findUsername(formElement); + const QueryItem item = findUsername(formElement); if (queryItemsContains(queryItems, item.first, item.second)) { usernameValue = item.second; found = true; @@ -93,22 +93,22 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons bool PageFormCompleter::completePage(const QByteArray &data) const { bool completed = false; - const QueryItems &queryItems = createQueryItems(data); + const QueryItems queryItems = createQueryItems(data); // Input types that are being completed QStringList inputTypes; inputTypes << "text" << "password" << "email"; // Find all input elements in the page - const QWebElementCollection &inputs = getAllElementsFromPage("input"); + const QWebElementCollection inputs = getAllElementsFromPage("input"); for (int i = 0; i < queryItems.count(); i++) { - const QString &key = queryItems.at(i).first; - const QString &value = queryItems.at(i).second; + const QString key = queryItems.at(i).first; + const QString value = queryItems.at(i).second; for (int i = 0; i < inputs.count(); i++) { QWebElement element = inputs.at(i); - const QString &typeAttr = element.attribute("type"); + const QString typeAttr = element.attribute("type"); if (!inputTypes.contains(typeAttr) && !typeAttr.isEmpty()) { continue; @@ -132,7 +132,7 @@ bool PageFormCompleter::queryItemsContains(const QueryItems &queryItems, const Q } for (int i = 0; i < queryItems.count(); i++) { - const QueryItem &item = queryItems.at(i); + const QueryItem item = queryItems.at(i); if (item.first == attributeName) { return item.second == attributeValue; @@ -197,10 +197,10 @@ PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement & << "input:not([type=\"hidden\"][type=\"password\"])"; foreach (const QString &selector, selectors) { - const QWebElementCollection &inputs = form.findAll(selector); + const QWebElementCollection inputs = form.findAll(selector); foreach (QWebElement element, inputs) { - const QString &name = element.attribute("name"); - const QString &value = element.evaluateJavaScript("this.value").toString(); + const QString name = element.attribute("name"); + const QString value = element.evaluateJavaScript("this.value").toString(); if (!name.isEmpty() && !value.isEmpty()) { QueryItem item; diff --git a/src/lib/autofill/passwordbackends/databaseencryptedpasswordbackend.cpp b/src/lib/autofill/passwordbackends/databaseencryptedpasswordbackend.cpp index fe65276e4..1e725fbb0 100644 --- a/src/lib/autofill/passwordbackends/databaseencryptedpasswordbackend.cpp +++ b/src/lib/autofill/passwordbackends/databaseencryptedpasswordbackend.cpp @@ -55,7 +55,7 @@ QVector DatabaseEncryptedPasswordBackend::getEntries(const QUrl & AesInterface aesDecryptor; - const QString &host = PasswordManager::createHost(url); + const QString host = PasswordManager::createHost(url); QSqlQuery query; query.prepare("SELECT id, username_encrypted, password_encrypted, data_encrypted FROM autofill_encrypted " diff --git a/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp b/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp index 2915ec8a7..944e279a4 100644 --- a/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp +++ b/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp @@ -35,7 +35,7 @@ QString DatabasePasswordBackend::name() const QVector DatabasePasswordBackend::getEntries(const QUrl &url) { - const QString &host = PasswordManager::createHost(url); + const QString host = PasswordManager::createHost(url); QSqlQuery query; query.prepare("SELECT id, username, password, data FROM autofill " diff --git a/src/lib/autofill/passwordmanager.cpp b/src/lib/autofill/passwordmanager.cpp index 21b703b5d..9760707e5 100644 --- a/src/lib/autofill/passwordmanager.cpp +++ b/src/lib/autofill/passwordmanager.cpp @@ -166,7 +166,7 @@ bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backen void PasswordManager::unregisterBackend(PasswordBackend* backend) { - const QString &key = m_backends.key(backend); + const QString key = m_backends.key(backend); m_backends.remove(key); if (m_backend == backend) { diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index 49ecd1670..a17e5bdc3 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -255,7 +255,7 @@ void BookmarksManager::itemControlClicked(QTreeWidgetItem* item) return; } - const QUrl &url = QUrl::fromEncoded(item->text(1).toUtf8()); + const QUrl url = QUrl::fromEncoded(item->text(1).toUtf8()); getQupZilla()->tabWidget()->addView(url, item->text(0)); } diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index 60a6886f6..aed9c8c31 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -65,7 +65,7 @@ bool CookieJar::rejectCookie(const QString &domain, const QNetworkCookie &cookie { Q_UNUSED(domain) - const QString &cookieDomain = cookie.domain(); + const QString cookieDomain = cookie.domain(); if (!m_allowCookies) { bool result = listMatchesDomain(m_whitelist, cookieDomain); @@ -146,7 +146,7 @@ void CookieJar::saveCookies() int count = cookies.count(); for (int i = 0; i < count; i++) { - const QNetworkCookie &cookie = cookies.at(i); + const QNetworkCookie cookie = cookies.at(i); if (listMatchesDomain(m_whitelist, cookie.domain())) { allCookies.append(cookie); @@ -161,7 +161,7 @@ void CookieJar::saveCookies() stream << count; for (int i = 0; i < count; i++) { - const QNetworkCookie &cookie = allCookies.at(i); + const QNetworkCookie cookie = allCookies.at(i); if (cookie.isSessionCookie()) { continue; @@ -195,7 +195,7 @@ void CookieJar::restoreCookies() continue; } - const QNetworkCookie &cookie = cookieList.at(0); + const QNetworkCookie cookie = cookieList.at(0); if (cookie.expirationDate() < now) { continue; diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index 925bdf2b2..1ea9f9a29 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -111,7 +111,7 @@ void CookieManager::removeCookie() QList allCookies = mApp->cookieJar()->getAllCookies(); if (current->text(1).isEmpty()) { //Remove whole cookie group - const QString &domain = current->data(0, Qt::UserRole + 10).toString(); + const QString domain = current->data(0, Qt::UserRole + 10).toString(); foreach (const QNetworkCookie &cookie, allCookies) { if (cookie.domain() == domain || cookie.domain() == domain.mid(1)) { allCookies.removeOne(cookie); @@ -121,7 +121,7 @@ void CookieManager::removeCookie() ui->cookieTree->deleteItem(current); } else { - const QNetworkCookie &cookie = qvariant_cast(current->data(0, Qt::UserRole + 10)); + const QNetworkCookie cookie = qvariant_cast(current->data(0, Qt::UserRole + 10)); allCookies.removeOne(cookie); QTreeWidgetItem* parentItem = current->parent(); @@ -154,7 +154,7 @@ void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem return; } - const QNetworkCookie &cookie = qvariant_cast(current->data(0, Qt::UserRole + 10)); + const QNetworkCookie cookie = qvariant_cast(current->data(0, Qt::UserRole + 10)); ui->name->setText(cookie.name()); ui->value->setText(cookie.value()); @@ -187,7 +187,7 @@ void CookieManager::slotRefreshTable() QPointer guard = this; QHash hash; for (int i = 0; i < allCookies.count(); ++i) { - const QNetworkCookie &cookie = allCookies.at(i); + const QNetworkCookie cookie = allCookies.at(i); QTreeWidgetItem* item; QString cookieDomain = cookie.domain(); @@ -246,7 +246,7 @@ void CookieManager::slotRefreshFilters() void CookieManager::addWhitelist() { - const QString &server = QInputDialog::getText(this, tr("Add to whitelist"), tr("Server:")); + const QString server = QInputDialog::getText(this, tr("Add to whitelist"), tr("Server:")); if (server.isEmpty()) { return; } @@ -261,7 +261,7 @@ void CookieManager::removeWhitelist() void CookieManager::addBlacklist() { - const QString &server = QInputDialog::getText(this, tr("Add to blacklist"), tr("Server:")); + const QString server = QInputDialog::getText(this, tr("Add to blacklist"), tr("Server:")); if (server.isEmpty()) { return; } diff --git a/src/lib/history/history.cpp b/src/lib/history/history.cpp index d1929349b..52a7d3c6a 100644 --- a/src/lib/history/history.cpp +++ b/src/lib/history/history.cpp @@ -57,8 +57,8 @@ void History::addHistoryEntry(WebView* view) return; } - const QUrl &url = view->url(); - const QString &title = view->title(); + const QUrl url = view->url(); + const QString title = view->title(); addHistoryEntry(url, title); } diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index 0361053f7..428210374 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -26,7 +26,7 @@ static QString dateTimeToString(const QDateTime &dateTime) { - const QDateTime ¤t = QDateTime::currentDateTime(); + const QDateTime current = QDateTime::currentDateTime(); if (current.date() == dateTime.date()) { return dateTime.time().toString("h:mm"); } @@ -379,8 +379,8 @@ void HistoryModel::historyEntryEdited(const HistoryEntry &before, const HistoryE if (item) { HistoryItem* parentItem = item->parent(); - const QModelIndex &sourceParent = createIndex(parentItem->row(), 0, parentItem); - const QModelIndex &destinationParent = createIndex(m_todayItem->row(), 0, m_todayItem); + const QModelIndex sourceParent = createIndex(parentItem->row(), 0, parentItem); + const QModelIndex destinationParent = createIndex(m_todayItem->row(), 0, m_todayItem); int row = item->row(); beginMoveRows(sourceParent, row, row, destinationParent, 0); @@ -455,9 +455,9 @@ void HistoryModel::init() return; } - const QDate &today = QDate::currentDate(); - const QDate &week = today.addDays(1 - today.dayOfWeek()); - const QDate &month = QDate(today.year(), today.month(), 1); + const QDate today = QDate::currentDate(); + const QDate week = today.addDays(1 - today.dayOfWeek()); + const QDate month = QDate(today.year(), today.month(), 1); const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch(); qint64 timestamp = currentTimestamp; @@ -553,7 +553,7 @@ void HistoryFilterModel::startFiltering() bool HistoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - const QModelIndex &index = sourceModel()->index(sourceRow, 0, sourceParent); + const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); if (index.data(HistoryModel::IsTopLevelRole).toBool()) { return true; diff --git a/src/lib/history/historyview.cpp b/src/lib/history/historyview.cpp index 0da108ed7..ca0c31777 100644 --- a/src/lib/history/historyview.cpp +++ b/src/lib/history/historyview.cpp @@ -146,7 +146,7 @@ void HistoryView::copyAddress() void HistoryView::contextMenuEvent(QContextMenuEvent* event) { - const QModelIndex &index = indexAt(event->pos()); + const QModelIndex index = indexAt(event->pos()); if (!index.isValid() || index.data(HistoryModel::IsTopLevelRole).toBool()) { return; } diff --git a/src/lib/navigation/completer/locationcompleterdelegate.cpp b/src/lib/navigation/completer/locationcompleterdelegate.cpp index b768c1b61..a6409f01a 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.cpp +++ b/src/lib/navigation/completer/locationcompleterdelegate.cpp @@ -93,7 +93,7 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI painter->drawPixmap(starRect, starPixmap); } - const QString &searchText = index.data(LocationCompleterModel::SearchStringRole).toString(); + const QString searchText = index.data(LocationCompleterModel::SearchStringRole).toString(); // Draw title const int leftTitleEdge = leftPosition + 2; @@ -108,7 +108,7 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI // Draw link const int infoYPos = titleRect.bottom() + opt.fontMetrics.leading() + 2; QRect linkRect(titleRect.x(), infoYPos, titleRect.width(), opt.fontMetrics.height()); - const QByteArray &linkArray = index.data(Qt::DisplayRole).toByteArray(); + const QByteArray linkArray = index.data(Qt::DisplayRole).toByteArray(); // Let's assume that more than 500 characters won't fit in line on any display... // Fixes performance when trying to get elidedText for a really long // (length() > 1000000) urls - data: urls can get that long @@ -209,8 +209,8 @@ void LocationCompleterDelegate::drawHighlightedTextLine(const QRect &rect, const int start = delimiters.takeFirst(); int end = delimiters.takeFirst(); - const QString &normalPart = text.mid(lastEndPos, start - lastEndPos); - const QString &boldPart = text.mid(start, end - start); + const QString normalPart = text.mid(lastEndPos, start - lastEndPos); + const QString boldPart = text.mid(start, end - start); lastEndPos = end; @@ -251,7 +251,7 @@ void LocationCompleterDelegate::drawHighlightedTextLine(const QRect &rect, const } if (delimiters.isEmpty() && lastEndPos != text.size()) { - const QString &lastText = text.mid(lastEndPos); + const QString lastText = text.mid(lastEndPos); int width = normalMetrics.width(lastText); QRect nRect = adjustRect(rect, QRect(lastRectPos, rect.top(), width, rect.height())); diff --git a/src/lib/navigation/completer/locationcompletermodel.cpp b/src/lib/navigation/completer/locationcompletermodel.cpp index 564f59812..d6ef32c72 100644 --- a/src/lib/navigation/completer/locationcompletermodel.cpp +++ b/src/lib/navigation/completer/locationcompletermodel.cpp @@ -66,7 +66,7 @@ void LocationCompleterModel::refreshCompletions(const QString &string) while (query.next()) { QStandardItem* item = new QStandardItem(); - const QUrl &url = query.value(1).toUrl(); + const QUrl url = query.value(1).toUrl(); item->setIcon(qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()))); item->setText(url.toEncoded()); @@ -92,7 +92,7 @@ void LocationCompleterModel::refreshCompletions(const QString &string) while (query.next()) { QStandardItem* item = new QStandardItem(); - const QUrl &url = query.value(1).toUrl(); + const QUrl url = query.value(1).toUrl(); item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); @@ -124,7 +124,7 @@ void LocationCompleterModel::showMostVisited() while (query.next()) { QStandardItem* item = new QStandardItem(); - const QUrl &url = query.value(1).toUrl(); + const QUrl url = query.value(1).toUrl(); item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 0e03d53ca..26f505c25 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -196,8 +196,8 @@ QString LocationBar::convertUrlToText(const QUrl &url) const void LocationBar::urlEnter() { - const QUrl &url = createUrl(); - const QString &urlString = convertUrlToText(url); + const QUrl url = createUrl(); + const QString urlString = convertUrlToText(url); m_completer.closePopup(); m_webView->setFocus(); @@ -258,7 +258,7 @@ void LocationBar::showUrl(const QUrl &url) return; } - const QString &stringUrl = convertUrlToText(url); + const QString stringUrl = convertUrlToText(url); if (stringUrl == text()) { return; @@ -370,7 +370,7 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event) void LocationBar::focusInEvent(QFocusEvent* event) { if (m_webView) { - const QString &stringUrl = convertUrlToText(m_webView->url()); + const QString stringUrl = convertUrlToText(m_webView->url()); // Text has been edited, let's show go button if (stringUrl != text()) { @@ -456,7 +456,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event) case Qt::Key_End: case Qt::Key_Right: { - const QString &completionText = m_completer.domainCompletion(); + const QString completionText = m_completer.domainCompletion(); if (m_inlineCompletionVisible && !completionText.isEmpty()) { m_inlineCompletionVisible = false; @@ -623,7 +623,7 @@ void LocationBar::paintEvent(QPaintEvent* event) QRect contentsRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this); contentsRect.adjust(lm, tm, -rm, -bm); - const QFontMetrics &fm = fontMetrics(); + const QFontMetrics fm = fontMetrics(); const int x = contentsRect.x() + 4; const int y = contentsRect.y() + (contentsRect.height() - fm.height() + 1) / 2; const int width = contentsRect.width() - 6; @@ -639,7 +639,7 @@ void LocationBar::paintEvent(QPaintEvent* event) if (hasFocus() && m_inlineCompletionVisible) { // Draw inline domain completion if available - const QString &completionText = m_completer.domainCompletion(); + const QString completionText = m_completer.domainCompletion(); if (!completionText.isEmpty()) { QRect completionRect = textRect; diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp index 9df5a6bc5..440238272 100644 --- a/src/lib/navigation/navigationbar.cpp +++ b/src/lib/navigation/navigationbar.cpp @@ -252,7 +252,7 @@ void NavigationBar::aboutToShowHistoryBackMenu() if (item.isValid()) { QString title = titleForUrl(item.title(), item.url()); - const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack)); + const QIcon icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack)); Action* act = new Action(icon, title); act->setData(i); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); @@ -286,7 +286,7 @@ void NavigationBar::aboutToShowHistoryNextMenu() if (item.isValid()) { QString title = titleForUrl(item.title(), item.url()); - const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward)); + const QIcon icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward)); Action* act = new Action(icon, title); act->setData(i); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); diff --git a/src/lib/navigation/siteicon.cpp b/src/lib/navigation/siteicon.cpp index 246b24dff..af744081b 100644 --- a/src/lib/navigation/siteicon.cpp +++ b/src/lib/navigation/siteicon.cpp @@ -93,8 +93,8 @@ void SiteIcon::mouseMoveEvent(QMouseEvent* e) return; } - const QUrl &url = m_locationBar->webView()->url(); - const QString &title = m_locationBar->webView()->title(); + const QUrl url = m_locationBar->webView()->url(); + const QString title = m_locationBar->webView()->title(); if (url.isEmpty() || title.isEmpty()) { ToolButton::mouseMoveEvent(e); diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index 144b3aac0..4755f98d5 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -188,7 +188,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList errors) continue; } - const QSslCertificate &cert = error.certificate(); + const QSslCertificate cert = error.certificate(); if (errorHash.contains(cert)) { errorHash[cert].append(error.errorString()); @@ -210,8 +210,8 @@ void NetworkManager::sslError(QNetworkReply* reply, QList errors) QHash::const_iterator i = errorHash.constBegin(); while (i != errorHash.constEnd()) { - const QSslCertificate &cert = i.key(); - const QStringList &errors = i.value(); + const QSslCertificate cert = i.key(); + const QStringList errors = i.value(); if (m_localCerts.contains(cert) || m_tempAllowedCerts.contains(cert) || errors.isEmpty()) { ++i; @@ -586,13 +586,13 @@ void NetworkManager::removeLocalCertificate(const QSslCertificate &cert) bool deleted = false; QDirIterator it(mApp->currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories); while (it.hasNext()) { - const QString &filePath = it.next(); + const QString filePath = it.next(); const QList &certs = QSslCertificate::fromPath(filePath); if (certs.isEmpty()) { continue; } - const QSslCertificate &cert_ = certs.at(0); + const QSslCertificate cert_ = certs.at(0); if (cert == cert_) { QFile file(filePath); if (!file.remove()) { diff --git a/src/lib/network/networkproxyfactory.cpp b/src/lib/network/networkproxyfactory.cpp index abbeccc2d..3aec88549 100644 --- a/src/lib/network/networkproxyfactory.cpp +++ b/src/lib/network/networkproxyfactory.cpp @@ -120,7 +120,7 @@ QList NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &q return proxyList; } - const QString &urlHost = query.url().host(); + const QString urlHost = query.url().host(); foreach (WildcardMatcher* m, m_proxyExceptions) { if (m->match(urlHost)) { proxyList.append(QNetworkProxy::NoProxy); diff --git a/src/lib/network/schemehandlers/adblockschemehandler.cpp b/src/lib/network/schemehandlers/adblockschemehandler.cpp index e3d09da64..091d8e37f 100644 --- a/src/lib/network/schemehandlers/adblockschemehandler.cpp +++ b/src/lib/network/schemehandlers/adblockschemehandler.cpp @@ -39,7 +39,7 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat return 0; } - const QUrl &url = request.url(); + const QUrl url = request.url(); const QList > queryItems = #if QT_VERSION >= 0x050000 QUrlQuery(url).queryItems(); @@ -64,7 +64,7 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat return 0; } - const QString &message = AdBlockManager::tr("Do you want to add %1 subscription?").arg(subscriptionTitle); + const QString message = AdBlockManager::tr("Do you want to add %1 subscription?").arg(subscriptionTitle); QMessageBox::StandardButton result = QMessageBox::question(0, AdBlockManager::tr("AdBlock Subscription"), message, QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::Yes) { diff --git a/src/lib/network/schemehandlers/fileschemehandler.cpp b/src/lib/network/schemehandlers/fileschemehandler.cpp index 64f248f26..604da9ce7 100644 --- a/src/lib/network/schemehandlers/fileschemehandler.cpp +++ b/src/lib/network/schemehandlers/fileschemehandler.cpp @@ -76,9 +76,9 @@ void FileSchemeHandler::handleUrl(const QUrl &url) return; } - const QString &fileName = info.fileName(); - const QPixmap &pixmap = iconProvider.icon(info).pixmap(30); - const QString &type = iconProvider.type(info); + const QString fileName = info.fileName(); + const QPixmap pixmap = iconProvider.icon(info).pixmap(30); + const QString type = iconProvider.type(info); DownloadOptionsDialog dialog(fileName, pixmap, type, url, mApp->getWindow()); dialog.showExternalManagerOption(false); @@ -92,9 +92,9 @@ void FileSchemeHandler::handleUrl(const QUrl &url) } else if (status == 2) { // Save - const QString &savePath = QzTools::getSaveFileName("FileSchemeHandler-Save", mApp->getWindow(), - QObject::tr("Save file as..."), - QDir::homePath() + QDir::separator() + QzTools::getFileNameFromUrl(url)); + const QString savePath = QzTools::getSaveFileName("FileSchemeHandler-Save", mApp->getWindow(), + QObject::tr("Save file as..."), + QDir::homePath() + QDir::separator() + QzTools::getFileNameFromUrl(url)); if (!savePath.isEmpty()) { file.copy(savePath); @@ -149,9 +149,9 @@ void FileSchemeReply::loadPage() QString FileSchemeReply::loadDirectory() { - const QDir &dir = QDir(request().url().toLocalFile()); - const QFileInfoList &list = dir.entryInfoList(QDir::AllEntries | QDir::Hidden, - QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); + const QDir dir = QDir(request().url().toLocalFile()); + const QFileInfoList list = dir.entryInfoList(QDir::AllEntries | QDir::Hidden, + QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); static QString sPage; diff --git a/src/lib/network/schemehandlers/ftpschemehandler.cpp b/src/lib/network/schemehandlers/ftpschemehandler.cpp index 978b0eb70..add0c4b45 100644 --- a/src/lib/network/schemehandlers/ftpschemehandler.cpp +++ b/src/lib/network/schemehandlers/ftpschemehandler.cpp @@ -243,7 +243,7 @@ QString FtpSchemeReply::loadDirectory() } QString base_path = u.path(); - const QDir &dir = QDir(base_path); + const QDir dir = QDir(base_path); QUrl parent = u.resolved(QUrl("..")); diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index e1e6bcf12..049c0504b 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -460,7 +460,7 @@ QString QupZillaSchemeReply::configPage() settings->beginGroup(group); foreach (const QString &key, settings->childKeys()) { - const QVariant &keyValue = settings->value(key); + const QVariant keyValue = settings->value(key); QString keyString; switch (keyValue.type()) { diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index b6d8bc90c..77ab8d011 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -245,7 +245,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView return; } - const QString &method = formElement.hasAttribute("method") ? formElement.attribute("method").toUpper() : "GET"; + const QString method = formElement.hasAttribute("method") ? formElement.attribute("method").toUpper() : "GET"; bool isPost = method == QLatin1String("POST"); QUrl actionUrl = QUrl::fromEncoded(formElement.attribute("action").toUtf8()); diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index dc21484d1..c0ba953ce 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -65,14 +65,14 @@ void ClearPrivateData::historyClicked(bool state) void ClearPrivateData::clearLocalStorage() { - const QString &profile = mApp->currentProfilePath(); + const QString profile = mApp->currentProfilePath(); QzTools::removeDir(profile + "LocalStorage"); } void ClearPrivateData::clearWebDatabases() { - const QString &profile = mApp->currentProfilePath(); + const QString profile = mApp->currentProfilePath(); QWebDatabase::removeAllDatabases(); QzTools::removeDir(profile + "Databases"); @@ -118,9 +118,9 @@ void ClearPrivateData::dialogAccepted() qint64 start = QDateTime::currentMSecsSinceEpoch(); qint64 end = 0; - const QDate &today = QDate::currentDate(); - const QDate &week = today.addDays(1 - today.dayOfWeek()); - const QDate &month = QDate(today.year(), today.month(), 1); + const QDate today = QDate::currentDate(); + const QDate week = today.addDays(1 - today.dayOfWeek()); + const QDate month = QDate(today.year(), today.month(), 1); switch (ui->historyLength->currentIndex()) { case 0: //Later Today diff --git a/src/lib/other/iconchooser.cpp b/src/lib/other/iconchooser.cpp index bdc1b4f44..777791d81 100644 --- a/src/lib/other/iconchooser.cpp +++ b/src/lib/other/iconchooser.cpp @@ -36,8 +36,8 @@ IconChooser::IconChooser(QWidget* parent) void IconChooser::chooseFile() { - const QString &fileTypes = QString("%3(*.png *.jpg *.jpeg *.gif)").arg(tr("Image files")); - const QString &path = QzTools::getOpenFileName("IconChooser-ChangeIcon", this, tr("Choose icon..."), QDir::homePath(), fileTypes); + const QString fileTypes = QString("%3(*.png *.jpg *.jpeg *.gif)").arg(tr("Image files")); + const QString path = QzTools::getOpenFileName("IconChooser-ChangeIcon", this, tr("Choose icon..."), QDir::homePath(), fileTypes); if (path.isEmpty()) { return; diff --git a/src/lib/other/pagescreen.cpp b/src/lib/other/pagescreen.cpp index 27b62e532..aeee756ed 100644 --- a/src/lib/other/pagescreen.cpp +++ b/src/lib/other/pagescreen.cpp @@ -98,10 +98,10 @@ void PageScreen::formatChanged() void PageScreen::changeLocation() { - const QString &name = QzTools::filterCharsFromFilename(m_pageTitle).replace(QLatin1Char(' '), QLatin1Char('_')); - const QString &suggestedPath = QString("%1/%2.%3").arg(QDir::homePath(), name, m_formats[ui->formats->currentIndex()].toLower()); + const QString name = QzTools::filterCharsFromFilename(m_pageTitle).replace(QLatin1Char(' '), QLatin1Char('_')); + const QString suggestedPath = QString("%1/%2.%3").arg(QDir::homePath(), name, m_formats[ui->formats->currentIndex()].toLower()); - const QString &path = QzTools::getOpenFileName("PageScreen-Location", this, tr("Choose location..."), suggestedPath); + const QString path = QzTools::getOpenFileName("PageScreen-Location", this, tr("Choose location..."), suggestedPath); if (!path.isEmpty()) { ui->location->setText(path); @@ -112,7 +112,7 @@ void PageScreen::dialogAccepted() { if (!ui->location->text().isEmpty()) { if (QFile::exists(ui->location->text())) { - const QString &text = tr("File '%1' already exists. Do you want to overwrite it?").arg(ui->location->text()); + const QString text = tr("File '%1' already exists. Do you want to overwrite it?").arg(ui->location->text()); QMessageBox::StandardButton button = QMessageBox::warning(this, tr("File already exists"), text, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); @@ -123,7 +123,7 @@ void PageScreen::dialogAccepted() QApplication::setOverrideCursor(Qt::WaitCursor); - const QString &format = m_formats[ui->formats->currentIndex()]; + const QString format = m_formats[ui->formats->currentIndex()]; if (format == QLatin1String("PDF")) { saveAsDocument(format); } @@ -139,7 +139,7 @@ void PageScreen::dialogAccepted() void PageScreen::saveAsImage(const QString &format) { - const QString &suffix = QLatin1Char('.') + format.toLower(); + const QString suffix = QLatin1Char('.') + format.toLower(); QString pathWithoutSuffix = ui->location->text(); if (pathWithoutSuffix.endsWith(suffix, Qt::CaseInsensitive)) { @@ -152,7 +152,7 @@ void PageScreen::saveAsImage(const QString &format) else { int part = 1; foreach (const QImage &image, m_pageImages) { - const QString &fileName = pathWithoutSuffix + ".part" + QString::number(part); + const QString fileName = pathWithoutSuffix + ".part" + QString::number(part); image.save(fileName + suffix, format.toUtf8()); part++; } @@ -161,7 +161,7 @@ void PageScreen::saveAsImage(const QString &format) void PageScreen::saveAsDocument(const QString &format) { - const QString &suffix = QLatin1Char('.') + format.toLower(); + const QString suffix = QLatin1Char('.') + format.toLower(); QString pathWithoutSuffix = ui->location->text(); if (pathWithoutSuffix.endsWith(suffix, Qt::CaseInsensitive)) { @@ -180,7 +180,7 @@ void PageScreen::saveAsDocument(const QString &format) painter.begin(&printer); for (int i = 0; i < m_pageImages.size(); ++i) { - const QImage &image = m_pageImages.at(i); + const QImage image = m_pageImages.at(i); painter.drawImage(0, 0, image); if (i != m_pageImages.size() - 1) { @@ -197,8 +197,8 @@ void PageScreen::createThumbnail() const int heightLimit = 20000; const QPoint originalScrollPosition = page->mainFrame()->scrollPosition(); - const QSize &originalSize = page->viewportSize(); - const QSize &frameSize = page->mainFrame()->contentsSize(); + const QSize originalSize = page->viewportSize(); + const QSize frameSize = page->mainFrame()->contentsSize(); const int verticalScrollbarSize = page->mainFrame()->scrollBarGeometry(Qt::Vertical).width(); const int horizontalScrollbarSize = page->mainFrame()->scrollBarGeometry(Qt::Horizontal).height(); diff --git a/src/lib/other/statusbarmessage.cpp b/src/lib/other/statusbarmessage.cpp index 5848e6849..22c6dd16b 100644 --- a/src/lib/other/statusbarmessage.cpp +++ b/src/lib/other/statusbarmessage.cpp @@ -136,7 +136,7 @@ void StatusBarMessage::showMessage(const QString &message) m_statusBarText->resize(m_statusBarText->sizeHint()); QPoint position(0, view->height() - horizontalScrollSize - m_statusBarText->height()); - const QRect &statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size()); + const QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size()); if (statusRect.contains(QCursor::pos())) { position.setY(position.y() - m_statusBarText->height()); diff --git a/src/lib/other/useragentmanager.cpp b/src/lib/other/useragentmanager.cpp index 024b608d7..e02633de8 100644 --- a/src/lib/other/useragentmanager.cpp +++ b/src/lib/other/useragentmanager.cpp @@ -51,7 +51,7 @@ void UserAgentManager::loadSettings() QString UserAgentManager::userAgentForUrl(const QUrl &url) const { - const QString &host = url.host(); + const QString host = url.host(); if (m_usePerDomainUserAgent) { QHashIterator i(m_userAgentsList); diff --git a/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.cpp b/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.cpp index 576c0c181..436fd465e 100644 --- a/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.cpp +++ b/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.cpp @@ -68,7 +68,7 @@ SpellCheckDialog::SpellCheckDialog(QWidget* parent) void SpellCheckDialog::changeDictionaryPath() { - const QString &path = QzTools::getExistingDirectory("SpellCheckDialog-Directory", this, tr("Choose dictionary path..."), ui->dictPath->text()); + const QString path = QzTools::getExistingDirectory("SpellCheckDialog-Directory", this, tr("Choose dictionary path..."), ui->dictPath->text()); if (!path.isEmpty()) { ui->dictPath->setText(path); @@ -77,7 +77,7 @@ void SpellCheckDialog::changeDictionaryPath() void SpellCheckDialog::addUserWord() { - const QString &word = QInputDialog::getText(0, tr("Add new word..."), tr("Add new word:")); + const QString word = QInputDialog::getText(0, tr("Add new word..."), tr("Add new word:")); if (!word.isEmpty()) { ui->userDictList->addItem(word); @@ -125,7 +125,7 @@ void SpellCheckDialog::saveSettings() int count = ui->userDictList->count(); for (int i = 0; i < count; ++i) { - const QString &word = ui->userDictList->item(i)->text(); + const QString word = ui->userDictList->item(i)->text(); stream << word << endl; } diff --git a/src/lib/plugins/qtwebkit/spellcheck/speller.cpp b/src/lib/plugins/qtwebkit/spellcheck/speller.cpp index ef6c33875..d57944acf 100644 --- a/src/lib/plugins/qtwebkit/spellcheck/speller.cpp +++ b/src/lib/plugins/qtwebkit/spellcheck/speller.cpp @@ -166,7 +166,7 @@ void Speller::populateContextMenu(QMenu* menu, const QWebHitTestResult &hitTest) m_startPos = finder.toPreviousBoundary(); m_endPos = finder.toNextBoundary(); - const QString &word = text.mid(m_startPos, m_endPos - m_startPos).trimmed(); + const QString word = text.mid(m_startPos, m_endPos - m_startPos).trimmed(); if (!isValidWord(word) || !isMisspelled(word)) { return; @@ -196,7 +196,7 @@ void Speller::populateContextMenu(QMenu* menu, const QWebHitTestResult &hitTest) void Speller::addToDictionary() { if (QAction* act = qobject_cast(sender())) { - const QString &word = act->data().toString(); + const QString word = act->data().toString(); putWord(word); if (!m_userDictionary.open(QFile::WriteOnly | QFile::Append)) { @@ -265,7 +265,7 @@ void Speller::putWord(const QString &word) return; } - const QByteArray &data = m_textCodec->fromUnicode(word); + const QByteArray data = m_textCodec->fromUnicode(word); if (m_hunspell->add(data.constData()) != 0) { qWarning() << "SpellCheck: Error while adding" << word << "word!"; @@ -278,7 +278,7 @@ bool Speller::isMisspelled(const QString &string) return false; } - const QByteArray &data = m_textCodec->fromUnicode(string); + const QByteArray data = m_textCodec->fromUnicode(string); return m_hunspell->spell(data.constData()) == 0; } @@ -290,7 +290,7 @@ QStringList Speller::suggest(const QString &word) } char** suggestions; - const QByteArray &data = m_textCodec->fromUnicode(word); + const QByteArray data = m_textCodec->fromUnicode(word); int count = m_hunspell->suggest(&suggestions, data.constData()); QStringList suggests; diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index c8a8f58d1..8023625dd 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -93,7 +93,7 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url) { ENSURE_LOADED; - const QString &urlString = url.toString(); + const QString urlString = url.toString(); foreach (const Page &page, m_webPages) { if (page.url == urlString) { @@ -236,7 +236,7 @@ void SpeedDial::changed(const QString &allPages) return; } - const QStringList &entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts); + const QStringList entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts); m_webPages.clear(); foreach (const QString &entry, entries) { @@ -244,7 +244,7 @@ void SpeedDial::changed(const QString &allPages) continue; } - const QStringList &tmp = entry.split(QLatin1String("\"|"), QString::SkipEmptyParts); + const QStringList tmp = entry.split(QLatin1String("\"|"), QString::SkipEmptyParts); if (tmp.count() != 2) { continue; } @@ -285,8 +285,8 @@ void SpeedDial::removeImageForUrl(const QString &url) QString SpeedDial::getOpenFileName() { - const QString &fileTypes = QString("%3(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff)").arg(tr("Image files")); - const QString &image = QzTools::getOpenFileName("SpeedDial-GetOpenFileName", 0, tr("Select image..."), QDir::homePath(), fileTypes); + const QString fileTypes = QString("%3(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff)").arg(tr("Image files")); + const QString image = QzTools::getOpenFileName("SpeedDial-GetOpenFileName", 0, tr("Select image..."), QDir::homePath(), fileTypes); if (image.isEmpty()) { return image; @@ -399,7 +399,7 @@ QString SpeedDial::generateAllPages() QString allPages; foreach (const Page &page, m_webPages) { - const QString &string = QString("url:\"%1\"|title:\"%2\";").arg(page.url, page.title); + const QString string = QString("url:\"%1\"|title:\"%2\";").arg(page.url, page.title); allPages.append(string); } diff --git a/src/lib/popupwindow/popupwebview.cpp b/src/lib/popupwindow/popupwebview.cpp index 95cb7da42..e38aa3446 100644 --- a/src/lib/popupwindow/popupwebview.cpp +++ b/src/lib/popupwindow/popupwebview.cpp @@ -91,7 +91,7 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event) { m_menu->clear(); - const QWebHitTestResult &hitTest = page()->mainFrame()->hitTestContent(event->pos()); + const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos()); createContextMenu(m_menu, hitTest, event->pos()); @@ -100,7 +100,7 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event) if (!m_menu->isEmpty()) { // Prevent choosing first option with double rightclick - const QPoint &pos = event->globalPos(); + const QPoint pos = event->globalPos(); QPoint p(pos.x(), pos.y() + 1); m_menu->popup(p); return; diff --git a/src/lib/preferences/pluginlistdelegate.cpp b/src/lib/preferences/pluginlistdelegate.cpp index dd886bc35..439fc94c5 100644 --- a/src/lib/preferences/pluginlistdelegate.cpp +++ b/src/lib/preferences/pluginlistdelegate.cpp @@ -77,7 +77,7 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op leftPosition = iconRect.right() + m_padding; // Draw plugin name - const QString &name = index.data(Qt::DisplayRole).toString(); + const QString name = index.data(Qt::DisplayRole).toString(); const int leftTitleEdge = leftPosition + 2; const int rightTitleEdge = rightPosition - m_padding; const int leftPosForVersion = titleMetrics.width(name) + m_padding; @@ -86,7 +86,7 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op style->drawItemText(painter, nameRect, Qt::AlignLeft, opt.palette, true, name, colorRole); // Draw version - const QString &version = index.data(Qt::UserRole).toString(); + const QString version = index.data(Qt::UserRole).toString(); QRect versionRect(nameRect.x() + leftPosForVersion, nameRect.y(), rightTitleEdge - leftPosForVersion, titleMetrics.height()); QFont versionFont = titleFont; versionFont.setBold(false); @@ -96,14 +96,14 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op // Draw info const int infoYPos = nameRect.bottom() + opt.fontMetrics.leading(); QRect infoRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height()); - const QString &info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width()); + const QString info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width()); painter->setFont(opt.font); style->drawItemText(painter, infoRect, Qt::TextSingleLine | Qt::AlignLeft, opt.palette, true, info, colorRole); // Draw description const int descriptionYPos = infoRect.bottom() + opt.fontMetrics.leading(); QRect descriptionRect(infoRect.x(), descriptionYPos, infoRect.width(), opt.fontMetrics.height()); - const QString &description = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 2).toString(), Qt::ElideRight, descriptionRect.width()); + const QString description = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 2).toString(), Qt::ElideRight, descriptionRect.width()); style->drawItemText(painter, descriptionRect, Qt::TextSingleLine | Qt::AlignLeft, opt.palette, true, description, colorRole); } diff --git a/src/lib/preferences/sslmanager.cpp b/src/lib/preferences/sslmanager.cpp index 93b5df507..152d3b9f4 100644 --- a/src/lib/preferences/sslmanager.cpp +++ b/src/lib/preferences/sslmanager.cpp @@ -129,7 +129,7 @@ void SSLManager::showCaCertInfo() void SSLManager::addLocalCertificate() { - const QString &path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt"); + const QString path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt"); if (path.isEmpty()) { return; diff --git a/src/lib/preferences/useragentdialog.cpp b/src/lib/preferences/useragentdialog.cpp index 256d124a3..1c263c2b6 100644 --- a/src/lib/preferences/useragentdialog.cpp +++ b/src/lib/preferences/useragentdialog.cpp @@ -35,7 +35,7 @@ UserAgentDialog::UserAgentDialog(QWidget* parent) ui->globalComboBox->setLayoutDirection(Qt::LeftToRight); ui->table->setLayoutDirection(Qt::LeftToRight); - const QString &os = QzTools::operatingSystem(); + const QString os = QzTools::operatingSystem(); m_knownUserAgents << QString("Opera/9.80 (%1) Presto/2.12.388 Version/12.14").arg(os) << QString("Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36").arg(os) << QString("Mozilla/5.0 (%1) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0.6 Safari/536.26").arg(os) @@ -43,7 +43,7 @@ UserAgentDialog::UserAgentDialog(QWidget* parent) ui->globalComboBox->addItems(m_knownUserAgents); - const QString &globalUserAgent = m_manager->globalUserAgent(); + const QString globalUserAgent = m_manager->globalUserAgent(); ui->changeGlobal->setChecked(!globalUserAgent.isEmpty()); ui->globalComboBox->lineEdit()->setText(globalUserAgent); ui->globalComboBox->lineEdit()->setCursorPosition(0); diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index 2290dfc56..6d3bd4267 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -71,9 +71,9 @@ RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* m_rssApps << bloglines << myaol << netvibes << yahoo; #ifdef QZ_WS_X11 - const QString &akregatorBin = QzTools::resolveFromPath("akregator"); - const QString &lifereaBin = QzTools::resolveFromPath("liferea"); - const QString &lifereaAddFeedBin = QzTools::resolveFromPath("liferea-add-feed"); + const QString akregatorBin = QzTools::resolveFromPath("akregator"); + const QString lifereaBin = QzTools::resolveFromPath("liferea"); + const QString lifereaAddFeedBin = QzTools::resolveFromPath("liferea-add-feed"); if (!akregatorBin.isEmpty()) { RssApp akregator; @@ -129,7 +129,7 @@ void RSSNotification::addRss() switch (ui->comboBox->itemData(index).toInt()) { case WebApplication: { const RssApp app = m_rssApps.at(index); - const QUrl &url = QUrl::fromEncoded(QString(app.address + QUrl::toPercentEncoding(m_url.toString())).toLatin1()); + const QUrl url = QUrl::fromEncoded(QString(app.address + QUrl::toPercentEncoding(m_url.toString())).toLatin1()); m_view->openUrlInNewTab(url, Qz::NT_SelectedTab); success = true; @@ -145,16 +145,16 @@ void RSSNotification::addRss() break; } } - const QString &arguments = QString("%1 %2").arg(app.arguments, QString::fromUtf8(m_url.toEncoded())); + const QString arguments = QString("%1 %2").arg(app.arguments, QString::fromUtf8(m_url.toEncoded())); success = QzTools::startExternalProcess(app.executable, arguments); break; } case Other: { QApplication::clipboard()->setText(m_url.toEncoded()); - const QString &message = tr("To add this RSS feed into other application, please use this information:

" - "Title: %1
Url: %2

" - "Url address of this feed has been copied into your clipboard.").arg(m_title, m_url.toString()); + const QString message = tr("To add this RSS feed into other application, please use this information:

" + "Title: %1
Url: %2

" + "Url address of this feed has been copied into your clipboard.").arg(m_title, m_url.toString()); QMessageBox::information(0, tr("Add feed into other application"), message); success = true; break; diff --git a/src/lib/sidebar/bookmarkssidebar.cpp b/src/lib/sidebar/bookmarkssidebar.cpp index 51b9a6bd5..7e61bcdcd 100644 --- a/src/lib/sidebar/bookmarkssidebar.cpp +++ b/src/lib/sidebar/bookmarkssidebar.cpp @@ -73,7 +73,7 @@ void BookmarksSideBar::itemControlClicked(QTreeWidgetItem* item) return; } - const QUrl &url = QUrl::fromEncoded(item->text(1).toUtf8()); + const QUrl url = QUrl::fromEncoded(item->text(1).toUtf8()); p_QupZilla->tabWidget()->addView(url, item->text(0)); } @@ -83,7 +83,7 @@ void BookmarksSideBar::itemDoubleClicked(QTreeWidgetItem* item) return; } - const QUrl &url = QUrl::fromEncoded(item->text(1).toUtf8()); + const QUrl url = QUrl::fromEncoded(item->text(1).toUtf8()); p_QupZilla->loadAddress(url); } diff --git a/src/lib/tools/actioncopy.cpp b/src/lib/tools/actioncopy.cpp index ac6491738..5fea69c08 100644 --- a/src/lib/tools/actioncopy.cpp +++ b/src/lib/tools/actioncopy.cpp @@ -30,8 +30,8 @@ ActionCopy::ActionCopy(QAction* original, QObject* parent) void ActionCopy::updateAction() { - const QString &shortcutString = m_action->shortcut().toString(QKeySequence::NativeText); - const QString &actionText = QString("%1\t%2").arg(m_action->text(), shortcutString); + const QString shortcutString = m_action->shortcut().toString(QKeySequence::NativeText); + const QString actionText = QString("%1\t%2").arg(m_action->text(), shortcutString); setText(actionText); setIcon(m_action->icon()); diff --git a/src/lib/tools/combotabbar.cpp b/src/lib/tools/combotabbar.cpp index c2cf73e7b..c57c58869 100644 --- a/src/lib/tools/combotabbar.cpp +++ b/src/lib/tools/combotabbar.cpp @@ -1207,7 +1207,7 @@ void TabBarScrollWidget::ensureVisible(int index, int xmargin) // Qt Bug? the following lines were taken from QScrollArea::ensureVisible() and // then were fixed. The original version caculates wrong values in RTL layouts. - const QRect &logicalTabRect = QStyle::visualRect(m_tabBar->layoutDirection(), m_tabBar->rect(), m_tabBar->tabRect(index)); + const QRect logicalTabRect = QStyle::visualRect(m_tabBar->layoutDirection(), m_tabBar->rect(), m_tabBar->tabRect(index)); int logicalX = QStyle::visualPos(Qt::LeftToRight, m_scrollArea->viewport()->rect(), logicalTabRect.center()).x(); if (logicalX - xmargin < m_scrollBar->value()) { diff --git a/src/lib/tools/html5permissions/html5permissionsmanager.cpp b/src/lib/tools/html5permissions/html5permissionsmanager.cpp index 1e42c1a24..545bab001 100644 --- a/src/lib/tools/html5permissions/html5permissionsmanager.cpp +++ b/src/lib/tools/html5permissions/html5permissionsmanager.cpp @@ -36,7 +36,7 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame return; } - const QString &host = page->url().host(); + const QString host = page->url().host(); WebView* view = qobject_cast(page->view()); switch (feature) { diff --git a/src/lib/tools/listitemdelegate.cpp b/src/lib/tools/listitemdelegate.cpp index 665bfe382..b11aa3059 100644 --- a/src/lib/tools/listitemdelegate.cpp +++ b/src/lib/tools/listitemdelegate.cpp @@ -74,7 +74,7 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti topPosition += m_iconSize + m_padding; // Draw title - const QString &title = index.data(Qt::DisplayRole).toString(); + const QString title = index.data(Qt::DisplayRole).toString(); const int leftTitleEdge = opt.rect.left() + m_padding; QRect titleRect(leftTitleEdge, topPosition, opt.rect.width() - 2 * m_padding, opt.fontMetrics.height()); QRect visualTitleRect = style->visualRect(direction, opt.rect, titleRect); diff --git a/src/lib/tools/plaineditwithlines.cpp b/src/lib/tools/plaineditwithlines.cpp index 7cd6d68b2..c9929f00b 100644 --- a/src/lib/tools/plaineditwithlines.cpp +++ b/src/lib/tools/plaineditwithlines.cpp @@ -153,7 +153,7 @@ void PlainEditWithLines::highlightCurrentLine() return; } - const QColor &lineColor = palette().color(QPalette::Highlight).lighter(); + const QColor lineColor = palette().color(QPalette::Highlight).lighter(); QList selectionsList; QTextEdit::ExtraSelection selection; @@ -168,7 +168,7 @@ void PlainEditWithLines::highlightCurrentLine() void PlainEditWithLines::lineNumberAreaPaintEvent(QPaintEvent* event) { - const QRect &eventRect = event->rect(); + const QRect eventRect = event->rect(); QPainter painter(m_lineNumberArea); painter.fillRect(eventRect, QColor(235, 235, 235)); diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index bd866ec23..43ebe34ec 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -95,7 +95,7 @@ QString QzTools::readAllFileContents(const QString &filename) void QzTools::centerWidgetOnScreen(QWidget* w) { const QRect screen = QApplication::desktop()->screenGeometry(); - const QRect &size = w->geometry(); + const QRect size = w->geometry(); w->move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2); } @@ -428,7 +428,7 @@ QIcon QzTools::iconFromFileName(const QString &fileName) QString QzTools::resolveFromPath(const QString &name) { - const QString &path = qgetenv("PATH").trimmed(); + const QString path = qgetenv("PATH").trimmed(); if (path.isEmpty()) { return QString(); @@ -688,7 +688,7 @@ QStringList QzTools::splitCommandArguments(const QString &command) const int strlen = line.length(); for (int i = 0; i < strlen; ++i) { - const QChar &c = line.at(i); + const QChar c = line.at(i); if (inQuote && c == QUOTE && i > 0 && line.at(i - 1) != BSLASH) { QString str = line.mid(startPos, i - startPos); @@ -720,7 +720,7 @@ QStringList QzTools::splitCommandArguments(const QString &command) if (inWord && (c == SPACE || i == strlen - 1)) { int len = (i == strlen - 1) ? -1 : i - startPos; - const QString &str = line.mid(startPos, len); + const QString str = line.mid(startPos, len); inWord = false; if (!str.isEmpty()) { @@ -743,7 +743,7 @@ QStringList QzTools::splitCommandArguments(const QString &command) bool QzTools::startExternalProcess(const QString &executable, const QString &args) { - const QStringList &arguments = splitCommandArguments(args); + const QStringList arguments = splitCommandArguments(args); bool success = QProcess::startDetached(executable, arguments); diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index f37df722a..aaa3bca25 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -208,7 +208,7 @@ void SiteInfo::databaseItemChanged(QListWidgetItem* item) return; } - const QWebDatabase &db = list.at(id); + const QWebDatabase db = list.at(id); ui->databaseName->setText(QString("%1 (%2)").arg(db.displayName(), db.name())); ui->databasePath->setText(db.fileName()); diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index fdd595100..9e83bbd88 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -192,7 +192,7 @@ void TabBar::contextMenuRequested(const QPoint &position) } // Prevent choosing first option with double rightclick - const QPoint &pos = mapToGlobal(position); + const QPoint pos = mapToGlobal(position); QPoint p(pos.x(), pos.y() + 1); menu.exec(p); diff --git a/src/lib/webview/tabbedwebview.cpp b/src/lib/webview/tabbedwebview.cpp index aefeb87f9..8aa3f43d9 100644 --- a/src/lib/webview/tabbedwebview.cpp +++ b/src/lib/webview/tabbedwebview.cpp @@ -165,7 +165,7 @@ void TabbedWebView::setIp(const QHostInfo &info) void TabbedWebView::titleChanged() { - const QString &t = title(); + const QString t = title(); if (isCurrent()) { p_QupZilla->setWindowTitle(tr("%1 - QupZilla").arg(t)); @@ -255,7 +255,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event) { m_menu->clear(); - const QWebHitTestResult &hitTest = page()->mainFrame()->hitTestContent(event->pos()); + const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos()); createContextMenu(m_menu, hitTest, event->pos()); @@ -268,7 +268,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event) if (!m_menu->isEmpty()) { // Prevent choosing first option with double rightclick - const QPoint &pos = event->globalPos(); + const QPoint pos = event->globalPos(); QPoint p(pos.x(), pos.y() + 1); m_menu->popup(p); diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 4ad92336c..905cb5980 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -709,9 +709,9 @@ int TabWidget::duplicateTab(int index) WebTab* webTab = weTab(index); - const QUrl &url = webTab->url(); - const QString &title = webTab->title(); - const QByteArray &history = webTab->historyData(); + const QUrl url = webTab->url(); + const QString title = webTab->title(); + const QByteArray history = webTab->historyData(); QNetworkRequest req(url); req.setRawHeader("Referer", url.toEncoded()); diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 2b25b678a..bbd51a50e 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -147,7 +147,7 @@ void WebPage::scheduleAdjustPage() m_adjustingScheduled = true; } else { - const QSize &originalSize = webView->size(); + const QSize originalSize = webView->size(); QSize newSize(originalSize.width() - 1, originalSize.height() - 1); webView->resize(newSize); @@ -243,7 +243,7 @@ void WebPage::finished() connect(m_fileWatcher, SIGNAL(delayedFileChanged(QString)), this, SLOT(watchedFileChanged(QString))); } - const QString &filePath = url().toLocalFile(); + const QString filePath = url().toLocalFile(); if (QFile::exists(filePath) && !m_fileWatcher->files().contains(filePath)) { m_fileWatcher->addPath(filePath); @@ -294,16 +294,16 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) return; } - const QUrl &url = reply->url(); + const QUrl url = reply->url(); switch (reply->error()) { case QNetworkReply::NoError: if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); if (requestUrl.endsWith(QLatin1String(".swf"))) { - const QWebElement &docElement = mainFrame()->documentElement(); - const QWebElement &object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); - const QWebElement &embed = docElement.findFirst(QString("embed[src=\"%1\"]").arg(requestUrl)); + const QWebElement docElement = mainFrame()->documentElement(); + const QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); + const QWebElement embed = docElement.findFirst(QString("embed[src=\"%1\"]").arg(requestUrl)); if (!object.isNull() || !embed.isNull()) { qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download flash object on site!"; @@ -338,7 +338,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) void WebPage::handleUnknownProtocol(const QUrl &url) { - const QString &protocol = url.scheme(); + const QString protocol = url.scheme(); if (protocol == QLatin1String("mailto")) { desktopServicesOpen(url); @@ -357,10 +357,10 @@ void WebPage::handleUnknownProtocol(const QUrl &url) CheckBoxDialog dialog(QDialogButtonBox::Yes | QDialogButtonBox::No, view()); - const QString &wrappedUrl = QzTools::alignTextToWidth(url.toString(), "
", dialog.fontMetrics(), 450); - const QString &text = tr("QupZilla cannot handle %1: links. The requested link " - "is
  • %2
Do you want QupZilla to try " - "open this link in system application?").arg(protocol, wrappedUrl); + const QString wrappedUrl = QzTools::alignTextToWidth(url.toString(), "
", dialog.fontMetrics(), 450); + const QString text = tr("QupZilla cannot handle %1: links. The requested link " + "is
  • %2
Do you want QupZilla to try " + "open this link in system application?").arg(protocol, wrappedUrl); dialog.setText(text); dialog.setCheckBoxText(tr("Remember my choice for this protocol")); @@ -427,7 +427,7 @@ void WebPage::dbQuotaExceeded(QWebFrame* frame) return; } - const QWebSecurityOrigin &origin = frame->securityOrigin(); + const QWebSecurityOrigin origin = frame->securityOrigin(); const qint64 oldQuota = origin.databaseQuota(); frame->securityOrigin().setDatabaseQuota(oldQuota * 2); @@ -609,10 +609,10 @@ void WebPage::cleanBlockedObjects() return; } - const QWebElement &docElement = mainFrame()->documentElement(); + const QWebElement docElement = mainFrame()->documentElement(); foreach (const AdBlockedEntry &entry, m_adBlockedEntries) { - const QString &urlString = entry.url.toString(); + const QString urlString = entry.url.toString(); if (urlString.endsWith(QLatin1String(".js")) || urlString.endsWith(QLatin1String(".css"))) { continue; } @@ -823,7 +823,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte return false; // Downloads } - const QUrl &loadedUrl = exOption->url; + const QUrl loadedUrl = exOption->url; exReturn->baseUrl = loadedUrl; QFile file(":/html/errorPage.html"); @@ -998,7 +998,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile) suggFileName = oldFile; } - const QString &fileName = QzTools::getOpenFileName("WebPage-ChooseFile", originatingFrame->page()->view(), tr("Choose file..."), suggFileName); + const QString fileName = QzTools::getOpenFileName("WebPage-ChooseFile", originatingFrame->page()->view(), tr("Choose file..."), suggFileName); if (!fileName.isEmpty()) { s_lastUploadLocation = fileName; @@ -1006,7 +1006,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile) // Check if we can read from file QFile file(fileName); if (!file.open(QFile::ReadOnly)) { - const QString &msg = tr("Cannot read data from %1. Upload was cancelled!").arg(fileName); + const QString msg = tr("Cannot read data from %1. Upload was cancelled!").arg(fileName); QMessageBox::critical(view(), tr("Cannot read file!"), msg); return QString(); } diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 3fec0f42a..86b088e60 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -173,7 +173,7 @@ void WebView::load(const QUrl &url) void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) { - const QUrl &reqUrl = request.url(); + const QUrl reqUrl = request.url(); if (reqUrl.scheme() == QLatin1String("javascript")) { // Getting scriptSource from PercentEncoding to properly load bookmarklets @@ -197,7 +197,7 @@ void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operat } SearchEnginesManager::SearchResult res = mApp->searchEnginesManager()->searchResult(reqUrl.toString()); - const QUrl &searchUrl = res.request.url(); + const QUrl searchUrl = res.request.url(); QWebView::load(res.request, res.operation, res.data); @@ -422,7 +422,7 @@ void WebView::checkRss() m_rssChecked = true; QWebFrame* frame = page()->mainFrame(); - const QWebElementCollection &links = frame->findAllElements("link[type=\"application/rss+xml\"]"); + const QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]"); m_hasRss = links.count() != 0; emit rssChanged(m_hasRss); @@ -446,7 +446,7 @@ void WebView::slotUrlChanged(const QUrl &url) } // Disable touch mocking on pages known not to work properly - const QString &host = url.host(); + const QString host = url.host(); m_disableTouchMocking = false; foreach (const QString &site, exceptions) { @@ -466,14 +466,14 @@ void WebView::openUrlInNewWindow() void WebView::sendLinkByMail() { if (QAction* action = qobject_cast(sender())) { - const QUrl &mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(action->data().toUrl().toEncoded())); + const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(action->data().toUrl().toEncoded())); QDesktopServices::openUrl(mailUrl); } } void WebView::sendPageByMail() { - const QUrl &mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(title())); + const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(title())); QDesktopServices::openUrl(mailUrl); } @@ -761,8 +761,8 @@ void WebView::checkForForm(QMenu* menu, const QWebElement &element) return; } - const QString &url = parentElement.attribute("action"); - const QString &method = parentElement.hasAttribute("method") ? parentElement.attribute("method").toUpper() : "GET"; + const QString url = parentElement.attribute("action"); + const QString method = parentElement.hasAttribute("method") ? parentElement.attribute("method").toUpper() : "GET"; if (!url.isEmpty() && (method == QLatin1String("GET") || method == QLatin1String("POST"))) { menu->addAction(QIcon(":icons/menu/search-icon.png"), tr("Create Search Engine"), this, SLOT(createSearchEngine())); @@ -945,11 +945,11 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) menu->addSeparator(); if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) { - const QUrl &w3url = QUrl::fromEncoded("http://validator.w3.org/check?uri=" + QUrl::toPercentEncoding(url().toEncoded())); + const QUrl w3url = QUrl::fromEncoded("http://validator.w3.org/check?uri=" + QUrl::toPercentEncoding(url().toEncoded())); menu->addAction(QIcon(":icons/sites/w3.png"), tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(w3url); QByteArray langCode = mApp->currentLanguage().left(2).toUtf8(); - const QUrl >url = QUrl::fromEncoded("http://translate.google.com/translate?sl=auto&tl=" + langCode + "&u=" + QUrl::toPercentEncoding(url().toEncoded())); + const QUrl gturl = QUrl::fromEncoded("http://translate.google.com/translate?sl=auto&tl=" + langCode + "&u=" + QUrl::toPercentEncoding(url().toEncoded())); menu->addAction(QIcon(":icons/sites/translate.png"), tr("Translate page"), this, SLOT(openUrlInSelectedTab()))->setData(gturl); } @@ -1188,7 +1188,7 @@ void WebView::mousePressEvent(QMouseEvent* event) case Qt::LeftButton: { QWebFrame* frame = page()->frameAt(event->pos()); if (frame) { - const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); + const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) { userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier); event->accept(); @@ -1214,7 +1214,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event) case Qt::MiddleButton: { QWebFrame* frame = page()->frameAt(event->pos()); if (frame) { - const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); + const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); if (m_clickedUrl == link && isUrlValid(link)) { userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier); event->accept(); @@ -1255,9 +1255,9 @@ void WebView::keyPressEvent(QKeyEvent* event) // Key_Right within RTL layout should trigger QWebPage::MoveToPreviousChar if (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right) { - const QWebElement &elementHasCursor = activeElement(); + const QWebElement elementHasCursor = activeElement(); if (!elementHasCursor.isNull()) { - const QString &direction = elementHasCursor.styleProperty("direction", QWebElement::ComputedStyle); + const QString direction = elementHasCursor.styleProperty("direction", QWebElement::ComputedStyle); if (direction == QLatin1String("rtl")) { eventKey = eventKey == Qt::Key_Left ? Qt::Key_Right : Qt::Key_Left; QKeyEvent ev(event->type(), eventKey, event->modifiers(), event->text(), event->isAutoRepeat()); diff --git a/src/main/main.cpp b/src/main/main.cpp index e6a56eaf3..5ae496ed4 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -82,7 +82,7 @@ void qupzilla_signal_handler(int s) dir.cd("crashlog"); } - const QDateTime ¤tDateTime = QDateTime::currentDateTime(); + const QDateTime currentDateTime = QDateTime::currentDateTime(); QFile file(dir.absoluteFilePath("Crash-" + currentDateTime.toString(Qt::ISODate) + ".txt")); if (!file.open(QFile::WriteOnly | QFile::Truncate)) { diff --git a/src/plugins/AccessKeysNavigation/akn_handler.cpp b/src/plugins/AccessKeysNavigation/akn_handler.cpp index ce6491e2a..7260860e3 100644 --- a/src/plugins/AccessKeysNavigation/akn_handler.cpp +++ b/src/plugins/AccessKeysNavigation/akn_handler.cpp @@ -261,7 +261,7 @@ void AKN_Handler::showAccessKeys() } QChar accessKey; for (int i = 0; i < accessKeyAttribute.count(); i += 2) { - const QChar &possibleAccessKey = accessKeyAttribute[i]; + const QChar possibleAccessKey = accessKeyAttribute[i]; if (unusedKeys.contains(possibleAccessKey)) { accessKey = possibleAccessKey; break; @@ -291,7 +291,7 @@ void AKN_Handler::showAccessKeys() QChar accessKey; QString text = element.toPlainText().toLower(); for (int i = 0; i < text.count(); ++i) { - const QChar &c = text.at(i); + const QChar c = text.at(i); if (unusedKeys.contains(c)) { accessKey = c; break; diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.cpp b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.cpp index 756c3e60e..89645b75e 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.cpp +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringpasswordbackend.cpp @@ -89,7 +89,7 @@ QVector GnomeKeyringPasswordBackend::getEntries(const QUrl &url) { initialize(); - const QString &host = PasswordManager::createHost(url); + const QString host = PasswordManager::createHost(url); QVector list; diff --git a/src/plugins/GreaseMonkey/gm_addscriptdialog.cpp b/src/plugins/GreaseMonkey/gm_addscriptdialog.cpp index 6ef7f54d7..6f9300447 100644 --- a/src/plugins/GreaseMonkey/gm_addscriptdialog.cpp +++ b/src/plugins/GreaseMonkey/gm_addscriptdialog.cpp @@ -41,8 +41,8 @@ GM_AddScriptDialog::GM_AddScriptDialog(GM_Manager* manager, GM_Script* script, Q QString runsAt; QString dontRunsAt; - const QStringList &include = script->include(); - const QStringList &exclude = script->exclude(); + const QStringList include = script->include(); + const QStringList exclude = script->exclude(); if (!include.isEmpty()) { runsAt = tr("

runs at
%1

").arg(include.join("
")); @@ -66,7 +66,7 @@ void GM_AddScriptDialog::showSource() return; } - const QString &tmpFileName = QzTools::ensureUniqueFilename(mApp->tempPath() + "/tmp-userscript.js"); + const QString tmpFileName = QzTools::ensureUniqueFilename(mApp->tempPath() + "/tmp-userscript.js"); if (QFile::copy(m_script->fileName(), tmpFileName)) { int index = qz->tabWidget()->addView(QUrl::fromLocalFile(tmpFileName), Qz::NT_SelectedTabAtTheEnd); diff --git a/src/plugins/GreaseMonkey/gm_downloader.cpp b/src/plugins/GreaseMonkey/gm_downloader.cpp index 918b9da18..b6616ac20 100644 --- a/src/plugins/GreaseMonkey/gm_downloader.cpp +++ b/src/plugins/GreaseMonkey/gm_downloader.cpp @@ -55,7 +55,7 @@ void GM_Downloader::scriptDownloaded() QByteArray response = QString::fromUtf8(m_reply->readAll()).toUtf8(); if (m_reply->error() == QNetworkReply::NoError && response.contains("// ==UserScript==")) { - const QString &filePath = m_manager->scriptsDirectory() + QzTools::getFileNameFromUrl(m_reply->url()); + const QString filePath = m_manager->scriptsDirectory() + QzTools::getFileNameFromUrl(m_reply->url()); m_fileName = QzTools::ensureUniqueFilename(filePath); QFile file(m_fileName); @@ -77,7 +77,7 @@ void GM_Downloader::scriptDownloaded() rx.indexIn(response); for (int i = 1; i <= rx.captureCount(); ++i) { - const QString &url = rx.cap(i).trimmed(); + const QString url = rx.cap(i).trimmed(); if (!url.isEmpty() && !settings.contains(url)) { m_requireUrls.append(QUrl(url)); } @@ -100,8 +100,8 @@ void GM_Downloader::requireDownloaded() QByteArray response = QString::fromUtf8(m_reply->readAll()).toUtf8(); if (m_reply->error() == QNetworkReply::NoError && !response.isEmpty()) { - const QString &filePath = m_manager->settinsPath() + "/greasemonkey/requires/require.js"; - const QString &fileName = QzTools::ensureUniqueFilename(filePath, "%1"); + const QString filePath = m_manager->settinsPath() + "/greasemonkey/requires/require.js"; + const QString fileName = QzTools::ensureUniqueFilename(filePath, "%1"); QFile file(fileName); diff --git a/src/plugins/GreaseMonkey/gm_manager.cpp b/src/plugins/GreaseMonkey/gm_manager.cpp index 8fa195b96..13329aa96 100644 --- a/src/plugins/GreaseMonkey/gm_manager.cpp +++ b/src/plugins/GreaseMonkey/gm_manager.cpp @@ -81,7 +81,7 @@ QString GM_Manager::requireScripts(const QStringList &urlList) const foreach (const QString &url, urlList) { if (settings.contains(url)) { - const QString &fileName = settings.value(url).toString(); + const QString fileName = settings.value(url).toString(); script.append(QzTools::readAllFileContents(fileName).trimmed() + '\n'); } } @@ -201,8 +201,8 @@ void GM_Manager::pageLoadStart() return; } - const QString &urlScheme = mainFrame->url().scheme(); - const QString &urlString = mainFrame->url().toEncoded(); + const QString urlScheme = mainFrame->url().scheme(); + const QString urlString = mainFrame->url().toEncoded(); if (!canRunOnScheme(urlScheme)) { return; @@ -224,8 +224,8 @@ void GM_Manager::pageLoadStart() foreach (GM_Script* script, m_endScripts) { if (script->match(urlString)) { - const QString &jscript = QString("window.addEventListener(\"DOMContentLoaded\"," - "function(e) { \n%1\n }, false);").arg(m_bootstrap + script->script()); + const QString jscript = QString("window.addEventListener(\"DOMContentLoaded\"," + "function(e) { \n%1\n }, false);").arg(m_bootstrap + script->script()); mainFrame->evaluateJavaScript(jscript); } } @@ -250,7 +250,7 @@ void GM_Manager::load() m_disabledScripts = settings.value("disabledScripts", QStringList()).toStringList(); foreach (const QString &fileName, gmDir.entryList(QStringList("*.js"), QDir::Files)) { - const QString &absolutePath = gmDir.absoluteFilePath(fileName); + const QString absolutePath = gmDir.absoluteFilePath(fileName); GM_Script* script = new GM_Script(this, absolutePath); if (!script->isValid()) { diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index 0f23378e2..cb623725a 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -101,7 +101,7 @@ QNetworkReply* GM_Plugin::createRequest(QNetworkAccessManager::Operation op, con Q_UNUSED(outgoingData) if (op == QNetworkAccessManager::GetOperation && request.rawHeader("X-QupZilla-UserLoadAction") == QByteArray("1")) { - const QString &urlString = request.url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); + const QString urlString = request.url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); if (urlString.endsWith(QLatin1String(".user.js"))) { m_manager->downloadScript(request); diff --git a/src/plugins/GreaseMonkey/gm_script.cpp b/src/plugins/GreaseMonkey/gm_script.cpp index 3558bc8db..0eacde1e9 100644 --- a/src/plugins/GreaseMonkey/gm_script.cpp +++ b/src/plugins/GreaseMonkey/gm_script.cpp @@ -193,7 +193,7 @@ void GM_Script::parseScript() QStringList requireList; - const QStringList &lines = metadataBlock.split(QLatin1Char('\n'), QString::SkipEmptyParts); + const QStringList lines = metadataBlock.split(QLatin1Char('\n'), QString::SkipEmptyParts); foreach (QString line, lines) { if (!line.startsWith(QLatin1String("// @"))) { continue; @@ -206,8 +206,8 @@ void GM_Script::parseScript() continue; } - const QString &key = line.left(index).trimmed(); - const QString &value = line.mid(index + 1).trimmed(); + const QString key = line.left(index).trimmed(); + const QString value = line.mid(index + 1).trimmed(); // Ignored values: // @resource diff --git a/src/plugins/GreaseMonkey/gm_urlmatcher.cpp b/src/plugins/GreaseMonkey/gm_urlmatcher.cpp index 08b829d68..7667b1fd1 100644 --- a/src/plugins/GreaseMonkey/gm_urlmatcher.cpp +++ b/src/plugins/GreaseMonkey/gm_urlmatcher.cpp @@ -28,7 +28,7 @@ static bool wildcardMatch(const QString &string, const QString &pattern) bool startsWithWildcard = pattern[0] == QLatin1Char('*'); bool endsWithWildcard = pattern[patternSize - 1] == QLatin1Char('*'); - const QStringList &parts = pattern.split(QLatin1Char('*')); + const QStringList parts = pattern.split(QLatin1Char('*')); int pos = 0; if (startsWithWildcard) { diff --git a/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp b/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp index af6b38151..fd065745a 100644 --- a/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp +++ b/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp @@ -86,7 +86,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte leftPosition = iconRect.right() + m_padding; // Draw script name - const QString &name = index.data(Qt::DisplayRole).toString(); + const QString name = index.data(Qt::DisplayRole).toString(); const int leftTitleEdge = leftPosition + 2; const int rightTitleEdge = rightPosition - m_padding; const int leftPosForVersion = titleMetrics.width(name) + m_padding; @@ -95,7 +95,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte style->drawItemText(painter, nameRect, Qt::AlignLeft, opt.palette, true, name, colorRole); // Draw version - const QString &version = index.data(Qt::UserRole).toString(); + const QString version = index.data(Qt::UserRole).toString(); QRect versionRect(nameRect.x() + leftPosForVersion, nameRect.y(), rightTitleEdge - leftPosForVersion, titleMetrics.height()); QFont versionFont = titleFont; versionFont.setBold(false); @@ -105,7 +105,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte // Draw description const int infoYPos = nameRect.bottom() + opt.fontMetrics.leading(); QRect infoRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height()); - const QString &info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width()); + const QString info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width()); painter->setFont(opt.font); style->drawItemText(painter, infoRect, Qt::TextSingleLine | Qt::AlignLeft, opt.palette, true, info, colorRole); diff --git a/src/plugins/GreaseMonkey/settings/gm_settingslistwidget.cpp b/src/plugins/GreaseMonkey/settings/gm_settingslistwidget.cpp index 5b6ac0550..b8acbe08b 100644 --- a/src/plugins/GreaseMonkey/settings/gm_settingslistwidget.cpp +++ b/src/plugins/GreaseMonkey/settings/gm_settingslistwidget.cpp @@ -57,7 +57,7 @@ bool GM_SettingsListWidget::containsRemoveIcon(const QPoint &pos) const return false; } - const QRect &rect = visualItemRect(item); + const QRect rect = visualItemRect(item); const int removeIconPosition = rect.right() - m_delegate->padding() - 16; const int center = rect.height() / 2 + rect.top(); const int removeIconYPos = center - (16 / 2); diff --git a/src/plugins/KWalletPasswords/kwalletpasswordbackend.cpp b/src/plugins/KWalletPasswords/kwalletpasswordbackend.cpp index ba3d52d32..fa86d2311 100644 --- a/src/plugins/KWalletPasswords/kwalletpasswordbackend.cpp +++ b/src/plugins/KWalletPasswords/kwalletpasswordbackend.cpp @@ -52,7 +52,7 @@ QVector KWalletPasswordBackend::getEntries(const QUrl &url) { initialize(); - const QString &host = PasswordManager::createHost(url); + const QString host = PasswordManager::createHost(url); QVector list; diff --git a/src/plugins/PIM/PIM_handler.cpp b/src/plugins/PIM/PIM_handler.cpp index ef99a4142..8b4ae166c 100644 --- a/src/plugins/PIM/PIM_handler.cpp +++ b/src/plugins/PIM/PIM_handler.cpp @@ -122,7 +122,7 @@ void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitT } for (int i = 0; i < PI_Max; ++i) { - const QString &info = m_allInfo[PI_Type(i)]; + const QString info = m_allInfo[PI_Type(i)]; if (info.isEmpty()) { continue; } @@ -152,11 +152,11 @@ bool PIM_Handler::keyPress(WebView* view, QKeyEvent* event) return false; } - const QWebElement &document = view->page()->mainFrame()->documentElement(); + const QWebElement document = view->page()->mainFrame()->documentElement(); const QWebElementCollection elements = document.findAll("input[type=\"text\"]"); foreach (QWebElement element, elements) { - const QString &name = element.attribute("name"); + const QString name = element.attribute("name"); if (name.isEmpty()) { continue; } @@ -203,11 +203,11 @@ void PIM_Handler::pageLoadFinished() loadSettings(); } - const QWebElement &document = page->mainFrame()->documentElement(); + const QWebElement document = page->mainFrame()->documentElement(); const QWebElementCollection elements = document.findAll("input[type=\"text\"]"); foreach (QWebElement element, elements) { - const QString &name = element.attribute("name"); + const QString name = element.attribute("name"); if (name.isEmpty()) { continue; } diff --git a/src/plugins/StatusBarIcons/sbi_networkicondialog.cpp b/src/plugins/StatusBarIcons/sbi_networkicondialog.cpp index adc1736dc..2e85d5db3 100644 --- a/src/plugins/StatusBarIcons/sbi_networkicondialog.cpp +++ b/src/plugins/StatusBarIcons/sbi_networkicondialog.cpp @@ -52,7 +52,7 @@ SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent) void SBI_NetworkIconDialog::addProxy() { - const QString &name = QInputDialog::getText(this, tr("Add proxy"), tr("Name of proxy:")); + const QString name = QInputDialog::getText(this, tr("Add proxy"), tr("Name of proxy:")); if (name.isEmpty() || ui->comboBox->findText(name) > -1) { return; } diff --git a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp index ff2cf8978..823c94df5 100644 --- a/src/plugins/StatusBarIcons/sbi_networkmanager.cpp +++ b/src/plugins/StatusBarIcons/sbi_networkmanager.cpp @@ -57,7 +57,7 @@ void SBI_NetworkManager::loadSettings() m_proxies[group] = proxy; } - const QString ¤tName = settings.value("CurrentProxy", QString()).toString(); + const QString currentName = settings.value("CurrentProxy", QString()).toString(); m_currentProxy = m_proxies.contains(currentName) ? m_proxies.value(currentName) : 0; applyCurrentProxy();