summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-11-23 02:38:07 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-11-23 02:38:07 +0100
commit5d02d0ba7fc7dfff2776b1d6fe9bd3202a564c12 (patch)
tree371705d5172bd4536274f3d3fea17a85f744a30b
parentForgot some files :) (diff)
downloadrekonq-5d02d0ba7fc7dfff2776b1d6fe9bd3202a564c12.tar.xz
Save memory.
One ad-block is enough
-rw-r--r--src/application.cpp14
-rw-r--r--src/application.h3
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/webpage.cpp4
-rw-r--r--src/webpage.h5
5 files changed, 21 insertions, 9 deletions
diff --git a/src/application.cpp b/src/application.cpp
index d02e44c9..766d56ed 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -40,6 +40,7 @@
#include "webview.h"
#include "urlbar.h"
#include "sessionmanager.h"
+#include "adblockmanager.h"
// KDE Includes
#include <KCmdLineArgs>
@@ -61,7 +62,7 @@
QPointer<HistoryManager> Application::s_historyManager;
QPointer<BookmarkProvider> Application::s_bookmarkProvider;
QPointer<SessionManager> Application::s_sessionManager;
-
+QPointer<AdBlockManager> Application::s_adblockManager;
Application::Application()
@@ -432,3 +433,14 @@ MainWindowList Application::mainWindowList()
{
return m_mainWindows;
}
+
+
+
+AdBlockManager *Application::adblockManager()
+{
+ if(!s_adblockManager)
+ {
+ s_adblockManager = new AdBlockManager(instance());
+ }
+ return s_adblockManager;
+} \ No newline at end of file
diff --git a/src/application.h b/src/application.h
index 786e5173..b15720f5 100644
--- a/src/application.h
+++ b/src/application.h
@@ -48,6 +48,7 @@ class BookmarkProvider;
class HistoryManager;
class MainWindow;
class SessionManager;
+class AdBlockManager;
typedef QList< QPointer<MainWindow> > MainWindowList;
@@ -105,6 +106,7 @@ public:
static HistoryManager *historyManager();
static BookmarkProvider *bookmarkProvider();
static SessionManager *sessionManager();
+ static AdBlockManager *adblockManager();
public slots:
/**
@@ -139,6 +141,7 @@ private:
static QPointer<HistoryManager> s_historyManager;
static QPointer<BookmarkProvider> s_bookmarkProvider;
static QPointer<SessionManager> s_sessionManager;
+ static QPointer<AdBlockManager> s_adblockManager;
MainWindowList m_mainWindows;
};
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 137f0f2c..c7da7512 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -46,6 +46,7 @@
#include "urlbar.h"
#include "tabbar.h"
#include "newtabpage.h"
+#include "adblockmanager.h"
// Ui Includes
#include "ui_cleardata.h"
@@ -544,7 +545,8 @@ void MainWindow::updateConfiguration()
// ====== load Settings on main classes
Application::historyManager()->loadSettings();
-
+ Application::adblockManager()->loadSettings();
+
defaultSettings = 0;
}
diff --git a/src/webpage.cpp b/src/webpage.cpp
index e8c204f8..941567a0 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -41,6 +41,7 @@
#include "mainview.h"
#include "webview.h"
#include "webpluginfactory.h"
+#include "adblockmanager.h"
// KDE Includes
#include <KStandardDirs>
@@ -69,7 +70,6 @@ WebPage::WebPage(QObject *parent, qlonglong windowId)
: KWebPage(parent, windowId)
, m_keyboardModifiers(Qt::NoModifier)
, m_pressedButtons(Qt::NoButton)
- , m_adBlockMan(new AdBlockManager(this))
{
setPluginFactory(new WebPluginFactory(this));
@@ -257,5 +257,5 @@ bool WebPage::authorizedRequest(const QUrl &url) const
if(url.scheme() != QLatin1String("http"))
return true;
- return m_adBlockMan->isUrlAllowed(url);
+ return Application::adblockManager()->isUrlAllowed(url);
}
diff --git a/src/webpage.h b/src/webpage.h
index acaaab25..eb558220 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -32,9 +32,6 @@
#define WEBPAGE_H
-// Local Includes
-#include "adblockmanager.h"
-
// KDE Includes
#include <KWebPage>
@@ -78,8 +75,6 @@ private:
Qt::MouseButtons m_pressedButtons;
QUrl m_requestedUrl;
-
- AdBlockManager *m_adBlockMan;
};
#endif