1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[CodingStyle] Don't use references when assigning to local variable

Let the compiler do the optimization
This commit is contained in:
nowrep 2013-12-30 13:43:48 +01:00
parent d695a8b99a
commit da15e5868d
73 changed files with 273 additions and 273 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -68,7 +68,7 @@ void CommandLineOptions::parseActions()
{
using namespace std;
const QStringList &arguments = QCoreApplication::arguments();
const QStringList arguments = QCoreApplication::arguments();
if (arguments.isEmpty()) {
return;
}

View File

@ -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);
}

View File

@ -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:<br/><br/><b>" + browseDataBackup + "<br/>" + settingsBackup + "<br/></b>";
const QString text = "Incompatible profile version has been detected. To avoid losing your profile data, they were "
"backed up in following directories:<br/><br/><b>" + browseDataBackup + "<br/>" + settingsBackup + "<br/></b>";
QMessageBox::warning(0, "QupZilla: Incompatible profile version", text);
}

View File

@ -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<QByteArray> 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<QAction*>(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;

View File

@ -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;

View File

@ -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;

View File

@ -55,7 +55,7 @@ QVector<PasswordEntry> 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 "

View File

@ -35,7 +35,7 @@ QString DatabasePasswordBackend::name() const
QVector<PasswordEntry> 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 "

View File

@ -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) {

View File

@ -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));
}

View File

@ -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;

View File

@ -111,7 +111,7 @@ void CookieManager::removeCookie()
QList<QNetworkCookie> 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<QNetworkCookie>(current->data(0, Qt::UserRole + 10));
const QNetworkCookie cookie = qvariant_cast<QNetworkCookie>(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<QNetworkCookie>(current->data(0, Qt::UserRole + 10));
const QNetworkCookie cookie = qvariant_cast<QNetworkCookie>(current->data(0, Qt::UserRole + 10));
ui->name->setText(cookie.name());
ui->value->setText(cookie.value());
@ -187,7 +187,7 @@ void CookieManager::slotRefreshTable()
QPointer<CookieManager> guard = this;
QHash<QString, QTreeWidgetItem*> 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;
}

View File

@ -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);
}

View File

@ -26,7 +26,7 @@
static QString dateTimeToString(const QDateTime &dateTime)
{
const QDateTime &current = 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;

View File

@ -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;
}

View File

@ -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()));

View File

@ -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());

View File

@ -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;

View File

@ -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()));

View File

@ -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);

View File

@ -188,7 +188,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> 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<QSslError> errors)
QHash<QSslCertificate, QStringList>::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<QSslCertificate> &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()) {

View File

@ -120,7 +120,7 @@ QList<QNetworkProxy> 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);

View File

@ -39,7 +39,7 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat
return 0;
}
const QUrl &url = request.url();
const QUrl url = request.url();
const QList<QPair<QString, QString> > 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 <b>%1</b> subscription?").arg(subscriptionTitle);
const QString message = AdBlockManager::tr("Do you want to add <b>%1</b> subscription?").arg(subscriptionTitle);
QMessageBox::StandardButton result = QMessageBox::question(0, AdBlockManager::tr("AdBlock Subscription"), message, QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) {

View File

@ -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;

View File

@ -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(".."));

View File

@ -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()) {

View File

@ -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());

View File

@ -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

View File

@ -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;

View File

@ -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();

View File

@ -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());

View File

@ -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<QString, QString> i(m_userAgentsList);

View File

@ -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;
}

View File

@ -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<QAction*>(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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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:<br/><br/>"
"<b>Title: </b>%1<br/><b>Url: </b>%2<br/><br/>"
"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:<br/><br/>"
"<b>Title: </b>%1<br/><b>Url: </b>%2<br/><br/>"
"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;

View File

@ -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);
}

View File

@ -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());

View File

@ -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()) {

View File

@ -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<WebView*>(page->view());
switch (feature) {

View File

@ -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);

View File

@ -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<QTextEdit::ExtraSelection> 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));

View File

@ -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);

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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());

View File

@ -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(), "<br/>", dialog.fontMetrics(), 450);
const QString &text = tr("QupZilla cannot handle <b>%1:</b> links. The requested link "
"is <ul><li>%2</li></ul>Do you want QupZilla to try "
"open this link in system application?").arg(protocol, wrappedUrl);
const QString wrappedUrl = QzTools::alignTextToWidth(url.toString(), "<br/>", dialog.fontMetrics(), 450);
const QString text = tr("QupZilla cannot handle <b>%1:</b> links. The requested link "
"is <ul><li>%2</li></ul>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 <b>%1</b>. Upload was cancelled!").arg(fileName);
const QString msg = tr("Cannot read data from <b>%1</b>. Upload was cancelled!").arg(fileName);
QMessageBox::critical(view(), tr("Cannot read file!"), msg);
return QString();
}

View File

@ -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<QAction*>(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 &gturl = 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());

View File

@ -82,7 +82,7 @@ void qupzilla_signal_handler(int s)
dir.cd("crashlog");
}
const QDateTime &currentDateTime = QDateTime::currentDateTime();
const QDateTime currentDateTime = QDateTime::currentDateTime();
QFile file(dir.absoluteFilePath("Crash-" + currentDateTime.toString(Qt::ISODate) + ".txt"));
if (!file.open(QFile::WriteOnly | QFile::Truncate)) {

View File

@ -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;

View File

@ -89,7 +89,7 @@ QVector<PasswordEntry> GnomeKeyringPasswordBackend::getEntries(const QUrl &url)
{
initialize();
const QString &host = PasswordManager::createHost(url);
const QString host = PasswordManager::createHost(url);
QVector<PasswordEntry> list;

View File

@ -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("<p>runs at<br/><i>%1</i></p>").arg(include.join("<br/>"));
@ -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);

View File

@ -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);

View File

@ -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()) {

View File

@ -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);

View File

@ -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

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -52,7 +52,7 @@ QVector<PasswordEntry> KWalletPasswordBackend::getEntries(const QUrl &url)
{
initialize();
const QString &host = PasswordManager::createHost(url);
const QString host = PasswordManager::createHost(url);
QVector<PasswordEntry> list;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -57,7 +57,7 @@ void SBI_NetworkManager::loadSettings()
m_proxies[group] = proxy;
}
const QString &currentName = 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();