diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-04-29 01:41:58 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-04-29 01:41:58 +0200 |
commit | 5fb7d909e87be4ea5a07b7a29271c96b7db4a9b3 (patch) | |
tree | 66446357b150a6aa5e675ec75b65973787fb3ad7 | |
parent | Removed loadUrl method from WebView (diff) | |
download | rekonq-5fb7d909e87be4ea5a07b7a29271c96b7db4a9b3.tar.xz |
Fixed loading Url methods.
Now in all rekonq code we have just a loadUrl method in mainview
(doing the dirty job) and one in mainwindow, provided for convenience.
Every class needing loading an url has a openUrl signal.
Hope this should go well..
-rw-r--r-- | src/application.cpp | 2 | ||||
-rw-r--r-- | src/bookmarks.cpp | 4 | ||||
-rw-r--r-- | src/bookmarks.h | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 11 | ||||
-rw-r--r-- | src/mainview.h | 8 | ||||
-rw-r--r-- | src/mainwindow.cpp | 8 | ||||
-rw-r--r-- | src/panelhistory.h | 2 | ||||
-rw-r--r-- | src/sidepanel.h | 2 |
8 files changed, 23 insertions, 16 deletions
diff --git a/src/application.cpp b/src/application.cpp index 16b24ba0..902c2946 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -94,7 +94,7 @@ int Application::newInstance() { KUrl url = MainWindow::guessUrlFromString(args->arg(i)); newWebView(); - mainWindow()->mainView()->loadUrlInCurrentTab(url); + mainWindow()->loadUrl(url); } args->clear(); } diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index 94a31015..758ed1c0 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com> * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * * @@ -86,7 +86,7 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm) for(url = urlList.begin(); url != urlList.end(); ++url) { app->newWebView(); - app->mainWindow()->mainView()->loadUrlInCurrentTab(*url); + app->mainWindow()->loadUrl(*url); } } diff --git a/src/bookmarks.h b/src/bookmarks.h index e7875745..7a6eee7f 100644 --- a/src/bookmarks.h +++ b/src/bookmarks.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com> * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * * diff --git a/src/mainview.cpp b/src/mainview.cpp index ed09def9..df42a340 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -300,7 +300,7 @@ WebView *MainView::newWebView(bool makeCurrent) { // line edit UrlBar *urlBar = new UrlBar; // Ownership of widget is passed on to the QStackedWidget (addWidget method). - connect(urlBar, SIGNAL(activated(const KUrl&)), this, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(urlBar, SIGNAL(activated(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); m_urlBars->addUrlBar(urlBar); WebView *webView = new WebView; // should be deleted on tab close @@ -616,12 +616,17 @@ void MainView::aboutToShowRecentTabsMenu() void MainView::aboutToShowRecentTriggeredAction(QAction *action) { KUrl url = action->data().toUrl(); - loadUrlInCurrentTab(url); + loadUrl(url); } -void MainView::loadUrlInCurrentTab(const KUrl &url) +void MainView::loadUrl(const KUrl &url) { + if (url.isEmpty()) + return; + + currentUrlBar()->setUrl(url.prettyUrl()); + WebView *webView = currentWebView(); KUrl loadingUrl(url); diff --git a/src/mainview.h b/src/mainview.h index c6f26a66..89cb3553 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -111,7 +111,13 @@ public slots: * @return a pointer to the new WebView */ WebView *newWebView(bool makeCurrent = true); - void loadUrlInCurrentTab(const KUrl &url); + + /** + * Core browser slot. Load an url in a webview + * + * @param url The url to load + */ + void loadUrl(const KUrl &url); void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); void slotCloseOtherTabs(int index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 827f10c1..56ae108e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -331,7 +331,7 @@ void MainWindow::setupSidePanel() void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(historyMenu, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); @@ -455,11 +455,7 @@ KUrl MainWindow::guessUrlFromString(const QString &string) void MainWindow::loadUrl(const KUrl &url) { - if (!currentTab() || url.isEmpty()) - return; - - m_view->currentUrlBar()->setUrl(url.prettyUrl()); - m_view->loadUrlInCurrentTab(url); + m_view->loadUrl(url); } diff --git a/src/panelhistory.h b/src/panelhistory.h index 45847565..927b0319 100644 --- a/src/panelhistory.h +++ b/src/panelhistory.h @@ -41,7 +41,7 @@ public: virtual ~PanelHistory(); signals: - void openUrl(const KUrl&); + void openUrl(const KUrl &); private slots: void open(); diff --git a/src/sidepanel.h b/src/sidepanel.h index ae1a76f1..12be5030 100644 --- a/src/sidepanel.h +++ b/src/sidepanel.h @@ -40,7 +40,7 @@ public: ~SidePanel(); signals: - void openUrl(const KUrl&); + void openUrl(const KUrl &); private: PanelHistory *m_panelHistory; |