Bug 260343 - Show title when hovering tab
Summary: Show title when hovering tab
Status: RESOLVED FIXED
Alias: None
Product: rekonq
Classification: Applications
Component: general (show other bugs)
Version: 0.6.1
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Andrea Diamantini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-17 08:30 UTC by Thomas Tanghus
Modified: 2011-01-07 17:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Tanghus 2010-12-17 08:30:52 UTC
Version:           0.6.1
OS:                Linux

When "Show preview when hovering tab" is disabled the title and/or URL of the tab should be shown as a tooltip instead. Or maybe the option should be: "When hovering tab show:" (a combobox with) Preview/Title Tooltip/Nothing

Reproducible: Always




OS: Linux (i686) release 2.6.35-23-generic
Compiler: cc
Comment 1 Panagiotis Papadopoulos 2011-01-04 13:53:35 UTC
It should be available soon

http://git.reviewboard.kde.org/r/100282/

:-)
Comment 2 Thomas Tanghus 2011-01-04 14:06:13 UTC
(In reply to comment #1)
> It should be available soon

Nice :-)
Comment 3 Andrea Diamantini 2011-01-07 17:53:51 UTC
commit cb84ae8badcab5bfe095e71cf4c0e33175e60817
branch master
Author: Andrea Diamantini <adjam7@gmail.com>
Date:   Fri Jan 7 17:49:24 2011 +0100

    This GCI task adds a combobox with different settings to choice when hovering tabs:
    * tab preview (default one)
    * show title as tooltip
    * show url as tooltip
    * show nothing
    
    Patch by Furkan Uzumcu, reviewed (and merged) by adjam
    
    BUG:260343
    RB:100282

diff --git a/src/application.cpp b/src/application.cpp
index 41c6e76..466a0a4 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -528,6 +528,35 @@ void Application::updateConfiguration()
     Application::historyManager()->loadSettings();
     Application::adblockManager()->loadSettings();
 
+    // hovering unfocused tabs options
+    switch(ReKonfig::hoveringTabOption())
+    {
+    case 0: // tab previews
+    case 3: // nothing
+        for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
+        {
+            mainWindow()->mainView()->tabBar()->setTabToolTip(i, "");
+        }
+        break;
+
+    case 1: // title previews
+        for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
+        {
+            mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->tabText(i).remove('&'));
+        }
+        break;
+
+    case 2: // url previews
+        for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
+        {
+            mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->webTab(i)->url().toMimeDataString());
+        }
+        break;
+
+    default: // non extant case
+        break;
+    }
+
     defaultSettings = 0;
 }
 
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 94dc168..42a7675 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -566,6 +566,8 @@ void MainView::webViewTitleChanged(const QString &title)
         emit currentTitle(viewTitle);
     }
     Application::historyManager()->updateHistoryEntry(tab->url(), tabTitle);
+    if (ReKonfig::hoveringTabOption() == 1)
+        tabBar()->setTabToolTip(index, tabTitle.remove('&'));
 }
 
 
@@ -577,6 +579,8 @@ void MainView::webViewUrlChanged(const QUrl &url)
     {
         tabBar()->setTabData(index, url);
     }
+    if (ReKonfig::hoveringTabOption() == 2)
+        tabBar()->setTabToolTip(index, webTab(index)->url().toMimeDataString());
     emit tabsChanged();
 }
 
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 6700b4e..cda76d8 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -96,8 +96,8 @@
     <entry name="openTabsNearCurrent" type="Bool">
         <default>false</default>
     </entry>
-    <entry name="alwaysShowTabPreviews" type="Bool">
-        <default>true</default>
+    <entry name="hoveringTabOption" type="Int">
+        <default>0</default>
     </entry>
     <entry name="closeTabSelectPrevious" type="Bool">
         <default>false</default>
diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui
index 2e2ee10..290c627 100644
--- a/src/settings/settings_tabs.ui
+++ b/src/settings/settings_tabs.ui
@@ -20,6 +20,9 @@
       <string>New Tab Behavior</string>
      </property>
      <layout class="QFormLayout" name="formLayout">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::ExpandingFieldsGrow</enum>
