2 This file is part of Akonadi.
4 Copyright (c) 2009 KDAB
5 Author: Till Adam <adam@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #include <QtCore/QObject>
27 #include <QtCore/QDateTime>
28 #include <QtCore/QList>
29 #include <QtCore/QPair>
36 bool operator==( const JobInfo
& other
)
39 && parent
== other
.parent
41 && timestamp
== other
.timestamp
42 && state
== other
.state
;
58 QString
stateAsString() const;
61 class JobTracker
: public QObject
64 Q_CLASSINFO( "D-Bus Interface", "org.freedesktop.Akonadi.JobTracker" )
67 explicit JobTracker( const char *name
, QObject
* parent
= 0 );
69 QStringList
sessions() const;
71 /** Returns the list of (sub)jobs of a session or another job. */
72 QList
<JobInfo
> jobs( const QString
& parent
) const;
73 QList
<JobInfo
> jobs( int id
) const;
75 int idForJob( const QString
& job
) const;
76 QString
jobForId( int id
) const;
77 int idForSession( const QString
& session
) const;
78 QString
sessionForId( int id
) const;
79 int parentId( int id
) const;
81 JobInfo
info( const QString
& job
) const;
82 JobInfo
info( int ) const;
84 bool isEnabled() const;
87 /** Emitted when jobs (or sessiona) have been added to the tracker.
88 * The format is a list of pairs consisting of the position of the
89 * job or session relative to the parent and the id of that parent.
90 * This makes it easy for the model to find and update the right
91 * part of the model, for efficiency.
93 void added( const QList
< QPair
<int, int> >& additions
);
95 /** Emitted when jobs (or sessiona) have been updated in the tracker.
96 * The format is a list of pairs consisting of the position of the
97 * job or session relative to the parent and the id of that parent.
98 * This makes it easy for the model to find and update the right
99 * part of the model, for efficiency.
101 void updated( const QList
< QPair
<int, int> >& updates
);
106 Q_SCRIPTABLE
void jobCreated( const QString
& session
, const QString
& job
, const QString
& parentJob
, const QString
& jobType
);
107 Q_SCRIPTABLE
void jobStarted( const QString
& job
);
108 Q_SCRIPTABLE
void jobEnded( const QString
& job
, const QString
&error
);
109 Q_SCRIPTABLE
void triggerReset();
110 Q_SCRIPTABLE
void setEnabled( bool on
);
113 void signalUpdates();
120 #endif /* JOBTRACKER_H_ */