Bug 121782 - Ampersand in title sets Accel
Summary: Ampersand in title sets Accel
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 1.6
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-11 19:27 UTC by Ernst de Haan
Modified: 2006-05-05 03:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot (10.99 KB, image/png)
2006-02-11 19:34 UTC, Ernst de Haan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ernst de Haan 2006-02-11 19:27:24 UTC
Version:           1.6 (using KDE 3.5.1, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo Hardened 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.14-gentoo-r2

Steps to reproduce:
1. Create a new Konsole window
2. Change the name of the tab to "a&b" (Ctrl-Alt-S)
3. Create a new tab (Ctrl-Alt-N)

Expected behaviour:
- name of the first tab remains the same

Actual behaviour:
- name changes to "ab" where the "b" is underlined
Comment 1 Ernst de Haan 2006-02-11 19:27:55 UTC
This is on KDE 3.5.1. Konsole reports its version is 1.6.
Comment 2 Ernst de Haan 2006-02-11 19:34:35 UTC
Created attachment 14643 [details]
Screenshot

This screenshot shows the results of the listed steps, with the problem.
Comment 3 Kurt Hindenburg 2006-02-12 22:23:49 UTC
Yea, I'm not sure why this is... the KTabWidget has setNoAccel on it so the & should be ignored.  You'll notice that you can switch to that tab using Alt+b.
Comment 4 Kurt Hindenburg 2006-05-05 02:51:56 UTC
SVN commit 537524 by hindenburg:

Fix issue when there are ampersands in tab title.

BUG: 121782 


 M  +9 -3      konsole.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #537523:537524
@@ -1364,6 +1364,7 @@
     else
       title = sessions.at(i)->Title();
 
+    title=title.replace('&',"&&");
     switch(mode) {
       case ShowIconAndText:
         tabwidget->changeTab(page, icon, title);
@@ -2198,7 +2199,7 @@
     ra->setIcon(icon);
   if (m_tabViewMode == ShowIconOnly) tabwidget->changeTab( se->widget(), QString::null );
   else if (b_matchTabWinTitle)
-    tabwidget->changeTab( se->widget(), se->fullTitle() );
+    tabwidget->changeTab( se->widget(), se->fullTitle().replace('&',"&&"));
 }
 
 void Konsole::initSessionFont(QFont font) {
@@ -3127,7 +3128,9 @@
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position-1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position-1);
   tabwidget->showPage(se->widget());
   tabwidget->setTabColor(se->widget(),oldcolor);
   
@@ -3158,7 +3161,9 @@
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position+1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position+1);
   tabwidget->showPage(se->widget());
   tabwidget->setTabColor(se->widget(),oldcolor);
   
@@ -3671,6 +3676,7 @@
   konsole->attachSession(_se);
   konsole->activateSession(_se);
   konsole->changeTabTextColor( _se, se_tabtextcolor.rgb() );//restore prev color
+  konsole->slotTabSetViewOptions(m_tabViewMode);
 
   if (_se==se) {
     if (se == se_previous)
Comment 5 Kurt Hindenburg 2006-05-05 03:00:50 UTC
SVN commit 537528 by hindenburg:

Fix issue when there are ampersands in tab title.

CCBUG: 121782


 M  +9 -3      konsole.cpp  


--- trunk/KDE/kdebase/apps/konsole/konsole/konsole.cpp #537527:537528
@@ -1376,6 +1376,7 @@
     else
       title = sessions.at(i)->Title();
 
+    title=title.replace('&',"&&");
     switch(mode) {
       case ShowIconAndText:
         tabwidget->setTabIcon( i, icon );
@@ -2148,7 +2149,7 @@
   if (m_tabViewMode == ShowIconOnly)
     tabwidget->setTabText( se_index, QString() );
   else if (b_matchTabWinTitle)
-    tabwidget->setTabText( se_index, se->fullTitle() );
+    tabwidget->setTabText( se_index, se->fullTitle().replace('&', "&&") );
 }
 
 void Konsole::initSessionFont(QFont font) {
@@ -3092,7 +3093,9 @@
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position-1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position-1);
   tabwidget->showPage(se->widget());
   tabwidget->setTabTextColor(tabwidget->indexOf(se->widget()),oldcolor);
   
@@ -3123,7 +3126,9 @@
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position+1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position+1);
   tabwidget->showPage(se->widget());
   tabwidget->setTabTextColor(tabwidget->indexOf(se->widget()),oldcolor);
   
@@ -3639,6 +3644,7 @@
   konsole->attachSession(_se);
   konsole->activateSession(_se);
   konsole->changeTabTextColor( _se, se_tabtextcolor.rgb() );//restore prev color
+  konsole->slotTabSetViewOptions(m_tabViewMode);
 
   if (_se==se) {
     if (se == se_previous)