Bug 131881 - The number in the tab title gets incremented whether or not it's necessary
Summary: The number in the tab title gets incremented whether or not it's necessary
Status: RESOLVED FIXED
Alias: None
Product: yakuake
Classification: Applications
Component: general (show other bugs)
Version: 2.7.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-04 20:02 UTC by Stephan Sokolow
Modified: 2007-06-04 18:15 UTC (History)
0 users

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 Stephan Sokolow 2006-08-04 20:02:56 UTC
Version:           2.7.5 (using KDE KDE 3.5.2)
Compiler:          gcc (GCC) 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9) 
OS:                Linux

Open Yakuake and open two tabs. They will default to "Shell" and "Shell No. 2". Then close "Shell No. 2" and open a new one.

Instead of re-using "Shell No. 2", it gets called "Shell No. 3". For someone who does a lot of tab opening and closing, this gets very irritating very quickly.
Comment 1 Eike Hein 2006-08-04 20:25:05 UTC
Coming in the next release.
Comment 2 Eike Hein 2007-06-04 18:15:42 UTC
SVN commit 671379 by hein:

Make initial session naming/numbering consistent with Konsole.
BUG:131881


 M  +34 -1     tabbed_widget.cpp  
 M  +1 -0      tabbed_widget.h  


--- branches/extragear/kde3/utils/yakuake/src/tabbed_widget.cpp #671378:671379
@@ -94,7 +94,7 @@
 {
     items.append(session_id);
     areas.append(0);
-    captions.append(defaultTabCaption(session_id));
+    captions.append(lowestAvailableCaption());
 
     refreshBuffer();
 }
@@ -104,6 +104,39 @@
     return i18n("Shell", "Shell No. %n", id+1);
 }
 
+QString TabbedWidget::lowestAvailableCaption()
+{
+    QString newTitle = defaultTabCaption(0);
+
+    bool nameOk;
+    int count = 0;
+
+    do
+    {
+        nameOk = true;
+
+        QValueList<QString>::iterator it;
+
+        for (it = captions.begin(); it != captions.end(); ++it)
+        {
+            if (newTitle == (*it))
+            {
+                nameOk = false;
+                break;
+            }
+        }
+
+        if (!nameOk)
+        {
+            count++;
+            newTitle = newTitle = defaultTabCaption(count);
+        }
+    }
+    while (!nameOk);
+
+    return newTitle;
+}
+
 int TabbedWidget::removeItem(int session_id)
 {
     uint position = items.findIndex(session_id);
--- branches/extragear/kde3/utils/yakuake/src/tabbed_widget.h #671378:671379
@@ -106,6 +106,7 @@
         void createContextMenu();
         const int drawButton(int position, QPainter& painter);
         QString defaultTabCaption(int session_id);
+        QString lowestAvailableCaption();
 
         int current_position;
         bool pressed;