When using -e <command> don't save to profile for new tabs.

Currently using -e <command> will cause all new tabs/windows to run
    <command>.  This patch fixes that such that new tabs/windows will start
    the default profile.

    Patch by Gu Rui <chaos.proton@gmail.com> with minor edit by self.
    FIXED-IN: 4.8
    REVIEW: 102602
    CCBUG: 192212
wilder-portage
Kurt Hindenburg 15 years ago
parent e14b2099cc
commit 35fae00159
  1. 37
      src/Application.cpp

@ -130,7 +130,8 @@ int Application::newInstance()
// default profile to be changed
processProfileChangeArgs(args,window);
if ( !args->isSet("tabs-from-file") ) {
if ( !args->isSet("tabs-from-file") )
{
// create new session
Session* session = createSession(window->defaultProfile(),
QString(),
@ -138,8 +139,26 @@ int Application::newInstance()
if ( !args->isSet("close") ) {
session->setAutoClose(false);
}
// run a custom command, don't store it in the default profile.
// Otherwise it will become the default for new tabs.
if ( args->isSet("e") )
{
QStringList arguments;
arguments << args->getOption("e");
for ( int i = 0 ; i < args->count() ; i++ )
arguments << args->arg(i);
QString exec = args->getOption("e");
if (exec.startsWith(QLatin1String("./")))
exec = QDir::currentPath() + exec.mid(1);
session->setProgram(exec);
session->setArguments(arguments);
}
}
else {
else
{
// create new session(s) as described in file
processTabsFromFileArgs(args, window);
}
@ -328,20 +347,6 @@ void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window
defaultProfile = SessionManager::instance()->defaultProfile();
Profile::Ptr newProfile = Profile::Ptr(new Profile(defaultProfile));
newProfile->setHidden(true);
// run a custom command
if ( args->isSet("e") )
{
QStringList arguments;
arguments << args->getOption("e");
for ( int i = 0 ; i < args->count() ; i++ )
arguments << args->arg(i);
QString exec = args->getOption("e");
if (exec.startsWith(QLatin1String("./")))
exec = QDir::currentPath() + exec.mid(1);
newProfile->setProperty(Profile::Command,exec);
newProfile->setProperty(Profile::Arguments,arguments);
}
// change the initial working directory
if( args->isSet("workdir") )

Loading…
Cancel
Save