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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
#ifndef __bugsystem_h__
#define __bugsystem_h__
#include "package.h"
#include "bug.h"
#include "bugdetails.h"
#include "bugcache.h"
#include <kurl.h>
#include <qobject.h>
#include <qptrlist.h>
#include <qmap.h>
#include <qpair.h>
class KConfig;
class BugCommand;
class BugServer;
class BugServerConfig;
class BugJob;
class BugSystem : public QObject
{
Q_OBJECT
friend class BugJob;
public:
BugSystem();
virtual ~BugSystem();
static BugSystem *self();
BugCache *cache()const;
BugServer *server() const { return mServer; }
/**
BugSystem takes ownership of the BugServerConfig objects.
*/
void setServerList( const QValueList<BugServerConfig> &servers );
QValueList<BugServer *> serverList();
void setCurrentServer( const QString & );
void retrievePackageList();
void retrieveBugList( const Package &, const QString &component );
void retrieveBugDetails( const Bug & );
/**
* Load the bugs the user reported himself, or for which he is the assigned to person
*/
void retrieveMyBugsList();
/**
Queue a new command.
*/
void queueCommand( BugCommand * );
/**
Forget all commands for a given bug.
*/
void clearCommands( const QString &bug );
/**
Forget all commands for all bugs.
*/
void clearCommands();
/**
Send all commands (generate the mails).
*/
void sendCommands();
void setDisconnected( bool );
bool disconnected() const;
Package::List packageList() const;
Package package( const QString &pkgname ) const;
Bug bug( const Package &pkg, const QString &component, const QString &number ) const;
static void saveQuery( const KURL &url );
static void saveResponse( const QByteArray &d );
static QString lastResponse();
void readConfig( KConfig * );
void writeConfig( KConfig * );
signals:
void packageListAvailable( const Package::List &pkgs );
void bugListAvailable( const Package &pkg, const QString &component, const Bug::List & );
void bugListAvailable( const QString &label, const Bug::List & );
void bugDetailsAvailable( const Bug &, const BugDetails & );
void packageListLoading();
void bugListLoading( const Package &, const QString &component );
void bugListLoading( const QString &label );
void bugDetailsLoading( const Bug & );
void packageListCacheMiss();
void bugListCacheMiss( const Package &package );
void bugListCacheMiss( const QString &label );
void bugDetailsCacheMiss( const Bug & );
void bugDetailsLoadingError();
void infoMessage( const QString &message );
void infoPercent( unsigned long percent );
void commandQueued( BugCommand * );
void commandCanceled( const QString & );
void loadingError( const QString &text );
protected:
BugServer *findServer( const QString &name );
void registerJob( BugJob * );
void connectJob( BugJob * );
void killAllJobs();
protected slots:
void unregisterJob( BugJob * );
private slots:
void setPackageList( const Package::List &pkgs );
void setBugList( const Package &pkg, const QString &component, const Bug::List &bugs );
void setBugDetails( const Bug &bug, const BugDetails &details );
private:
bool m_disconnected;
BugServer *mServer;
QValueList<BugServer *> mServerList;
QPtrList<BugJob> mJobs;
static BugSystem *s_self;
static QString mLastResponse;
};
#endif
/*
* vim:sw=4:ts=4:et
*/
|