1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Coding style.

This commit is contained in:
nowrep 2013-02-08 12:10:12 +01:00
parent 3b648397b0
commit 0a9f2ec4d6
12 changed files with 49 additions and 50 deletions

View File

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

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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);

View File

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

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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<QImage>(imageVariant));
result = saveBookmark(url, title, icon, BookmarksModel::fromTranslatedFolder(folder));
bool result = saveBookmark(url, title, icon, BookmarksModel::fromTranslatedFolder(folder));
if (ok) {
*ok = result;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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("<a href='toggle_dial'>%1</a>");
if (page.url.isEmpty()) {
m_speedDial->addPage(m_url, m_view->title());

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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 &currentTimestamp = QDateTime::currentMSecsSinceEpoch();
const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch();
qint64 timestamp = currentTimestamp;
while (timestamp > minTimestamp) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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);
}

View File

@ -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<Plugins::Plugin>();
const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value<Plugins::Plugin>();
allowedPlugins.append(plugin.fullPath);
}
@ -227,7 +227,7 @@ void PluginsManager::currentChanged(QListWidgetItem* item)
return;
}
const Plugins::Plugin &plugin = item->data(Qt::UserRole + 10).value<Plugins::Plugin>();
const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value<Plugins::Plugin>();
bool showSettings = plugin.pluginSpec.hasSettings;
if (!plugin.isLoaded()) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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());
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 Franz Fellner <alpine.art.de@googlemail.com>
* Copyright (C) 2010-2013 Franz Fellner <alpine.art.de@googlemail.com>
* David Rosca <nowrep@gmail.com>
*
* 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);

View File

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

View File

@ -211,7 +211,7 @@ bool QjtMouseGestureFilter::paintEvent(QObject* obj, QPaintEvent* event)
QWidget* wid = static_cast<QWidget*>(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);