Changeset View
Changeset View
Standalone View
Standalone View
src/core/provider.h
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | #ifndef KNEWSTUFF3_PROVIDER_P_H | 20 | #ifndef KNEWSTUFF3_PROVIDER_P_H | ||
21 | #define KNEWSTUFF3_PROVIDER_P_H | 21 | #define KNEWSTUFF3_PROVIDER_P_H | ||
22 | 22 | | |||
23 | #include <QList> | 23 | #include <QList> | ||
24 | #include <QString> | 24 | #include <QString> | ||
25 | #include <QUrl> | 25 | #include <QUrl> | ||
26 | 26 | | |||
27 | #include <memory> | ||||
28 | | ||||
27 | #include "entryinternal.h" | 29 | #include "entryinternal.h" | ||
28 | #include "errorcode.h" | 30 | #include "errorcode.h" | ||
29 | 31 | | |||
30 | #include "knewstuffcore_export.h" | 32 | #include "knewstuffcore_export.h" | ||
31 | 33 | | |||
32 | class KJob; | 34 | class KJob; | ||
33 | 35 | | |||
34 | namespace KNSCore | 36 | namespace KNSCore | ||
35 | { | 37 | { | ||
38 | struct Comment; | ||||
36 | /** | 39 | /** | ||
37 | * @short KNewStuff Base Provider class. | 40 | * @short KNewStuff Base Provider class. | ||
38 | * | 41 | * | ||
39 | * This class provides accessors for the provider object. | 42 | * This class provides accessors for the provider object. | ||
40 | * It should not be used directly by the application. | 43 | * It should not be used directly by the application. | ||
41 | * This class is the base class and will be instantiated for | 44 | * This class is the base class and will be instantiated for | ||
42 | * static website providers. | 45 | * static website providers. | ||
43 | * | 46 | * | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 54 | public: | |||
139 | * @param searchstring string to search with | 142 | * @param searchstring string to search with | ||
140 | * @param page page number to load | 143 | * @param page page number to load | ||
141 | * | 144 | * | ||
142 | * Note: the engine connects to loadingFinished() signal to get the result | 145 | * Note: the engine connects to loadingFinished() signal to get the result | ||
143 | */ | 146 | */ | ||
144 | virtual void loadEntries(const KNSCore::Provider::SearchRequest &request) = 0; | 147 | virtual void loadEntries(const KNSCore::Provider::SearchRequest &request) = 0; | ||
145 | virtual void loadEntryDetails(const KNSCore::EntryInternal &) {} | 148 | virtual void loadEntryDetails(const KNSCore::EntryInternal &) {} | ||
146 | virtual void loadPayloadLink(const EntryInternal &entry, int linkId) = 0; | 149 | virtual void loadPayloadLink(const EntryInternal &entry, int linkId) = 0; | ||
150 | /** | ||||
pino: BIC change, you cannot add virtual functions in a public class | |||||
That's a fair bit more annoying... Oh well, signal-based workaround it is, i guess (not like we have a lot of providers anyway ;) ) leinir: That's a fair bit more annoying... Oh well, signal-based workaround it is, i guess (not like we… | |||||
151 | * Request a loading of comments from this provider. The engine listens to the | ||||
152 | * commentsLoaded() signal for the result | ||||
153 | * | ||||
154 | * @note Implementation detail: All subclasses should connect to this signal | ||||
155 | * and point it at a slot which does the actual work, if they support comments. | ||||
156 | * | ||||
157 | * TODO: KF6 This should be a virtual function, but can't do it now because BIC | ||||
158 | * @see commentsLoaded(const QList<shared_ptr<KNSCore::Comment>> comments) | ||||
159 | * @since 5.62 | ||||
160 | */ | ||||
161 | Q_SIGNAL void loadComments(const EntryInternal &entry, int commentsPerPage, int page); | ||||
162 | /** | ||||
163 | * Request loading of the details for a specific person with the given username. | ||||
164 | * The engine listens to the personLoaded() for the result | ||||
165 | * | ||||
166 | * @note Implementation detail: All subclasses should connect to this signal | ||||
167 | * and point it at a slot which does the actual work, if they support comments. | ||||
168 | * | ||||
169 | * TODO: KF6 This should be a virtual function, but can't do it now because BIC | ||||
170 | * @since 5.62 | ||||
171 | */ | ||||
172 | Q_SIGNAL void loadPerson(const QString& username); | ||||
147 | 173 | | |||
148 | virtual bool userCanVote() | 174 | virtual bool userCanVote() | ||
149 | { | 175 | { | ||
150 | return false; | 176 | return false; | ||
151 | } | 177 | } | ||
152 | virtual void vote(const EntryInternal &entry, uint rating) | 178 | virtual void vote(const EntryInternal &entry, uint rating) | ||
153 | { | 179 | { | ||
154 | Q_UNUSED(entry) Q_UNUSED(rating) | 180 | Q_UNUSED(entry) Q_UNUSED(rating) | ||
Show All 40 Lines | |||||
195 | Q_SIGNALS: | 221 | Q_SIGNALS: | ||
196 | void providerInitialized(KNSCore::Provider *); | 222 | void providerInitialized(KNSCore::Provider *); | ||
197 | 223 | | |||
198 | void loadingFinished(const KNSCore::Provider::SearchRequest &, const KNSCore::EntryInternal::List &) const; | 224 | void loadingFinished(const KNSCore::Provider::SearchRequest &, const KNSCore::EntryInternal::List &) const; | ||
199 | void loadingFailed(const KNSCore::Provider::SearchRequest &); | 225 | void loadingFailed(const KNSCore::Provider::SearchRequest &); | ||
200 | 226 | | |||
201 | void entryDetailsLoaded(const KNSCore::EntryInternal &); | 227 | void entryDetailsLoaded(const KNSCore::EntryInternal &); | ||
202 | void payloadLinkLoaded(const KNSCore::EntryInternal &); | 228 | void payloadLinkLoaded(const KNSCore::EntryInternal &); | ||
229 | /** | ||||
230 | * Fired when new comments have been loaded | ||||
231 | * @param comments The list of newly loaded comments, in a depth-first order | ||||
232 | * @since 5.62 | ||||
233 | */ | ||||
234 | void commentsLoaded(const QList<std::shared_ptr<KNSCore::Comment>> comments); | ||||
235 | /** | ||||
236 | * Fired when the details of a person have been loaded | ||||
237 | * @param author The person we've just loaded data for | ||||
238 | * @since 5.62 | ||||
239 | */ | ||||
240 | void personLoaded(const std::shared_ptr<KNSCore::Author> author); | ||||
203 | 241 | | |||
204 | void signalInformation(const QString &) const; | 242 | void signalInformation(const QString &) const; | ||
205 | void signalError(const QString &) const; | 243 | void signalError(const QString &) const; | ||
206 | void signalErrorCode(const KNSCore::ErrorCode &errorCode, const QString &message, const QVariant &metadata) const; | 244 | void signalErrorCode(const KNSCore::ErrorCode &errorCode, const QString &message, const QVariant &metadata) const; | ||
207 | 245 | | |||
208 | void categoriesMetadataLoded(const QList<CategoryMetadata> &categories); | 246 | void categoriesMetadataLoded(const QList<CategoryMetadata> &categories); | ||
209 | 247 | | |||
210 | protected: | 248 | protected: | ||
Show All 11 Lines |
BIC change, you cannot add virtual functions in a public class