diff --git a/src/lib/adblock/adblockaddsubscriptiondialog.cpp b/src/lib/adblock/adblockaddsubscriptiondialog.cpp index ba70db30d..e51362936 100644 --- a/src/lib/adblock/adblockaddsubscriptiondialog.cpp +++ b/src/lib/adblock/adblockaddsubscriptiondialog.cpp @@ -62,7 +62,7 @@ QString AdBlockAddSubscriptionDialog::url() const void AdBlockAddSubscriptionDialog::indexChanged(int index) { - const Subscription &subscription = m_knownSubscriptions.at(index); + const Subscription subscription = m_knownSubscriptions.at(index); int pos = subscription.title.indexOf(QLatin1Char('(')); QString title = subscription.title; diff --git a/src/lib/adblock/adblocksubscription.cpp b/src/lib/adblock/adblocksubscription.cpp index d14e7356a..a6f5a49ff 100644 --- a/src/lib/adblock/adblocksubscription.cpp +++ b/src/lib/adblock/adblocksubscription.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -457,7 +457,7 @@ bool AdBlockCustomList::containsFilter(const QString &filter) const bool AdBlockCustomList::removeFilter(const QString &filter) { for (int i = 0; i < m_rules.count(); ++i) { - const AdBlockRule &rule = m_rules.at(i); + const AdBlockRule rule = m_rules.at(i); if (rule.filter() == filter) { return removeRule(i); diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index b2889383e..62dd8393c 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -292,7 +292,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa } PageFormCompleter completer(webPage); - const PageFormData &formData = completer.extractFormData(outgoingData); + const PageFormData formData = completer.extractFormData(outgoingData); if (!formData.found) { return; diff --git a/src/lib/bookmarks/bookmarksmodel.cpp b/src/lib/bookmarks/bookmarksmodel.cpp index 1a57153ed..c47bc17e6 100644 --- a/src/lib/bookmarks/bookmarksmodel.cpp +++ b/src/lib/bookmarks/bookmarksmodel.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -616,10 +616,8 @@ void BookmarksModel::changeFolderParent(const QString &name, bool isSubfolder, b void BookmarksModel::bookmarkDropedLink(const QUrl &url, const QString &title, const QVariant &imageVariant, const QString &folder, bool* ok) { - bool result = false; - QIcon icon = qIconProvider->iconFromImage(qvariant_cast(imageVariant)); - result = saveBookmark(url, title, icon, BookmarksModel::fromTranslatedFolder(folder)); + bool result = saveBookmark(url, title, icon, BookmarksModel::fromTranslatedFolder(folder)); if (ok) { *ok = result; diff --git a/src/lib/bookmarks/bookmarkswidget.cpp b/src/lib/bookmarks/bookmarkswidget.cpp index 51a7020f3..daf411892 100644 --- a/src/lib/bookmarks/bookmarkswidget.cpp +++ b/src/lib/bookmarks/bookmarkswidget.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ BookmarksWidget::BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* pa connect(ui->speeddialButton, SIGNAL(clicked(QPoint)), this, SLOT(toggleSpeedDial())); - const SpeedDial::Page &page = m_speedDial->pageForUrl(m_url); + const SpeedDial::Page page = m_speedDial->pageForUrl(m_url); ui->speeddialButton->setText(page.url.isEmpty() ? tr("Add to Speed Dial") : tr("Remove from Speed Dial")); @@ -108,9 +108,8 @@ void BookmarksWidget::loadBookmark() void BookmarksWidget::toggleSpeedDial() { - const SpeedDial::Page &page = m_speedDial->pageForUrl(m_url); + const SpeedDial::Page page = m_speedDial->pageForUrl(m_url); - QString const dialText("%1"); if (page.url.isEmpty()) { m_speedDial->addPage(m_url, m_view->title()); diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index 4e52a7018..8f88bc03c 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,7 +92,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const return QVariant(); } - const HistoryEntry &entry = item->historyEntry; + const HistoryEntry entry = item->historyEntry; switch (role) { case IdRole: @@ -450,7 +450,7 @@ void HistoryModel::init() return; } - const qint64 &minTimestamp = query.value(0).toLongLong(); + const qint64 minTimestamp = query.value(0).toLongLong(); if (minTimestamp <= 0) { return; } @@ -458,7 +458,7 @@ void HistoryModel::init() const QDate &today = QDate::currentDate(); const QDate &week = today.addDays(1 - today.dayOfWeek()); const QDate &month = QDate(today.year(), today.month(), 1); - const qint64 ¤tTimestamp = QDateTime::currentMSecsSinceEpoch(); + const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch(); qint64 timestamp = currentTimestamp; while (timestamp > minTimestamp) { diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index f6bcfd243..e8b7a7755 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,7 +120,7 @@ QUrl SearchEnginesManager::searchUrl(const Engine &engine, const QString &string QUrl SearchEnginesManager::searchUrl(const QString &string) { - const Engine &en = qzSettings->searchWithDefaultEngine ? m_defaultEngine : m_activeEngine; + const Engine en = qzSettings->searchWithDefaultEngine ? m_defaultEngine : m_activeEngine; return searchUrl(en, string); } diff --git a/src/lib/preferences/pluginsmanager.cpp b/src/lib/preferences/pluginsmanager.cpp index 76afe7d39..bd0f8e9f0 100644 --- a/src/lib/preferences/pluginsmanager.cpp +++ b/src/lib/preferences/pluginsmanager.cpp @@ -111,7 +111,7 @@ void PluginsManager::save() QListWidgetItem* item = ui->list->item(i); if (item->checkState() == Qt::Checked) { - const Plugins::Plugin &plugin = item->data(Qt::UserRole + 10).value(); + const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value(); allowedPlugins.append(plugin.fullPath); } @@ -227,7 +227,7 @@ void PluginsManager::currentChanged(QListWidgetItem* item) return; } - const Plugins::Plugin &plugin = item->data(Qt::UserRole + 10).value(); + const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value(); bool showSettings = plugin.pluginSpec.hasSettings; if (!plugin.isLoaded()) { diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index e7b9f7974..4591d3413 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -104,7 +104,7 @@ void RSSNotification::addRss() switch (ui->comboBox->itemData(index).toInt()) { case WebApplication: { - const RssApp &app = m_rssApps.at(index); + const RssApp app = m_rssApps.at(index); const QUrl &url = QUrl::fromEncoded(QString(app.address + QUrl::toPercentEncoding(m_url.toString())).toLatin1()); m_view->openUrlInNewTab(url, Qz::NT_SelectedTab); @@ -113,7 +113,7 @@ void RSSNotification::addRss() } case DesktopApplication: { - const RssApp &app = m_rssApps.at(index); + const RssApp app = m_rssApps.at(index); if (app.title == QLatin1String("Akregator")) { success = startExternalProcess("/usr/bin/akregator", QStringList() << "-a" << m_url.toEncoded()); } diff --git a/src/lib/session/recoverywidget.cpp b/src/lib/session/recoverywidget.cpp index 68b24bcee..45026a7ac 100644 --- a/src/lib/session/recoverywidget.cpp +++ b/src/lib/session/recoverywidget.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 Franz Fellner +* Copyright (C) 2010-2013 Franz Fellner * David Rosca * * This program is free software: you can redistribute it and/or modify @@ -33,10 +33,10 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) setCursor(Qt::ArrowCursor); - const RestoreData &data = mApp->restoreManager()->restoreData(); + const RestoreData data = mApp->restoreManager()->restoreData(); for (int i = 0; i < data.size(); ++i) { - const RestoreManager::WindowData &wd = data.at(i); + const RestoreManager::WindowData wd = data.at(i); QTreeWidgetItem* root = new QTreeWidgetItem(ui->treeWidget); root->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate); @@ -44,7 +44,7 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) root->setCheckState(0, Qt::Checked); for (int tab = 0; tab < wd.tabsState.size(); ++tab) { - const WebTab::SavedTab &st = wd.tabsState.at(tab); + const WebTab::SavedTab st = wd.tabsState.at(tab); QTreeWidgetItem* child = new QTreeWidgetItem(root); child->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index b375b887e..455ae952e 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -797,33 +797,35 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c if (hitTest.isContentEditable()) { if (menu->actions().count() == spellCheckActionCount) { QMenu* pageMenu = page()->createStandardContextMenu(); - - int i = 0; - foreach(QAction * act, pageMenu->actions()) { - if (act->isSeparator()) { - menu->addSeparator(); - continue; - } - - // Hiding double Direction + Fonts menu (bug in QtWebKit 2.2) - if (i <= 1 && act->menu()) { - if (act->menu()->actions().contains(pageAction(QWebPage::SetTextDirectionDefault)) || - act->menu()->actions().contains(pageAction(QWebPage::ToggleBold))) { - act->setVisible(false); + // Apparently createStandardContextMenu() can return null pointer + if (pageMenu) { + int i = 0; + foreach(QAction * act, pageMenu->actions()) { + if (act->isSeparator()) { + menu->addSeparator(); + continue; } + + // Hiding double Direction + Fonts menu (bug in QtWebKit 2.2) + if (i <= 1 && act->menu()) { + if (act->menu()->actions().contains(pageAction(QWebPage::SetTextDirectionDefault)) || + act->menu()->actions().contains(pageAction(QWebPage::ToggleBold))) { + act->setVisible(false); + } + } + + menu->addAction(act); + + ++i; } - menu->addAction(act); + if (menu->actions().last() == pageAction(QWebPage::InspectElement)) { + // We have own Inspect Element action + menu->actions().last()->setVisible(false); + } - ++i; + delete pageMenu; } - - if (menu->actions().last() == pageAction(QWebPage::InspectElement)) { - // We have own Inspect Element action - menu->actions().last()->setVisible(false); - } - - delete pageMenu; } if (hitTest.element().tagName().toLower() == QLatin1String("input")) { diff --git a/src/plugins/MouseGestures/3rdparty/QjtMouseGestureFilter.cpp b/src/plugins/MouseGestures/3rdparty/QjtMouseGestureFilter.cpp index 007a7f6c2..ab7b70fd7 100644 --- a/src/plugins/MouseGestures/3rdparty/QjtMouseGestureFilter.cpp +++ b/src/plugins/MouseGestures/3rdparty/QjtMouseGestureFilter.cpp @@ -211,7 +211,7 @@ bool QjtMouseGestureFilter::paintEvent(QObject* obj, QPaintEvent* event) QWidget* wid = static_cast(obj); QPainter painter(wid); painter.drawPixmap(0, 0, d->px); - const Gesture::PosList &points = d->mgr->currentPath(); + const Gesture::PosList points = d->mgr->currentPath(); painter.save(); QPen pe; pe.setColor(Qt::red);