Commit aa75fc8f authored by Jekyll Wu's avatar Jekyll Wu

konsole -e 'man ls' should work as expected

BUG: 295648
FIXED-IN: 4.9.0
parent cd090f2d
......@@ -38,6 +38,7 @@
#include "SessionManager.h"
#include "MainWindow.h"
#include "Session.h"
#include "ShellCommand.h"
using namespace Konsole;
......@@ -375,12 +376,25 @@ Profile::Ptr Application::processProfileChangeArgs(KCmdLineArgs* args, Profile::
// run a custom command
if ( args->isSet("e") ) {
QString commandExec;
QStringList commandArguments;
commandArguments << args->getOption("e");
for ( int i = 0 ; i < args->count() ; i++ )
commandArguments << args->arg(i);
QString commandExec = args->getOption("e");
// Note: KCmdLineArgs::count() return the number of arguments
// that aren't options.
if ( args->count() > 0 ) { // example: konsole -e man ls
commandExec = args->getOption("e");
commandArguments << commandExec;
for ( int i = 0 ; i < args->count() ; i++ )
commandArguments << args->arg(i);
} else { // example: konsole -e "man ls"
ShellCommand shellCommand(args->getOption("e"));
commandExec = shellCommand.command();
commandArguments = shellCommand.arguments();
}
if (commandExec.startsWith(QLatin1String("./")))
commandExec = QDir::currentPath() + commandExec.mid(1);
......
......@@ -23,6 +23,9 @@
// Qt
#include <QtCore/QStringList>
// Konsole
#include "konsole_export.h"
namespace Konsole
{
......@@ -47,7 +50,7 @@ namespace Konsole
* </li>
* </ul>
*/
class ShellCommand
class KONSOLEPRIVATE_EXPORT ShellCommand
{
public:
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment