summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-08-23 12:39:21 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-08-23 12:39:21 +0200
commitc30a6e73d97530ed22cafa89b59cf25cf93e02d1 (patch)
tree1b9f9ed0bffc5fefa36f172f9585cc3a06a3c4c4 /src/mainview.cpp
parentMerge commit 'megabigbug/Print' (diff)
downloadrekonq-c30a6e73d97530ed22cafa89b59cf25cf93e02d1.tar.xz
Modified newTab function and splitted into two parts.
There are still some regressions to be fixed: - open link in new tab is always without focus - urlbar is empty on new tab loading - mics..
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp70
1 files changed, 58 insertions, 12 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 5f0afa5c..3eca7929 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -307,7 +307,8 @@ WebView *MainView::webView(int index) const
// 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::newTab(bool focused)
+
+WebView *MainView::newWebView()
{
WebView *webView = new WebView; // should be deleted on tab close?
@@ -328,27 +329,72 @@ WebView *MainView::newTab(bool focused)
addTab(webView, i18n("(Untitled)"));
urlBar()->setUrl(KUrl(""));
-
- if (focused)
- {
- setCurrentWidget(webView);
- urlBar()->setFocus();
- }
-
+
emit tabsChanged();
showTabBar();
addTabButtonPosition();
+ return webView;
+}
+
+
+void MainView::newTab()
+{
+ WebView *w = newWebView();
+
+ setCurrentWidget(w);
+ urlBar()->setFocus();
+
if (ReKonfig::newTabsOpenHomePage())
{
- webView->load(QUrl(ReKonfig::homePage()));
+ w->load(QUrl(ReKonfig::homePage()));
}
-
- return webView;
}
+// 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)
@@ -413,7 +459,7 @@ void MainView::slotCloneTab(int index)
index = currentIndex();
if (index < 0 || index >= count())
return;
- WebView *tab = newTab();
+ WebView *tab = newWebView();
tab->setUrl(webView(index)->url());
showTabBar();