Quote arguments containing spaces when expanding the list of arguments

in a ShellCommand.

BUG: 156826
BACKPORT: 4.1

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=837723
This commit is contained in:
Robert Knight
2008-07-25 15:04:34 +00:00
parent fde7b8b4f5
commit f601444514

View File

@@ -66,7 +66,18 @@ ShellCommand::ShellCommand(const QString& command , const QStringList& arguments
}
QString ShellCommand::fullCommand() const
{
return _arguments.join(QChar(' '));
QStringList quotedArgs(_arguments);
for (int i=0;i<quotedArgs.count();i++)
{
QString arg = quotedArgs.at(i);
bool hasSpace = false;
for (int j=0;j<arg.count();j++)
if (arg[j].isSpace())
hasSpace = true;
if (hasSpace)
quotedArgs[i] = '\"' + arg + '\"';
}
return quotedArgs.join(QChar(' '));
}
QString ShellCommand::command() const
{