[Konsole-devel] [Bug 151735] New: [PATCH] Unless renamed, make userTitle fully override tab/window/icon text rather than prepend the default

Christopher Layne clayne at anodized.com
Fri Nov 2 10:19:03 UTC 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=151735         
           Summary: [PATCH] Unless renamed, make userTitle fully override
                    tab/window/icon text rather than prepend the default
           Product: konsole
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
        AssignedTo: konsole-devel kde org
        ReportedBy: clayne anodized com


Version:            (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
Compiler:          gcc 4.2 
OS:                Linux

Earlier bug from 2001, which is indirectly related:

http://bugs.kde.org/show_bug.cgi?id=33641

Anyways, in cases where the user has specified their own userTitle via escape sequences, etc, the userTitle will override the default title, and not append, e.g. "- Shell" to said userTitle.

However, if a user specifically renames a session via the tab rename or dcop rename, that title will then be sticky and fully override whatever title is there (default or userTitle).

Rationale for this is that a userTitle should, in an intuitive fashion, overwrite the default title by nature. Additionally, the current behaviour of prepending it to the default session title just ends up taking way too much horizontal room in each tab title.

Example:
Current behaviour:

def: [ Shell No. 2 ]
usr: [ user host:/var/log/httpd - Shell No. 2 ]
ren: [ user host:/var/log/httpd - httpd logs ]

Patched behaviour:

def: [ Shell No. 2 ]
usr: [ user host:/var/log/httpd ]
ren: [ httpd logs ]

I think it's quite apparent which one will take up the least space when one has, for example, 6+ tabs in a given konsole window. Also, as a long time user of konsole on a day to day basis, I think it would be prudent to remove the "No. x" code present in konsole.cpp (the double while loop deal). For one, it adds complexity to the code, but more importantly there is really no advantage to knowing which session number a given tab is. It's arbitrary and not something that one even takes note of - hence it just steals valuable horizontal space in the tab bar.

Patch for previously discussed changes:

Index: kdebase/konsole/konsole/session.cpp
===================================================================
--- kdebase/konsole/konsole/session.cpp (revision 722255)
+++ kdebase/konsole/konsole/session.cpp (working copy)
 @ -246,8 +246,8  @
 QString TESession::fullTitle() const
 {
     QString res = title;
-    if ( !userTitle.isEmpty() )
-        res = userTitle + " - " + res;
+    if ( !titleSticky && !userTitle.isEmpty() )
+        res = userTitle;
     return res;
 }

 @ -334,7 +334,8  @

 void TESession::renameSession(const QString &name)
 {
-  title=name;
+  setTitleSticky(name);
+
   emit renameSession(this,name);
 }

 @ -464,6 +465,12  @
   font_no = fn;
 }

+void TESession::setTitleSticky(const QString& _title)
+{
+  title = _title;
+  titleSticky = true;
+}
+
 void TESession::setTitle(const QString& _title)
 {
   title = _title;
Index: kdebase/konsole/konsole/konsole.cpp
===================================================================
--- kdebase/konsole/konsole/konsole.cpp (revision 722255)
+++ kdebase/konsole/konsole/konsole.cpp (working copy)
 @ -3790,7 +3790,7  @

   if (!ok) return;

-  ses->setTitle(title);
+  ses->setTitleSticky(title);
   slotRenameSession(ses,title);
 }

Index: kdebase/konsole/konsole/session.h
===================================================================
--- kdebase/konsole/konsole/session.h   (revision 722255)
+++ kdebase/konsole/konsole/session.h   (working copy)
 @ -85,6 +85,7  @
   void setKeymap(const QString& _id);
   void setFontNo(int fn);
   void setTitle(const QString& _title);
+  void setTitleSticky(const QString& _title);
   void setIconName(const QString& _iconName);
   void setIconText(const QString& _iconText);
   void setAddToUtmp(bool);
 @ -186,6 +187,7  @
   bool           masterMode;
   bool           autoClose;
   bool           wantedClose;
+  bool           titleSticky;
   QTimer*        monitorTimer;

   //FIXME: using the indices here



More information about the konsole-devel mailing list