summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp2
-rw-r--r--src/urlbar/urlbar.cpp6
-rw-r--r--src/webpage.cpp36
-rw-r--r--src/webpage.h38
-rw-r--r--src/webtab.cpp36
-rw-r--r--src/webtab.h21
-rw-r--r--src/webview.cpp15
-rw-r--r--src/webview.h1
8 files changed, 95 insertions, 60 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 19e5531d..419dc413 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -500,7 +500,7 @@ void MainView::closeTab(int index, bool del)
if (del)
{
- tabToClose->deleteLater();
+ delete tabToClose;
}
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index df1ee696..43109db3 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -137,7 +137,7 @@ UrlBar::UrlBar(QWidget *parent)
this, SLOT(updateRightIcons()));
// bookmark icon
- connect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()),this, SLOT(updateRightIcons()));
+ connect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(updateRightIcons()));
_suggestionTimer->setSingleShot(true);
connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest()));
@@ -151,6 +151,8 @@ UrlBar::~UrlBar()
_suggestionTimer->stop();
activateSuggestions(false);
_box.clear();
+
+ disconnect();
}
@@ -428,7 +430,7 @@ void UrlBar::showBookmarkInfo(QPoint pos)
else
{
BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
- connect(widget, SIGNAL(updateIcon()), this, SLOT(updateRightIcons()));
+// connect(widget, SIGNAL(updateIcon()), this, SLOT(updateRightIcons()));
widget->showAt(pos);
}
}
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 6a6f1bc9..f22d478b 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -175,6 +175,42 @@ WebPage::~WebPage()
}
+bool WebPage::hasNetworkAnalyzerEnabled() const
+{
+ return _networkAnalyzer;
+};
+
+
+void WebPage::enableNetworkAnalyzer(bool b)
+{
+ _networkAnalyzer = b;
+};
+
+
+bool WebPage::isOnRekonqPage() const
+{
+ return _isOnRekonqPage;
+};
+
+
+void WebPage::setIsOnRekonqPage(bool b)
+{
+ _isOnRekonqPage = b;
+};
+
+
+KUrl WebPage::loadingUrl()
+{
+ return _loadingUrl;
+};
+
+
+QString WebPage::suggestedFileName()
+{
+ return _suggestedFileName;
+};
+
+
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
if (_isOnRekonqPage)
diff --git a/src/webpage.h b/src/webpage.h
index 3b2d37ad..31f42184 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -52,35 +52,15 @@ public:
explicit WebPage(QWidget *parent = 0);
~WebPage();
- inline bool hasNetworkAnalyzerEnabled() const
- {
- return _networkAnalyzer;
- };
-
- inline void enableNetworkAnalyzer(bool b)
- {
- _networkAnalyzer = b;
- };
-
- inline bool isOnRekonqPage() const
- {
- return _isOnRekonqPage;
- };
-
- inline void setIsOnRekonqPage(bool b)
- {
- _isOnRekonqPage = b;
- };
-
- inline KUrl loadingUrl()
- {
- return _loadingUrl;
- };
-
- inline QString suggestedFileName()
- {
- return _suggestedFileName;
- };
+ bool hasNetworkAnalyzerEnabled() const;
+ void enableNetworkAnalyzer(bool b);
+
+ bool isOnRekonqPage() const;
+ void setIsOnRekonqPage(bool b);
+
+ KUrl loadingUrl();
+
+ QString suggestedFileName();
bool hasSslValid() const;
diff --git a/src/webtab.cpp b/src/webtab.cpp
index e5cfac56..57f46ea4 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -60,7 +60,7 @@
WebTab::WebTab(QWidget *parent)
: QWidget(parent)
- , m_webView(new WebView(this))
+ , m_webView(0)
, m_urlBar(new UrlBar(this))
, m_progress(0)
, m_part(0)
@@ -71,13 +71,13 @@ WebTab::WebTab(QWidget *parent)
l->setMargin(0);
l->setSpacing(0);
- l->addWidget(m_webView);
- m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ l->addWidget(view());
+ view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// fix focus handling
- setFocusProxy(m_webView);
+ setFocusProxy(view());
- KWebWallet *wallet = m_webView->page()->wallet();
+ KWebWallet *wallet = page()->wallet();
if (wallet)
{
@@ -85,12 +85,12 @@ WebTab::WebTab(QWidget *parent)
this, SLOT(createWalletBar(QString,QUrl)));
}
- connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
- connect(m_webView, SIGNAL(loadStarted()), this, SLOT(resetProgress()));
- connect(m_webView, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
+ connect(view(), SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
+ connect(view(), SIGNAL(loadStarted()), this, SLOT(resetProgress()));
+ connect(view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
// Session Manager
- connect(m_webView, SIGNAL(loadFinished(bool)), rApp->sessionManager(), SLOT(saveSession()));
+ connect(view(), SIGNAL(loadFinished(bool)), rApp->sessionManager(), SLOT(saveSession()));
}
@@ -100,6 +100,24 @@ WebTab::~WebTab()
m_previewSelectorBar.clear();
delete m_part;
+ delete m_urlBar;
+ delete m_webView;
+}
+
+
+WebView *WebTab::view()
+{
+ if (!m_webView)
+ {
+ m_webView = new WebView(this);
+ }
+ return m_webView;
+}
+
+
+WebPage *WebTab::page()
+{
+ return view()->page();
}
diff --git a/src/webtab.h b/src/webtab.h
index 954db13c..5c04b683 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -58,18 +58,13 @@ public:
explicit WebTab(QWidget *parent = 0);
~WebTab();
- WebView *view() const
- {
- return m_webView;
- }
- UrlBar *urlBar() const
+ WebView *view();
+ WebPage *page();
+
+ inline UrlBar *urlBar() const
{
return m_urlBar;
}
- WebPage *page() const
- {
- return view()->page();
- }
inline int progress() const
{
@@ -105,15 +100,17 @@ private Q_SLOTS:
void showMessageBar();
+private:
+ KUrl extractOpensearchUrl(QWebElement e);
+
Q_SIGNALS:
void loadProgressing();
void titleChanged(const QString &);
private:
- KUrl extractOpensearchUrl(QWebElement e);
+ WebView *m_webView;
- WebView *const m_webView;
- UrlBar *const m_urlBar;
+ UrlBar *m_urlBar;
int m_progress;
diff --git a/src/webview.cpp b/src/webview.cpp
index a581664a..688816e6 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -65,6 +65,7 @@
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
+ , m_page(0)
, m_autoScrollTimer(new QTimer(this))
, m_verticalAutoScrollSpeed(0)
, m_horizontalAutoScrollSpeed(0)
@@ -77,11 +78,8 @@ WebView::WebView(QWidget* parent)
, m_accessKeysPressed(false)
, m_accessKeysActive(false)
{
- WebPage *page = new WebPage(this);
- setPage(page);
-
// download system
- connect(this, SIGNAL(linkShiftClicked(KUrl)), page, SLOT(downloadUrl(KUrl)));
+ connect(this, SIGNAL(linkShiftClicked(KUrl)), page(), SLOT(downloadUrl(KUrl)));
// middle click || ctrl + click signal
connect(this, SIGNAL(linkMiddleOrCtrlClicked(KUrl)), this, SLOT(loadUrlInNewTab(KUrl)));
@@ -132,9 +130,12 @@ void WebView::changeWindowIcon()
WebPage *WebView::page()
{
- WebPage *const page = qobject_cast<WebPage *>(KWebView::page());
- Q_ASSERT(page);
- return page;
+ if (!m_page)
+ {
+ m_page = new WebPage(this);
+ setPage(m_page);
+ }
+ return m_page;
}
diff --git a/src/webview.h b/src/webview.h
index c8a0c7db..18977798 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -120,6 +120,7 @@ private:
void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element);
private:
+ WebPage *m_page;
QPoint m_clickPos;
// Auto Scroll