Bug 52176

Summary: after ALT+F2: can't get rid of "Run in terminal"
Product: kdesktop Reporter: Andreas Leuner <almighty>
Component: generalAssignee: David Faure <faure>
Status: CLOSED FIXED    
Severity: normal CC: finex
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: for kdebase/kdesktop/minicli.cpp
fixes terminal app checkbox

Description Andreas Leuner 2002-12-22 00:00:22 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

steps to reproduce:

1. Press ALT+F2 to open the "Run command" dialog
2. Enter e.g. "konsole" and check "Run in terminal" in the "Options", click "Run"
Konsole will start from a terminal

3. [Quit kmail]
4. Press ALT+F2 to open the "Run command" dialog
5. Enter "konsole" and _uncheck_ "Run in terminal" in the "Options", click "Run"

Konsole will again start from a terminal.

You'll have to logout and manually edit $KDEHOME/share/config/kdesktoprc to remove 
konsole from the TerminalApps list.
Comment 1 Stephan Kulow 2002-12-22 12:43:11 UTC
funny bug 
Comment 2 Andreas Leuner 2002-12-22 16:16:43 UTC
Created attachment 641 [details]
for kdebase/kdesktop/minicli.cpp

Really :-)

I fixed this for me. The attached patch implements the "ability" to run
applications that were run in a terminal to run without a terminal.

It also eliminates another sort of strange behavior. Steps to reproduce:
1. Press ALT+F2 to open the "Run command" dialog
2. Enter e.g. "ls" (or another app already known as a terminal app)
3. Open the advanced options
4. Type in another command or scroll through the command history

The "Run in terminal" checkbox will remain checked during step 4.

OK, as I already said, the patch fixes it for me. It even contains some
explaining comments.

Hope it helps,
Andreas Leuner
Comment 3 David Faure 2002-12-23 10:55:35 UTC
Subject: kdebase/kdesktop

CVS commit by faure: 

Applied patch from BR 52176, can't get rid of "Run in terminal".
Thanks to Andreas Leuner <almighty at atlantis.wh2.tu-dresden.de>
CCMAIL: 52176-done@bugs.kde.org


  M +24 -11    minicli.cpp   1.139


--- kdebase/kdesktop/minicli.cpp  #1.138:1.139
@@ -244,5 +244,4 @@ int Minicli::runCommand()
     }
 
-    bool useTerminal = mpAdvanced && mpAdvanced->terminal();
     QString cmdNoArgs = cmd.stripWhiteSpace();
     {
@@ -251,14 +250,18 @@ int Minicli::runCommand()
           cmdNoArgs.truncate(i);
     }
+    
+    bool useTerminal;
     if (!mpAdvanced || mpAdvanced->isHidden()) // Advanced options have not been touched
-    {
-       if (terminalAppList.contains(cmdNoArgs))
-          useTerminal = true;
-    }
-    else if (!mpAdvanced->needsKDEsu())
+       // take the stored setting
+       useTerminal = terminalAppList.contains(cmdNoArgs);
+    else 
     {
        terminalAppList.remove(cmdNoArgs);
-       if (useTerminal)
+       
+       if (useTerminal = mpAdvanced->terminal())
           terminalAppList.append(cmdNoArgs);
+          
+       /*Now the terminalAppList will contain cmdNoArgs iff the checkbox is marked 
+         (provided it is seen by the user)*/
     }
 
@@ -453,4 +456,17 @@ void Minicli::slotCmdChanged(const QStri
         return;
     }
+    else
+    {
+      QString cmdNoArgs = text.stripWhiteSpace();
+      {
+        int i = cmdNoArgs.find(' ');
+        if (i != -1)
+            cmdNoArgs.truncate(i);
+      }
+    
+      // Look if the new app is a TerminalApp
+      if (mpAdvanced)
+        mpAdvanced->slotTerminal(terminalAppList.contains(cmdNoArgs));
+    }
 
     m_parseTimer->start(250, true);
@@ -478,6 +494,5 @@ void Minicli::slotAdvanced()
            if (i != -1)
                cmdNoArgs.truncate(i);
-           if (terminalAppList.contains(cmdNoArgs))
-              mpAdvanced->slotTerminal(true);
+           mpAdvanced->slotTerminal(terminalAppList.contains(cmdNoArgs));
         }
 
