Bug 74269

Summary: FIXME/Patch: sorting Settings/Keyboard entires
Product: [Applications] konsole Reporter: Kurt Hindenburg <khindenburg>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch to sort KeyBoard menu entires

Description Kurt Hindenburg 2004-02-05 19:27:48 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice) 
OS:          Linux

FIXME in konsole/konsole.cpp asks for sorting of Keyboard menu entires.
New layout:
linux console
vt100 (historical)
VT420PC
XTerm (XFree 3.x.x)
XTerm (XFree 4.x.x)
Comment 1 Kurt Hindenburg 2004-02-05 19:28:46 UTC
Created attachment 4526 [details]
Patch to sort KeyBoard menu entires
Comment 2 Waldo Bastian 2004-02-05 23:50:29 UTC
Subject: KDE_3_2_BRANCH: kdebase/konsole/konsole

CVS commit by waba: 

Sort Settings/Keyboard entries (BR74269)
Patch by Kurt V.Hindenburg
CCMAIL: 74269-done@bugs.kde.org


  M +15 -1     konsole.cpp   1.441.2.4


--- kdebase/konsole/konsole/konsole.cpp  #1.441.2.3:1.441.2.4
@@ -769,12 +769,26 @@ void Konsole::makeGUI()
 
    // insert keymaps into menu
-   //FIXME: sort
+   // This sorting seems a bit cumbersome; but it is not called often.
+   QStringList kt_titles;
+   typedef QMap<QString,KeyTrans*> QStringKeyTransMap;
+   QStringKeyTransMap kt_map;
+
    for (int i = 0; i < KeyTrans::count(); i++)
    {
       KeyTrans* ktr = KeyTrans::find(i);
       assert( ktr );
+      QString title=ktr->hdr().lower();
+      kt_titles << title;
+      kt_map[title] = ktr;
+   }
+   kt_titles.sort();
+   for ( QStringList::Iterator it = kt_titles.begin(); it != kt_titles.end(); ++it ) {
+      KeyTrans* ktr = kt_map[*it];
+      assert( ktr );
       QString title=ktr->hdr();
       m_keytab->insertItem(title.replace('&',"&&"),ktr->numb());
+      //KONSOLEDEBUG << *it << "---" << title << "---" << ktr->numb() << endl;
    }
+
    applySettingsToGUI();
    isRestored = false;