summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-07-06 22:46:16 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-07-06 22:46:16 +0200
commit67ed4f88998e30b90cfcb93cd8e6bd7e4d0ae7bd (patch)
tree2cf2c3b2034265ee4111cce99c03466c6314c745
parentFixed a line that was calling QString::startsWith() without args. Fixed build. (diff)
downloadrekonq-67ed4f88998e30b90cfcb93cd8e6bd7e4d0ae7bd.tar.xz
Fix adblock hide behavior
NOTE: You'll find also some style & copyrights fixes here. Just reenable the git hooks scripts... BUG: 302050
-rw-r--r--kwebapp/kwebmain.cpp4
-rw-r--r--kwebapp/urlresolver.h4
-rw-r--r--kwebapp/webpage.cpp4
-rw-r--r--src/adblock/adblockmanager.cpp8
-rw-r--r--src/main.cpp2
-rw-r--r--src/mainview.cpp4
-rw-r--r--src/mainview.h2
-rw-r--r--src/networkaccessmanager.cpp14
-rw-r--r--src/networkaccessmanager.h2
-rw-r--r--src/newtabpage.cpp2
-rw-r--r--src/settings/settingsdialog.cpp2
-rw-r--r--src/tabbar.cpp4
-rw-r--r--src/urlbar/completionwidget.cpp11
-rw-r--r--src/urlbar/urlbar.cpp8
-rw-r--r--src/webpage.cpp2
-rw-r--r--src/webview.cpp8
-rw-r--r--src/webview.h8
17 files changed, 51 insertions, 38 deletions
diff --git a/kwebapp/kwebmain.cpp b/kwebapp/kwebmain.cpp
index 08dfbaa5..815c4dc9 100644
--- a/kwebapp/kwebmain.cpp
+++ b/kwebapp/kwebmain.cpp
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
KApplication app;
QWebSettings::setIconDatabasePath(KStandardDirs::locateLocal("cache", "kwebapp.favicons/"));
-
+
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() != 1)
{
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
}
RekonqView *widg = new RekonqView();
- widg->loadUrl( UrlResolver::urlFromTextTyped(args->arg(0)) );
+ widg->loadUrl(UrlResolver::urlFromTextTyped(args->arg(0)));
widg->show();
args->clear();
diff --git a/kwebapp/urlresolver.h b/kwebapp/urlresolver.h
index 1c5ad354..47105f01 100644
--- a/kwebapp/urlresolver.h
+++ b/kwebapp/urlresolver.h
@@ -37,9 +37,9 @@
namespace UrlResolver
{
- KUrl urlFromTextTyped(const QString &);
+KUrl urlFromTextTyped(const QString &);
- bool isKDEUrl(const QString &);
+bool isKDEUrl(const QString &);
}
diff --git a/kwebapp/webpage.cpp b/kwebapp/webpage.cpp
index afe23035..827bbce1 100644
--- a/kwebapp/webpage.cpp
+++ b/kwebapp/webpage.cpp
@@ -63,7 +63,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
{
QUrl reqUrl = request.url();
QString protocol = reqUrl.scheme();
-
+
// javascript handling
if (protocol == QL1S("javascript"))
{
@@ -117,7 +117,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
kDebug() << "Error: " << protocol;
return;
}
-
+
// "mailto" handling.
if (protocol == QL1S("mailto"))
{
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index f2c71640..140669c5 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -275,7 +275,13 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa
QWebElementCollection elements = document.findAll("*");
Q_FOREACH(QWebElement el, elements)
{
- const QString srcAttribute = el.attribute("src");
+ QString srcAttribute = el.attribute("src");
+ if (srcAttribute.isEmpty())
+ continue;
+
+ if (!srcAttribute.startsWith(QL1S("http")))
+ srcAttribute = host + srcAttribute;
+
if (filter.match(request, srcAttribute, srcAttribute.toLower()))
{
el.setStyleProperty(QL1S("visibility"), QL1S("hidden"));
diff --git a/src/main.cpp b/src/main.cpp
index db6bf843..c43b1c04 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -186,7 +186,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
// set application data
QCoreApplication::setApplicationName(QL1S("rekonq"));
QCoreApplication::setApplicationVersion(REKONQ_VERSION);
-
+
if (app.isSessionRestored())
for (int i = 1; MainWindow::canBeRestored(i); i++)
app.newMainWindow(false)->restore(i);
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 4733ae3b..861a6b1f 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -469,7 +469,7 @@ void MainView::closeTab(int index, bool del)
TabHistory history(tabToClose->view()->history());
history.title = tabToClose->view()->title();
history.url = tabToClose->url().url();
-
+
m_recentlyClosedTabs.removeAll(history);
if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit)
m_recentlyClosedTabs.removeLast();
@@ -698,7 +698,7 @@ void MainView::restoreClosedTab(int i, bool inNewTab)
history.applyHistory(view->history());
view->load(KUrl(history.url));
-
+
// just to get sure...
m_recentlyClosedTabs.removeAll(history);
}
diff --git a/src/mainview.h b/src/mainview.h
index b6cbf2f0..9378f4bd 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -64,7 +64,7 @@ class REKONQ_TESTS_EXPORT MainView : public KTabWidget
public:
MainView(QWidget *parent);
~MainView();
-
+
inline StackedUrlBar *widgetBar() const
{
return m_widgetBar;
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index 3291b6db..dc10da1b 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -3,7 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -48,7 +48,7 @@ class NullNetworkReply : public QNetworkReply
{
public:
NullNetworkReply(const QNetworkRequest &req, QObject* parent = 0)
- :QNetworkReply(parent)
+ : QNetworkReply(parent)
{
setRequest(req);
setUrl(req.url());
@@ -60,10 +60,16 @@ public:
}
virtual void abort() {}
- virtual qint64 bytesAvailable() const { return 0; }
+ virtual qint64 bytesAvailable() const
+ {
+ return 0;
+ }
protected:
- virtual qint64 readData(char*, qint64) {return -1;}
+ virtual qint64 readData(char*, qint64)
+ {
+ return -1;
+ }
};
diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h
index 55a44ce4..5c877bdf 100644
--- a/src/networkaccessmanager.h
+++ b/src/networkaccessmanager.h
@@ -3,7 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
index 3cd241a4..89363fe4 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -966,7 +966,7 @@ void NewTabPage::createBookmarkItem(const KBookmark &bookmark, QWebElement paren
bookmarkElement.lastChild().setAttribute(QL1S("width") , QL1S("16"));
bookmarkElement.lastChild().setAttribute(QL1S("height") , QL1S("16"));
bookmarkElement.appendInside(QL1S(" "));
- bookmarkElement.appendInside( checkTitle(bookmark.fullText(), 40) );
+ bookmarkElement.appendInside(checkTitle(bookmark.fullText(), 40));
}
}
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index 095f0497..6629f10c 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -169,7 +169,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
// save settings
connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings()));
connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings()));
- setHelp("Config-rekonq","rekonq");
+ setHelp("Config-rekonq", "rekonq");
}
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 39dd7f74..ac257d12 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -91,7 +91,7 @@ TabBar::TabBar(QWidget *parent)
// avoid ambiguos shortcuts. See BUG:275858
KAcceleratorManager::setNoAccel(this);
-
+
connect(this, SIGNAL(contextMenu(int, QPoint)), this, SLOT(contextMenu(int, QPoint)));
connect(this, SIGNAL(emptyAreaContextMenu(QPoint)), this, SLOT(emptyAreaContextMenu(QPoint)));
@@ -106,7 +106,7 @@ TabBar::TabBar(QWidget *parent)
QSize TabBar::tabSizeHint(int index) const
{
Q_UNUSED(index);
-
+
MainView *view = qobject_cast<MainView *>(parent());
int buttonSize = view->addTabButton()->size().width();
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 83de2f09..04f7bad0 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -137,19 +137,20 @@ void CompletionWidget::up()
{
if (_currentIndex >= 0)
findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
-
+
--_currentIndex;
- if (_currentIndex < -1) {
+ if (_currentIndex < -1)
+ {
_currentIndex = _list.count() - 1;
}
-
+
activateCurrentListItem();
}
void CompletionWidget::down()
{
- if(_currentIndex >= 0)
+ if (_currentIndex >= 0)
findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
++_currentIndex;
@@ -166,7 +167,7 @@ void CompletionWidget::activateCurrentListItem()
// activate "new" current
ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
-
+
// update text of the url bar
bar->blockSignals(true); // without compute suggestions
if (widget)
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 6bf069dd..ac6665af 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -112,7 +112,7 @@ UrlBar::UrlBar(QWidget *parent)
// set initial icon
_icon->setIcon(KIcon("arrow-right"));
-
+
// initial style
setStyleSheet(QString("UrlBar { padding: 2px 0 2px %1px; height: %1px } ").arg(_icon->sizeHint().width()));
@@ -409,7 +409,7 @@ void UrlBar::loadFinished()
if (_tab->hasAdBlockedElements())
{
IconButton *bt = addRightIcon(UrlBar::AdBlock);
-
+
connect(bt, SIGNAL(clicked(QPoint)), (QObject *) rApp->adblockManager(), SLOT(showBlockedItemDialog()));
}
@@ -606,7 +606,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
updateRightIconPosition(rightIcon, iconsCount);
rightIcon->show();
-
+
return rightIcon;
}
@@ -622,7 +622,7 @@ void UrlBar::resizeEvent(QResizeEvent *event)
{
int ih = _icon->sizeHint().height();
int iconsCount = _rightIconsList.count();
- int iconHeight = (height() - ih) / 2;
+ int iconHeight = (height() - ih) / 2;
_icon->move(c_iconMargin, iconHeight);
diff --git a/src/webpage.cpp b/src/webpage.cpp
index b6e5a62d..49345ad0 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -468,7 +468,7 @@ void WebPage::loadStarted()
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group(config, "Zoom");
val = group.readEntry(_loadingUrl.host(), QString("10"));
-
+
int value = val.toInt();
if (value != 10)
mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values
diff --git a/src/webview.cpp b/src/webview.cpp
index 9d2d72aa..4ebd5a9b 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -104,13 +104,13 @@ WebView::~WebView()
}
-void WebView::load (const QUrl &url)
+void WebView::load(const QUrl &url)
{
load(QNetworkRequest(url));
}
-void WebView::load (const QNetworkRequest &req, QNetworkAccessManager::Operation op, const QByteArray &body)
+void WebView::load(const QNetworkRequest &req, QNetworkAccessManager::Operation op, const QByteArray &body)
{
QNetworkRequest request = req;
const QUrl &reqUrl = request.url();
@@ -487,7 +487,7 @@ void WebView::mousePressEvent(QMouseEvent *event)
default:
break;
};
-
+
KWebView::mousePressEvent(event);
}
@@ -1248,7 +1248,7 @@ void WebView::mouseReleaseEvent(QMouseEvent *event)
event->accept();
return;
}
-
+
emit loadUrl(url, Rekonq::NewTab);
event->accept();
return;
diff --git a/src/webview.h b/src/webview.h
index 4adc6ec7..0141925c 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -66,10 +66,10 @@ public:
WebPage *page();
- void load (const QUrl &url);
- void load (const QNetworkRequest &req,
- QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation,
- const QByteArray & body = QByteArray() );
+ void load(const QUrl &url);
+ void load(const QNetworkRequest &req,
+ QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation,
+ const QByteArray & body = QByteArray());
protected:
void contextMenuEvent(QContextMenuEvent *event);