diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2009-08-23 22:30:23 +0200 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2009-08-23 22:30:23 +0200 | 
| commit | 7d27ad56c1d65b97842d954f25ee22b3711ec05b (patch) | |
| tree | 19530225943fbe93ec40bafee142384f56fc92ae | |
| parent | Modified newTab function and splitted into two parts. (diff) | |
| download | rekonq-7d27ad56c1d65b97842d954f25ee22b3711ec05b.tar.xz | |
Fixed problems restoring Lionel's hack about focused (or not) new WebViews
Some fixing also on urlbar/tabwidget/webview focus.
It seems working well.. :)
| -rw-r--r-- | src/application.cpp | 8 | ||||
| -rw-r--r-- | src/mainview.cpp | 56 | ||||
| -rw-r--r-- | src/mainview.h | 2 | ||||
| -rw-r--r-- | src/webpage.cpp | 2 | 
4 files changed, 11 insertions, 57 deletions
| diff --git a/src/application.cpp b/src/application.cpp index 81df7ffb..35d52a23 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -298,20 +298,18 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)      switch(type)      {      case Rekonq::SettingOpenTab: -        webView = m_mainWindow->mainView()->newWebView(); +        webView = m_mainWindow->mainView()->newWebView(!ReKonfig::openTabsBack());          if (!ReKonfig::openTabsBack())          { -            m_mainWindow->mainView()->setCurrentWidget(webView);              m_mainWindow->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());          }          break;      case Rekonq::NewCurrentTab: -        webView = m_mainWindow->mainView()->newWebView(); -        m_mainWindow->mainView()->setCurrentWidget(webView); +        webView = m_mainWindow->mainView()->newWebView(true);          m_mainWindow->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());          break;      case Rekonq::NewBackTab: -        webView = m_mainWindow->mainView()->newWebView(); +        webView = m_mainWindow->mainView()->newWebView(false);          break;      case Rekonq::CurrentTab:          webView = m_mainWindow->mainView()->currentWebView(); diff --git a/src/mainview.cpp b/src/mainview.cpp index 3eca7929..c6be22e9 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -303,12 +303,7 @@ WebView *MainView::webView(int index) const  } -// FIXME (0.3 target, after OneUrlBar). Divide in 2 functions: -// 1. the slot void newTab() to create a "new empty focused tab" -// 2. the public method WebView *newWebView() to just create a new webview  -// without working with the focus and loading an url - -WebView *MainView::newWebView() +WebView *MainView::newWebView(bool focused)  {      WebView *webView = new WebView;  // should be deleted on tab close? @@ -328,7 +323,10 @@ WebView *MainView::newWebView()      addTab(webView, i18n("(Untitled)")); -    urlBar()->setUrl(KUrl("")); +    if (focused) +    { +        setCurrentWidget(webView); +    }      emit tabsChanged(); @@ -343,7 +341,7 @@ void MainView::newTab()  {      WebView *w = newWebView(); -    setCurrentWidget(w); +    urlBar()->setUrl(KUrl(""));      urlBar()->setFocus();      if (ReKonfig::newTabsOpenHomePage()) @@ -353,48 +351,6 @@ void MainView::newTab()  } -// WebView *MainView::newTab(bool focused) -// { -//     WebView *webView = new WebView;  // should be deleted on tab close? -//  -//     // connecting webview with mainview -//     connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); -//     connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); -//     connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); -//     connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); -//     connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); -//  -//     connect(webView, SIGNAL(ctrlTabPressed()), this, SLOT(nextTab())); -//     connect(webView, SIGNAL(shiftCtrlTabPressed()), this, SLOT(previousTab())); -//  -//     // connecting webPage signals with mainview -//     connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); -//     connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); -//  -//     addTab(webView, i18n("(Untitled)")); -//         -//     urlBar()->setUrl(KUrl("")); -//      -//     if (focused) -//     { -//         setCurrentWidget(webView); -//         urlBar()->setFocus(); -//     } -//    -//     emit tabsChanged(); -//  -//     showTabBar(); -//     addTabButtonPosition(); -//      -//     if (ReKonfig::newTabsOpenHomePage()) -//     { -//         webView->load(QUrl(ReKonfig::homePage())); -//     } -//  -//     return webView; -// } - -  void MainView::slotReloadAllTabs()  {      for (int i = 0; i < count(); ++i) diff --git a/src/mainview.h b/src/mainview.h index de07e9a9..ae6019b7 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -81,7 +81,7 @@ public:      void showTabBar();      void clear(); -    WebView *newWebView(); +    WebView *newWebView(bool focused = true);  signals:      // tab widget signals diff --git a/src/webpage.cpp b/src/webpage.cpp index 14994746..d3e49e10 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -129,7 +129,7 @@ WebPage *WebPage::newWindow(WebWindowType type)      // FIXME: regression introduced. No more following rekonq setting about tab focus      // the FIX should be moving loadUrl code from Application to acceptNavigationRequest -    WebView *w = Application::instance()->mainWindow()->mainView()->newWebView(); +    WebView *w = Application::instance()->mainWindow()->mainView()->newWebView(!ReKonfig::openTabsBack());      return w->page();  } | 
