~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/misc/rkjobsequence.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2010-10-04 14:30:00 UTC
  • mfrom: (12.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101004143000-qey73molmxxwy4w6
Tags: 0.5.4-1
* new upstream release
* bump standards version to 3.9.1 (no changes needed)
* no more need to remove svncopy.sh-script in rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          rkjobsequence  -  description
 
3
                             -------------------
 
4
    begin                : Tue May 04
 
5
    copyright            : (C) 2010 by Thomas Friedrichsmeier
 
6
    email                : tfry@users.sourceforge.net
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
#include "rkjobsequence.h"
 
18
 
 
19
#include "../debug.h"
 
20
 
 
21
RKJobSequence::RKJobSequence () : QObject () {
 
22
        RK_TRACE (MISC);
 
23
}
 
24
 
 
25
RKJobSequence::~RKJobSequence () {
 
26
        RK_TRACE (MISC);
 
27
}
 
28
 
 
29
void RKJobSequence::addJob (KJob* job) {
 
30
        RK_TRACE (MISC);
 
31
 
 
32
        outstanding_jobs.append (job);
 
33
        connect (job, SIGNAL (result(KJob*)), this, SLOT(jobDone(KJob*)));
 
34
}
 
35
 
 
36
bool RKJobSequence::hadError () const {
 
37
        RK_TRACE (MISC);
 
38
 
 
39
        return (!_errors.isEmpty ());
 
40
}
 
41
 
 
42
QStringList RKJobSequence::errors () const {
 
43
        RK_TRACE (MISC);
 
44
 
 
45
        return (_errors);
 
46
}
 
47
 
 
48
void RKJobSequence::start () {
 
49
        RK_TRACE (MISC);
 
50
 
 
51
        nextJob ();
 
52
}
 
53
 
 
54
void RKJobSequence::nextJob () {
 
55
        RK_TRACE (MISC);
 
56
 
 
57
        if (outstanding_jobs.isEmpty ()) {
 
58
                emit (finished (this));
 
59
                deleteLater ();
 
60
                return;
 
61
        }
 
62
 
 
63
        outstanding_jobs.first ()->start ();
 
64
}
 
65
 
 
66
void RKJobSequence::jobDone (KJob* job) {
 
67
        RK_TRACE (MISC);
 
68
 
 
69
        outstanding_jobs.removeAll (job);
 
70
        if (job->error ()) {
 
71
                _errors.append (job->errorString ());
 
72
        }
 
73
        nextJob ();
 
74
}
 
75
 
 
76
#include "rkjobsequence.moc"