Bug 105754 - Invalid Exec in session doesn't appear in session menu
Summary: Invalid Exec in session doesn't appear in session menu
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 1.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 12:21 UTC by Jaakko Holster
Modified: 2005-05-24 19:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaakko Holster 2005-05-16 12:21:44 UTC
Version:           1.5 (using KDE 3.4.0, Debian Package 4:3.4.0-0ubuntu3 (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2)
OS:                Linux (i686) release 2.6.11-1-686

How to re-produce:

1) Create new session and save it
2) Open 'Session' menu
-> problem: the created session is not found in the menu

Restarting konsole doesn't solve the problem. However, new desktop-file can be found in $KDEDIR/share/apps/konsole.
Comment 1 Jaakko Holster 2005-05-16 12:33:53 UTC
There was following line in session's desktop-file:
Exec=somehost.foo

If you replace it with following line, the session will appear in menu:

Exec=ssh somehost.foo

So, it seems that if the command is invalid, konsole excludes the session from the menu. That's ok, but a message box 'sorry, your command is invalid etc' would make the user happier.
Comment 2 Stephan Binner 2005-05-18 06:55:42 UTC
> 1) Create new session and save it

You mean in the session editor?
Comment 3 Jaakko Holster 2005-05-18 10:37:20 UTC
Right. Settings -> Configure Konsole -> Sessions

Comment 4 Kurt Hindenburg 2005-05-24 07:39:54 UTC
Yes, the invalid session still shows up in the Configure->session list, but doesn't show up in the Session Menu List.  I had thought at one time I had a popup; but it appears it just prints a warning:

konsole: WARNING: Unable to use /home/kvh/.kdehome-cvs/share/apps/konsole/Linux Console4.desktop

Comment 5 Kurt Hindenburg 2005-05-24 19:07:53 UTC
SVN commit 417792 by hindenburg:

Display a warning message if user enters an invalid Execute command in the Session editor.

BUG: 105754 



 M  +26 -0     sessioneditor.cpp  


--- trunk/KDE/kdebase/kcontrol/konsole/sessioneditor.cpp #417791:417792
@@ -31,6 +31,8 @@
 #include <kurlrequester.h>
 #include <klineedit.h>
 #include <kiconloader.h>
+#include <krun.h>
+#include <kshell.h>
 
 // SessionListBoxText is a list box text item with session filename
 class SessionListBoxText : public QListBoxText
@@ -285,6 +287,30 @@
 
 void SessionEditor::saveCurrent()
 {
+  // Verify Execute entry is valid; otherwise Konsole will ignore it.
+  // This code is take from konsole.cpp; if you change one, change both.
+  QString exec = executeLine->text();
+  if ( exec.startsWith( "su -c \'" ) ) {
+     exec = exec.mid( 7, exec.length() - 8 );
+  }
+  exec = KRun::binaryName( exec, false );
+  exec = KShell::tildeExpand( exec );
+  QString pexec = KGlobal::dirs()->findExe( exec );
+
+  if ( pexec.isEmpty() )
+  {
+    int result = KMessageBox::warningContinueCancel( this,
+            i18n( "The Execute entry is not a valid command.\n"
+			"You can still save this session, but it will not show up in Konsole's Session list." ),
+			i18n( "Invalid Execute entry" ),
+			KStdGuiItem::save() );
+    if ( result != KMessageBox::Continue )
+    {
+        return;
+    }
+
+  }
+
   QString fullpath;
   if (sessionList->currentText() == nameLine->text()) {
     fullpath = ( ((SessionListBoxText *)sessionList->item( sessionList->currentItem() ))->filename() ).section('/',-1);