Esempio n. 1
0
void BoxContainerItem::runCommand(const QString &cmd)
{
    KProcess *process = new KProcess;
    process->setUseShell(true);
    *process << cmd;
    connect(process, SIGNAL(processExited(KProcess *)), this, SLOT(processExited(KProcess *)));
    process->start();
}
Esempio n. 2
0
bool ValgrindDialog::isNewValgrindVersion( ) const
{
  KProcess *proc = new KProcess;
  proc->setUseShell(true);
  *proc << "test \"valgrind-20\" == `valgrind --version | awk -F \\. '{print $1$2}'`";
  proc->start(KProcess::Block);
  if (proc->normalExit())
    return proc->exitStatus();
  return true;
}
Esempio n. 3
0
/**
 * Handles the "Edit->Edit in External Editor" menu command.
 * Invokes an external editor for the current file and line number.
 */
void KScope::slotExtEdit()
{
	QString sCmdLine;
	KProcess proc;

	// Create the command line for the external editor	
	sCmdLine = Config().getExtEditor();
	sCmdLine.replace("%F", m_sCurFilePath);
	sCmdLine.replace("%L", QString::number(m_nCurLine));
	
	// Run the external editor
	proc.setUseShell(true);
	proc << sCmdLine;
	proc.start(KProcess::DontCare);
}
Esempio n. 4
0
bool KNotify::notifyByExecute(const QString &command, const QString &event, const QString &fromApp, const QString &text, int winId, int eventId)
{
    if(!command.isEmpty())
    {
        // kdDebug() << "executing command '" << command << "'" << endl;
        QMap< QChar, QString > subst;
        subst.insert('e', event);
        subst.insert('a', fromApp);
        subst.insert('s', text);
        subst.insert('w', QString::number(winId));
        subst.insert('i', QString::number(eventId));
        QString execLine = KMacroExpander::expandMacrosShellQuote(command, subst);
        if(execLine.isEmpty())
            execLine = command; // fallback

        KProcess p;
        p.setUseShell(true);
        p << execLine;
        p.start(KProcess::DontCare);
        return true;
    }
    return false;
}