summaryrefslogtreecommitdiff
path: root/src/tabwindow/tabwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-07-28 11:11:56 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:04 +0100
commit9a111024c84f7f7cc10cbbd5fc43ee82e48ae79e (patch)
tree688b549594169bfca6b248415286adede8e4f4c5 /src/tabwindow/tabwindow.cpp
parentUpdate SearchEngine class to fix it with KDE 4.9 changes (diff)
downloadrekonq-9a111024c84f7f7cc10cbbd5fc43ee82e48ae79e.tar.xz
Class Application Import, first (important) part
Diffstat (limited to 'src/tabwindow/tabwindow.cpp')
-rw-r--r--src/tabwindow/tabwindow.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 9e2a17ce..a849426e 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -85,6 +85,11 @@ TabWindow::TabWindow(QWidget *parent)
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ // NOTE: NEVER create a tabwindow without AT LEAST one tab...
+ WebWindow *tab = prepareNewTab();
+ addTab(tab, i18n("new tab"));
+ setCurrentWidget(tab);
+
// FIXME: Manage sizes...
kDebug() << "SIZE: " << size();
kDebug() << "SIZE HINT: " << sizeHint();
@@ -147,15 +152,35 @@ WebWindow *TabWindow::prepareNewTab(WebPage *page)
}
-void TabWindow::loadUrlInNewTab(const QUrl &url, TabHistory *history)
+void TabWindow::loadUrl(const KUrl &url, Rekonq::OpenType type, TabHistory *history)
{
- WebWindow *tab = prepareNewTab();
+ WebWindow *tab = 0;
+ switch (type)
+ {
+ case Rekonq::NewTab:
+ case Rekonq::NewBackGroundTab:
+ tab = prepareNewTab();
+ addTab(tab, i18n("new tab"));
+ break;
+
+ case Rekonq::NewFocusedTab:
+ tab = prepareNewTab();
+ addTab(tab, i18n("new tab"));
+ setCurrentWidget(tab);
+ break;
+
+ case Rekonq::NewWindow:
+ // TODO
+// emit loadUrlInNewWindow(url);
+ return;
- // Now, the dirty jobs...
- addTab(tab, i18n("new tab"));
- tab->load(url);
+ case Rekonq::CurrentTab:
+ default:
+ tab = currentWebWindow();
+ break;
+ };
- setCurrentWidget(tab);
+ tab->load(url);
if (history)
{
@@ -169,7 +194,7 @@ void TabWindow::loadUrlInNewTab(const QUrl &url, TabHistory *history)
void TabWindow::newCleanTab()
{
QUrl u = QUrl::fromUserInput("/DATI/WEBPAGES/HomePage/index.htm");
- loadUrlInNewTab(u);
+ loadUrl(u, Rekonq::NewTab);
}
@@ -338,7 +363,7 @@ void TabWindow::cloneTab(int index)
QWebHistory* history = webWindow(index)->page()->history();
TabHistory tHistory(history);
- loadUrlInNewTab(u, &tHistory);
+ loadUrl(u, Rekonq::NewTab, &tHistory);
}
@@ -440,7 +465,7 @@ void TabWindow::restoreClosedTab(int i)
QUrl u = QUrl(history.url);
- loadUrlInNewTab(u, &history);
+ loadUrl(u, Rekonq::NewTab, &history);
// just to get sure...
m_recentlyClosedTabs.removeAll(history);