From 88a5c9816cd6a07240a4a94820e0a809aecd074a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 16 Feb 2011 01:47:08 +0100 Subject: Cleans up "tab switch" management and expecially the use of signals on that. This, expecially to avoid double calls on functions to manage tab switching and info updating. Reviewed by NOBODY (oops...) --- src/mainview.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index fe6413a1..dfa202dc 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -112,7 +112,6 @@ void MainView::postLaunch() // Session Manager connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession())); - connect(this, SIGNAL(currentChanged(int)), Application::sessionManager(), SLOT(saveSession())); m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab")); @@ -267,6 +266,8 @@ void MainView::currentChanged(int index) tab->view()->setFocus(); tabBar()->resetTabHighlighted(index); + + emit tabsChanged(); } @@ -316,9 +317,13 @@ WebTab *MainView::newWebTab(bool focused) { setCurrentWidget(tab); } - - emit tabsChanged(); - + else + { + // if tab is not focused, + // current index doesn't change... + emit tabsChanged(); + } + return tab; } @@ -484,7 +489,9 @@ void MainView::closeTab(int index, bool del) tabToClose->deleteLater(); } - emit tabsChanged(); + // if tab was not focused, current index does not change... + if(index != currentIndex()) + emit tabsChanged(); } @@ -594,6 +601,7 @@ void MainView::webViewUrlChanged(const QUrl &url) } if (ReKonfig::hoveringTabOption() == 2) tabBar()->setTabToolTip(index, webTab(index)->url().toMimeDataString()); + emit tabsChanged(); } -- cgit v1.2.1