Bug 77018

Summary: konsole session does not honor keytab in .kde
Product: [Applications] konsole Reporter: Guenther Palfinger <guenther.palfinger>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to fix KeyTab= filename.

Description Guenther Palfinger 2004-03-08 14:35:18 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    RedHat RPMs
OS:          Linux

When selecting a keytab for a session for which the .keytab file resides in .kde/share/apps/konsole/, the setting is not stored. This is clearly seen in Settings/Configure Konsole/Session tab, when selecting the changed session, where XTerm (XFree 3.x.x) is set instead.

It works with konsole --keytab <name>.

I noticed the bug 5 weeks ago with KDE 3.1.5.
Comment 1 Guenther Palfinger 2004-05-10 19:26:15 UTC
Confirmed on Konsole 1.3.2 (Using KDE 3.2.2-3.0.rh7.3.kde). It shows immediately when choosing a keytab for a session in the Configure Konsole dialogue and Applying the changes. Only [XTerm (XFree 4.x.x)] and [XTerm (XFree 3.x.x)] are accepted. So it might have nothing to do with the directory the keytab file is in as others a not accepted either.
Comment 2 Kurt Hindenburg 2004-06-06 00:49:47 UTC
This patches fixes this...

Index: keytrans.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/keytrans.cpp,v
retrieving revision 1.46
diff -u -p -r1.46 keytrans.cpp
--- keytrans.cpp        26 Jul 2003 10:41:25 -0000      1.46
+++ keytrans.cpp        5 Jun 2004 22:48:05 -0000
@@ -649,9 +649,14 @@ KeyTrans* KeyTrans::find(int numb)
 KeyTrans* KeyTrans::find(const QString &id)
 {
   QIntDictIterator<KeyTrans> it(*numb2keymap);
+
+  QString key = id;
+  if (key.endsWith(".keytab"))
+    key.remove(".keytab");
+
   while(it.current())
   {
-    if (it.current()->id() == id)
+    if (it.current()->id() == key)
        return it.current();
     ++it;
   }
Comment 3 Kurt Hindenburg 2004-06-06 01:14:34 UTC
Hmm, this could be done in konsole.cpp Konsole::newSession instead.

  if (key.isEmpty())
    s->setKeymapNo(n_defaultKeytab);
  else
    s->setKeymap(key);

I think the patch in comment #2 will catch all occurances.. since numb2keymap stores the filename without the .keytab.  Will there be a performance hit in find(QString)?
Comment 4 Kurt Hindenburg 2004-06-06 02:46:52 UTC
Index: konsole.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/konsole.cpp,v
retrieving revision 1.463
diff -u -p -r1.463 konsole.cpp
--- konsole.cpp   5 Jun 2004 19:17:27 -0000  1.463
+++ konsole.cpp   6 Jun 2004 00:45:47 -0000
@@ -2701,8 +2701,12 @@ QString Konsole::newSession(KSimpleConfi
   s->setSchemaNo(schmno);
   if (key.isEmpty())
     s->setKeymapNo(n_defaultKeytab);
-  else
+  else {
+    if (key.endsWith(".keytab"))
+      key.remove(".keytab");
     s->setKeymap(key);
+  }
+
   s->setTitle(txt);
   s->setIconName(icon);
   s->setAddToUtmp(b_addToUtmp);
Comment 5 Kurt Hindenburg 2004-06-07 05:00:52 UTC
Created attachment 6266 [details]
Patch to fix KeyTab= filename.

This fixes this bug; however, there is a bigger issue that needs fixed.  See
the patch comments for more info.
1. The schemas are stored internally as name.schema
2. The keytabs are stored as name.

Some consistency would be in order.  

Since this bug is on the 'most hated' this patch should be applied and later
I'll look at the overall view.
Comment 6 Kurt Hindenburg 2004-06-07 18:33:59 UTC
Applied.

Index: konsole.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/konsole.cpp,v
retrieving revision 1.463
diff -u -p -r1.463 konsole.cpp
--- konsole.cpp 5 Jun 2004 19:17:27 -0000       1.463
+++ konsole.cpp 7 Jun 2004 16:23:50 -0000
@@ -2701,8 +2701,13 @@ QString Konsole::newSession(KSimpleConfi
   s->setSchemaNo(schmno);
   if (key.isEmpty())
     s->setKeymapNo(n_defaultKeytab);
-  else
+  else {
+    // TODO: Fixes BR77018, see BR83000.
+    if (key.endsWith(".keytab"))
+      key.remove(".keytab");
     s->setKeymap(key);
+  }
+
   s->setTitle(txt);
   s->setIconName(icon);
   s->setAddToUtmp(b_addToUtmp);