diff --git a/src/ShellCommand.cpp b/src/ShellCommand.cpp index 2fcaf54a9..4f164156f 100644 --- a/src/ShellCommand.cpp +++ b/src/ShellCommand.cpp @@ -21,6 +21,7 @@ #include "ShellCommand.h" // Qt +#include #include using namespace Konsole; @@ -31,31 +32,7 @@ static bool expandEnv(QString& text); ShellCommand::ShellCommand(const QString& fullCommand) { - bool inQuotes = false; - - QString builder; - - for ( int i = 0 ; i < fullCommand.count() ; i++ ) - { - QChar ch = fullCommand[i]; - - const bool isLastChar = ( i == fullCommand.count() - 1 ); - const bool isQuote = ( ch == '\'' || ch == '\"' ); - - if ( !isLastChar && isQuote ) - inQuotes = !inQuotes; - else - { - if ( (!ch.isSpace() || inQuotes) && !isQuote ) - builder.append(ch); - - if ( (ch.isSpace() && !inQuotes) || ( i == fullCommand.count()-1 ) ) - { - _arguments << builder; - builder.clear(); - } - } - } + _arguments = KShell::splitArgs(fullCommand); } ShellCommand::ShellCommand(const QString& command , const QStringList& arguments) {