summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9process.cpp
blob: d3586569e7ad1e62d77e8698e0a7ee7f47fbe4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// C++ Implementation: k9process
//
// Description: 
//
//
// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "k9process.h"
#include <tqobject.h>
#include <tqapplication.h>
#include <tqeventloop.h>

k9Process::k9Process(TQObject *tqparent, const char *name)
 : KProcess(tqparent, name),m_waitSync(false)
{
   connect(this,TQT_SIGNAL(processExited( KProcess* )),this,TQT_SLOT(slotProcessExited( KProcess* )));
 
}


k9Process::~k9Process()
{
}

void k9Process::sync() {
  m_waitSync=true;
  TQApplication::eventLoop()->enterLoop();
}


void k9Process::slotProcessExited( KProcess * proc) {
   if (m_waitSync) {
   	TQApplication::eventLoop()->exitLoop();
   	m_waitSync=false;	
   }
}

const TQString & k9Process::debug() {
    m_debug="";
    for (int i=0;i<arguments.count();i++ ){
        m_debug +=" "+ *(arguments.at(i));
    }
    return m_debug;
}

bool  k9Process::start (RunMode runmode, Communication comm) {
  m_elapsed.start();
  return KProcess::start(runmode,comm);
}
#include "k9process.moc"


int k9Process::getElapsed() const {
    return m_elapsed.elapsed();
}