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

List:       kde-commits
Subject:    KDE/kdelibs/kate/script
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2010-02-14 16:19:46
Message-ID: 1266164386.578399.21305.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1090086 by dhaumann:

add support for quoting in command line scripts

 M  +9 -1      katecommandlinescript.cpp  


--- trunk/KDE/kdelibs/kate/script/katecommandlinescript.cpp #1090085:1090086
@@ -26,6 +26,7 @@
 #include "katedocument.h"
 #include "kateview.h"
 #include "katecmd.h"
+#include "kshell.h"
 
 KateCommandLineScript::KateCommandLineScript(const QString &url, const \
KateCommandLineScriptHeader &header)  : KateScript(url)
@@ -78,7 +79,14 @@
 
 bool KateCommandLineScript::exec (KTextEditor::View *view, const QString &_cmd, \
QString &errorMsg)  {
-  QStringList args(_cmd.split(QRegExp("\\s+"), QString::SkipEmptyParts));
+  KShell::Errors errorCode;
+  QStringList args(KShell::splitArgs(_cmd, KShell::NoOptions, &errorCode));
+
+  if (errorCode != KShell::NoError) {
+    errorMsg = i18n("Bad quoting in call: %1. Please escape single quotes with a \
backslash.", _cmd); +    return false;
+  }
+
   QString cmd(args.first());
   args.removeFirst();
 


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

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