@@ -530,6 +545,4 @@ void Minicli::parseLine( bool final )
            if (i != -1)
                cmdNoArgs.truncate(i);
-           if (terminalAppList.contains(cmdNoArgs))
-              mpAdvanced->slotTerminal(true);
          }
     }


Comment 4 hughjonesd 2003-01-29 17:48:15 UTC
this bug remains for me in 3.1, using the Suse 8.0 RPMs 
Comment 5 Andreas Leuner 2003-01-29 19:35:03 UTC
As I learn from looking into the webcvs the patch has only been applied to CVS
HEAD almost directly after the KDE_3_1_BRANCH had been created. Everything
changed between the current KDE_3_1_BRANCH version and "my" change is trivial. 

My patch will apply cleanly to the current KDE_3_1_BRANCH. Although I haven't
tested if it would compile or even work I strongly suppose so. 

Could someone check it in, please?
Comment 6 David Faure 2003-01-29 21:29:32 UTC
Subject: KDE_3_1_BRANCH: kdebase/kdesktop

CVS commit by faure: 

Backporting -r1.139:
Patch from BR 52176, can't get rid of "Run in terminal". 
 Thanks to Andreas Leuner <almighty at atlantis.wh2.tu-dresden.de> 
CCMAIL: 52176@bugs.kde.org


  M +24 -11    minicli.cpp   1.136.2.2


--- kdebase/kdesktop/minicli.cpp  #1.136.2.1:1.136.2.2
@@ -244,5 +244,4 @@ int Minicli::runCommand()
     }
 
-    bool useTerminal = mpAdvanced && mpAdvanced->terminal();
     QString cmdNoArgs = cmd.stripWhiteSpace();
     {
@@ -251,14 +250,18 @@ int Minicli::runCommand()
           cmdNoArgs.truncate(i);
     }
+    
+    bool useTerminal;
     if (!mpAdvanced || mpAdvanced->isHidden()) // Advanced options have not been touched
-    {
-       if (terminalAppList.contains(cmdNoArgs))
-          useTerminal = true;
-    }
-    else if (!mpAdvanced->needsKDEsu())
+       // take the stored setting
+       useTerminal = terminalAppList.contains(cmdNoArgs);
+    else 
     {
        terminalAppList.remove(cmdNoArgs);
-       if (useTerminal)
+       
+       if (useTerminal = mpAdvanced->terminal())
           terminalAppList.append(cmdNoArgs);
+          
+       /*Now the terminalAppList will contain cmdNoArgs iff the checkbox is marked 
+         (provided it is seen by the user)*/
     }
 
@@ -453,4 +456,17 @@ void Minicli::slotCmdChanged(const QStri
         return;
     }
+    else
+    {
+      QString cmdNoArgs = text.stripWhiteSpace();
+      {
+        int i = cmdNoArgs.find(' ');
+        if (i != -1)
+            cmdNoArgs.truncate(i);
+      }
+    
+      // Look if the new app is a TerminalApp
+      if (mpAdvanced)
+        mpAdvanced->slotTerminal(terminalAppList.contains(cmdNoArgs));
+    }
 
     m_parseTimer->start(250, true);
@@ -478,6 +494,5 @@ void Minicli::slotAdvanced()
            if (i != -1)
                cmdNoArgs.truncate(i);
-           if (terminalAppList.contains(cmdNoArgs))
-              mpAdvanced->slotTerminal(true);
+           mpAdvanced->slotTerminal(terminalAppList.contains(cmdNoArgs));
         }
 
@@ -530,6 +545,4 @@ void Minicli::parseLine( bool final )
            if (i != -1)
                cmdNoArgs.truncate(i);
-           if (terminalAppList.contains(cmdNoArgs))
-              mpAdvanced->slotTerminal(true);
          }
     }


Comment 7 Andreas Leuner 2003-08-12 22:15:50 UTC
The behavior I described in comment #2 occurs again in current HEAD. 
Comment 8 Andreas Leuner 2003-08-12 22:22:31 UTC
Created attachment 2224 [details]
fixes terminal app checkbox
Comment 9 Aaron J. Seigo 2003-09-09 10:54:42 UTC
*** Bug has been marked as fixed ***.
Comment 10 FiNeX 2009-01-02 20:21:00 UTC
Bug closed. Kdesktop is no more mantained.