[Konsole-devel] [Bug 105754] Invalid Exec in session doesn't appear in session menu

Kurt V.Hindenburg kurt.hindenburg at kdemail.net
Tue May 24 17:07:56 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=105754         
kurt.hindenburg kdemail net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From kurt.hindenburg kdemail net  2005-05-24 19:07 -------
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);



More information about the konsole-devel mailing list