summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-29 22:11:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-29 22:11:37 +0200
commit5f0e4fe5fabd7ca49cb7d6cb54dc6e903fffbf74 (patch)
tree52c3f6c744d1b71f8bd65ced265b4ce7633fabd0
parentsearch --> opensearch dir (diff)
downloadrekonq-5f0e4fe5fabd7ca49cb7d6cb54dc6e903fffbf74.tar.xz
Clean up urlbar use. This fix an urlbar bug opening plugins
in next tabs and remove some Application::instance() calls from the Web* classes.
-rw-r--r--src/CMakeLists.txt12
-rw-r--r--src/mainview.cpp32
-rw-r--r--src/urlbar/stackedurlbar.cpp1
-rw-r--r--src/webpage.cpp18
-rw-r--r--src/webtab.cpp8
-rw-r--r--src/webtab.h9
6 files changed, 45 insertions, 35 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5f99a608..861126f5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -73,11 +73,11 @@ SET( rekonq_KDEINIT_SRCS
analyzer/analyzerpanel.cpp
analyzer/networkanalyzer.cpp
#----------------------------------------
- search/searchengine.cpp
- search/opensearchwriter.cpp
- search/opensearchreader.cpp
- search/opensearchmanager.cpp
- search/opensearchengine.cpp
+ opensearch/searchengine.cpp
+ opensearch/opensearchwriter.cpp
+ opensearch/opensearchreader.cpp
+ opensearch/opensearchmanager.cpp
+ opensearch/opensearchengine.cpp
)
@@ -103,7 +103,7 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/rekonqpage
${CMAKE_CURRENT_SOURCE_DIR}/settings
${CMAKE_CURRENT_SOURCE_DIR}/analyzer
- ${CMAKE_CURRENT_SOURCE_DIR}/search
+ ${CMAKE_CURRENT_SOURCE_DIR}/opensearch
${CMAKE_CURRENT_BINARY_DIR}
${KDE4_INCLUDES}
${QT4_INCLUDES}
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 3daee339..d263111a 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -313,8 +313,7 @@ WebTab *MainView::webTab(int index) const
WebTab *MainView::newWebTab(bool focused)
{
- WebTab* tab = new WebTab(this);
- UrlBar *bar = new UrlBar(tab);
+ WebTab *tab = new WebTab(this);
// connecting webview with mainview
connect(tab->view(), SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
@@ -324,18 +323,18 @@ WebTab *MainView::newWebTab(bool focused)
connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
// connecting webPage signals with mainview
- connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
- connect(tab->view()->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
+ connect(tab->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
+ connect(tab->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
if ( ReKonfig::openTabsNearCurrent() )
{
insertTab(currentIndex() + 1, tab, i18n("(Untitled)"));
- _widgetBar->insertWidget(currentIndex() + 1, bar);
+ _widgetBar->insertWidget(currentIndex() + 1, tab->urlBar());
}
else
{
addTab(tab, i18n("(Untitled)"));
- _widgetBar->addWidget(bar);
+ _widgetBar->addWidget(tab->urlBar());
}
updateTabBar();
@@ -471,11 +470,11 @@ void MainView::closeTab(int index, bool del)
if (index < 0 || index >= count())
return;
- WebTab *tab = webTab(index);
- if (!tab)
+ WebTab *tabToClose = webTab(index);
+ if (!tabToClose)
return;
- if (tab->view()->isModified())
+ if (tabToClose->view()->isModified())
{
int risp = KMessageBox::warningContinueCancel(this,
i18n("This tab contains changes that have not been submitted.\n"
@@ -486,12 +485,12 @@ void MainView::closeTab(int index, bool del)
return;
}
- if (!tab->url().isEmpty()
+ if (!tabToClose->url().isEmpty()
&& !QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)
)
{
- QString title = tab->view()->title();
- QString url = tab->url().prettyUrl();
+ QString title = tabToClose->view()->title();
+ QString url = tabToClose->url().prettyUrl();
HistoryItem item(url, QDateTime(), title);
m_recentlyClosedTabs.removeAll(item);
m_recentlyClosedTabs.prepend(item);
@@ -500,15 +499,12 @@ void MainView::closeTab(int index, bool del)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- UrlBar *urlbar = _widgetBar->urlBar(index);
- _widgetBar->removeWidget(urlbar);
-
+ _widgetBar->removeWidget( tabToClose->urlBar() );
_widgetBar->setCurrentIndex(m_currentTabIndex);
if (del)
{
- tab->deleteLater();
- urlbar->deleteLater();
+ tabToClose->deleteLater();
}
emit tabsChanged();
@@ -718,7 +714,7 @@ void MainView::detachTab(int index, MainWindow *toWindow)
else
{
QString label = tab->view()->title();
- UrlBar *bar = _widgetBar->urlBar(index);
+ UrlBar *bar = tab->urlBar();
closeTab(index, false);
MainWindow *w;
diff --git a/src/urlbar/stackedurlbar.cpp b/src/urlbar/stackedurlbar.cpp
index 1882d98c..44039244 100644
--- a/src/urlbar/stackedurlbar.cpp
+++ b/src/urlbar/stackedurlbar.cpp
@@ -29,7 +29,6 @@
#include "stackedurlbar.moc"
// Local Includes
-#include "application.h"
#include "urlbar.h"
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 9be0d3c9..d481567f 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -459,7 +459,12 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
mainFrame()->setHtml(html);
_isOnRekonqPage = true;
- Application::instance()->mainWindow()->mainView()->urlBar()->setQUrl(replyUrl);
+
+ WebView *view = qobject_cast<WebView *>(parent());
+ WebTab *tab = qobject_cast<WebTab *>(view->parent());
+ UrlBar *bar = tab->urlBar();
+ bar->setQUrl(replyUrl);
+
Application::instance()->mainWindow()->updateActions();
}
else
@@ -561,9 +566,14 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
frame->setHtml(errorPage(reply));
if(isMainFrameRequest)
{
- _isOnRekonqPage = true;
- Application::instance()->mainWindow()->mainView()->urlBar()->setQUrl(_loadingUrl);
- Application::instance()->mainWindow()->updateActions();
+ _isOnRekonqPage = true;
+
+ WebView *view = qobject_cast<WebView *>(parent());
+ WebTab *tab = qobject_cast<WebTab *>(view->parent());
+ UrlBar *bar = tab->urlBar();
+ bar->setQUrl(_loadingUrl);
+
+ Application::instance()->mainWindow()->updateActions();
}
}
break;
diff --git a/src/webtab.cpp b/src/webtab.cpp
index cce09953..c525ac00 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -33,6 +33,7 @@
#include "rekonq.h"
// Local Includes
+#include "urlbar.h"
#include "previewselectorbar.h"
#include "rsswidget.h"
#include "walletbar.h"
@@ -48,7 +49,8 @@
WebTab::WebTab(QWidget *parent)
: QWidget(parent)
, _view(new WebView(this))
- , m_progress(0)
+ , _bar(new UrlBar(this))
+ , _progress(0)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -110,14 +112,14 @@ KUrl WebTab::url()
void WebTab::updateProgress(int p)
{
- m_progress = p;
+ _progress = p;
emit loadProgressing();
}
void WebTab::loadFinished(bool)
{
- m_progress = 0;
+ _progress = 0;
}
diff --git a/src/webtab.h b/src/webtab.h
index a9129d0b..d9213983 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -39,6 +39,7 @@
#include <QtGui/QWidget>
// Forward Declarations
+class UrlBar;
class PreviewSelectorBar;
class WalletBar;
@@ -52,8 +53,9 @@ public:
~WebTab();
inline WebView *view() { return _view; }
+ UrlBar *urlBar() { return _bar; }
inline WebPage *page() { return view()->page(); }
- inline int progress() { return m_progress; }
+ inline int progress() { return _progress; }
KUrl url();
void createPreviewSelectorBar(int index);
@@ -72,8 +74,9 @@ signals:
private:
WebView *_view;
-
- int m_progress;
+ UrlBar *_bar;
+
+ int _progress;
QWeakPointer<WalletBar> _walletBar;
QWeakPointer<PreviewSelectorBar> _previewSelectorBar;