bool KSysTrayCmd::start() { // If we have no command we must catching an existing window if ( !command ) { if ( win ) { setTargetWindow( win ); return true; } checkExistingWindows(); if ( win ) { // Window always on top if (onTop) { KWin::setState(win, NET::StaysOnTop); } return true; } errStr = i18n( "No window matching pattern '%1' and no command specified.\n" ) .arg( window ); return false; } // Run the command and watch for its window if ( !startClient() ) { errStr = i18n( "KSysTrayCmd: KShellProcess cannot find a shell." ); clientExited(); return false; } return true; }
void BtsSpawnClient::procFinished(int exitCode) { p->forceKillTimer->stop(); emit clientExited(); qDebug() << "btsync finished with code" << exitCode; if(exitCode != 0 || p->autorestart) { QTimer::singleShot(1000, this, SLOT(startClient())); } }
BtsSpawnClient::~BtsSpawnClient() { if(p->clientProc) { BtsApi api(this); api.shutdown(); p->clientProc->waitForFinished(5000); p->clientProc->terminate(); if(!p->clientProc->waitForFinished(5000)) { p->clientProc->kill(); p->clientProc->waitForFinished(500); } emit clientExited(); } delete p; }