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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
/*
This file is part of KOrganizer.
Copyright (c) 2002 Cornelius Schumacher <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KNEWSTUFF_PROVIDER_H
#define KNEWSTUFF_PROVIDER_H
#include <tqcstring.h>
#include <tqdom.h>
#include <tqobject.h>
#include <tqptrlist.h>
#include <tqstring.h>
#include <kurl.h>
namespace KIO { class Job; }
namespace KNS {
/**
* @short KNewStuff provider container.
*
* This class provides accessors for the provider object.
* as used by KNewStuff.
* It should probably not be used directly by the application.
*
* @author Cornelius Schumacher ([email protected])
* \par Maintainer:
* Josef Spillner ([email protected])
*/
class Provider
{
public:
typedef TQPtrList<Provider> List;
/**
* Constructor.
*/
Provider();
/**
* Constructor with XML feed.
*/
Provider( const TQDomElement & );
/**
* Destructor.
*/
~Provider();
/**
* Sets the common name of the provider.
*/
void setName( const TQString & );
/**
* Retrieves the common name of the provider.
*
* @return provider name
*/
TQString name() const;
/**
* Sets the download URL.
*/
void setDownloadUrl( const KURL & );
/**
* Retrieves the download URL.
*
* @return download URL
*/
KURL downloadUrl() const;
/**
* Sets the upload URL.
*/
void setUploadUrl( const KURL & );
/**
* Retrieves the upload URL.
*
* @return upload URL
*/
KURL uploadUrl() const;
/**
* Sets the URL where a user is led if the provider does not support
* uploads.
*
* @see setNoUpload
*/
void setNoUploadUrl( const KURL & );
/**
* Retrieves the URL where a user is led if the provider does not
* support uploads.
*
* @return website URL
*/
KURL noUploadUrl() const;
/**
* Indicate whether provider supports uploads.
*/
void setNoUpload( bool );
/**
* Query whether provider supports uploads.
*
* @return upload support status
*/
bool noUpload() const;
/**
* Sets the URL for an icon for this provider.
* The icon should be in 32x32 format. If not set, the default icon
* of KDialogBase is used.
*/
void setIcon( const KURL & );
/**
* Retrieves the icon URL for this provider.
*
* @return icon URL
*/
KURL icon() const;
protected:
void parseDomElement( const TQDomElement & );
TQDomElement createDomElement( TQDomDocument &, TQDomElement &parent );
private:
TQString mName;
KURL mDownloadUrl;
KURL mUploadUrl;
KURL mNoUploadUrl;
KURL mIcon;
bool mNoUpload;
};
/**
* KNewStuff provider loader.
* This class sets up a list of all possible providers by querying
* the main provider database for this specific application.
* It should probably not be used directly by the application.
*/
class ProviderLoader : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor.
*
* @param parentWidget the parent widget
*/
ProviderLoader( TQWidget *parentWidget );
/**
* Starts asynchronously loading the list of providers of the
* specified type.
*
* @param type data type such as 'kdesktop/wallpaper'.
* @param providerList the URl to the list of providers; if empty
* we first try the ProvidersUrl from KGlobal::config, then we
* fall back to a hardcoded value.
*/
void load( const TQString &type, const TQString &providerList = TQString() );
signals:
/**
* Indicates that the list of providers has been successfully loaded.
*/
void providersLoaded( Provider::List * );
protected slots:
void slotJobData( KIO::Job *, const TQByteArray & );
void slotJobResult( KIO::Job * );
private:
TQWidget *mParentWidget;
TQString mJobData;
Provider::List mProviders;
};
}
#endif
|