summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-08-23 22:30:23 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-08-23 22:30:23 +0200
commit7d27ad56c1d65b97842d954f25ee22b3711ec05b (patch)
tree19530225943fbe93ec40bafee142384f56fc92ae /src/mainview.cpp
parentModified newTab function and splitted into two parts. (diff)
downloadrekonq-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.. :)
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp56
1 files changed, 6 insertions, 50 deletions
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)