+      </property>
       <item row="0" column="0">
        <widget class="QLabel" name="label_4">
         <property name="minimumSize">
@@ -126,18 +129,64 @@
      <property name="title">
       <string>Tabbed Browsing</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout_4">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
       <item>
-       <widget class="QCheckBox" name="kcfg_openTabNoWindow">
-        <property name="text">
-         <string>Open links in new tab instead of in new window</string>
-        </property>
-       </widget>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="label_6">
+          <property name="minimumSize">
+           <size>
+            <width>150</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>When hovering tab show:</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KComboBox" name="kcfg_hoveringTabOption">
+          <property name="enabled">
+           <bool>true</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <item>
+           <property name="text">
+            <string>Tab Previews</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string>Title Tooltip</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string>Url Tooltip</string>
+           </property>
+          </item>
+          <item>
+           <property name="text">
+            <string comment="@item:inlistbox">Nothing</string>
+           </property>
+          </item>
+         </widget>
+        </item>
+       </layout>
       </item>
       <item>
-       <widget class="QCheckBox" name="kcfg_alwaysShowTabBar">
+       <widget class="QCheckBox" name="kcfg_openTabNoWindow">
         <property name="text">
-         <string>Always show tab bar</string>
+         <string>Open links in new tab instead of in new window</string>
         </property>
        </widget>
       </item>
@@ -156,16 +205,6 @@
        </widget>
       </item>
       <item>
-       <widget class="QCheckBox" name="kcfg_alwaysShowTabPreviews">
-        <property name="text">
-         <string>Show preview when hovering tab</string>
-        </property>
-        <property name="checked">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
        <widget class="QCheckBox" name="kcfg_closeTabSelectPrevious">
         <property name="text">
          <string>Activate previously used tab when closing the current one</string>
diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp
index aa55533..d9b741b 100644
--- a/src/settings/tabswidget.cpp
+++ b/src/settings/tabswidget.cpp
@@ -41,7 +41,6 @@ void TabsWidget::save()
 {
 }
 
-
 bool TabsWidget::changed()
 {
     return _changed;
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 286d7d4..5712497 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -54,7 +54,6 @@
 #include <QtGui/QMouseEvent>
 #include <QtGui/QToolButton>
 
-
 #define BASE_WIDTH_DIVISOR    4
 #define MIN_WIDTH_DIVISOR     8
 
@@ -220,7 +219,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
 
     KTabBar::mouseMoveEvent(event);
 
-    if (ReKonfig::alwaysShowTabPreviews())
+    if (ReKonfig::hoveringTabOption() == 0)
     {
         //Find the tab under the mouse
         int i = 0;
@@ -262,7 +261,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
 
 void TabBar::leaveEvent(QEvent *event)
 {
-    if (ReKonfig::alwaysShowTabPreviews())
+    if (ReKonfig::hoveringTabOption() == 0)
     {
         //if leave tabwidget then hide previous tab preview
         if (!m_previewPopup.isNull())
@@ -278,7 +277,7 @@ void TabBar::leaveEvent(QEvent *event)
 
 void TabBar::mousePressEvent(QMouseEvent *event)
 {
-    if (ReKonfig::alwaysShowTabPreviews())
+    if (ReKonfig::hoveringTabOption() == 0)
     {
         if (!m_previewPopup.isNull())
         {
@@ -355,7 +354,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event)
 
 void TabBar::tabRemoved(int /*index*/)
 {
-    if (ReKonfig::alwaysShowTabPreviews())
+    if (ReKonfig::hoveringTabOption() == 0)
     {
         if (!m_previewPopup.isNull())
         {
diff --git a/src/tabbar.h b/src/tabbar.h
index acd8e2f..4170786 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -90,7 +90,6 @@ private slots:
 
 private:
     void setupHistoryActions();
-
     friend class MainView;
 
     /**