Example #1
0
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;
}
Example #2
0
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()));
	}
}
Example #3
0
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;
}