summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp38
-rw-r--r--src/mainview.h2
-rw-r--r--src/tabbar.cpp30
-rw-r--r--src/tabbar.h6
4 files changed, 33 insertions, 43 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 37a5df0d..850101e2 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -99,7 +99,7 @@ MainView::MainView(MainWindow *parent)
void MainView::postLaunch()
{
QStringList list = Application::sessionManager()->closedSites();
- foreach(const QString &line, list)
+ Q_FOREACH(const QString &line, list)
{
if(line.startsWith( QL1S("about") ))
break;
@@ -176,41 +176,17 @@ WebTab *MainView::currentWebTab() const
void MainView::updateTabBar()
{
- if (ReKonfig::alwaysShowTabBar())
+ if (ReKonfig::alwaysShowTabBar() || tabBar()->count() > 1)
{
- if (!isTabBarHidden())
- {
- if (tabBar()->isHidden())
- {
- tabBar()->show();
- m_addTabButton->show();
- }
- updateTabButtonPosition();
- }
- return;
+ if (tabBar()->isHidden())
+ tabBar()->show();
}
-
- if (tabBar()->count() == 1)
+ else
{
tabBar()->hide();
- m_addTabButton->hide();
- }
- else if (!isTabBarHidden())
- {
- if (tabBar()->isHidden())
- {
- tabBar()->show();
- m_addTabButton->show();
- }
- updateTabButtonPosition();
}
-}
-
-void MainView::setTabBarHidden(bool hide)
-{
- m_addTabButton->setVisible(!hide);
- KTabWidget::setTabBarHidden(hide);
+ updateTabButtonPosition();
}
@@ -557,7 +533,7 @@ void MainView::webViewIconChanged()
WebView *view = qobject_cast<WebView *>(sender());
WebTab *tab = qobject_cast<WebTab *>(view->parent());
int index = indexOf(tab);
-
+
if (-1 != index)
{
kDebug() << "TAB URL: " << tab->url();
diff --git a/src/mainview.h b/src/mainview.h
index 2ba18892..1d04d284 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -83,8 +83,6 @@ public:
*/
void updateTabBar();
- void setTabBarHidden(bool hide);
-
inline QToolButton *addTabButton() const { return m_addTabButton; }
/**
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 0866bfd8..286d7d45 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -77,11 +77,6 @@ TabBar::TabBar(QWidget *parent)
}
-TabBar::~TabBar()
-{
-}
-
-
QSize TabBar::tabSizeHint(int index) const
{
MainView *view = qobject_cast<MainView *>(parent());
@@ -189,6 +184,26 @@ void TabBar::showTabPreview()
}
+void TabBar::hideEvent(QHideEvent *event)
+{
+ if (!event->spontaneous())
+ {
+ qobject_cast<MainView *>(parent())->addTabButton()->hide();
+ }
+ QTabBar::hideEvent(event);
+}
+
+
+void TabBar::showEvent(QShowEvent *event)
+{
+ QTabBar::showEvent(event);
+ if (!event->spontaneous())
+ {
+ qobject_cast<MainView *>(parent())->addTabButton()->show();
+ }
+}
+
+
void TabBar::mouseMoveEvent(QMouseEvent *event)
{
if (count() == 1)
@@ -338,9 +353,8 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event)
}
-void TabBar::tabRemoved(int index)
+void TabBar::tabRemoved(int /*index*/)
{
- Q_UNUSED(index)
if (ReKonfig::alwaysShowTabPreviews())
{
if (!m_previewPopup.isNull())
@@ -374,7 +388,7 @@ void TabBar::setupHistoryActions()
if(!isEnabled)
return;
- foreach (const HistoryItem &item, mv->recentlyClosedTabs())
+ Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs())
{
KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this);
a->setData(item.url);
diff --git a/src/tabbar.h b/src/tabbar.h
index a80776e1..acd8e2fb 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -51,8 +51,8 @@ class REKONQ_TESTS_EXPORT TabBar : public KTabBar
Q_OBJECT
public:
- TabBar(QWidget *parent);
- ~TabBar();
+ explicit TabBar(QWidget *parent);
+ virtual ~TabBar() {}
signals:
void cloneTab(int index);
@@ -68,6 +68,8 @@ protected:
*/
virtual QSize tabSizeHint(int index) const;
+ virtual void hideEvent(QHideEvent *event);
+ virtual void showEvent(QShowEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void leaveEvent(QEvent *event);
virtual void mousePressEvent(QMouseEvent *event);