~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to threadweaver/Examples/QProcessJob/QProcessJob.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "QProcessJob.h"
 
2
 
 
3
using namespace ThreadWeaver;
 
4
 
 
5
QProcessJob::QProcessJob ( QObject * parent )
 
6
    : Job ( parent )
 
7
{
 
8
}
 
9
 
 
10
void QProcessJob::run()
 
11
{
 
12
    QProcess m_process;
 
13
 
 
14
    QStringList args;
 
15
    args.append ( "+%H:%m:%S %N" );
 
16
    m_process.start( "date", args );
 
17
 
 
18
    if (  ! m_process.waitForFinished ( -1 ) )
 
19
    {
 
20
        return;
 
21
    }
 
22
 
 
23
    m_result = m_process.readAll();
 
24
 
 
25
    // qDebug ( "'date' returned %s", result.constData() );
 
26
}
 
27
 
 
28
QString QProcessJob::result()
 
29
{
 
30
    Q_ASSERT ( isFinished () );
 
31
    return m_result;
 
32
}
 
33
 
 
34
#include "QProcessJob.moc"