| Summary: | Invalid Exec in session doesn't appear in session menu | ||
|---|---|---|---|
| Product: | [Applications] konsole | Reporter: | Jaakko Holster <holster> |
| Component: | general | Assignee: | Konsole Developer <konsole-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.5 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Jaakko Holster
2005-05-16 12:21:44 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. > 1) Create new session and save it
You mean in the session editor?
Right. Settings -> Configure Konsole -> Sessions 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 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);
|