~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/akonadiconsole/jobtracker.h

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2009-07-10 06:34:50 UTC
  • mfrom: (1.1.40 upstream)
  • Revision ID: james.westby@ubuntu.com-20090710063450-neojgew2fh0n3y0u
Tags: 4:4.2.96-0ubuntu1
* New upstream release
* Bump kde build-deps to 4.2.96

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 This file is part of Akonadi.
3
 
 
4
 
 Copyright (c) 2009 Till Adam <adam@kde.org>
5
 
 
6
 
 This program is free software; you can redistribute it and/or modify
7
 
 it under the terms of the GNU General Public License as published by
8
 
 the Free Software Foundation; either version 2 of the License, or
9
 
 (at your option) any later version.
10
 
 
11
 
 This program is distributed in the hope that it will be useful,
12
 
 but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 
 GNU General Public License for more details.
15
 
 
16
 
 You should have received a copy of the GNU General Public License
17
 
 along with this program; if not, write to the Free Software
18
 
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19
 
 USA.
20
 
 */
21
 
 
22
 
#ifndef JOBTRACKER_H_
23
 
#define JOBTRACKER_H_
24
 
 
25
 
#include <QtCore/QObject>
26
 
#include <QtCore/QDateTime>
27
 
 
28
 
class JobInfo
29
 
{
30
 
public:
31
 
  JobInfo() :parent(-1)
32
 
  {}
33
 
  bool operator==( const JobInfo& other )
34
 
  {
35
 
      return id == other.id
36
 
          && parent == other.parent
37
 
          && type == other.type
38
 
          && timestamp == other.timestamp
39
 
          && state == other.state;
40
 
  }
41
 
 
42
 
  QString id;
43
 
  int parent;
44
 
  QString type;
45
 
  QDateTime timestamp;
46
 
  enum JobState
47
 
  {
48
 
      Initial = 0,
49
 
      Running,
50
 
      Ended,
51
 
      Failed
52
 
  };
53
 
  JobState state;
54
 
  QString error;
55
 
  QString stateAsString() const;
56
 
};
57
 
 
58
 
class JobTracker : public QObject
59
 
{
60
 
  Q_OBJECT
61
 
  Q_CLASSINFO( "D-Bus Interface", "org.freedesktop.Akonadi.JobTracker" )
62
 
public:
63
 
  JobTracker( const char *name, QObject* parent = 0 );
64
 
  ~JobTracker();
65
 
  QStringList sessions() const;
66
 
 
67
 
  /** Returns the list of (sub)jobs of a session or another job. */
68
 
  QList<JobInfo> jobs( const QString& parent ) const;
69
 
  QList<JobInfo> jobs( int id ) const;
70
 
 
71
 
  int idForJob( const QString& job ) const;
72
 
  QString jobForId( int id ) const;
73
 
  int idForSession( const QString& session ) const;
74
 
  QString sessionForId( int id ) const;
75
 
  int parentId( int id ) const;
76
 
 
77
 
  JobInfo info( const QString& job ) const;
78
 
  JobInfo info( int ) const;
79
 
 
80
 
  bool isEnabled() const;
81
 
Q_SIGNALS:
82
 
  void updated();
83
 
 
84
 
public Q_SLOTS:
85
 
  Q_SCRIPTABLE void jobCreated( const QString & session, const QString & job, const QString& parentJob, const QString & jobType );
86
 
  Q_SCRIPTABLE void jobStarted( const QString & job );
87
 
  Q_SCRIPTABLE void jobEnded( const QString & job, const QString &error );
88
 
  Q_SCRIPTABLE void reset();
89
 
  Q_SCRIPTABLE void setEnabled( bool on );
90
 
 
91
 
private:
92
 
  class Private;
93
 
  Private * const d;
94
 
};
95
 
 
96
 
#endif /* JOBTRACKER_H_ */