249
245
QSharedPointer<KNS3::Provider> provider;
250
246
if (isAtticaProviderFile || n.attribute("type").toLower() == "rest") {
252
247
provider = QSharedPointer<KNS3::Provider> (new AtticaProvider(d->categories));
255
249
provider = QSharedPointer<KNS3::Provider> (new StaticXmlProvider);
299
293
foreach (ProviderInformation p, d->providers) {
300
294
if (p.provider->isInitialized()) {
301
// FIXME: other parameters
302
// FIXME use cache, if this request was sent already, take it from the cache
295
if (d->currentRequest.sortMode == Provider::Installed) {
296
// when asking for installed entries, never use the cache
297
p.provider->loadEntries(d->currentRequest);
299
// take entries from cache until there are no more
306
300
EntryInternal::List cache = d->cache->requestFromCache(d->currentRequest);
307
if (!cache.isEmpty()) {
301
while (!cache.isEmpty()) {
308
302
kDebug() << "From cache";
309
303
emit signalEntriesLoaded(cache);
310
d->currentPage = page;
311
d->currentRequest.page = page;
318
kDebug() << "From provider";
319
p.provider->loadEntries(d->currentRequest);
305
d->currentPage = d->currentRequest.page;
306
++d->currentRequest.page;
307
cache = d->cache->requestFromCache(d->currentRequest);
309
// if the cache was empty, request data from provider
310
if (d->currentPage == -1) {
311
kDebug() << "From provider";
312
p.provider->loadEntries(d->currentRequest);
367
361
foreach (ProviderInformation p, d->providers) {
368
362
if (p.provider->isInitialized()) {
369
// FIXME: other parameters
370
// FIXME use cache, if this request was sent already, take it from the cache
371
EntryInternal::List cache = d->cache->requestFromCache(d->currentRequest);
372
if (!cache.isEmpty()) {
373
kDebug() << "From cache";
374
emit signalEntriesLoaded(cache);
376
kDebug() << "From provider";
377
p.provider->loadEntries(d->currentRequest);
363
p.provider->loadEntries(d->currentRequest);
544
529
// FIXME implement warning?
532
bool Engine::userCanVote(const EntryInternal& entry)
534
QSharedPointer<Provider> p = d->providers.value(entry.providerId()).provider;
535
return p->userCanVote();
547
538
void Engine::vote(const EntryInternal& entry, bool positiveVote)
549
540
QSharedPointer<Provider> p = d->providers.value(entry.providerId()).provider;
550
541
p->vote(entry, positiveVote);
544
bool Engine::userCanBecomeFan(const EntryInternal& entry)
546
QSharedPointer<Provider> p = d->providers.value(entry.providerId()).provider;
547
return p->userCanBecomeFan();
553
550
void Engine::becomeFan(const EntryInternal& entry)
555
552
QSharedPointer<Provider> p = d->providers.value(entry.providerId()).provider;