1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Code] Updated coding style with patched Astyle + normalized signals.

Code was formatted with patched astyle that correctly formats
foreach macro.
Normalize tool is now used to normalize all signal/slots signatures
to normalized format. It saves few reallocations on connections.
This commit is contained in:
nowrep 2013-03-06 09:05:41 +01:00
parent cc93b67002
commit 5f5cf7417d
84 changed files with 329 additions and 321 deletions

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
# #
# Requirements: # Requirements:
# astyle >=2.02 # astyle > =2.02 (patched with foreach support)
# normalize (Qt tool to normalize all signal/slots format)
# #
function format_sources { function format_sources {
@ -9,7 +10,7 @@ function format_sources {
--indent-labels --pad-oper --unpad-paren --pad-header \ --indent-labels --pad-oper --unpad-paren --pad-header \
--convert-tabs --indent-preprocessor --break-closing-brackets \ --convert-tabs --indent-preprocessor --break-closing-brackets \
--align-pointer=type --align-reference=name \ --align-pointer=type --align-reference=name \
`find -type f -name '*.cpp'` `find -type f -name '*.cpp'` | grep 'Formatted'
find . -name "*.orig" -print0 | xargs -0 rm -rf find . -name "*.orig" -print0 | xargs -0 rm -rf
} }
@ -20,16 +21,19 @@ function format_headers {
--keep-one-line-statements --keep-one-line-blocks \ --keep-one-line-statements --keep-one-line-blocks \
--indent-preprocessor --convert-tabs \ --indent-preprocessor --convert-tabs \
--align-pointer=type --align-reference=name \ --align-pointer=type --align-reference=name \
`find -type f -name '*.h'` `find -type f -name '*.h'` | grep 'Formatted'
find . -name "*.orig" -print0 | xargs -0 rm -rf find . -name "*.orig" -print0 | xargs -0 rm -rf
} }
cd ../src cd ../src
echo "running astyle for *.cpp ..." echo "Running astyle for *.cpp ..."
format_sources format_sources
echo "running astyle for *.h ..." echo "Running astyle for *.h ..."
format_headers format_headers
echo "Running normalize ..."
normalize --modify .
exit 0 exit 0

View File

@ -623,7 +623,7 @@ void FancyTabWidget::SetMode(Mode mode)
side_layout_->insertWidget(0, bar); side_layout_->insertWidget(0, bar);
tab_bar_ = bar; tab_bar_ = bar;
foreach(const Item & item, items_) { foreach (const Item &item, items_) {
if (item.type_ == Item::Type_Spacer) { if (item.type_ == Item::Type_Spacer) {
bar->addSpacer(item.spacer_size_); bar->addSpacer(item.spacer_size_);
} }
@ -722,7 +722,7 @@ void FancyTabWidget::MakeTabBar(QTabBar::Shape shape, bool text, bool icons,
side_layout_->insertWidget(0, bar); side_layout_->insertWidget(0, bar);
} }
foreach(const Item & item, items_) { foreach (const Item &item, items_) {
if (item.type_ != Item::Type_Tab) { if (item.type_ != Item::Type_Tab) {
continue; continue;
} }

View File

@ -1493,15 +1493,15 @@ QFtp::QFtp(QObject* parent)
SLOT(_q_piConnectState(int))); SLOT(_q_piConnectState(int)));
connect(&d->pi, SIGNAL(finished(QString)), connect(&d->pi, SIGNAL(finished(QString)),
SLOT(_q_piFinished(QString))); SLOT(_q_piFinished(QString)));
connect(&d->pi, SIGNAL(error(int, QString)), connect(&d->pi, SIGNAL(error(int,QString)),
SLOT(_q_piError(int, QString))); SLOT(_q_piError(int,QString)));
connect(&d->pi, SIGNAL(rawFtpReply(int, QString)), connect(&d->pi, SIGNAL(rawFtpReply(int,QString)),
SLOT(_q_piFtpReply(int, QString))); SLOT(_q_piFtpReply(int,QString)));
connect(&d->pi.dtp, SIGNAL(readyRead()), connect(&d->pi.dtp, SIGNAL(readyRead()),
SIGNAL(readyRead())); SIGNAL(readyRead()));
connect(&d->pi.dtp, SIGNAL(dataTransferProgress(qint64, qint64)), connect(&d->pi.dtp, SIGNAL(dataTransferProgress(qint64,qint64)),
SIGNAL(dataTransferProgress(qint64, qint64))); SIGNAL(dataTransferProgress(qint64,qint64)));
connect(&d->pi.dtp, SIGNAL(listInfo(QUrlInfo)), connect(&d->pi.dtp, SIGNAL(listInfo(QUrlInfo)),
SIGNAL(listInfo(QUrlInfo))); SIGNAL(listInfo(QUrlInfo)));
} }

View File

@ -213,7 +213,7 @@ bool QtLockedFile::unlock()
rmutex = 0; rmutex = 0;
} }
else { else {
foreach(Qt::HANDLE mutex, rmutexes) { foreach (Qt::HANDLE mutex, rmutexes) {
ReleaseMutex(mutex); ReleaseMutex(mutex);
CloseHandle(mutex); CloseHandle(mutex);
} }

View File

@ -143,7 +143,7 @@ void QtSingleApplication::sysInit(const QString &appId)
{ {
actWin = 0; actWin = 0;
peer = new QtLocalPeer(this, appId); peer = new QtLocalPeer(this, appId);
connect(peer, SIGNAL(messageReceived(const QString &)), SIGNAL(messageReceived(const QString &))); connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
} }
@ -258,10 +258,10 @@ void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessag
} }
if (activateOnMessage) { if (activateOnMessage) {
connect(peer, SIGNAL(messageReceived(const QString &)), this, SLOT(activateWindow())); connect(peer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
} }
else { else {
disconnect(peer, SIGNAL(messageReceived(const QString &)), this, SLOT(activateWindow())); disconnect(peer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
} }
} }

View File

@ -284,7 +284,7 @@ bool WindowNotifier::nativeEvent(const QByteArray &eventType, void* _message, lo
#endif #endif
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) { if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
bool compositionEnabled = QtWin::isCompositionEnabled(); bool compositionEnabled = QtWin::isCompositionEnabled();
foreach(QWidget * widget, widgets) { foreach (QWidget* widget, widgets) {
if (widget) { if (widget) {
widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled); widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled);
bool isBlur = widgetsBlurState.value(widget, false); bool isBlur = widgetsBlurState.value(widget, false);
@ -364,7 +364,7 @@ void QtWin::populateFrequentSites(IObjectCollection* collection, const QString &
History* history = mApp->history(); History* history = mApp->history();
QVector<HistoryEntry> mostList = history->mostVisited(6); QVector<HistoryEntry> mostList = history->mostVisited(6);
foreach(const HistoryEntry & entry, mostList) { foreach (const HistoryEntry &entry, mostList) {
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, QString(" " + entry.url.toEncoded()), appPath, 1)); collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, QString(" " + entry.url.toEncoded()), appPath, 1));
} }

View File

@ -127,9 +127,10 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
if (color.isValid() && color != m_baseColor) { if (color.isValid() && color != m_baseColor) {
m_baseColor = color; m_baseColor = color;
foreach(QWidget * w, QApplication::topLevelWidgets()) foreach (QWidget* w, QApplication::topLevelWidgets()) {
w->update(); w->update();
} }
}
} }
static void verticalGradientHelper(QPainter* p, const QRect &spanRect, const QRect &rect, bool lightColored) static void verticalGradientHelper(QPainter* p, const QRect &spanRect, const QRect &rect, bool lightColored)

View File

@ -42,7 +42,7 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
<< Subscription("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.txt") << Subscription("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.txt")
<< Subscription("Antisocial (English)", "http://adversity.googlecode.com/hg/Antisocial.txt"); << Subscription("Antisocial (English)", "http://adversity.googlecode.com/hg/Antisocial.txt");
foreach(const Subscription & subscription, m_knownSubscriptions) { foreach (const Subscription &subscription, m_knownSubscriptions) {
ui->comboBox->addItem(subscription.title); ui->comboBox->addItem(subscription.title);
} }

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -169,7 +169,7 @@ void AdBlockDialog::load()
return; return;
} }
foreach(AdBlockSubscription * subscription, m_manager->subscriptions()) { foreach (AdBlockSubscription* subscription, m_manager->subscriptions()) {
AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, tabWidget); AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, tabWidget);
tabWidget->addTab(tree, subscription->title()); tabWidget->addTab(tree, subscription->title());
} }

View File

