From 7cd00f6764a775934394ac9ee92b2393e5928f50 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 17 Jul 2009 00:46:05 +0200 Subject: Definitely fixing rekonq API. First step. newTab function in MainView --- src/application.cpp | 4 ++-- src/application.h | 13 +------------ src/mainview.cpp | 47 ++++++++++++++++++++++------------------------- src/mainview.h | 6 +----- src/mainwindow.cpp | 3 +-- 5 files changed, 27 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index afd6a2cc..27dcc83a 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -141,9 +141,9 @@ MainWindow *Application::mainWindow() } -WebView *Application::newWebView(Rekonq::OpenType type) +WebView *Application::newWebView() { - return m_mainWindow->mainView()->newWebView(type); + return m_mainWindow->mainView()->newTab(); } diff --git a/src/application.h b/src/application.h index 46d013e3..24ee7d28 100644 --- a/src/application.h +++ b/src/application.h @@ -48,17 +48,6 @@ class WebView; namespace Rekonq { - /** - * @short Open link options - * Different modes of opening new tab - */ - enum OpenType - { - Default, ///< open url according to users settings - New, ///< open url in new tab and make it current - Background ///< open url in new tab in background - }; - /** * @short notifying message status * Different message status @@ -88,7 +77,7 @@ public: static Application *instance(); MainWindow *mainWindow(); - WebView *newWebView(Rekonq::OpenType type = Rekonq::Default); + WebView *newWebView(); static KIcon icon(const KUrl &url); diff --git a/src/mainview.cpp b/src/mainview.cpp index 41f5b72d..05e461ee 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -164,12 +164,6 @@ int MainView::webViewIndex(WebView *webView) const } -void MainView::setMakeBackTab(bool b) -{ - m_makeBackTab = b; -} - - void MainView::showTabBar() { if (ReKonfig::alwaysShowTabBar()) @@ -358,7 +352,7 @@ WebView *MainView::webView(int index) const } -WebView *MainView::newWebView(Rekonq::OpenType type) +WebView *MainView::newTab() { // line edit UrlBar *urlBar = new UrlBar; // Ownership of widget is passed on to the QStackedWidget (addWidget method). @@ -389,22 +383,25 @@ WebView *MainView::newWebView(Rekonq::OpenType type) addTab(webView, i18n("(Untitled)")); - switch(type) - { - case Rekonq::Default: - if (!m_makeBackTab) - { - setCurrentWidget(webView); // this method does NOT take ownership of webView - urlBar->setFocus(); - } - break; - case Rekonq::New: - setCurrentWidget(webView); // this method does NOT take ownership of webView - urlBar->setFocus(); - break; - case Rekonq::Background: - break; - }; + setCurrentWidget(webView); // this method does NOT take ownership of webView + urlBar->setFocus(); + +// switch(type) +// { +// case Rekonq::Default: +// if (!m_makeBackTab) +// { +// setCurrentWidget(webView); // this method does NOT take ownership of webView +// urlBar->setFocus(); +// } +// break; +// case Rekonq::New: +// setCurrentWidget(webView); // this method does NOT take ownership of webView +// urlBar->setFocus(); +// break; +// case Rekonq::Background: +// break; +// }; emit tabsChanged(); @@ -480,7 +477,7 @@ void MainView::slotCloneTab(int index) index = currentIndex(); if (index < 0 || index >= count()) return; - WebView *tab = newWebView(); + WebView *tab = newTab(); tab->setUrl(webView(index)->url()); showTabBar(); @@ -758,7 +755,7 @@ void MainView::mouseDoubleClickEvent(QMouseEvent *event) { if (!childAt(event->pos())) { - newWebView(Rekonq::New); + newTab(); return; } KTabWidget::mouseDoubleClickEvent(event); diff --git a/src/mainview.h b/src/mainview.h index d338402a..05a7d96f 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -72,8 +72,6 @@ public: StackedUrlBar *urlBarStack() const; WebView *currentWebView() const; int webViewIndex(WebView *webView) const; - KAction *recentlyClosedTabsAction() const; - void setMakeBackTab(bool b); /** * show and hide TabBar if user doesn't choose @@ -104,7 +102,7 @@ public slots: * * @return a pointer to the new WebView */ - WebView *newWebView(Rekonq::OpenType type = Rekonq::Default); + WebView *newTab(); /** * Core browser slot. Load an url in a webview @@ -180,8 +178,6 @@ private: QString m_loadingGitPath; - bool m_makeBackTab; - QToolButton *m_addTabButton; }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 471a469a..54f72e61 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -304,7 +304,7 @@ void MainWindow::setupActions() a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::Key_N)); actionCollection()->addAction(QLatin1String("new_tab"), a); - connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newWebView())); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); @@ -386,7 +386,6 @@ void MainWindow::slotUpdateConfiguration() // ============== General ================== m_homePage = ReKonfig::homePage(); mainView()->showTabBar(); - mainView()->setMakeBackTab( ReKonfig::openTabsBack() ); // "status bar" messages (new notifyMessage system) if(ReKonfig::showUrlsPopup()) -- cgit v1.2.1