[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] Bugfix for application launcher applet
From:       AndreasWSimon () t-online ! de (Andreas Simon)
Date:       2002-02-23 21:29:46
[Download RAW message or body]

Hi,

here is a patch for the "Application Launcher" applet.
(made against current CVS Head)

* fix bug #20453 "application launcher applet, internet keywords"
* fix bug #22223 "Contributed fix for krunapplet command
  arguments problem"
  This bug report contains a half-year old patch but I didn't
  look at the patch because I was too lazy to decode the
  base64 attachment by hand

Cheers,
Andreas Simon

["runapplet.patch" (runapplet.patch)]

? runapplet.patch
Index: runapplet.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/applets/run/runapplet.cpp,v
retrieving revision 1.19
diff -u -3 -p -r1.19 runapplet.cpp
--- runapplet.cpp	2002/01/23 02:23:35	1.19
+++ runapplet.cpp	2002/02/23 21:21:03
@@ -71,6 +71,7 @@ RunApplet::RunApplet(const QString& conf
 
     // setup history combo
     _input = new KHistoryCombo(this);
+    _input->setDuplicatesEnabled( false );
     _input->setFocus();
     _input->clearEdit();
     _input->lineEdit()->installEventFilter( this );
@@ -200,30 +201,22 @@ void RunApplet::popup_combo()
 
 void RunApplet::run_command(const QString& command)
 {
-    _input->addToHistory(command);
-    _input->clearEdit();
+    QString exec;
+
     kapp->propagateSessionManager();
 
-    // Okay lets get the actual data...
-    // But get it from the combo, not from _filterData,
-    // because in the filter we only put the first 'word' (David)
-    QString cmd = command.stripWhiteSpace();
-
-    // Extract first word (executable name...)
-    QChar ch = cmd[0];
-    int space_pos = cmd.find( ' ' );
-    if( ch != '\'' && ch != '"' && space_pos > -1 &&
-	cmd[space_pos - 1] != '\\' )
-	{
-	    cmd = cmd.left( space_pos );
-	}
-    _filterData->setData( cmd );
-    KURIFilter::self()->filterURI( *(_filterData) );
+    _filterData->setData( _input->currentText().stripWhiteSpace() );
+    QStringList filters;
+    filters << "kurisearchfilter" << "kshorturifilter";
+    KURIFilter::self()->filterURI( *(_filterData), filters );
 
-    QString exec;
+    _input->addToHistory(command);
+    _input->clearEdit();
 
+    QString cmd = (_filterData->uri().isLocalFile() ? _filterData->uri().path():_filterData->uri().url());
+
     // Nothing interesting. Quit!
-    if (cmd.isEmpty()){
+    if ( cmd.isEmpty() ){
 	KMessageBox::sorry(0L, i18n("You have to enter a command to execute "
 				    "or a URL to be opened first."));
 	goto hide;
@@ -249,28 +242,19 @@ void RunApplet::run_command(const QStrin
 		case KURIFilterData::NET_PROTOCOL:
 		case KURIFilterData::HELP:
 		    {
-			(void) new KRun( _filterData->uri() );
+		        (void) new KRun( _filterData->uri() );
 			goto hide;
 		    }
 		case KURIFilterData::EXECUTABLE:
 		case KURIFilterData::SHELL:
 		    {
-			QChar ch = cmd[0];
-			int space_pos = cmd.find( ' ' );
-			if( ch != '\'' && ch != '"' && space_pos > -1 &&
-			    cmd[space_pos - 1] != '\\' )
-			    {
-				exec = cmd.left( space_pos );
-			    } else
-				{
-				    exec = cmd;
-				}
+		        exec = cmd;
+			if( _filterData->hasArgsAndOptions() )
+			  cmd += _filterData->argsAndOptions();
 			break;
 		    }
+		case KURIFilterData::UNKNOWN:
 		case KURIFilterData::ERROR:
-		    KMessageBox::error( 0, _filterData->errorMsg() );
-		    _input->removeFromHistory( _input->currentText() );
-		    goto hide;
 		default:
 		    KMessageBox::sorry( 0, i18n("<qt>The program name or command <b>%1</b>\n"
 						"cannot be found. Please correct the command\n"
@@ -279,7 +263,7 @@ void RunApplet::run_command(const QStrin
 		    goto hide;
 		}
 	}
-    if (KRun::runCommand(cmd, exec, ""))
+    if (KRun::runCommand( cmd, exec, "" ))
 	goto hide;
     else
 	{

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic