summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp19
-rw-r--r--src/mainview.h2
2 files changed, 11 insertions, 10 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 2e30aa58..865ffab2 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -80,18 +80,12 @@ MainView::MainView(QWidget *parent)
m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
m_recentlyClosedTabsAction->setEnabled(false);
- #if QT_VERSION >= 0x040500
- connect(m_tabBar, SIGNAL(closeRequest(int)), this, SLOT(closeTab(int)));
- #if KDE_IS_VERSION(4,2,60)
- setTabsClosable(true); // this causes #23 on KDE 4.2
- #else
- setCloseButtonEnabled(true); // this is deprecated, remove for KDE >=4.3
- #endif
- #endif
-
// --
connect(this, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrlInCurrentTab(const KUrl &)));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
+
+ setTabsClosable(true);
+ connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int)));
}
@@ -366,9 +360,11 @@ void MainView::slotReloadAllTabs()
void MainView::windowCloseRequested()
{
+
WebPage *webPage = qobject_cast<WebPage*>(sender());
WebView *webView = qobject_cast<WebView*>(webPage->view());
int index = webViewIndex(webView);
+
if (index >= 0)
{
if (count() == 1)
@@ -380,6 +376,10 @@ void MainView::windowCloseRequested()
slotCloseTab(index);
}
}
+ else
+ {
+ kWarning() << "Invalid tab index" << "line:" << __LINE__;
+ }
}
@@ -419,6 +419,7 @@ void MainView::slotCloneTab(int index)
// When index is -1 index chooses the current tab
void MainView::slotCloseTab(int index)
{
+ kWarning() << "Index: " << index;
// do nothing if just one tab is opened
if( count() == 1 )
return;
diff --git a/src/mainview.h b/src/mainview.h
index 81865ca6..facd865f 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -111,7 +111,7 @@ public slots:
* @return a pointer to the new WebView
*/
WebView *newWebView(bool makeCurrent = true);
- void loadUrlInCurrentTab(const KUrl &url); // DEPRECATED
+ void loadUrlInCurrentTab(const KUrl &url);
void slotCloneTab(int index = -1);
void slotCloseTab(int index = -1);
void slotCloseOtherTabs(int index);