@ -152,7 +152,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
} }
else { else {
menu->addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false); menu->addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
foreach(const WebPage::AdBlockedEntry & entry, entries) { foreach (const WebPage::AdBlockedEntry &entry, entries) {
QString address = entry.url.toString().right(55); QString address = entry.url.toString().right(55);
QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace(QLatin1Char('&'), QLatin1String("&&")); QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace(QLatin1Char('&'), QLatin1String("&&"));

View File

@ -93,7 +93,7 @@ QNetworkReply* AdBlockManager::block(const QNetworkRequest &request)
return 0; return 0;
} }
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
const AdBlockRule* blockedRule = subscription->match(request, urlDomain, urlString); const AdBlockRule* blockedRule = subscription->match(request, urlDomain, urlString);
if (blockedRule) { if (blockedRule) {
@ -185,7 +185,7 @@ bool AdBlockManager::removeSubscription(AdBlockSubscription* subscription)
AdBlockCustomList* AdBlockManager::customList() const AdBlockCustomList* AdBlockManager::customList() const
{ {
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
AdBlockCustomList* list = qobject_cast<AdBlockCustomList*>(subscription); AdBlockCustomList* list = qobject_cast<AdBlockCustomList*>(subscription);
if (list) { if (list) {
@ -224,7 +224,7 @@ void AdBlockManager::load()
QDir(mApp->currentProfilePath()).mkdir("adblock"); QDir(mApp->currentProfilePath()).mkdir("adblock");
} }
foreach(const QString & fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) { foreach (const QString &fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) {
if (fileName == QLatin1String("easylist.txt") || fileName == QLatin1String("customlist.txt")) { if (fileName == QLatin1String("easylist.txt") || fileName == QLatin1String("customlist.txt")) {
continue; continue;
} }
@ -264,7 +264,7 @@ void AdBlockManager::load()
connect(customList, SIGNAL(subscriptionEdited()), mApp, SLOT(reloadUserStyleSheet())); connect(customList, SIGNAL(subscriptionEdited()), mApp, SLOT(reloadUserStyleSheet()));
// Load all subscriptions // Load all subscriptions
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
subscription->loadSubscription(m_disabledRules); subscription->loadSubscription(m_disabledRules);
} }
@ -281,7 +281,7 @@ void AdBlockManager::load()
void AdBlockManager::updateAllSubscriptions() void AdBlockManager::updateAllSubscriptions()
{ {
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
subscription->updateSubscription(); subscription->updateSubscription();
} }
@ -297,7 +297,7 @@ void AdBlockManager::save()
return; return;
} }
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
subscription->saveSubscription(); subscription->saveSubscription();
} }
@ -322,7 +322,7 @@ bool AdBlockManager::canRunOnScheme(const QString &scheme) const
bool AdBlockManager::canBeBlocked(const QUrl &url) const bool AdBlockManager::canBeBlocked(const QUrl &url) const
{ {
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
if (subscription->adBlockDisabledForUrl(url)) { if (subscription->adBlockDisabledForUrl(url)) {
return false; return false;
} }
@ -339,7 +339,7 @@ QString AdBlockManager::elementHidingRules() const
QString rules; QString rules;
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
rules.append(subscription->elementHidingRules()); rules.append(subscription->elementHidingRules());
} }
@ -355,7 +355,7 @@ QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
{ {
QString rules; QString rules;
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
if (subscription->elemHideDisabledForUrl(url)) { if (subscription->elemHideDisabledForUrl(url)) {
return QString(); return QString();
} }
@ -373,7 +373,7 @@ QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) const AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) const
{ {
foreach(AdBlockSubscription * subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
if (subscription->title() == name) { if (subscription->title() == name) {
return subscription; return subscription;
} }

View File

@ -266,14 +266,14 @@ bool AdBlockRule::matchDomain(const QString &domain) const
} }
if (m_blockedDomains.isEmpty()) { if (m_blockedDomains.isEmpty()) {
foreach(const QString & d, m_allowedDomains) { foreach (const QString &d, m_allowedDomains) {
if (isMatchingDomain(domain, d)) { if (isMatchingDomain(domain, d)) {
return true; return true;
} }
} }
} }
else if (m_allowedDomains.isEmpty()) { else if (m_allowedDomains.isEmpty()) {
foreach(const QString & d, m_blockedDomains) { foreach (const QString &d, m_blockedDomains) {
if (isMatchingDomain(domain, d)) { if (isMatchingDomain(domain, d)) {
return false; return false;
} }
@ -281,13 +281,13 @@ bool AdBlockRule::matchDomain(const QString &domain) const
return true; return true;
} }
else { else {
foreach(const QString & d, m_blockedDomains) { foreach (const QString &d, m_blockedDomains) {
if (isMatchingDomain(domain, d)) { if (isMatchingDomain(domain, d)) {
return false; return false;
} }
} }
foreach(const QString & d, m_allowedDomains) { foreach (const QString &d, m_allowedDomains) {
if (isMatchingDomain(domain, d)) { if (isMatchingDomain(domain, d)) {
return true; return true;
} }
@ -395,7 +395,7 @@ void AdBlockRule::parseFilter()
QStringList options = parsedLine.mid(optionsIndex + 1).split(QLatin1Char(','), QString::SkipEmptyParts); QStringList options = parsedLine.mid(optionsIndex + 1).split(QLatin1Char(','), QString::SkipEmptyParts);
int handledOptions = 0; int handledOptions = 0;
foreach(const QString & option, options) { foreach (const QString &option, options) {
if (option.startsWith(QLatin1String("domain="))) { if (option.startsWith(QLatin1String("domain="))) {
parseDomains(option.mid(7), QLatin1Char('|')); parseDomains(option.mid(7), QLatin1Char('|'));
++handledOptions; ++handledOptions;
@ -526,7 +526,7 @@ void AdBlockRule::parseDomains(const QString &domains, const QChar &separator)
{ {
QStringList domainsList = domains.split(separator, QString::SkipEmptyParts); QStringList domainsList = domains.split(separator, QString::SkipEmptyParts);
foreach(const QString domain, domainsList) { foreach (const QString domain, domainsList) {
if (domain.isEmpty()) { if (domain.isEmpty()) {
continue; continue;
} }
@ -550,7 +550,7 @@ bool AdBlockRule::isMatchingDomain(const QString &domain, const QString &filter)
bool AdBlockRule::isMatchingRegExpStrings(const QString &url) const bool AdBlockRule::isMatchingRegExpStrings(const QString &url) const
{ {
foreach(const QString & string, m_regExpStrings) { foreach (const QString &string, m_regExpStrings) {
if (!url.contains(string)) { if (!url.contains(string)) {
return false; return false;
} }

View File

@ -436,7 +436,7 @@ void AdBlockCustomList::saveSubscription()
textStream << "Url: " << url().toString() << endl; textStream << "Url: " << url().toString() << endl;
textStream << "[Adblock Plus 1.1.1]" << endl; textStream << "[Adblock Plus 1.1.1]" << endl;
foreach(const AdBlockRule * rule, m_rules) { foreach (const AdBlockRule* rule, m_rules) {
textStream << rule->filter() << endl; textStream << rule->filter() << endl;
} }
@ -455,7 +455,7 @@ bool AdBlockCustomList::canBeRemoved() const
bool AdBlockCustomList::containsFilter(const QString &filter) const bool AdBlockCustomList::containsFilter(const QString &filter) const
{ {
foreach(const AdBlockRule * rule, m_rules) { foreach (const AdBlockRule* rule, m_rules) {
if (rule->filter() == filter) { if (rule->filter() == filter) {
return true; return true;
} }

View File

@ -36,7 +36,7 @@ AdBlockTreeWidget::AdBlockTreeWidget(AdBlockSubscription* subscription, QWidget*
setAlternatingRowColors(true); setAlternatingRowColors(true);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*))); connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*)));
connect(m_subscription, SIGNAL(subscriptionUpdated()), this, SLOT(subscriptionUpdated())); connect(m_subscription, SIGNAL(subscriptionUpdated()), this, SLOT(subscriptionUpdated()));
} }
@ -240,7 +240,7 @@ void AdBlockTreeWidget::refresh()
const QVector<AdBlockRule*> &allRules = m_subscription->allRules(); const QVector<AdBlockRule*> &allRules = m_subscription->allRules();
int index = 0; int index = 0;
foreach(const AdBlockRule * rule, allRules) { foreach (const AdBlockRule* rule, allRules) {
QTreeWidgetItem* item = new QTreeWidgetItem(m_topItem); QTreeWidgetItem* item = new QTreeWidgetItem(m_topItem);
item->setText(0, rule->filter()); item->setText(0, rule->filter());
item->setData(0, Qt::UserRole + 10, index); item->setData(0, Qt::UserRole + 10, index);

View File

@ -153,7 +153,7 @@ MainApplication::MainApplication(int &argc, char** argv)
if (argc > 1) { if (argc > 1) {
CommandLineOptions cmd(argc); CommandLineOptions cmd(argc);
foreach(const CommandLineOptions::ActionPair & pair, cmd.getActions()) { foreach (const CommandLineOptions::ActionPair &pair, cmd.getActions()) {
switch (pair.action) { switch (pair.action) {
case Qz::CL_StartWithoutAddons: case Qz::CL_StartWithoutAddons:
noAddons = true; noAddons = true;
@ -220,7 +220,7 @@ MainApplication::MainApplication(int &argc, char** argv)
} }
if (isRunning()) { if (isRunning()) {
foreach(const QString & message, messages) { foreach (const QString &message, messages) {
sendMessage(message); sendMessage(message);
} }
m_isClosing = true; m_isClosing = true;
@ -266,7 +266,7 @@ MainApplication::MainApplication(int &argc, char** argv)
QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl); QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl);
m_mainWindows.append(qupzilla); m_mainWindows.append(qupzilla);
connect(qupzilla, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(sendMessages(Qz::AppMessageType, bool))); connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool)));
connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor())); connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor()));
loadSettings(); loadSettings();
@ -913,7 +913,7 @@ Speller* MainApplication::speller()
void MainApplication::startPrivateBrowsing() void MainApplication::startPrivateBrowsing()
{ {
QStringList args; QStringList args;
foreach(const QString & arg, arguments()) { foreach (const QString &arg, arguments()) {
if (arg.startsWith(QLatin1Char('-'))) { if (arg.startsWith(QLatin1Char('-'))) {
args.append(arg); args.append(arg);
} }
@ -1101,7 +1101,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat
window->restoreWindowState(data); window->restoreWindowState(data);
} }
foreach(const RestoreManager::WindowData & data, recoveryData) { foreach (const RestoreManager::WindowData &data, recoveryData) {
QupZilla* window = makeNewWindow(Qz::BW_OtherRestoredWindow); QupZilla* window = makeNewWindow(Qz::BW_OtherRestoredWindow);
window->restoreWindowState(data); window->restoreWindowState(data);
} }

View File

@ -144,7 +144,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
m_hideNavigationTimer->setSingleShot(true); m_hideNavigationTimer->setSingleShot(true);
connect(m_hideNavigationTimer, SIGNAL(timeout()), this, SLOT(hideNavigationSlot())); connect(m_hideNavigationTimer, SIGNAL(timeout()), this, SLOT(hideNavigationSlot()));
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(receiveMessage(Qz::AppMessageType, bool))); connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(receiveMessage(Qz::AppMessageType,bool)));
QTimer::singleShot(0, this, SLOT(postLaunch())); QTimer::singleShot(0, this, SLOT(postLaunch()));
} }
@ -628,7 +628,7 @@ void QupZilla::setupOtherActions()
// Make shortcuts available even in fullscreen (menu hidden) // Make shortcuts available even in fullscreen (menu hidden)
QList<QAction*> actions = menuBar()->actions(); QList<QAction*> actions = menuBar()->actions();
foreach(QAction * action, actions) { foreach (QAction* action, actions) {
if (action->menu()) { if (action->menu()) {
actions += action->menu()->actions(); actions += action->menu()->actions();
} }
@ -1042,7 +1042,7 @@ void QupZilla::aboutToShowClosedTabsMenu()
{ {
m_menuClosedTabs->clear(); m_menuClosedTabs->clear();
int i = 0; int i = 0;
foreach(const ClosedTabsManager::Tab & tab, m_tabWidget->closedTabsManager()->allClosedTabs()) { foreach (const ClosedTabsManager::Tab &tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
QString title = tab.title; QString title = tab.title;
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);
@ -1092,7 +1092,7 @@ void QupZilla::aboutToShowHistoryMostMenu()
const QVector<HistoryEntry> &mostList = mApp->history()->mostVisited(10); const QVector<HistoryEntry> &mostList = mApp->history()->mostVisited(10);
foreach(const HistoryEntry & entry, mostList) { foreach (const HistoryEntry &entry, mostList) {
QString title = entry.title; QString title = entry.title;
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);
@ -1155,7 +1155,7 @@ void QupZilla::aboutToShowEditMenu()
void QupZilla::aboutToHideEditMenu() void QupZilla::aboutToHideEditMenu()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
foreach(QAction * act, m_menuEdit->actions()) { foreach (QAction* act, m_menuEdit->actions()) {
act->setEnabled(false); act->setEnabled(false);
} }
#endif #endif
@ -1189,7 +1189,7 @@ void QupZilla::aboutToShowEncodingMenu()
qSort(available); qSort(available);
const QString &activeCodec = mApp->webSettings()->defaultTextEncoding(); const QString &activeCodec = mApp->webSettings()->defaultTextEncoding();
foreach(const QByteArray & name, available) { foreach (const QByteArray &name, available) {
QTextCodec* codec = QTextCodec::codecForName(name); QTextCodec* codec = QTextCodec::codecForName(name);
if (codec && codec->aliases().contains(name)) { if (codec && codec->aliases().contains(name)) {
continue; continue;
@ -1404,7 +1404,7 @@ void QupZilla::loadFolderBookmarks(Menu* menu)
return; return;
} }
foreach(const Bookmark & b, mApp->bookmarksModel()->folderBookmarks(folder)) { foreach (const Bookmark &b, mApp->bookmarksModel()->folderBookmarks(folder)) {
tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab); tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
} }
} }
@ -2137,13 +2137,13 @@ void QupZilla::disconnectObjects()
m_tabWidget->disconnectObjects(); m_tabWidget->disconnectObjects();
m_tabWidget->getTabBar()->disconnectObjects(); m_tabWidget->getTabBar()->disconnectObjects();
foreach(WebTab * tab, m_tabWidget->allTabs()) { foreach (WebTab* tab, m_tabWidget->allTabs()) {
tab->disconnectObjects(); tab->disconnectObjects();
tab->view()->disconnectObjects(); tab->view()->disconnectObjects();
tab->view()->page()->disconnectObjects(); tab->view()->page()->disconnectObjects();
} }
foreach(const QPointer<QWidget> &pointer, m_deleteOnCloseWidgets) { foreach (const QPointer<QWidget> &pointer, m_deleteOnCloseWidgets) {
if (pointer) { if (pointer) {
pointer.data()->deleteLater(); pointer.data()->deleteLater();
} }

View File

@ -320,7 +320,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
if (isStored(siteUrl)) { if (isStored(siteUrl)) {
const QVector<AutoFillData> &list = getFormData(siteUrl); const QVector<AutoFillData> &list = getFormData(siteUrl);
foreach(const AutoFillData & data, list) { foreach (const AutoFillData &data, list) {
if (data.username == formData.username) { if (data.username == formData.username) {
updateLastUsed(data.id); updateLastUsed(data.id);

View File

@ -52,11 +52,11 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons
const QWebElementCollection &allForms = getAllElementsFromPage(m_page, "form"); const QWebElementCollection &allForms = getAllElementsFromPage(m_page, "form");
// Find form that contains password value sent in data // Find form that contains password value sent in data
foreach(const QWebElement & formElement, allForms) { foreach (const QWebElement &formElement, allForms) {
bool found = false; bool found = false;
const QWebElementCollection &inputs = formElement.findAll("input[type=\"password\"]"); const QWebElementCollection &inputs = formElement.findAll("input[type=\"password\"]");
foreach(QWebElement inputElement, inputs) { foreach (QWebElement inputElement, inputs) {
const QString &passName = inputElement.attribute("name"); const QString &passName = inputElement.attribute("name");
const QString &passValue = inputElement.evaluateJavaScript("this.value").toString(); const QString &passValue = inputElement.evaluateJavaScript("this.value").toString();
@ -197,9 +197,9 @@ PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &
<< "input[type=\"email\"]" << "input[type=\"email\"]"
<< "input:not([type=\"hidden\"][type=\"password\"])"; << "input:not([type=\"hidden\"][type=\"password\"])";
foreach(const QString & selector, selectors) { foreach (const QString &selector, selectors) {
const QWebElementCollection &inputs = form.findAll(selector); const QWebElementCollection &inputs = form.findAll(selector);
foreach(QWebElement element, inputs) { foreach (QWebElement element, inputs) {
const QString &name = element.attribute("name"); const QString &name = element.attribute("name");
const QString &value = element.evaluateJavaScript("this.value").toString(); const QString &value = element.evaluateJavaScript("this.value").toString();

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -52,9 +52,9 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent)
ui->bookmarksTree->setDragDropReceiver(true, m_bookmarksModel); ui->bookmarksTree->setDragDropReceiver(true, m_bookmarksModel);
ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks")); ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks"));
connect(ui->bookmarksTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*)));
connect(ui->addFolder, SIGNAL(clicked()), this, SLOT(addFolder())); connect(ui->addFolder, SIGNAL(clicked()), this, SLOT(addFolder()));
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->collapseAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(collapseAll())); connect(ui->collapseAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(collapseAll()));
@ -62,13 +62,13 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent)
connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark)), this, SLOT(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)), this, SLOT(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(subfolderAdded(QString)), this, SLOT(addSubfolder(QString))); connect(m_bookmarksModel, SIGNAL(subfolderAdded(QString)), this, SLOT(addSubfolder(QString)));
connect(m_bookmarksModel, SIGNAL(folderAdded(QString)), this, SLOT(addFolder(QString))); connect(m_bookmarksModel, SIGNAL(folderAdded(QString)), this, SLOT(addFolder(QString)));
connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(removeFolder(QString))); connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(removeFolder(QString)));
connect(m_bookmarksModel, SIGNAL(folderRenamed(QString, QString)), this, SLOT(renameFolder(QString, QString))); connect(m_bookmarksModel, SIGNAL(folderRenamed(QString,QString)), this, SLOT(renameFolder(QString,QString)));
connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString, bool)), this, SLOT(changeFolderParent(QString, bool))); connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString,bool)), this, SLOT(changeFolderParent(QString,bool)));
connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString, QByteArray, int, QUrl, QString, QString)), this, SLOT(changeBookmarkParent(QString, QByteArray, int, QUrl, QString, QString))); connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString,QByteArray,int,QUrl,QString,QString)), this, SLOT(changeBookmarkParent(QString,QByteArray,int,QUrl,QString,QString)));
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb())); connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
connect(ui->importBookmarks, SIGNAL(clicked(QPoint)), this, SLOT(importBookmarks())); connect(ui->importBookmarks, SIGNAL(clicked(QPoint)), this, SLOT(importBookmarks()));
@ -382,7 +382,7 @@ void BookmarksManager::addBookmark(const BookmarksModel::Bookmark &bookmark)
if (bookmark.inSubfolder) { if (bookmark.inSubfolder) {
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.folder, Qt::MatchExactly | Qt::MatchRecursive); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.folder, Qt::MatchExactly | Qt::MatchRecursive);
if (list.count() != 0) { if (list.count() != 0) {
foreach(QTreeWidgetItem * it, list) { foreach (QTreeWidgetItem* it, list) {
if (it->text(1).isEmpty()) { if (it->text(1).isEmpty()) {
it->addChild(item); it->addChild(item);
break; break;
@ -407,7 +407,7 @@ void BookmarksManager::removeBookmark(const BookmarksModel::Bookmark &bookmark)
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.folder, Qt::MatchExactly | Qt::MatchRecursive); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.folder, Qt::MatchExactly | Qt::MatchRecursive);
QTreeWidgetItem* subfolderItem = 0; QTreeWidgetItem* subfolderItem = 0;
if (list.count() != 0) { if (list.count() != 0) {
foreach(QTreeWidgetItem * it, list) { foreach (QTreeWidgetItem* it, list) {
if (it->text(1).isEmpty()) { if (it->text(1).isEmpty()) {
subfolderItem = it; subfolderItem = it;
break; break;
@ -482,7 +482,7 @@ void BookmarksManager::changeBookmarkParent(const QString &name, const QByteArra
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(name, Qt::MatchExactly | Qt::MatchRecursive); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(name, Qt::MatchExactly | Qt::MatchRecursive);
QTreeWidgetItem* item = 0; QTreeWidgetItem* item = 0;
foreach(item, list) { foreach (item, list) {
if (id == item->data(0, Qt::UserRole + 10).toInt()) { if (id == item->data(0, Qt::UserRole + 10).toInt()) {
break; break;
} }
@ -584,7 +584,7 @@ void BookmarksManager::removeFolder(const QString &name)
QTreeWidgetItem* folderItem = 0; QTreeWidgetItem* folderItem = 0;
if (list.count() != 0) { if (list.count() != 0) {
foreach(QTreeWidgetItem * it, list) { foreach (QTreeWidgetItem* it, list) {
if (it->text(1).isEmpty()) { if (it->text(1).isEmpty()) {
folderItem = it; folderItem = it;
break; break;
@ -607,7 +607,7 @@ void BookmarksManager::renameFolder(const QString &before, const QString &after)
QTreeWidgetItem* folderItem = 0; QTreeWidgetItem* folderItem = 0;
if (list.count() != 0) { if (list.count() != 0) {
foreach(QTreeWidgetItem * it, list) { foreach (QTreeWidgetItem* it, list) {
if (it->text(0) == before && it->text(1).isEmpty()) { if (it->text(0) == before && it->text(1).isEmpty()) {
folderItem = it; folderItem = it;
break; break;
@ -632,8 +632,8 @@ void BookmarksManager::insertBookmark(const QUrl &url, const QString &title, con
QLineEdit* edit = new QLineEdit(dialog); QLineEdit* edit = new QLineEdit(dialog);
QComboBox* combo = new QComboBox(dialog); QComboBox* combo = new QComboBox(dialog);
BookmarksTree* bookmarksTree = new BookmarksTree(dialog); BookmarksTree* bookmarksTree = new BookmarksTree(dialog);
connect(bookmarksTree, SIGNAL(requestNewFolder(QWidget*, QString*, bool, QString, WebView*)), connect(bookmarksTree, SIGNAL(requestNewFolder(QWidget*,QString*,bool,QString,WebView*)),
this, SLOT(addFolder(QWidget*, QString*, bool, QString, WebView*))); this, SLOT(addFolder(QWidget*,QString*,bool,QString,WebView*)));
bookmarksTree->setViewType(BookmarksTree::ComboFolderView); bookmarksTree->setViewType(BookmarksTree::ComboFolderView);
bookmarksTree->header()->hide(); bookmarksTree->header()->hide();
bookmarksTree->setColumnCount(1); bookmarksTree->setColumnCount(1);
@ -698,8 +698,8 @@ void BookmarksManager::insertAllTabs()
QLabel* label = new QLabel(dialog); QLabel* label = new QLabel(dialog);
QComboBox* combo = new QComboBox(dialog); QComboBox* combo = new QComboBox(dialog);
BookmarksTree* bookmarksTree = new BookmarksTree(dialog); BookmarksTree* bookmarksTree = new BookmarksTree(dialog);
connect(bookmarksTree, SIGNAL(requestNewFolder(QWidget*, QString*, bool, QString, WebView*)), connect(bookmarksTree, SIGNAL(requestNewFolder(QWidget*,QString*,bool,QString,WebView*)),
this, SLOT(addFolder(QWidget*, QString*, bool, QString, WebView*))); this, SLOT(addFolder(QWidget*,QString*,bool,QString,WebView*)));
bookmarksTree->setViewType(BookmarksTree::ComboFolderView); bookmarksTree->setViewType(BookmarksTree::ComboFolderView);
bookmarksTree->header()->hide(); bookmarksTree->header()->hide();
bookmarksTree->setColumnCount(1); bookmarksTree->setColumnCount(1);
@ -742,7 +742,7 @@ void BookmarksManager::insertAllTabs()
return; return;
} }
foreach(WebTab * tab, getQupZilla()->tabWidget()->allTabs(false)) { foreach (WebTab* tab, getQupZilla()->tabWidget()->allTabs(false)) {
if (tab->url().isEmpty()) { if (tab->url().isEmpty()) {
continue; continue;
} }

View File

@ -223,7 +223,7 @@ void BookmarksModel::removeBookmark(const QList<int> list)
QSqlDatabase db = QSqlDatabase::database(); QSqlDatabase db = QSqlDatabase::database();
db.transaction(); db.transaction();
foreach(int id, list) { foreach (int id, list) {
QSqlQuery query; QSqlQuery query;
query.prepare("SELECT url, title, folder FROM bookmarks WHERE id = ?"); query.prepare("SELECT url, title, folder FROM bookmarks WHERE id = ?");
query.bindValue(0, id); query.bindValue(0, id);

View File

@ -56,12 +56,12 @@ BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent)
connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark)), this, SLOT(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)), this, SLOT(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(subfolderAdded(QString)), this, SLOT(subfolderAdded(QString))); connect(m_bookmarksModel, SIGNAL(subfolderAdded(QString)), this, SLOT(subfolderAdded(QString)));
connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(folderDeleted(QString))); connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(folderDeleted(QString)));
connect(m_bookmarksModel, SIGNAL(folderRenamed(QString, QString)), this, SLOT(folderRenamed(QString, QString))); connect(m_bookmarksModel, SIGNAL(folderRenamed(QString,QString)), this, SLOT(folderRenamed(QString,QString)));
connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString, bool)), this, SLOT(changeFolderParent(QString, bool))); connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString,bool)), this, SLOT(changeFolderParent(QString,bool)));
connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString, QByteArray, int, QUrl, QString, QString)), this, SLOT(changeBookmarkParent(QString, QByteArray, int, QUrl, QString, QString))); connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString,QByteArray,int,QUrl,QString,QString)), this, SLOT(changeBookmarkParent(QString,QByteArray,int,QUrl,QString,QString)));
setMaximumWidth(p_QupZilla->width()); setMaximumWidth(p_QupZilla->width());
@ -334,7 +334,7 @@ void BookmarksToolbar::loadFolderBookmarksInTabs()
return; return;
} }
foreach(const Bookmark & b, m_bookmarksModel->folderBookmarks(folder)) { foreach (const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab); p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
} }
} }
@ -621,7 +621,7 @@ void BookmarksToolbar::aboutToShowFolderMenu()
menu->clear(); menu->clear();
QString folder = menu->title(); QString folder = menu->title();
foreach(const Bookmark & b, m_bookmarksModel->folderBookmarks(folder)) { foreach (const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
QString title = b.title; QString title = b.title;
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);
@ -687,7 +687,7 @@ void BookmarksToolbar::refreshMostVisited()
m_menuMostVisited->clear(); m_menuMostVisited->clear();
QVector<HistoryEntry> mostList = m_historyModel->mostVisited(10); QVector<HistoryEntry> mostList = m_historyModel->mostVisited(10);
foreach(const HistoryEntry & entry, mostList) { foreach (const HistoryEntry &entry, mostList) {
QString title = entry.title; QString title = entry.title;
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);

View File

@ -64,8 +64,8 @@ BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
loadBookmark(); loadBookmark();
connect(ui->folder, SIGNAL(activated(int)), this, SLOT(comboItemActive(int))); connect(ui->folder, SIGNAL(activated(int)), this, SLOT(comboItemActive(int)));
connect(m_bookmarksTree, SIGNAL(requestNewFolder(QWidget*, QString*, bool, QString, WebView*)), connect(m_bookmarksTree, SIGNAL(requestNewFolder(QWidget*,QString*,bool,QString,WebView*)),
mApp->browsingLibrary()->bookmarksManager(), SLOT(addFolder(QWidget*, QString*, bool, QString, WebView*))); mApp->browsingLibrary()->bookmarksManager(), SLOT(addFolder(QWidget*,QString*,bool,QString,WebView*)));
} }
void BookmarksWidget::loadBookmark() void BookmarksWidget::loadBookmark()

View File

@ -107,7 +107,7 @@ void BookmarksImportDialog::startFetchingIcons()
QIcon folderIcon = style()->standardIcon(QStyle::SP_DirIcon); QIcon folderIcon = style()->standardIcon(QStyle::SP_DirIcon);
QHash<QString, QTreeWidgetItem*> hash; QHash<QString, QTreeWidgetItem*> hash;
foreach(const Bookmark & b, m_exportedBookmarks) { foreach (const Bookmark &b, m_exportedBookmarks) {
QTreeWidgetItem* item; QTreeWidgetItem* item;
QTreeWidgetItem* findParent = hash[b.folder]; QTreeWidgetItem* findParent = hash[b.folder];
if (findParent) { if (findParent) {
@ -141,7 +141,7 @@ void BookmarksImportDialog::startFetchingIcons()
ui->treeWidget->expandAll(); ui->treeWidget->expandAll();
connect(m_fetcher, SIGNAL(iconFetched(QImage, QTreeWidgetItem*)), this, SLOT(iconFetched(QImage, QTreeWidgetItem*))); connect(m_fetcher, SIGNAL(iconFetched(QImage,QTreeWidgetItem*)), this, SLOT(iconFetched(QImage,QTreeWidgetItem*)));
connect(m_fetcher, SIGNAL(oneFinished()), this, SLOT(loadFinished())); connect(m_fetcher, SIGNAL(oneFinished()), this, SLOT(loadFinished()));
m_fetcherThread->start(); m_fetcherThread->start();
@ -267,7 +267,7 @@ void BookmarksImportDialog::addExportedBookmarks()
QSqlDatabase db = QSqlDatabase::database(); QSqlDatabase db = QSqlDatabase::database();
db.transaction(); db.transaction();
foreach(const Bookmark & b, m_exportedBookmarks) { foreach (const Bookmark &b, m_exportedBookmarks) {
model->saveBookmark(b.url, b.title, qIconProvider->iconFromImage(b.image), b.folder); model->saveBookmark(b.url, b.title, qIconProvider->iconFromImage(b.image), b.folder);
} }

View File

@ -68,7 +68,7 @@ void BookmarksImportIconFetcher::slotStartFetching()
{ {
QNetworkAccessManager* manager = new QNetworkAccessManager(this); QNetworkAccessManager* manager = new QNetworkAccessManager(this);
foreach(const Pair & pair, m_pairs) { foreach (const Pair &pair, m_pairs) {
QVariant itemPointer = QVariant::fromValue((void*) pair.item); QVariant itemPointer = QVariant::fromValue((void*) pair.item);
IconFetcher* fetcher = new IconFetcher(this); IconFetcher* fetcher = new IconFetcher(this);

View File

@ -67,7 +67,7 @@ QVector<Bookmark> ChromeImporter::exportBookmarks()
} }
QScriptEngine* scriptEngine = new QScriptEngine(); QScriptEngine* scriptEngine = new QScriptEngine();
foreach(QString parsedString, parsedBookmarks) { foreach (QString parsedString, parsedBookmarks) {
parsedString = "(" + parsedString + ")"; parsedString = "(" + parsedString + ")";
if (scriptEngine->canEvaluate(parsedString)) { if (scriptEngine->canEvaluate(parsedString)) {
QScriptValue object = scriptEngine->evaluate(parsedString); QScriptValue object = scriptEngine->evaluate(parsedString);

View File

@ -114,7 +114,7 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
{ {
QList<QNetworkCookie> newList; QList<QNetworkCookie> newList;
foreach(QNetworkCookie cookie, cookieList) { foreach (QNetworkCookie cookie, cookieList) {
// If cookie domain is empty, set it to url.host() // If cookie domain is empty, set it to url.host()
if (cookie.domain().isEmpty()) { if (cookie.domain().isEmpty()) {
cookie.setDomain(url.host()); cookie.setDomain(url.host());
@ -240,7 +240,7 @@ bool CookieJar::matchDomain(QString cookieDomain, QString siteDomain)
bool CookieJar::listMatchesDomain(const QStringList &list, const QString &cookieDomain) bool CookieJar::listMatchesDomain(const QStringList &list, const QString &cookieDomain)
{ {
foreach(const QString & d, list) { foreach (const QString &d, list) {
if (matchDomain(d, cookieDomain)) { if (matchDomain(d, cookieDomain)) {
return true; return true;
} }

View File

@ -40,7 +40,7 @@ CookieManager::CookieManager(QWidget* parent)
QzTools::centerWidgetOnScreen(this); QzTools::centerWidgetOnScreen(this);
// Stored Cookies // Stored Cookies
connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll())); connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll()));
connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie())); connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie()));
connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
@ -102,7 +102,7 @@ void CookieManager::removeCookie()
if (current->text(1).isEmpty()) { //Remove whole cookie group 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) { foreach (const QNetworkCookie &cookie, allCookies) {
if (cookie.domain() == domain || cookie.domain() == domain.mid(1)) { if (cookie.domain() == domain || cookie.domain() == domain.mid(1)) {
allCookies.removeOne(cookie); allCookies.removeOne(cookie);
} }

View File

@ -116,7 +116,7 @@ void DownloadItem::startDownloading()
m_reply->setParent(this); m_reply->setParent(this);
connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); connect(m_reply, SIGNAL(finished()), this, SLOT(finished()));
connect(m_reply, SIGNAL(readyRead()), this, SLOT(readyRead())); connect(m_reply, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); connect(m_reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error())); connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error()));
connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged())); connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
@ -141,9 +141,9 @@ void DownloadItem::startDownloadingFromFtp(const QUrl &url)
m_ftpDownloader = new FtpDownloader(this); m_ftpDownloader = new FtpDownloader(this);
connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished())); connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished()));
connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
connect(m_ftpDownloader, SIGNAL(errorOccured(QFtp::Error)), this, SLOT(error())); connect(m_ftpDownloader, SIGNAL(errorOccured(QFtp::Error)), this, SLOT(error()));
connect(m_ftpDownloader, SIGNAL(ftpAuthenticationRequierd(const QUrl &, QAuthenticator*)), mApp->networkManager(), SLOT(ftpAuthentication(const QUrl &, QAuthenticator*))); connect(m_ftpDownloader, SIGNAL(ftpAuthenticationRequierd(QUrl,QAuthenticator*)), mApp->networkManager(), SLOT(ftpAuthentication(QUrl,QAuthenticator*)));
m_ftpDownloader->download(url, &m_outputFile); m_ftpDownloader->download(url, &m_outputFile);
m_downloading = true; m_downloading = true;

View File

@ -152,20 +152,22 @@ void DownloadManager::timerEvent(QTimerEvent* e)
} }
QTime remaining; QTime remaining;
foreach(const QTime & time, remTimes) { foreach (const QTime &time, remTimes) {
if (time > remaining) { if (time > remaining) {
remaining = time; remaining = time;
} }
} }
int progress = 0; int progress = 0;
foreach(int prog, progresses) foreach (int prog, progresses) {
progress += prog; progress += prog;
}
progress = progress / progresses.count(); progress = progress / progresses.count();
double speed = 0.00; double speed = 0.00;
foreach(double spee, speeds) foreach (double spee, speeds) {
speed += spee; speed += spee;
}
ui->speedLabel->setText(tr("%1% of %2 files (%3) %4 remaining").arg(QString::number(progress), QString::number(progresses.count()), ui->speedLabel->setText(tr("%1% of %2 files (%3) %4 remaining").arg(QString::number(progress), QString::number(progresses.count()),
DownloadItem::currentSpeedToString(speed), DownloadItem::currentSpeedToString(speed),
@ -228,7 +230,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const Downl
reply->setProperty("downReply", QVariant(true)); reply->setProperty("downReply", QVariant(true));
DownloadFileHelper* h = new DownloadFileHelper(m_lastDownloadPath, m_downloadPath, m_useNativeDialog); DownloadFileHelper* h = new DownloadFileHelper(m_lastDownloadPath, m_downloadPath, m_useNativeDialog);
connect(h, SIGNAL(itemCreated(QListWidgetItem*, DownloadItem*)), this, SLOT(itemCreated(QListWidgetItem*, DownloadItem*))); connect(h, SIGNAL(itemCreated(QListWidgetItem*,DownloadItem*)), this, SLOT(itemCreated(QListWidgetItem*,DownloadItem*)));
h->setLastDownloadOption(m_lastDownloadOption); h->setLastDownloadOption(m_lastDownloadOption);
h->setDownloadManager(this); h->setDownloadManager(this);

View File

@ -142,7 +142,7 @@ void History::deleteHistoryEntry(const QList<int> &list)
QSqlDatabase db = QSqlDatabase::database(); QSqlDatabase db = QSqlDatabase::database();
db.transaction(); db.transaction();
foreach(int index, list) { foreach (int index, list) {
QSqlQuery query; QSqlQuery query;
query.prepare("SELECT count, date, url, title FROM history WHERE id=?"); query.prepare("SELECT count, date, url, title FROM history WHERE id=?");
query.addBindValue(index); query.addBindValue(index);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->historyTree, SIGNAL(openLink(QUrl, HistoryView::OpenBehavior)), this, SLOT(openLink(QUrl, HistoryView::OpenBehavior))); connect(ui->historyTree, SIGNAL(openLink(QUrl,HistoryView::OpenBehavior)), this, SLOT(openLink(QUrl,HistoryView::OpenBehavior)));
connect(ui->deleteB, SIGNAL(clicked()), ui->historyTree, SLOT(removeItems())); connect(ui->deleteB, SIGNAL(clicked()), ui->historyTree, SLOT(removeItems()));
connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory())); connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory()));

View File

@ -43,9 +43,9 @@ HistoryModel::HistoryModel(History* history)
init(); init();
connect(m_history, SIGNAL(resetHistory()), this, SLOT(resetHistory())); connect(m_history, SIGNAL(resetHistory()), this, SLOT(resetHistory()));
connect(m_history, SIGNAL(historyEntryAdded(const HistoryEntry &)), this, SLOT(historyEntryAdded(const HistoryEntry &))); connect(m_history, SIGNAL(historyEntryAdded(HistoryEntry)), this, SLOT(historyEntryAdded(HistoryEntry)));
connect(m_history, SIGNAL(historyEntryDeleted(const HistoryEntry &)), this, SLOT(historyEntryDeleted(const HistoryEntry &))); connect(m_history, SIGNAL(historyEntryDeleted(HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryEntry)));
connect(m_history, SIGNAL(historyEntryEdited(const HistoryEntry &, const HistoryEntry &)), this, SLOT(historyEntryEdited(const HistoryEntry &, const HistoryEntry &))); connect(m_history, SIGNAL(historyEntryEdited(HistoryEntry,HistoryEntry)), this, SLOT(historyEntryEdited(HistoryEntry,HistoryEntry)));
} }
QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const
@ -237,7 +237,7 @@ HistoryItem* HistoryModel::itemFromIndex(const QModelIndex &index) const
void HistoryModel::removeTopLevelIndexes(const QList<QPersistentModelIndex> &indexes) void HistoryModel::removeTopLevelIndexes(const QList<QPersistentModelIndex> &indexes)
{ {
foreach(const QPersistentModelIndex & index, indexes) { foreach (const QPersistentModelIndex &index, indexes) {
if (index.parent().isValid()) { if (index.parent().isValid()) {
continue; continue;
} }
@ -322,7 +322,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
beginInsertRows(parent, 0, list.size() - 1); beginInsertRows(parent, 0, list.size() - 1);
foreach(const HistoryEntry & entry, list) { foreach (const HistoryEntry &entry, list) {
HistoryItem* newItem = new HistoryItem(parentItem); HistoryItem* newItem = new HistoryItem(parentItem);
newItem->historyEntry = entry; newItem->historyEntry = entry;
} }

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -68,7 +68,7 @@ void HistoryView::removeItems()
QList<QPersistentModelIndex> topLevelIndexes; QList<QPersistentModelIndex> topLevelIndexes;
foreach(const QModelIndex & index, selectedIndexes()) { foreach (const QModelIndex &index, selectedIndexes()) {
if (index.column() > 0) { if (index.column() > 0) {
continue; continue;
} }

View File

@ -90,7 +90,7 @@ void LocationCompleter::currentChanged(const QModelIndex &index)
void LocationCompleter::slotPopupClosed() void LocationCompleter::slotPopupClosed()
{ {
disconnect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex))); disconnect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
disconnect(s_view, SIGNAL(clicked(QModelIndex)), this, SIGNAL(completionActivated())); disconnect(s_view, SIGNAL(clicked(QModelIndex)), this, SIGNAL(completionActivated()));
disconnect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed())); disconnect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed()));
disconnect(s_view, SIGNAL(aboutToActivateTab(TabPosition)), m_locationBar, SLOT(clear())); disconnect(s_view, SIGNAL(aboutToActivateTab(TabPosition)), m_locationBar, SLOT(clear()));
@ -118,7 +118,7 @@ void LocationCompleter::showPopup()
s_view->setFocusProxy(m_locationBar); s_view->setFocusProxy(m_locationBar);
s_view->setGeometry(popupRect); s_view->setGeometry(popupRect);
connect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex))); connect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
connect(s_view, SIGNAL(clicked(QModelIndex)), this, SIGNAL(completionActivated())); connect(s_view, SIGNAL(clicked(QModelIndex)), this, SIGNAL(completionActivated()));
connect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed())); connect(s_view, SIGNAL(closed()), this, SLOT(slotPopupClosed()));
connect(s_view, SIGNAL(aboutToActivateTab(TabPosition)), m_locationBar, SLOT(clear())); connect(s_view, SIGNAL(aboutToActivateTab(TabPosition)), m_locationBar, SLOT(clear()));

View File

@ -151,7 +151,7 @@ void LocationCompleterDelegate::drawHighlightedTextLine(const QRect &rect, const
// Look for longer parts first // Look for longer parts first
qSort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan); qSort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
foreach(const QString & string, searchStrings) { foreach (const QString &string, searchStrings) {
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive); int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
while (delimiter != -1) { while (delimiter != -1) {

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -184,13 +184,13 @@ QSqlQuery LocationCompleterModel::createQuery(const QString &searchString, const
sqlQuery.addBindValue(QString("%%1%").arg(searchString)); sqlQuery.addBindValue(QString("%%1%").arg(searchString));
} }
else { else {
foreach(const QString & str, searchList) { foreach (const QString &str, searchList) {
sqlQuery.addBindValue(QString("%%1%").arg(str)); sqlQuery.addBindValue(QString("%%1%").arg(str));
sqlQuery.addBindValue(QString("%%1%").arg(str)); sqlQuery.addBindValue(QString("%%1%").arg(str));
} }
} }
foreach(const QUrl & url, alreadyFound) { foreach (const QUrl &url, alreadyFound) {
sqlQuery.addBindValue(url); sqlQuery.addBindValue(url);
} }

View File

@ -91,7 +91,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
connect(down, SIGNAL(clicked(QPoint)), &m_completer, SLOT(showMostVisited())); connect(down, SIGNAL(clicked(QPoint)), &m_completer, SLOT(showMostVisited()));
connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText())); connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText())); connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), SLOT(onMessage(Qz::AppMessageType, bool))); connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), SLOT(onMessage(Qz::AppMessageType,bool)));
loadSettings(); loadSettings();
@ -319,7 +319,7 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
QMenu menu(this); QMenu menu(this);
int i = 0; int i = 0;
foreach(QAction * act, tempMenu->actions()) { foreach (QAction* act, tempMenu->actions()) {
menu.addAction(act); menu.addAction(act);
switch (i) { switch (i) {

View File

@ -93,8 +93,8 @@ WebSearchBar::WebSearchBar(QupZilla* mainClass)
m_openSearchEngine = new OpenSearchEngine(this); m_openSearchEngine = new OpenSearchEngine(this);
m_openSearchEngine->setNetworkAccessManager(mApp->networkManager()); m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
connect(m_openSearchEngine, SIGNAL(suggestions(const QStringList &)), this, SLOT(addSuggestions(const QStringList &))); connect(m_openSearchEngine, SIGNAL(suggestions(QStringList)), this, SLOT(addSuggestions(QStringList)));
connect(this, SIGNAL(textEdited(const QString &)), m_openSearchEngine, SLOT(requestSuggestions(QString))); connect(this, SIGNAL(textEdited(QString)), m_openSearchEngine, SLOT(requestSuggestions(QString)));
QTimer::singleShot(0, this, SLOT(setupEngines())); QTimer::singleShot(0, this, SLOT(setupEngines()));
} }
@ -153,7 +153,7 @@ void WebSearchBar::setupEngines()
m_boxSearchType->clearItems(); m_boxSearchType->clearItems();
foreach(const SearchEngine & en, m_searchManager->allEngines()) { foreach (const SearchEngine &en, m_searchManager->allEngines()) {
ButtonWithMenu::Item item; ButtonWithMenu::Item item;
item.icon = en.icon; item.icon = en.icon;
item.text = en.name; item.text = en.name;
@ -221,7 +221,7 @@ void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
QWebFrame* frame = view->page()->mainFrame(); QWebFrame* frame = view->page()->mainFrame();
QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]")); QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]"));
foreach(const QWebElement & element, elements) { foreach (const QWebElement &element, elements) {
if (element.attribute("type") != QLatin1String("application/opensearchdescription+xml")) { if (element.attribute("type") != QLatin1String("application/opensearchdescription+xml")) {
continue; continue;
} }
@ -272,7 +272,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
QMenu menu(this); QMenu menu(this);
int i = 0; int i = 0;
foreach(QAction * act, tempMenu->actions()) { foreach (QAction* act, tempMenu->actions()) {
menu.addAction(act); menu.addAction(act);
switch (i) { switch (i) {

View File

@ -69,9 +69,9 @@ NetworkManager::NetworkManager(QObject* parent)
, m_adblockManager(0) , m_adblockManager(0)
, m_ignoreAllWarnings(false) , m_ignoreAllWarnings(false)
{ {
connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(authentication(QNetworkReply*, QAuthenticator*))); connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentication(QNetworkReply*,QAuthenticator*)));
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*)), this, SLOT(proxyAuthentication(QNetworkProxy, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(proxyAuthentication(QNetworkProxy,QAuthenticator*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), this, SLOT(sslError(QNetworkReply*, QList<QSslError>))); connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(sslError(QNetworkReply*,QList<QSslError>)));
connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*))); connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*)));
m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler(); m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler();
@ -175,7 +175,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
} }
QHash<QSslCertificate, QStringList> errorHash; QHash<QSslCertificate, QStringList> errorHash;
foreach(const QSslError & error, errors) { foreach (const QSslError &error, errors) {
// Weird behavior on Windows // Weird behavior on Windows
if (error.error() == QSslError::NoError) { if (error.error() == QSslError::NoError) {
continue; continue;
@ -220,7 +220,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
certs += "</li></ul>"; certs += "</li></ul>";
certs += "<ul>"; certs += "<ul>";
foreach(const QString & error, errors) { foreach (const QString &error, errors) {
certs += "<li>"; certs += "<li>";
certs += tr("<b>Error: </b>") + error; certs += tr("<b>Error: </b>") + error;
certs += "</li>"; certs += "</li>";
@ -241,7 +241,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
return; return;
} }
foreach(const QSslCertificate & cert, errorHash.keys()) { foreach (const QSslCertificate &cert, errorHash.keys()) {
if (!m_localCerts.contains(cert)) { if (!m_localCerts.contains(cert)) {
addLocalCertificate(cert); addLocalCertificate(cert);
} }
@ -480,11 +480,11 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op
QVariant v = req.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100)); QVariant v = req.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>()); WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (webPage) { if (webPage) {
connect(reply, SIGNAL(downloadRequest(const QNetworkRequest &)), connect(reply, SIGNAL(downloadRequest(QNetworkRequest)),
webPage, SLOT(downloadRequested(const QNetworkRequest &))); webPage, SLOT(downloadRequested(QNetworkRequest)));
} }
connect(reply, SIGNAL(ftpAuthenticationRequierd(const QUrl &, QAuthenticator*)), connect(reply, SIGNAL(ftpAuthenticationRequierd(QUrl,QAuthenticator*)),
this, SLOT(ftpAuthentication(const QUrl &, QAuthenticator*))); this, SLOT(ftpAuthentication(QUrl,QAuthenticator*)));
} }
return reply; return reply;
} }
@ -625,7 +625,7 @@ void NetworkManager::loadCertificates()
//CA Certificates //CA Certificates
m_caCerts = QSslSocket::defaultCaCertificates(); m_caCerts = QSslSocket::defaultCaCertificates();
foreach(const QString & path, m_certPaths) { foreach (const QString &path, m_certPaths) {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// Used from Qt 4.7.4 qsslcertificate.cpp and modified because QSslCertificate::fromPath // Used from Qt 4.7.4 qsslcertificate.cpp and modified because QSslCertificate::fromPath
// is kind of a bugged on Windows, it does work only with full path to cert file // is kind of a bugged on Windows, it does work only with full path to cert file

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -36,10 +36,10 @@ void NetworkManagerProxy::setPrimaryNetworkAccessManager(NetworkManager* manager
Q_ASSERT(manager); Q_ASSERT(manager);
m_manager = manager; m_manager = manager;
connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), m_manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*))); connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), m_manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*)), m_manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), m_manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
connect(this, SIGNAL(finished(QNetworkReply*)), m_manager, SIGNAL(finished(QNetworkReply*))); connect(this, SIGNAL(finished(QNetworkReply*)), m_manager, SIGNAL(finished(QNetworkReply*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)), m_manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &))); connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), m_manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)));
} }
QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData) QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -185,7 +185,7 @@ QString FileSchemeReply::loadDirectory()
page.replace(QLatin1String("%UP-DIR-LINK%"), QUrl::fromLocalFile(upDir.absolutePath()).toEncoded()); page.replace(QLatin1String("%UP-DIR-LINK%"), QUrl::fromLocalFile(upDir.absolutePath()).toEncoded());
} }
foreach(const QFileInfo & info, list) { foreach (const QFileInfo &info, list) {
if (info.fileName() == QLatin1String(".") || info.fileName() == QLatin1String("..")) { if (info.fileName() == QLatin1String(".") || info.fileName() == QLatin1String("..")) {
continue; continue;
} }

View File

@ -75,8 +75,8 @@ FtpSchemeReply::FtpSchemeReply(const QNetworkRequest &request, QObject* parent)
m_ftp = new QFtp(this); m_ftp = new QFtp(this);
connect(m_ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(processListInfo(QUrlInfo))); connect(m_ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(processListInfo(QUrlInfo)));
connect(m_ftp, SIGNAL(readyRead()), this, SLOT(processData())); connect(m_ftp, SIGNAL(readyRead()), this, SLOT(processData()));
connect(m_ftp, SIGNAL(commandFinished(int, bool)), this, SLOT(processCommand(int, bool))); connect(m_ftp, SIGNAL(commandFinished(int,bool)), this, SLOT(processCommand(int,bool)));
connect(m_ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this, SIGNAL(downloadProgress(qint64, qint64))); connect(m_ftp, SIGNAL(dataTransferProgress(qint64,qint64)), this, SIGNAL(downloadProgress(qint64,qint64)));
m_buffer.open(QIODevice::ReadWrite); m_buffer.open(QIODevice::ReadWrite);
@ -120,7 +120,7 @@ void FtpSchemeReply::processCommand(int id, bool err)
case QFtp::List: case QFtp::List:
if (m_isGoingToDownload) { if (m_isGoingToDownload) {
foreach(const QUrlInfo & item, m_items) { foreach (const QUrlInfo &item, m_items) {
// don't check if it's a file or not, // don't check if it's a file or not,
// seems it's a QFtp's bug: for link to a file isDir() returns true // seems it's a QFtp's bug: for link to a file isDir() returns true
if (item.name() == m_probablyFileForDownload) { if (item.name() == m_probablyFileForDownload) {
@ -291,7 +291,7 @@ QString FtpSchemeReply::loadDirectory()
} }
} }
foreach(const QUrlInfo & item, m_items) { foreach (const QUrlInfo &item, m_items) {
if (item.name() == QLatin1String(".") || item.name() == QLatin1String("..")) { if (item.name() == QLatin1String(".") || item.name() == QLatin1String("..")) {
continue; continue;
@ -422,7 +422,7 @@ FtpDownloader::FtpDownloader(QObject* parent)
, m_dev(0) , m_dev(0)
, m_lastError(QFtp::NoError) , m_lastError(QFtp::NoError)
{ {
connect(this, SIGNAL(commandFinished(int, bool)), this, SLOT(processCommand(int, bool))); connect(this, SIGNAL(commandFinished(int,bool)), this, SLOT(processCommand(int,bool)));
connect(this, SIGNAL(done(bool)), this, SLOT(onDone(bool))); connect(this, SIGNAL(done(bool)), this, SLOT(onDone(bool)));
} }

View File

@ -431,7 +431,7 @@ QString QupZillaSchemeReply::configPage()
QString pluginsString; QString pluginsString;
const QList<Plugins::Plugin> &availablePlugins = mApp->plugins()->getAvailablePlugins(); const QList<Plugins::Plugin> &availablePlugins = mApp->plugins()->getAvailablePlugins();
foreach(const Plugins::Plugin & plugin, availablePlugins) { foreach (const Plugins::Plugin &plugin, availablePlugins) {
PluginSpec spec = plugin.pluginSpec; PluginSpec spec = plugin.pluginSpec;
pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg( pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(
spec.name, spec.version, QzTools::escape(spec.author), spec.description)); spec.name, spec.version, QzTools::escape(spec.author), spec.description));
@ -445,11 +445,11 @@ QString QupZillaSchemeReply::configPage()
QString allGroupsString; QString allGroupsString;
QSettings* settings = Settings::globalSettings(); QSettings* settings = Settings::globalSettings();
foreach(const QString & group, settings->childGroups()) { foreach (const QString &group, settings->childGroups()) {
QString groupString = QString("<tr><th colspan=\"2\">[%1]</th></tr>").arg(group); QString groupString = QString("<tr><th colspan=\"2\">[%1]</th></tr>").arg(group);
settings->beginGroup(group); settings->beginGroup(group);
foreach(const QString & key, settings->childKeys()) { foreach (const QString &key, settings->childKeys()) {
const QVariant &keyValue = settings->value(key); const QVariant &keyValue = settings->value(key);
QString keyString; QString keyString;

View File

@ -37,7 +37,7 @@ SearchEnginesDialog::SearchEnginesDialog(QWidget* parent)
connect(ui->moveUp, SIGNAL(clicked()), this, SLOT(moveUp())); connect(ui->moveUp, SIGNAL(clicked()), this, SLOT(moveUp()));
connect(ui->moveDown, SIGNAL(clicked()), this, SLOT(moveDown())); connect(ui->moveDown, SIGNAL(clicked()), this, SLOT(moveDown()));
connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(editEngine())); connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(editEngine()));
ui->treeWidget->sortByColumn(-1); ui->treeWidget->sortByColumn(-1);
reloadEngines(); reloadEngines();
@ -214,7 +214,7 @@ void SearchEnginesDialog::reloadEngines()
ui->treeWidget->clear(); ui->treeWidget->clear();
const QString defaultEngineName = mApp->searchEnginesManager()->defaultEngine().name; const QString defaultEngineName = mApp->searchEnginesManager()->defaultEngine().name;
foreach(const SearchEngine & en, m_manager->allEngines()) { foreach (const SearchEngine &en, m_manager->allEngines()) {
QTreeWidgetItem* item = new QTreeWidgetItem(); QTreeWidgetItem* item = new QTreeWidgetItem();
setEngine(item, en); setEngine(item, en);
changeItemToDefault(item, en.name == defaultEngineName); changeItemToDefault(item, en.name == defaultEngineName);

View File

@ -99,7 +99,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut)
return returnEngine; return returnEngine;
} }
foreach(const Engine & en, m_allEngines) { foreach (const Engine &en, m_allEngines) {
if (en.shortcut == shortcut) { if (en.shortcut == shortcut) {
returnEngine = en; returnEngine = en;
break; break;
@ -171,7 +171,7 @@ void SearchEnginesManager::engineChangedImage()
return; return;
} }
foreach(Engine e, m_allEngines) { foreach (Engine e, m_allEngines) {
if (e.name == engine->name() && e.url.contains(engine->searchUrl("%s").toString()) if (e.name == engine->name() && e.url.contains(engine->searchUrl("%s").toString())
&& !engine->image().isNull()) { && !engine->image().isNull()) {
@ -233,7 +233,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
query.addQueryItem(element.attribute("name"), "%s"); query.addQueryItem(element.attribute("name"), "%s");
QWebElementCollection allInputs = formElement.findAll("input"); QWebElementCollection allInputs = formElement.findAll("input");
foreach(QWebElement e, allInputs) { foreach (QWebElement e, allInputs) {
if (element == e || !e.hasAttribute("name")) { if (element == e || !e.hasAttribute("name")) {
continue; continue;
} }
@ -247,7 +247,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
QList<QPair<QByteArray, QByteArray> > queryItems; QList<QPair<QByteArray, QByteArray> > queryItems;
QWebElementCollection allInputs = formElement.findAll("input"); QWebElementCollection allInputs = formElement.findAll("input");
foreach(QWebElement e, allInputs) { foreach (QWebElement e, allInputs) {
if (element == e || !e.hasAttribute("name")) { if (element == e || !e.hasAttribute("name")) {
continue; continue;
} }
@ -445,7 +445,7 @@ void SearchEnginesManager::saveSettings()
QSqlQuery query; QSqlQuery query;
query.exec("DELETE FROM search_engines"); query.exec("DELETE FROM search_engines");
foreach(const Engine & en, m_allEngines) { foreach (const Engine &en, m_allEngines) {
query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)"); query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)");
query.bindValue(0, en.name); query.bindValue(0, en.name);
query.bindValue(1, qIconProvider->iconToBase64(en.icon)); query.bindValue(1, qIconProvider->iconToBase64(en.icon));

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@ BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent)
ui->tabs->setFocus(); ui->tabs->setFocus();
connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(currentIndexChanged(int))); connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(currentIndexChanged(int)));
connect(ui->searchLine, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(search())); connect(ui->searchLine, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(search()));
} }
void BrowsingLibrary::currentIndexChanged(int index) void BrowsingLibrary::currentIndexChanged(int index)

View File

@ -42,13 +42,13 @@ void MacMenuReceiver::setEnabledSelectedMenuActions(QMenu* menu, const QList<int
// we mean all actions by empty list // we mean all actions by empty list
if (indexList.isEmpty()) { if (indexList.isEmpty()) {
foreach(QAction * act, menu->actions()) { foreach (QAction* act, menu->actions()) {
act->setEnabled(true); act->setEnabled(true);
} }
return; return;
} }
foreach(int index, indexList) { foreach (int index, indexList) {
Q_ASSERT(index >= 0 && index < menu->actions().size()); Q_ASSERT(index >= 0 && index < menu->actions().size());
menu->actions().at(index)->setEnabled(true); menu->actions().at(index)->setEnabled(true);
} }
@ -62,13 +62,13 @@ void MacMenuReceiver::setDisabledSelectedMenuActions(QMenu* menu, const QList<in
// we mean all actions by empty list // we mean all actions by empty list
if (indexList.isEmpty()) { if (indexList.isEmpty()) {
foreach(QAction * act, menu->actions()) { foreach (QAction* act, menu->actions()) {
act->setDisabled(true); act->setDisabled(true);
} }
return; return;
} }
foreach(int index, indexList) { foreach (int index, indexList) {
Q_ASSERT(index >= 0 && index < menu->actions().size()); Q_ASSERT(index >= 0 && index < menu->actions().size());
menu->actions().at(index)->setDisabled(true); menu->actions().at(index)->setDisabled(true);
} }

View File

@ -86,7 +86,7 @@ void PageScreen::saveScreen()
} }
else { else {
int part = 1; int part = 1;
foreach(const QImage & image, m_pageImages) { 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 + ".png", "PNG"); image.save(fileName + ".png", "PNG");
part++; part++;
@ -167,7 +167,7 @@ QImage PageScreen::scaleImage()
QVector<QImage> scaledImages; QVector<QImage> scaledImages;
int sumHeight = 0; int sumHeight = 0;
foreach(const QImage & image, m_pageImages) { foreach (const QImage &image, m_pageImages) {
QImage scaled = image.scaledToWidth(450, Qt::SmoothTransformation); QImage scaled = image.scaledToWidth(450, Qt::SmoothTransformation);
scaledImages.append(scaled); scaledImages.append(scaled);
@ -178,7 +178,7 @@ QImage PageScreen::scaleImage()
QPainter painter(&finalImage); QPainter painter(&finalImage);
int offset = 0; int offset = 0;
foreach(const QImage & image, scaledImages) { foreach (const QImage &image, scaledImages) {
painter.drawImage(0, offset, image); painter.drawImage(0, offset, image);
offset += image.height(); offset += image.height();
} }

View File

@ -199,7 +199,7 @@ void ClickToFlash::findElement()
elements.append(docElement.findAll(QLatin1String("embed"))); elements.append(docElement.findAll(QLatin1String("embed")));
elements.append(docElement.findAll(QLatin1String("object"))); elements.append(docElement.findAll(QLatin1String("object")));
foreach(const QWebElement & element, elements) { foreach (const QWebElement &element, elements) {
if (!checkElement(element) && !checkUrlOnElement(element)) { if (!checkElement(element) && !checkUrlOnElement(element)) {
continue; continue;
} }
@ -277,7 +277,7 @@ bool ClickToFlash::checkUrlOnElement(QWebElement el)
bool ClickToFlash::checkElement(QWebElement el) bool ClickToFlash::checkElement(QWebElement el)
{ {
if (m_argumentNames == el.attributeNames()) { if (m_argumentNames == el.attributeNames()) {
foreach(const QString & name, m_argumentNames) { foreach (const QString &name, m_argumentNames) {
if (m_argumentValues.indexOf(el.attribute(name)) == -1) { if (m_argumentValues.indexOf(el.attribute(name)) == -1) {
return false; return false;
} }
@ -297,7 +297,7 @@ void ClickToFlash::showInfo()
lay->addRow(new QLabel(tr("<b>Attribute Name</b>")), new QLabel(tr("<b>Value</b>"))); lay->addRow(new QLabel(tr("<b>Attribute Name</b>")), new QLabel(tr("<b>Value</b>")));
int i = 0; int i = 0;
foreach(const QString & name, m_argumentNames) { foreach (const QString &name, m_argumentNames) {
QString value = m_argumentValues.at(i); QString value = m_argumentValues.at(i);
SqueezeLabelV2* valueLabel = new SqueezeLabelV2(value); SqueezeLabelV2* valueLabel = new SqueezeLabelV2(value);
valueLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); valueLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -95,7 +95,7 @@ void PluginProxy::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitT
return; return;
} }
foreach(PluginInterface * iPlugin, m_loadedPlugins) { foreach (PluginInterface* iPlugin, m_loadedPlugins) {
iPlugin->populateWebViewMenu(menu, view, r); iPlugin->populateWebViewMenu(menu, view, r);
} }
} }
@ -104,7 +104,7 @@ bool PluginProxy::processMouseDoubleClick(const Qz::ObjectName &type, QObject* o
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_mouseDoubleClickHandlers) { foreach (PluginInterface* iPlugin, m_mouseDoubleClickHandlers) {
if (iPlugin->mouseDoubleClick(type, obj, event)) { if (iPlugin->mouseDoubleClick(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -117,7 +117,7 @@ bool PluginProxy::processMousePress(const Qz::ObjectName &type, QObject* obj, QM
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_mousePressHandlers) { foreach (PluginInterface* iPlugin, m_mousePressHandlers) {
if (iPlugin->mousePress(type, obj, event)) { if (iPlugin->mousePress(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -130,7 +130,7 @@ bool PluginProxy::processMouseRelease(const Qz::ObjectName &type, QObject* obj,
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_mouseReleaseHandlers) { foreach (PluginInterface* iPlugin, m_mouseReleaseHandlers) {
if (iPlugin->mouseRelease(type, obj, event)) { if (iPlugin->mouseRelease(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -143,7 +143,7 @@ bool PluginProxy::processMouseMove(const Qz::ObjectName &type, QObject* obj, QMo
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_mouseMoveHandlers) { foreach (PluginInterface* iPlugin, m_mouseMoveHandlers) {
if (iPlugin->mouseMove(type, obj, event)) { if (iPlugin->mouseMove(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -156,7 +156,7 @@ bool PluginProxy::processWheelEvent(const Qz::ObjectName &type, QObject* obj, QW
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_wheelEventHandlers) { foreach (PluginInterface* iPlugin, m_wheelEventHandlers) {
if (iPlugin->wheelEvent(type, obj, event)) { if (iPlugin->wheelEvent(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -169,7 +169,7 @@ bool PluginProxy::processKeyPress(const Qz::ObjectName &type, QObject* obj, QKey
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_keyPressHandlers) { foreach (PluginInterface* iPlugin, m_keyPressHandlers) {
if (iPlugin->keyPress(type, obj, event)) { if (iPlugin->keyPress(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -182,7 +182,7 @@ bool PluginProxy::processKeyRelease(const Qz::ObjectName &type, QObject* obj, QK
{ {
bool accepted = false; bool accepted = false;
foreach(PluginInterface * iPlugin, m_keyReleaseHandlers) { foreach (PluginInterface* iPlugin, m_keyReleaseHandlers) {
if (iPlugin->keyRelease(type, obj, event)) { if (iPlugin->keyRelease(type, obj, event)) {
accepted = true; accepted = true;
} }
@ -193,7 +193,7 @@ bool PluginProxy::processKeyRelease(const Qz::ObjectName &type, QObject* obj, QK
QNetworkReply* PluginProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData) QNetworkReply* PluginProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)
{ {
foreach(PluginInterface * iPlugin, m_loadedPlugins) { foreach (PluginInterface* iPlugin, m_loadedPlugins) {
QNetworkReply* reply = iPlugin->createRequest(op, request, outgoingData); QNetworkReply* reply = iPlugin->createRequest(op, request, outgoingData);
if (reply) { if (reply) {
return reply; return reply;

View File

@ -94,7 +94,7 @@ void Plugins::shutdown()
c2f_saveSettings(); c2f_saveSettings();
m_speedDial->saveSettings(); m_speedDial->saveSettings();
foreach(PluginInterface * iPlugin, m_loadedPlugins) { foreach (PluginInterface* iPlugin, m_loadedPlugins) {
iPlugin->unload(); iPlugin->unload();
} }
} }
@ -128,7 +128,7 @@ void Plugins::loadPlugins()
settingsDir.mkdir(settingsDir.absolutePath()); settingsDir.mkdir(settingsDir.absolutePath());
} }
foreach(const QString & fullPath, m_allowedPlugins) { foreach (const QString &fullPath, m_allowedPlugins) {
QPluginLoader* loader = new QPluginLoader(fullPath); QPluginLoader* loader = new QPluginLoader(fullPath);
PluginInterface* iPlugin = qobject_cast<PluginInterface*>(loader->instance()); PluginInterface* iPlugin = qobject_cast<PluginInterface*>(loader->instance());
if (!iPlugin) { if (!iPlugin) {
@ -172,9 +172,9 @@ void Plugins::loadAvailablePlugins()
#endif #endif
<< mApp->PROFILEDIR + "plugins/"; << mApp->PROFILEDIR + "plugins/";
foreach(const QString & dir, dirs) { foreach (const QString &dir, dirs) {
QDir pluginsDir = QDir(dir); QDir pluginsDir = QDir(dir);
foreach(const QString & fileName, pluginsDir.entryList(QDir::Files)) { foreach (const QString &fileName, pluginsDir.entryList(QDir::Files)) {
const QString absolutePath = pluginsDir.absoluteFilePath(fileName); const QString absolutePath = pluginsDir.absoluteFilePath(fileName);
if (m_allowedPlugins.contains(absolutePath)) { if (m_allowedPlugins.contains(absolutePath)) {
continue; continue;
@ -227,7 +227,7 @@ void Plugins::refreshLoadedPlugins()
{ {
m_loadedPlugins.clear(); m_loadedPlugins.clear();
foreach(const Plugin & plugin, m_availablePlugins) { foreach (const Plugin &plugin, m_availablePlugins) {
if (plugin.isLoaded()) { if (plugin.isLoaded()) {
m_loadedPlugins.append(plugin.instance); m_loadedPlugins.append(plugin.instance);
} }
@ -236,7 +236,7 @@ void Plugins::refreshLoadedPlugins()
bool Plugins::alreadySpecInAvailable(const PluginSpec &spec) bool Plugins::alreadySpecInAvailable(const PluginSpec &spec)
{ {
foreach(const Plugin & plugin, m_availablePlugins) { foreach (const Plugin &plugin, m_availablePlugins) {
if (plugin.pluginSpec == spec) { if (plugin.pluginSpec == spec) {
return true; return true;
} }

View File

@ -328,7 +328,7 @@ void Speller::populateLanguagesMenu()
} }
const QVector<Language> langs = availableLanguages(); const QVector<Language> langs = availableLanguages();
foreach(const Language & lang, langs) { foreach (const Language &lang, langs) {
QAction* act = menu->addAction(lang.name, this, SLOT(changeLanguage())); QAction* act = menu->addAction(lang.name, this, SLOT(changeLanguage()));
act->setCheckable(true); act->setCheckable(true);
act->setChecked(m_language == lang); act->setChecked(m_language == lang);

View File

@ -95,7 +95,7 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url)
const QString &urlString = url.toString(); const QString &urlString = url.toString();
foreach(const Page & page, m_webPages) { foreach (const Page &page, m_webPages) {
if (page.url == urlString) { if (page.url == urlString) {
return page; return page;
} }
@ -137,7 +137,7 @@ void SpeedDial::addPage(const QUrl &url, const QString &title)
m_webPages.append(page); m_webPages.append(page);
m_regenerateScript = true; m_regenerateScript = true;
foreach(QWebFrame * frame, cleanFrames()) { foreach (QWebFrame* frame, cleanFrames()) {
frame->page()->triggerAction(QWebPage::Reload); frame->page()->triggerAction(QWebPage::Reload);
} }
@ -156,7 +156,7 @@ void SpeedDial::removePage(const Page &page)
m_webPages.removeAll(page); m_webPages.removeAll(page);
m_regenerateScript = true; m_regenerateScript = true;
foreach(QWebFrame * frame, cleanFrames()) { foreach (QWebFrame* frame, cleanFrames()) {
frame->page()->triggerAction(QWebPage::Reload); frame->page()->triggerAction(QWebPage::Reload);
} }
@ -209,7 +209,7 @@ QString SpeedDial::initialScript()
m_regenerateScript = false; m_regenerateScript = false;
m_initialScript.clear(); m_initialScript.clear();
foreach(const Page & page, m_webPages) { foreach (const Page &page, m_webPages) {
QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png"; QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
if (!QFile(imgSource).exists()) { if (!QFile(imgSource).exists()) {
@ -239,7 +239,7 @@ void SpeedDial::changed(const QString &allPages)
const QStringList &entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts); const QStringList &entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts);
m_webPages.clear(); m_webPages.clear();
foreach(const QString & entry, entries) { foreach (const QString &entry, entries) {
if (entry.isEmpty()) { if (entry.isEmpty()) {
continue; continue;
} }
@ -269,7 +269,7 @@ void SpeedDial::loadThumbnail(const QString &url, bool loadTitle)
PageThumbnailer* thumbnailer = new PageThumbnailer(this); PageThumbnailer* thumbnailer = new PageThumbnailer(this);
thumbnailer->setUrl(QUrl::fromEncoded(url.toUtf8())); thumbnailer->setUrl(QUrl::fromEncoded(url.toUtf8()));
thumbnailer->setLoadTitle(loadTitle); thumbnailer->setLoadTitle(loadTitle);
connect(thumbnailer, SIGNAL(thumbnailCreated(const QPixmap &)), this, SLOT(thumbnailCreated(const QPixmap &))); connect(thumbnailer, SIGNAL(thumbnailCreated(QPixmap)), this, SLOT(thumbnailCreated(QPixmap)));
thumbnailer->start(); thumbnailer->start();
} }
@ -353,7 +353,7 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
m_regenerateScript = true; m_regenerateScript = true;
cleanFrames(); cleanFrames();
foreach(QWebFrame * frame, cleanFrames()) { foreach (QWebFrame* frame, cleanFrames()) {
frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(fileName))); frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(fileName)));
if (loadTitle) { if (loadTitle) {
frame->evaluateJavaScript(QString("setTitleToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(title))); frame->evaluateJavaScript(QString("setTitleToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(title)));
@ -398,7 +398,7 @@ QString SpeedDial::generateAllPages()
{ {
QString allPages; QString allPages;
foreach(const Page & page, m_webPages) { 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); allPages.append(string);
} }

View File

@ -96,7 +96,7 @@ PopupWindow::PopupWindow(PopupWebView* view)
// Make shortcuts available even with hidden menubar // Make shortcuts available even with hidden menubar
QList<QAction*> actions = m_menuBar->actions(); QList<QAction*> actions = m_menuBar->actions();
foreach(QAction * action, actions) { foreach (QAction* action, actions) {
if (action->menu()) { if (action->menu()) {
actions += action->menu()->actions(); actions += action->menu()->actions();
} }
@ -120,7 +120,7 @@ PopupWindow::PopupWindow(PopupWebView* view)
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString))); connect(m_page, SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(showStatusBarMessage(QString)));
connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect))); connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect)));
connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool))); connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool)));
connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool))); connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool)));

View File

@ -18,7 +18,7 @@
*/ */
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -79,7 +79,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList(); QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
settings.endGroup(); settings.endGroup();
foreach(const QString & code, langs) { foreach (const QString &code, langs) {
QString code_ = code; QString code_ = code;
QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_'))); QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_')));
QString label; QString label;

View File

@ -45,7 +45,7 @@ PluginsManager::PluginsManager(QWidget* parent)
ui->list->setEnabled(appPluginsEnabled); ui->list->setEnabled(appPluginsEnabled);
connect(ui->butSettings, SIGNAL(clicked()), this, SLOT(settingsClicked())); connect(ui->butSettings, SIGNAL(clicked()), this, SLOT(settingsClicked()));
connect(ui->list, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(currentChanged(QListWidgetItem*))); connect(ui->list, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(currentChanged(QListWidgetItem*)));
connect(ui->list, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(ui->list, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
connect(ui->allowAppPlugins, SIGNAL(clicked(bool)), this, SLOT(allowAppPluginsChanged(bool))); connect(ui->allowAppPlugins, SIGNAL(clicked(bool)), this, SLOT(allowAppPluginsChanged(bool)));
@ -62,7 +62,7 @@ PluginsManager::PluginsManager(QWidget* parent)
QStringList whitelist = mApp->plugins()->c2f_getWhiteList(); QStringList whitelist = mApp->plugins()->c2f_getWhiteList();
ui->allowClick2Flash->setChecked(settings.value("Enable", true).toBool()); ui->allowClick2Flash->setChecked(settings.value("Enable", true).toBool());
settings.endGroup(); settings.endGroup();
foreach(const QString & site, whitelist) { foreach (const QString &site, whitelist) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->whitelist); QTreeWidgetItem* item = new QTreeWidgetItem(ui->whitelist);
item->setText(0, site); item->setText(0, site);
} }
@ -167,7 +167,7 @@ void PluginsManager::refresh()
const QList<Plugins::Plugin> &allPlugins = mApp->plugins()->getAvailablePlugins(); const QList<Plugins::Plugin> &allPlugins = mApp->plugins()->getAvailablePlugins();
foreach(const Plugins::Plugin & plugin, allPlugins) { foreach (const Plugins::Plugin &plugin, allPlugins) {
PluginSpec spec = plugin.pluginSpec; PluginSpec spec = plugin.pluginSpec;
QListWidgetItem* item = new QListWidgetItem(ui->list); QListWidgetItem* item = new QListWidgetItem(ui->list);

View File

@ -162,7 +162,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->startProfile->addItem(actProfileName); ui->startProfile->addItem(actProfileName);
QDir profilesDir(mApp->PROFILEDIR + "profiles/"); QDir profilesDir(mApp->PROFILEDIR + "profiles/");
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach(const QString & name, list_) { foreach (const QString &name, list_) {
if (actProfileName == name) { if (actProfileName == name) {
continue; continue;
} }
@ -385,7 +385,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
QDir lanDir(mApp->TRANSLATIONSDIR); QDir lanDir(mApp->TRANSLATIONSDIR);
QStringList list = lanDir.entryList(QStringList("*.qm")); QStringList list = lanDir.entryList(QStringList("*.qm"));
foreach(const QString & name, list) { foreach (const QString &name, list) {
if (name.startsWith(QLatin1String("qt_"))) { if (name.startsWith(QLatin1String("qt_"))) {
continue; continue;
} }
@ -448,7 +448,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
connect(ui->uaManager, SIGNAL(clicked()), this, SLOT(openUserAgentManager())); connect(ui->uaManager, SIGNAL(clicked()), this, SLOT(openUserAgentManager()));
connect(ui->jsOptionsButton, SIGNAL(clicked()), this, SLOT(openJsOptions())); connect(ui->jsOptionsButton, SIGNAL(clicked()), this, SLOT(openJsOptions()));
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*))); connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true); ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
ui->version->setText(" QupZilla v" + QupZilla::VERSION); ui->version->setText(" QupZilla v" + QupZilla::VERSION);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -74,7 +74,7 @@ void SSLManager::refreshCAList()
ui->caList->clear(); ui->caList->clear();
m_caCerts = QSslSocket::defaultCaCertificates(); m_caCerts = QSslSocket::defaultCaCertificates();
foreach(const QSslCertificate & cert, m_caCerts) { foreach (const QSslCertificate &cert, m_caCerts) {
if (m_localCerts.contains(cert)) { if (m_localCerts.contains(cert)) {
continue; continue;
} }
@ -95,7 +95,7 @@ void SSLManager::refreshLocalList()
ui->localList->clear(); ui->localList->clear();
m_localCerts = mApp->networkManager()->getLocalCertificates(); m_localCerts = mApp->networkManager()->getLocalCertificates();
foreach(const QSslCertificate & cert, m_localCerts) { foreach (const QSslCertificate &cert, m_localCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->localList); QListWidgetItem* item = new QListWidgetItem(ui->localList);
item->setText(CertificateInfoWidget::certificateItemText(cert)); item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setData(Qt::UserRole + 10, m_localCerts.indexOf(cert)); item->setData(Qt::UserRole + 10, m_localCerts.indexOf(cert));
@ -108,7 +108,7 @@ void SSLManager::refreshLocalList()
void SSLManager::refreshPaths() void SSLManager::refreshPaths()
{ {
foreach(const QString & path, mApp->networkManager()->certificatePaths()) { foreach (const QString &path, mApp->networkManager()->certificatePaths()) {
ui->pathList->addItem(path); ui->pathList->addItem(path);
} }
} }

View File

@ -43,7 +43,7 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
QDir themeDir(mApp->THEMESDIR); QDir themeDir(mApp->THEMESDIR);
QStringList list = themeDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); QStringList list = themeDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach(const QString & name, list) { foreach (const QString &name, list) {
Theme themeInfo = parseTheme(name); Theme themeInfo = parseTheme(name);
if (!themeInfo.isValid) { if (!themeInfo.isValid) {
continue; continue;
@ -61,7 +61,7 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
ui->listWidget->addItem(item); ui->listWidget->addItem(item);
} }
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(currentChanged())); connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(currentChanged()));
connect(ui->license, SIGNAL(clicked(QPoint)), this, SLOT(showLicense())); connect(ui->license, SIGNAL(clicked(QPoint)), this, SLOT(showLicense()));
currentChanged(); currentChanged();

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -92,11 +92,11 @@ void RSSManager::refreshTable()
TreeWidget* tree = new TreeWidget(); TreeWidget* tree = new TreeWidget();
tree->setHeaderLabel(tr("News")); tree->setHeaderLabel(tr("News"));
tree->setContextMenuPolicy(Qt::CustomContextMenu); tree->setContextMenuPolicy(Qt::CustomContextMenu);
connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &))); connect(tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
ui->tabWidget->addTab(tree, title); ui->tabWidget->addTab(tree, title);
ui->tabWidget->setTabToolTip(i, address.toString()); ui->tabWidget->setTabToolTip(i, address.toString());
connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(loadFeed(QTreeWidgetItem*))); connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(loadFeed(QTreeWidgetItem*)));
connect(tree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*))); connect(tree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*)));
connect(tree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*))); connect(tree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*)));
QTreeWidgetItem* item = new QTreeWidgetItem(); QTreeWidgetItem* item = new QTreeWidgetItem();

View File

@ -103,7 +103,7 @@ RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView*
} }
#endif #endif
foreach(const RssApp & app, m_rssApps) { foreach (const RssApp &app, m_rssApps) {
ui->comboBox->addItem(app.icon, app.title, QVariant(app.type)); ui->comboBox->addItem(app.icon, app.title, QVariant(app.type));
} }

View File

@ -47,22 +47,22 @@ BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks")); ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks"));
ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded); ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded);
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*)));
connect(ui->search, SIGNAL(textChanged(QString)), ui->bookmarksTree, SLOT(filterString(QString))); connect(ui->search, SIGNAL(textChanged(QString)), ui->bookmarksTree, SLOT(filterString(QString)));
connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark)), connect(m_bookmarksModel, SIGNAL(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)),
this, SLOT(bookmarkEdited(BookmarksModel::Bookmark, BookmarksModel::Bookmark))); this, SLOT(bookmarkEdited(BookmarksModel::Bookmark,BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(folderAdded(QString)), this, SLOT(addFolder(QString))); connect(m_bookmarksModel, SIGNAL(folderAdded(QString)), this, SLOT(addFolder(QString)));
connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(removeFolder(QString))); connect(m_bookmarksModel, SIGNAL(folderDeleted(QString)), this, SLOT(removeFolder(QString)));
connect(m_bookmarksModel, SIGNAL(folderRenamed(QString, QString)), this, SLOT(renameFolder(QString, QString))); connect(m_bookmarksModel, SIGNAL(folderRenamed(QString,QString)), this, SLOT(renameFolder(QString,QString)));
connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString, bool)), this, SLOT(changeFolderParent(QString, bool))); connect(m_bookmarksModel, SIGNAL(folderParentChanged(QString,bool)), this, SLOT(changeFolderParent(QString,bool)));
connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString, QByteArray, int, QUrl, QString, QString)), connect(m_bookmarksModel, SIGNAL(bookmarkParentChanged(QString,QByteArray,int,QUrl,QString,QString)),
this, SLOT(changeBookmarkParent(QString, QByteArray, int, QUrl, QString, QString))); this, SLOT(changeBookmarkParent(QString,QByteArray,int,QUrl,QString,QString)));
QTimer::singleShot(0, this, SLOT(refreshTable())); QTimer::singleShot(0, this, SLOT(refreshTable()));
} }
@ -261,7 +261,7 @@ void BookmarksSideBar::changeBookmarkParent(const QString &name, const QByteArra
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(name, Qt::MatchExactly | Qt::MatchRecursive); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(name, Qt::MatchExactly | Qt::MatchRecursive);
QTreeWidgetItem* item = 0; QTreeWidgetItem* item = 0;
foreach(item, list) { foreach (item, list) {
if (id == item->data(0, Qt::UserRole + 10).toInt()) { if (id == item->data(0, Qt::UserRole + 10).toInt()) {
break; break;
} }
@ -309,7 +309,7 @@ void BookmarksSideBar::changeFolderParent(const QString &name, bool isSubfolder)
else { else {
addFolder(name); addFolder(name);
QVector<Bookmark> bookmarksList = m_bookmarksModel->folderBookmarks(name); QVector<Bookmark> bookmarksList = m_bookmarksModel->folderBookmarks(name);
foreach(const Bookmark & b, bookmarksList) { foreach (const Bookmark &b, bookmarksList) {
addBookmark(b); addBookmark(b);
} }
} }

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent)
ui->historyTree->setColumnHidden(3, true); ui->historyTree->setColumnHidden(3, true);
ui->historyTree->setSelectionMode(QAbstractItemView::SingleSelection); ui->historyTree->setSelectionMode(QAbstractItemView::SingleSelection);
connect(ui->historyTree, SIGNAL(openLink(QUrl, HistoryView::OpenBehavior)), this, SLOT(openLink(QUrl, HistoryView::OpenBehavior))); connect(ui->historyTree, SIGNAL(openLink(QUrl,HistoryView::OpenBehavior)), this, SLOT(openLink(QUrl,HistoryView::OpenBehavior)));
connect(ui->search, SIGNAL(textEdited(QString)), ui->historyTree->filterModel(), SLOT(setFilterFixedString(QString))); connect(ui->search, SIGNAL(textEdited(QString)), ui->historyTree->filterModel(), SLOT(setFilterFixedString(QString)));
} }

View File

@ -103,7 +103,7 @@ void SideBarManager::addSidebar(const QString &id, SideBarInterface* interface)
{ {
s_sidebars[id] = interface; s_sidebars[id] = interface;
foreach(QupZilla * window, mApp->mainWindows()) { foreach (QupZilla* window, mApp->mainWindows()) {
window->sideBarManager()->refreshMenu(); window->sideBarManager()->refreshMenu();
} }
} }
@ -112,7 +112,7 @@ void SideBarManager::removeSidebar(const QString &id)
{ {
s_sidebars.remove(id); s_sidebars.remove(id);
foreach(QupZilla * window, mApp->mainWindows()) { foreach (QupZilla* window, mApp->mainWindows()) {
window->sideBarManager()->sideBarRemoved(id); window->sideBarManager()->sideBarRemoved(id);
} }
} }
@ -134,7 +134,7 @@ void SideBarManager::refreshMenu()
act->setShortcut(QKeySequence("Ctrl+H")); act->setShortcut(QKeySequence("Ctrl+H"));
act->setData("History"); act->setData("History");
foreach(const QPointer<SideBarInterface> &sidebar, s_sidebars) { foreach (const QPointer<SideBarInterface> &sidebar, s_sidebars) {
if (!sidebar) { if (!sidebar) {
continue; continue;
} }
@ -162,7 +162,7 @@ void SideBarManager::updateActions()
return; return;
} }
foreach(QAction * act, m_menu->actions()) { foreach (QAction* act, m_menu->actions()) {
act->setChecked(act->data().toString() == m_activeBar); act->setChecked(act->data().toString() == m_activeBar);
} }
} }

View File

@ -58,7 +58,7 @@ void ButtonWithMenu::addItem(const Item &item)
void ButtonWithMenu::addItems(const QVector<Item> &items) void ButtonWithMenu::addItems(const QVector<Item> &items)
{ {
foreach(const Item & item, items) { foreach (const Item &item, items) {
addItem(item); addItem(item);
} }
} }
@ -134,7 +134,7 @@ void ButtonWithMenu::generateMenu()
{ {
m_menu->clear(); m_menu->clear();
foreach(const Item & item, m_items) { foreach (const Item &item, m_items) {
QVariant variant; QVariant variant;
variant.setValue<Item>(item); variant.setValue<Item>(item);
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant); m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);

View File

@ -29,7 +29,7 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
loadSettings(); loadSettings();
foreach(const QString & site, m_notificationsGranted) { foreach (const QString &site, m_notificationsGranted) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->notifTree); QTreeWidgetItem* item = new QTreeWidgetItem(ui->notifTree);
item->setText(0, site); item->setText(0, site);
item->setText(1, tr("Allow")); item->setText(1, tr("Allow"));
@ -38,7 +38,7 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
ui->notifTree->addTopLevelItem(item); ui->notifTree->addTopLevelItem(item);
} }
foreach(const QString & site, m_notificationsDenied) { foreach (const QString &site, m_notificationsDenied) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->notifTree); QTreeWidgetItem* item = new QTreeWidgetItem(ui->notifTree);
item->setText(0, site); item->setText(0, site);
item->setText(1, tr("Deny")); item->setText(1, tr("Deny"));
@ -47,7 +47,7 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
ui->notifTree->addTopLevelItem(item); ui->notifTree->addTopLevelItem(item);
} }
foreach(const QString & site, m_geolocationGranted) { foreach (const QString &site, m_geolocationGranted) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->geoTree); QTreeWidgetItem* item = new QTreeWidgetItem(ui->geoTree);
item->setText(0, site); item->setText(0, site);
item->setText(1, tr("Allow")); item->setText(1, tr("Allow"));
@ -56,7 +56,7 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) :
ui->geoTree->addTopLevelItem(item); ui->geoTree->addTopLevelItem(item);
} }
foreach(const QString & site, m_geolocationDenied) { foreach (const QString &site, m_geolocationDenied) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->geoTree); QTreeWidgetItem* item = new QTreeWidgetItem(ui->geoTree);
item->setText(0, site); item->setText(0, site);
item->setText(1, tr("Deny")); item->setText(1, tr("Deny"));

View File

@ -66,7 +66,7 @@ HtmlHighlighter::HtmlHighlighter(QTextDocument* parent)
tagFormat.setFontWeight(QFont::Bold); tagFormat.setFontWeight(QFont::Bold);
QStringList keywordPatterns; QStringList keywordPatterns;
keywordPatterns << "</?([A-Za-z:0-9]{1,20})/?(>| )?" << ">" << "(<!DOCTYPE html>|<!DOCTYPE html PUBLIC)"; keywordPatterns << "</?([A-Za-z:0-9]{1,20})/?(>| )?" << ">" << "(<!DOCTYPE html>|<!DOCTYPE html PUBLIC)";
foreach(const QString & pattern, keywordPatterns) { foreach (const QString &pattern, keywordPatterns) {
rule.pattern = QzRegExp(pattern); rule.pattern = QzRegExp(pattern);
rule.format = tagFormat; rule.format = tagFormat;
highlightingRules.append(rule); highlightingRules.append(rule);
@ -95,7 +95,7 @@ HtmlHighlighter::HtmlHighlighter(QTextDocument* parent)
void HtmlHighlighter::highlightBlock(const QString &text) void HtmlHighlighter::highlightBlock(const QString &text)
{ {
foreach(const HighlightingRule & rule, highlightingRules) { foreach (const HighlightingRule &rule, highlightingRules) {
QzRegExp expression(rule.pattern); QzRegExp expression(rule.pattern);
int index = expression.indexIn(text); int index = expression.indexIn(text);
while (index >= 0) { while (index >= 0) {

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -59,7 +59,7 @@ void IconProvider::saveIcon(WebView* view)
return; return;
} }
foreach(const Icon & ic, m_iconBuffer) { foreach (const Icon &ic, m_iconBuffer) {
if (ic.url == item.url && ic.image == item.image) { if (ic.url == item.url && ic.image == item.image) {
return; return;
} }
@ -70,7 +70,7 @@ void IconProvider::saveIcon(WebView* view)
QImage IconProvider::iconForUrl(const QUrl &url) QImage IconProvider::iconForUrl(const QUrl &url)
{ {
foreach(const Icon & ic, m_iconBuffer) { foreach (const Icon &ic, m_iconBuffer) {
if (ic.url == url) { if (ic.url == url) {
return ic.image; return ic.image;
} }
@ -89,7 +89,7 @@ QImage IconProvider::iconForUrl(const QUrl &url)
QImage IconProvider::iconForDomain(const QUrl &url) QImage IconProvider::iconForDomain(const QUrl &url)
{ {
foreach(const Icon & ic, m_iconBuffer) { foreach (const Icon &ic, m_iconBuffer) {
if (ic.url.host() == url.host()) { if (ic.url.host() == url.host()) {
return ic.image; return ic.image;
} }
@ -109,7 +109,7 @@ QImage IconProvider::iconForDomain(const QUrl &url)
void IconProvider::saveIconsToDatabase() void IconProvider::saveIconsToDatabase()
{ {
foreach(const Icon & ic, m_iconBuffer) { foreach (const Icon &ic, m_iconBuffer) {
QSqlQuery query; QSqlQuery query;
query.prepare("SELECT id FROM icons WHERE url = ?"); query.prepare("SELECT id FROM icons WHERE url = ?");
query.bindValue(0, ic.url.toEncoded(QUrl::RemoveFragment)); query.bindValue(0, ic.url.toEncoded(QUrl::RemoveFragment));

View File

@ -39,7 +39,7 @@
****************************************************************************/ ****************************************************************************/
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -66,7 +66,7 @@ PlainEditWithLines::PlainEditWithLines(QWidget* parent)
, m_countCache(-1, -1) , m_countCache(-1, -1)
{ {
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect, int)), this, SLOT(updateLineNumberArea(QRect, int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0); updateLineNumberAreaWidth(0);

View File

@ -382,7 +382,7 @@ QString QzTools::resolveFromPath(const QString &name)
QStringList dirs = path.split(QLatin1Char(':'), QString::SkipEmptyParts); QStringList dirs = path.split(QLatin1Char(':'), QString::SkipEmptyParts);
foreach(const QString & dir, dirs) { foreach (const QString &dir, dirs) {
QDir d(dir); QDir d(dir);
if (d.exists(name)) { if (d.exists(name)) {
return d.absoluteFilePath(name); return d.absoluteFilePath(name);

View File

@ -34,7 +34,7 @@ TreeWidget::TreeWidget(QWidget* parent)
{ {
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(sheduleRefresh())); connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(sheduleRefresh()));
} }
void TreeWidget::clear() void TreeWidget::clear()
@ -123,7 +123,7 @@ QMimeData* TreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
QByteArray encodedData; QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly); QDataStream stream(&encodedData, QIODevice::WriteOnly);
foreach(const QTreeWidgetItem * item, items) { foreach (const QTreeWidgetItem* item, items) {
if (item) { if (item) {
QTreeWidgetItem* clonedItem = item->clone(); QTreeWidgetItem* clonedItem = item->clone();
bool parentIsRoot = false; bool parentIsRoot = false;
@ -332,8 +332,9 @@ void TreeWidget::filterString(const QString &string)
QList<QTreeWidgetItem*> _allItems = allItems(); QList<QTreeWidgetItem*> _allItems = allItems();
if (string.isEmpty()) { if (string.isEmpty()) {
foreach(QTreeWidgetItem * item, _allItems) foreach (QTreeWidgetItem* item, _allItems) {
item->setHidden(false); item->setHidden(false);
}
for (int i = 0; i < topLevelItemCount(); i++) { for (int i = 0; i < topLevelItemCount(); i++) {
topLevelItem(i)->setHidden(false); topLevelItem(i)->setHidden(false);
} }
@ -342,7 +343,7 @@ void TreeWidget::filterString(const QString &string)
} }
} }
else { else {
foreach(QTreeWidgetItem * item, _allItems) { foreach (QTreeWidgetItem* item, _allItems) {
item->setHidden(!item->text(0).contains(string, Qt::CaseInsensitive)); item->setHidden(!item->text(0).contains(string, Qt::CaseInsensitive));
item->setExpanded(true); item->setExpanded(true);
} }
@ -460,13 +461,13 @@ void TreeWidget::setDragDropReceiver(bool enable, QObject* receiver)
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
model()->setSupportedDragActions(Qt::CopyAction); model()->setSupportedDragActions(Qt::CopyAction);
#endif #endif
connect(this, SIGNAL(folderParentChanged(QString, bool, bool*)), receiver, SLOT(changeFolderParent(QString, bool, bool*))); connect(this, SIGNAL(folderParentChanged(QString,bool,bool*)), receiver, SLOT(changeFolderParent(QString,bool,bool*)));
connect(this, SIGNAL(bookmarkParentChanged(int, QString, QString, bool*)), receiver, SLOT(changeBookmarkParent(int, QString, QString, bool*))); connect(this, SIGNAL(bookmarkParentChanged(int,QString,QString,bool*)), receiver, SLOT(changeBookmarkParent(int,QString,QString,bool*)));
connect(this, SIGNAL(linkWasDroped(QUrl, QString, QVariant, QString, bool*)), receiver, SLOT(bookmarkDropedLink(QUrl, QString, QVariant, QString, bool*))); connect(this, SIGNAL(linkWasDroped(QUrl,QString,QVariant,QString,bool*)), receiver, SLOT(bookmarkDropedLink(QUrl,QString,QVariant,QString,bool*)));
} }
else { else {
disconnect(this, SIGNAL(folderParentChanged(QString, bool, bool*)), receiver, SLOT(changeFolderParent(QString, bool, bool*))); disconnect(this, SIGNAL(folderParentChanged(QString,bool,bool*)), receiver, SLOT(changeFolderParent(QString,bool,bool*)));
disconnect(this, SIGNAL(bookmarkParentChanged(int, QString, QString, bool*)), receiver, SLOT(changeBookmarkParent(int, QString, QString, bool*))); disconnect(this, SIGNAL(bookmarkParentChanged(int,QString,QString,bool*)), receiver, SLOT(changeBookmarkParent(int,QString,QString,bool*)));
disconnect(this, SIGNAL(linkWasDroped(QUrl, QString, QVariant, QString, bool*)), receiver, SLOT(bookmarkDropedLink(QUrl, QString, QVariant, QString, bool*))); disconnect(this, SIGNAL(linkWasDroped(QUrl,QString,QVariant,QString,bool*)), receiver, SLOT(bookmarkDropedLink(QUrl,QString,QVariant,QString,bool*)));
} }
} }

View File

@ -138,7 +138,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
const QList<QWebDatabase> &databases = frame->securityOrigin().databases(); const QList<QWebDatabase> &databases = frame->securityOrigin().databases();
int counter = 0; int counter = 0;
foreach(const QWebDatabase & b, databases) { foreach (const QWebDatabase &b, databases) {
QListWidgetItem* item = new QListWidgetItem(ui->databaseList); QListWidgetItem* item = new QListWidgetItem(ui->databaseList);
item->setText(b.displayName()); item->setText(b.displayName());
item->setData(Qt::UserRole + 10, counter); item->setData(Qt::UserRole + 10, counter);
@ -168,9 +168,9 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
connect(ui->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked())); connect(ui->secDetailsButton, SIGNAL(clicked()), this, SLOT(securityDetailsClicked()));
connect(ui->saveButton, SIGNAL(clicked(QAbstractButton*)), this, SLOT(downloadImage())); connect(ui->saveButton, SIGNAL(clicked(QAbstractButton*)), this, SLOT(downloadImage()));
connect(ui->databaseList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(databaseItemChanged(QListWidgetItem*))); connect(ui->databaseList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(databaseItemChanged(QListWidgetItem*)));
connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*))); connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*)));
connect(ui->treeImages, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(imagesCustomContextMenuRequested(const QPoint &))); connect(ui->treeImages, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(imagesCustomContextMenuRequested(QPoint)));
ui->treeImages->setContextMenuPolicy(Qt::CustomContextMenu); ui->treeImages->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeImages->sortByColumn(-1); ui->treeImages->sortByColumn(-1);

View File

@ -62,7 +62,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
setAcceptDrops(true); setAcceptDrops(true);
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(m_tabWidget, SIGNAL(pinnedTabClosed()), this, SLOT(pinnedTabClosed())); connect(m_tabWidget, SIGNAL(pinnedTabClosed()), this, SLOT(pinnedTabClosed()));
connect(m_tabWidget, SIGNAL(pinnedTabAdded()), this, SLOT(pinnedTabAdded())); connect(m_tabWidget, SIGNAL(pinnedTabAdded()), this, SLOT(pinnedTabAdded()));
@ -642,7 +642,7 @@ void TabBar::dropEvent(QDropEvent* event)
int index = tabAt(event->pos()); int index = tabAt(event->pos());
if (index == -1) { if (index == -1) {
foreach(const QUrl & url, mime->urls()) { foreach (const QUrl &url, mime->urls()) {
m_tabWidget->addView(url, Qz::NT_SelectedTabAtTheEnd); m_tabWidget->addView(url, Qz::NT_SelectedTabAtTheEnd);
} }
} }

View File

@ -67,7 +67,7 @@ void TabbedWebView::setWebPage(WebPage* page)
page->setParent(this); page->setParent(this);
setPage(page); setPage(page);
connect(page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(linkHovered(QString, QString, QString))); connect(page, SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
} }
void TabbedWebView::slotIconChanged() void TabbedWebView::slotIconChanged()

View File

@ -93,7 +93,7 @@ void AddTabButton::dropEvent(QDropEvent* event)
return; return;
} }
foreach(const QUrl & url, mime->urls()) { foreach (const QUrl &url, mime->urls()) {
m_tabWidget->addView(url, Qz::NT_SelectedNewEmptyTab); m_tabWidget->addView(url, Qz::NT_SelectedNewEmptyTab);
} }
} }
@ -120,7 +120,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
connect(m_tabBar, SIGNAL(closeAllButCurrent(int)), this, SLOT(closeAllButCurrent(int))); connect(m_tabBar, SIGNAL(closeAllButCurrent(int)), this, SLOT(closeAllButCurrent(int)));
connect(m_tabBar, SIGNAL(duplicateTab(int)), this, SLOT(duplicateTab(int))); connect(m_tabBar, SIGNAL(duplicateTab(int)), this, SLOT(duplicateTab(int)));
connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int))); connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)));
connect(m_tabBar, SIGNAL(moveAddTabButton(int)), this, SLOT(moveAddTabButton(int))); connect(m_tabBar, SIGNAL(moveAddTabButton(int)), this, SLOT(moveAddTabButton(int)));
connect(m_tabBar, SIGNAL(showButtons()), this, SLOT(showButtons())); connect(m_tabBar, SIGNAL(showButtons()), this, SLOT(showButtons()));
@ -632,7 +632,7 @@ void TabWidget::closeAllButCurrent(int index)
WebTab* akt = weTab(index); WebTab* akt = weTab(index);
foreach(WebTab * tab, allTabs(false)) { foreach (WebTab* tab, allTabs(false)) {
int tabIndex = tab->tabIndex(); int tabIndex = tab->tabIndex();
if (akt == widget(tabIndex)) { if (akt == widget(tabIndex)) {
continue; continue;
@ -695,7 +695,7 @@ void TabWidget::restoreAllClosedTabs()
const QVector<ClosedTabsManager::Tab> &closedTabs = m_closedTabsManager->allClosedTabs(); const QVector<ClosedTabsManager::Tab> &closedTabs = m_closedTabsManager->allClosedTabs();
foreach(const ClosedTabsManager::Tab & tab, closedTabs) { foreach (const ClosedTabsManager::Tab &tab, closedTabs) {
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab); int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
webTab->p_restoreTab(tab.url, tab.history); webTab->p_restoreTab(tab.url, tab.history);
@ -737,7 +737,7 @@ void TabWidget::aboutToShowClosedTabsMenu()
else { else {
m_menuTabs->clear(); m_menuTabs->clear();
int i = 0; int i = 0;
foreach(const ClosedTabsManager::Tab & tab, closedTabsManager()->allClosedTabs()) { foreach (const ClosedTabsManager::Tab &tab, closedTabsManager()->allClosedTabs()) {
QString title = tab.title; QString title = tab.title;
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);
@ -880,7 +880,7 @@ QByteArray TabWidget::saveState()
stream << tabList.count(); stream << tabList.count();
foreach(const WebTab::SavedTab & tab, tabList) { foreach (const WebTab::SavedTab &tab, tabList) {
stream << tab; stream << tab;
} }
@ -919,7 +919,7 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
void TabWidget::closeRecoveryTab() void TabWidget::closeRecoveryTab()
{ {
foreach(WebTab * tab, allTabs(false)) { foreach (WebTab* tab, allTabs(false)) {
if (tab->url().toString() == QLatin1String("qupzilla:restore")) { if (tab->url().toString() == QLatin1String("qupzilla:restore")) {
closeTab(tab->tabIndex(), true); closeTab(tab->tabIndex(), true);
} }

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@ QList<QWebHistoryItem> WebHistoryWrapper::forwardItems(int maxItems, QWebHistory
QUrl lastUrl = history->currentItem().url(); QUrl lastUrl = history->currentItem().url();
int count = 0; int count = 0;
foreach(const QWebHistoryItem & item, history->forwardItems(maxItems + 5)) { foreach (const QWebHistoryItem &item, history->forwardItems(maxItems + 5)) {
if (item.url() == lastUrl || count == maxItems) { if (item.url() == lastUrl || count == maxItems) {
continue; continue;
} }

View File

@ -93,22 +93,22 @@ WebPage::WebPage(QupZilla* mainClass)
connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
connect(this, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(this, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
connect(this, SIGNAL(databaseQuotaExceeded(QWebFrame*, QString)), connect(this, SIGNAL(databaseQuotaExceeded(QWebFrame*,QString)),
this, SLOT(dbQuotaExceeded(QWebFrame*))); this, SLOT(dbQuotaExceeded(QWebFrame*)));
connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject())); connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject()));
#if QTWEBKIT_FROM_2_2 #if QTWEBKIT_FROM_2_2
connect(this, SIGNAL(featurePermissionRequested(QWebFrame*, QWebPage::Feature)), connect(this, SIGNAL(featurePermissionRequested(QWebFrame*,QWebPage::Feature)),
this, SLOT(featurePermissionRequested(QWebFrame*, QWebPage::Feature))); this, SLOT(featurePermissionRequested(QWebFrame*,QWebPage::Feature)));
#endif #endif
#if QTWEBKIT_FROM_2_3 #if QTWEBKIT_FROM_2_3
connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64, quint64)), connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64,quint64)),
this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*, quint64))); this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64)));
#elif QTWEBKIT_FROM_2_2 #elif QTWEBKIT_FROM_2_2
connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64)), connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64)),
this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*, quint64))); this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64)));
#endif #endif
s_livingPages.append(this); s_livingPages.append(this);
@ -162,7 +162,7 @@ bool WebPage::loadingError() const
void WebPage::addRejectedCerts(const QList<QSslCertificate> &certs) void WebPage::addRejectedCerts(const QList<QSslCertificate> &certs)
{ {
foreach(const QSslCertificate & cert, certs) { foreach (const QSslCertificate &cert, certs) {
if (!m_rejectedSslCerts.contains(cert)) { if (!m_rejectedSslCerts.contains(cert)) {
m_rejectedSslCerts.append(cert); m_rejectedSslCerts.append(cert);
} }
@ -173,7 +173,7 @@ bool WebPage::containsRejectedCerts(const QList<QSslCertificate> &certs)
{ {
int matches = 0; int matches = 0;
foreach(const QSslCertificate & cert, certs) { foreach (const QSslCertificate &cert, certs) {
if (m_rejectedSslCerts.contains(cert)) { if (m_rejectedSslCerts.contains(cert)) {
++matches; ++matches;
} }
@ -599,7 +599,7 @@ void WebPage::cleanBlockedObjects()
const QWebElement &docElement = mainFrame()->documentElement(); const QWebElement &docElement = mainFrame()->documentElement();
foreach(const AdBlockedEntry & entry, m_adBlockedEntries) { 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"))) { if (urlString.endsWith(QLatin1String(".js")) || urlString.endsWith(QLatin1String(".css"))) {
continue; continue;
@ -619,7 +619,7 @@ void WebPage::cleanBlockedObjects()
QString selector("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]"); QString selector("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]");
QWebElementCollection elements = docElement.findAll(selector.arg(urlEnd)); QWebElementCollection elements = docElement.findAll(selector.arg(urlEnd));
foreach(QWebElement element, elements) { foreach (QWebElement element, elements) {
QString src = element.attribute("src"); QString src = element.attribute("src");
src.remove(QLatin1String("../")); src.remove(QLatin1String("../"));
@ -755,7 +755,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
QWebElementCollection elements; QWebElementCollection elements;
elements.append(docElement.findAll("iframe")); elements.append(docElement.findAll("iframe"));
foreach(QWebElement element, elements) { foreach (QWebElement element, elements) {
QString src = element.attribute("src"); QString src = element.attribute("src");
if (exOption->url.toString().contains(src)) { if (exOption->url.toString().contains(src)) {
element.setStyleProperty("visibility", "hidden"); element.setStyleProperty("visibility", "hidden");

View File

@ -146,7 +146,7 @@ void WebView::setPage(QWebPage* page)
m_page = qobject_cast<WebPage*>(page); m_page = qobject_cast<WebPage*>(page);
setZoom(qzSettings->defaultZoom); setZoom(qzSettings->defaultZoom);
connect(m_page, SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)), this, SLOT(frameStateChanged())); connect(m_page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)), this, SLOT(frameStateChanged()));
connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool))); connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool)));
mApp->plugins()->emitWebPageCreated(m_page); mApp->plugins()->emitWebPageCreated(m_page);
@ -444,7 +444,7 @@ void WebView::slotUrlChanged(const QUrl &url)
const QString &host = url.host(); const QString &host = url.host();
m_disableTouchMocking = false; m_disableTouchMocking = false;
foreach(const QString & site, exceptions) { foreach (const QString &site, exceptions) {
if (host.contains(site)) { if (host.contains(site)) {
m_disableTouchMocking = true; m_disableTouchMocking = true;
} }
@ -810,7 +810,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
// Apparently createStandardContextMenu() can return null pointer // Apparently createStandardContextMenu() can return null pointer
if (pageMenu) { if (pageMenu) {
int i = 0; int i = 0;
foreach(QAction * act, pageMenu->actions()) { foreach (QAction* act, pageMenu->actions()) {
if (act->isSeparator()) { if (act->isSeparator()) {
menu->addSeparator(); menu->addSeparator();
continue; continue;
@ -1025,7 +1025,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
// Search with ... // Search with ...
Menu* swMenu = new Menu(tr("Search with..."), menu); Menu* swMenu = new Menu(tr("Search with..."), menu);
SearchEnginesManager* searchManager = mApp->searchEnginesManager(); SearchEnginesManager* searchManager = mApp->searchEnginesManager();
foreach(const SearchEngine & en, searchManager->allEngines()) { foreach (const SearchEngine &en, searchManager->allEngines()) {
Action* act = new Action(en.icon, en.name); Action* act = new Action(en.icon, en.name);
act->setData(QVariant::fromValue(en)); act->setData(QVariant::fromValue(en));

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* Access Keys Navigation plugin for QupZilla * Access Keys Navigation plugin for QupZilla
* Copyright (C) 2012 David Rosca <nowrep@gmail.com> * Copyright (C) 2012-2013 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -247,9 +247,9 @@ void AKN_Handler::showAccessKeys()
QRect viewport = QRect(page->currentFrame()->scrollPosition(), page->viewportSize()); QRect viewport = QRect(page->currentFrame()->scrollPosition(), page->viewportSize());
// Priority first goes to elements with accesskey attributes // Priority first goes to elements with accesskey attributes
QList<QWebElement> alreadyLabeled; QList<QWebElement> alreadyLabeled;
foreach(const QString & elementType, supportedElement) { foreach (const QString &elementType, supportedElement) {
QList<QWebElement> result = page->currentFrame()->findAllElements(elementType).toList(); QList<QWebElement> result = page->currentFrame()->findAllElements(elementType).toList();
foreach(const QWebElement & element, result) { foreach (const QWebElement &element, result) {
const QRect geometry = element.geometry(); const QRect geometry = element.geometry();
if (geometry.size().isEmpty() if (geometry.size().isEmpty()
|| !viewport.contains(geometry.topLeft())) { || !viewport.contains(geometry.topLeft())) {
@ -278,9 +278,9 @@ void AKN_Handler::showAccessKeys()
// Pick an access key first from the letters in the text and then from the // Pick an access key first from the letters in the text and then from the
// list of unused access keys // list of unused access keys
foreach(const QString & elementType, supportedElement) { foreach (const QString &elementType, supportedElement) {
QWebElementCollection result = page->currentFrame()->findAllElements(elementType); QWebElementCollection result = page->currentFrame()->findAllElements(elementType);
foreach(const QWebElement & element, result) { foreach (const QWebElement &element, result) {
const QRect geometry = element.geometry(); const QRect geometry = element.geometry();
if (unusedKeys.isEmpty() if (unusedKeys.isEmpty()
|| alreadyLabeled.contains(element) || alreadyLabeled.contains(element)
@ -310,7 +310,7 @@ void AKN_Handler::showAccessKeys()
if (m_accessKeysVisible) { if (m_accessKeysVisible) {
m_view.data()->installEventFilter(this); m_view.data()->installEventFilter(this);
connect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys())); connect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys()));
connect(m_view.data()->page(), SIGNAL(scrollRequested(int, int, QRect)), this, SLOT(hideAccessKeys())); connect(m_view.data()->page(), SIGNAL(scrollRequested(int,int,QRect)), this, SLOT(hideAccessKeys()));
#if QT_VERSION >= 0x040800 #if QT_VERSION >= 0x040800
connect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys())); connect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys()));
#endif #endif
@ -332,7 +332,7 @@ void AKN_Handler::hideAccessKeys()
// Uninstall event filter and disconnect loadStarted // Uninstall event filter and disconnect loadStarted
m_view.data()->removeEventFilter(this); m_view.data()->removeEventFilter(this);
disconnect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys())); disconnect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys()));
disconnect(m_view.data()->page(), SIGNAL(scrollRequested(int, int, QRect)), this, SLOT(hideAccessKeys())); disconnect(m_view.data()->page(), SIGNAL(scrollRequested(int,int,QRect)), this, SLOT(hideAccessKeys()));
#if QT_VERSION >= 0x040800 #if QT_VERSION >= 0x040800
disconnect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys())); disconnect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys()));
#endif #endif

View File

@ -75,7 +75,7 @@ QString GM_Manager::requireScripts(const QStringList &urlList) const
QString script; QString script;
foreach(const QString & url, urlList) { foreach (const QString &url, urlList) {
if (settings.contains(url)) { 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'); script.append(QzTools::readAllFileContents(fileName).trimmed() + '\n');
@ -107,13 +107,13 @@ QList<GM_Script*> GM_Manager::allScripts() const
bool GM_Manager::containsScript(const QString &fullName) const bool GM_Manager::containsScript(const QString &fullName) const
{ {
foreach(GM_Script * script, m_startScripts) { foreach (GM_Script* script, m_startScripts) {
if (fullName == script->fullName()) { if (fullName == script->fullName()) {
return true; return true;
} }
} }
foreach(GM_Script * script, m_endScripts) { foreach (GM_Script* script, m_endScripts) {
if (fullName == script->fullName()) { if (fullName == script->fullName()) {
return true; return true;
} }
@ -197,13 +197,13 @@ void GM_Manager::pageLoadStart()
return; return;
} }
foreach(GM_Script * script, m_startScripts) { foreach (GM_Script* script, m_startScripts) {
if (script->match(urlString)) { if (script->match(urlString)) {
frame->evaluateJavaScript(m_bootstrap + script->script()); frame->evaluateJavaScript(m_bootstrap + script->script());
} }
} }
foreach(GM_Script * script, m_endScripts) { foreach (GM_Script* script, m_endScripts) {
if (script->match(urlString)) { if (script->match(urlString)) {
const QString &jscript = QString("window.addEventListener(\"DOMContentLoaded\"," const QString &jscript = QString("window.addEventListener(\"DOMContentLoaded\","
"function(e) { %1 }, false);").arg(m_bootstrap + script->script()); "function(e) { %1 }, false);").arg(m_bootstrap + script->script());
@ -227,7 +227,7 @@ void GM_Manager::load()
settings.beginGroup("GreaseMonkey"); settings.beginGroup("GreaseMonkey");
m_disabledScripts = settings.value("disabledScripts", QStringList()).toStringList(); m_disabledScripts = settings.value("disabledScripts", QStringList()).toStringList();
foreach(const QString & fileName, gmDir.entryList(QStringList("*.js"), QDir::Files)) { 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); GM_Script* script = new GM_Script(this, absolutePath);

View File

@ -92,7 +92,7 @@ QStringList GM_Script::include() const
{ {
QStringList list; QStringList list;
foreach(const GM_UrlMatcher & matcher, m_include) { foreach (const GM_UrlMatcher &matcher, m_include) {
list.append(matcher.pattern()); list.append(matcher.pattern());
} }
@ -103,7 +103,7 @@ QStringList GM_Script::exclude() const
{ {
QStringList list; QStringList list;
foreach(const GM_UrlMatcher & matcher, m_exclude) { foreach (const GM_UrlMatcher &matcher, m_exclude) {
list.append(matcher.pattern()); list.append(matcher.pattern());
} }
@ -126,13 +126,13 @@ bool GM_Script::match(const QString &urlString)
return false; return false;
} }
foreach(const GM_UrlMatcher & matcher, m_exclude) { foreach (const GM_UrlMatcher &matcher, m_exclude) {
if (matcher.match(urlString)) { if (matcher.match(urlString)) {
return false; return false;
} }
} }
foreach(const GM_UrlMatcher & matcher, m_include) { foreach (const GM_UrlMatcher &matcher, m_include) {
if (matcher.match(urlString)) { if (matcher.match(urlString)) {
return true; return true;
} }
@ -188,7 +188,7 @@ void GM_Script::parseScript()
QStringList requireList; QStringList requireList;
const QStringList &lines = metadataBlock.split(QLatin1Char('\n'), QString::SkipEmptyParts); const QStringList &lines = metadataBlock.split(QLatin1Char('\n'), QString::SkipEmptyParts);
foreach(QString line, lines) { foreach (QString line, lines) {
if (!line.startsWith(QLatin1String("// @"))) { if (!line.startsWith(QLatin1String("// @"))) {
continue; continue;
} }

View File

@ -38,7 +38,7 @@ static bool wildcardMatch(const QString &string, const QString &pattern)
} }
} }
foreach(const QString & part, parts) { foreach (const QString &part, parts) {
pos = string.indexOf(part, pos); pos = string.indexOf(part, pos);
if (pos == -1) { if (pos == -1) {
return false; return false;

View File

@ -108,7 +108,7 @@ void GM_Settings::loadScripts()
ui->listWidget->clear(); ui->listWidget->clear();
foreach(GM_Script * script, m_manager->allScripts()) { foreach (GM_Script* script, m_manager->allScripts()) {
QListWidgetItem* item = new QListWidgetItem(ui->listWidget); QListWidgetItem* item = new QListWidgetItem(ui->listWidget);
QIcon icon = QIcon(":/gm/data/script.png"); QIcon icon = QIcon(":/gm/data/script.png");
item->setIcon(icon); item->setIcon(icon);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* Personal Information Manager plugin for QupZilla * Personal Information Manager plugin for QupZilla
* Copyright (C) 2012 David Rosca <nowrep@gmail.com> * Copyright (C) 2012-2013 David Rosca <nowrep@gmail.com>
* Copyright (C) 2012 Mladen Pejaković <pejakm@gmail.com> * Copyright (C) 2012 Mladen Pejaković <pejakm@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -155,7 +155,7 @@ bool PIM_Handler::keyPress(WebView* view, QKeyEvent* event)
const QWebElement &document = view->page()->mainFrame()->documentElement(); const QWebElement &document = view->page()->mainFrame()->documentElement();
const QWebElementCollection elements = document.findAll("input[type=\"text\"]"); const QWebElementCollection elements = document.findAll("input[type=\"text\"]");
foreach(QWebElement element, elements) { foreach (QWebElement element, elements) {
const QString &name = element.attribute("name"); const QString &name = element.attribute("name");
if (name.isEmpty()) { if (name.isEmpty()) {
continue; continue;
@ -206,7 +206,7 @@ void PIM_Handler::pageLoadFinished()
const QWebElement &document = page->mainFrame()->documentElement(); const QWebElement &document = page->mainFrame()->documentElement();
const QWebElementCollection elements = document.findAll("input[type=\"text\"]"); const QWebElementCollection elements = document.findAll("input[type=\"text\"]");
foreach(QWebElement element, elements) { foreach (QWebElement element, elements) {
const QString &name = element.attribute("name"); const QString &name = element.attribute("name");
if (name.isEmpty()) { if (name.isEmpty()) {
continue; continue;
@ -224,7 +224,7 @@ PIM_Handler::PI_Type PIM_Handler::nameMatch(const QString &name)
{ {
for (int i = 0; i < PI_Max; ++i) { for (int i = 0; i < PI_Max; ++i) {
if (!m_allInfo[PI_Type(i)].isEmpty()) { if (!m_allInfo[PI_Type(i)].isEmpty()) {
foreach(const QString & n, m_infoMatches[PI_Type(i)]) { foreach (const QString &n, m_infoMatches[PI_Type(i)]) {
if (name == n) { if (name == n) {
return PI_Type(i); return PI_Type(i);
} }