void EditorsDialog::startjob(QString strDir) { kdDebug(9006) << "EditorsDialog::start() workDir = " << strDir << endl; DCOPRef job = m_cvsService->editors( strDir ); m_cvsJob = new CvsJob_stub( job.app(), job.obj() ); // establish connections to the signals of the cvs m_job connectDCOPSignal( job.app(), job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true ); // We'll read the ouput directly from the job ... connectDCOPSignal( job.app(), job.obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true ); kdDebug(9006) << "Running: " << m_cvsJob->cvsCommand() << endl; m_cvsJob->execute(); }
void CVSLogPage::startLog( const QString &workDir, const QString &pathName ) { kdDebug(9006) << "CVSLogPage::start() here! workDir = " << workDir << ", pathName = " << pathName << endl; // CvsOptions *options = CvsOptions::instance(); // "cvs log" needs to be done on relative-path basis m_pathName = pathName; m_diffStrings.clear(); DCOPRef job = m_cvsService->log( pathName ); m_cvsLogJob = new CvsJob_stub( job.app(), job.obj() ); // establish connections to the signals of the cvs m_job connectDCOPSignal( job.app(), job.obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true ); // We'll read the ouput directly from the job ... connectDCOPSignal( job.app(), job.obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true ); // connectDCOPSignal( job.app(), job.obj(), "receivedStderr(QString)", "slotReceivedErrors(QString)", true ); kdDebug(9006) << "Running: " << m_cvsLogJob->cvsCommand() << endl; m_cvsLogJob->execute(); }
bool CvsProcessWidget::startJob( const DCOPRef &aJob ) { kdDebug(9006) << "CvsProcessWidget::startJob(const DCOPRef &) here!" << endl; clear(); m_part->mainWindow()->raiseView( this ); m_part->core()->running( m_part, true ); // create a DCOP stub for the non-concurrent cvs job if (m_job) { delete m_job; m_job = 0; } m_job = new CvsJob_stub( aJob.app(), aJob.obj() ); // establish connections to the signals of the cvs m_job connectDCOPSignal( m_job->app(), m_job->obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true ); connectDCOPSignal( m_job->app(), m_job->obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true ); connectDCOPSignal( m_job->app(), m_job->obj(), "receivedStderr(QString)", "slotReceivedErrors(QString)", true ); // get command line and add it to output buffer QString cmdLine = m_job->cvsCommand(); m_part->mainWindow()->statusBar()->message( cmdLine ); kdDebug(9006) << "Running: " << cmdLine << endl; // disconnect 3rd party slots from our signals disconnect( SIGNAL(jobFinished(bool, int)) ); showInfo( i18n("Started job: %1").arg( cmdLine ) ); #ifdef MYDCOPDEBUG g_dcopExitCounter = 0; g_dcopOutCounter = 0; g_dcopErrCounter = 0; #endif return m_job->execute(); }
DCOPStub::DCOPStub( const DCOPRef& ref ) : m_app( ref.app() ), m_obj( ref.obj() ), m_status( CallSucceeded ),d(0) { }
DCOPRef::DCOPRef(const DCOPRef &ref) : d(ref.d) { m_app = ref.app(); m_obj = ref.obj(); m_type = ref.type(); }
int run(DCOPRef& ref) { DCOPClient *client = KApplication::dcopClient(); // Disable completion for now. We might want to add completion of JS // keywords and Kst objects at some point. rl_bind_key('\t', rl_insert); kstName = ref.app(); #ifndef SOLARIS signal(SIGALRM, &ping); itimerval tv = { { 1, 0 }, { 1, 0 } }; itimerval old; setitimer(ITIMER_REAL, &tv, &old); #endif for (;;) { if (!client->registeredApplications().contains(kstName)) { printf("%s", _T("Kst application process has terminated.\n")); return ERR_KST_TERMINATED; } char *l = 0L; const char *prompt = "kst> "; QString line; do { if (!line.isEmpty()) { // replace \ with \n line[line.length() - 1] = '\n'; } l = readline(prompt); prompt = ""; if (!l) { return 0; } line += QString(l); free(l); l = 0L; } while (line.endsWith("\\")); QString clean = line.stripWhiteSpace(); if (clean == "exit") { return ERR_NONE; } if (clean == "session") { printf("%s\n", ref.app().data()); continue; } if (clean == "help") { printf("%s", _T("Help:\n")); printf("%s", _T("session\t\t\t\tDisplay the name of the session in use\n")); printf("%s", _T("help\t\t\t\tDisplay help\n")); printf("%s", _T("exit\t\t\t\tExit the command-line interpreter\n")); continue; } if (clean.isEmpty()) { continue; } add_history(line.latin1()); DCOPReply r = ref.call("evaluate", clean); if (r.isValid()) { QString res; r.get(res); if (!res.isEmpty()) { printf("%s\n", res.latin1()); } } } }