• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • knewstuff
  • knewstuff3
  • attica
atticaprovider.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KNEWSTUFF3_ATTICA_PROVIDER_H
18#define KNEWSTUFF3_ATTICA_PROVIDER_H
19
20#include <QtCore/QSet>
21#include <QtCore/QPointer>
22
23#include <attica/providermanager.h>
24#include <attica/provider.h>
25
26#include "core/provider.h"
27
28namespace Attica {
29 class BaseJob;
30}
31
32namespace KNS3
33{
46 class AtticaProvider: public Provider
47 {
48 Q_OBJECT
49 public:
50 AtticaProvider(const QStringList& categories);
51 AtticaProvider(const Attica::Provider& provider, const QStringList& categories);
52
53 virtual QString id() const;
54
58 virtual bool setProviderXML(const QDomElement & xmldata);
59
60 virtual bool isInitialized() const;
61 virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries);
62
63 virtual void loadEntries(const KNS3::Provider::SearchRequest& request);
64 virtual void loadEntryDetails(const KNS3::EntryInternal& entry);
65 virtual void loadPayloadLink(const EntryInternal& entry, int linkId);
66
67 virtual bool userCanVote() {return true;}
68 virtual void vote(const EntryInternal& entry, uint rating);
69
70 virtual bool userCanBecomeFan() {return true;}
71 virtual void becomeFan(const EntryInternal& entry);
72
73 private Q_SLOTS:
74 void providerLoaded(const Attica::Provider& provider);
75 void listOfCategoriesLoaded(Attica::BaseJob*);
76 void categoryContentsLoaded(Attica::BaseJob* job);
77 void downloadItemLoaded(Attica::BaseJob* job);
78 void accountBalanceLoaded(Attica::BaseJob* job);
79 void authenticationCredentialsMissing(const Provider&);
80 void votingFinished(Attica::BaseJob*);
81 void becomeFanFinished(Attica::BaseJob* job);
82 void detailsLoaded(Attica::BaseJob* job);
83
84 private:
85 void checkForUpdates();
86 EntryInternal::List installedEntries() const;
87 bool jobSuccess(Attica::BaseJob* job) const;
88
89 Attica::Provider::SortMode atticaSortMode(const SortMode& sortMode);
90
91 EntryInternal entryFromAtticaContent(const Attica::Content&);
92
93 // the attica categories we are interested in (e.g. Wallpaper, Application, Vocabulary File...)
94 QHash<QString, Attica::Category> mCategoryMap;
95
96 Attica::ProviderManager m_providerManager;
97 Attica::Provider m_provider;
98
99 KNS3::EntryInternal::List mCachedEntries;
100 QHash<QString, Attica::Content> mCachedContent;
101
102 // Associate job and entry, this is needed when fetching
103 // download links or the account balance in order to continue
104 // when the result is there.
105 QHash<Attica::BaseJob*, QPair<EntryInternal, int> > mDownloadLinkJobs;
106
107 // keep track of the current request
108 QPointer<Attica::BaseJob> mEntryJob;
109 Provider::SearchRequest mCurrentRequest;
110
111 QSet<Attica::BaseJob*> m_updateJobs;
112
113 bool mInitialized;
114
115 Q_DISABLE_COPY(AtticaProvider)
116 };
117
118}
119
120#endif
KNS3::AtticaProvider
KNewStuff Attica Provider class.
Definition: atticaprovider.h:47
KNS3::AtticaProvider::id
virtual QString id() const
A unique Id for this provider (the url in most cases)
Definition: atticaprovider.cpp:62
KNS3::AtticaProvider::loadPayloadLink
virtual void loadPayloadLink(const EntryInternal &entry, int linkId)
Definition: atticaprovider.cpp:248
KNS3::AtticaProvider::becomeFan
virtual void becomeFan(const EntryInternal &entry)
Definition: atticaprovider.cpp:342
KNS3::AtticaProvider::setCachedEntries
virtual void setCachedEntries(const KNS3::EntryInternal::List &cachedEntries)
Definition: atticaprovider.cpp:94
KNS3::AtticaProvider::setProviderXML
virtual bool setProviderXML(const QDomElement &xmldata)
set the provider data xml, to initialize the provider
Definition: atticaprovider.cpp:73
KNS3::AtticaProvider::userCanVote
virtual bool userCanVote()
Definition: atticaprovider.h:67
KNS3::AtticaProvider::userCanBecomeFan
virtual bool userCanBecomeFan()
Definition: atticaprovider.h:70
KNS3::AtticaProvider::loadEntries
virtual void loadEntries(const KNS3::Provider::SearchRequest &request)
load the given search and return given page
Definition: atticaprovider.cpp:135
KNS3::AtticaProvider::isInitialized
virtual bool isInitialized() const
Definition: atticaprovider.cpp:130
KNS3::AtticaProvider::vote
virtual void vote(const EntryInternal &entry, uint rating)
Definition: atticaprovider.cpp:328
KNS3::AtticaProvider::loadEntryDetails
virtual void loadEntryDetails(const KNS3::EntryInternal &entry)
Definition: atticaprovider.cpp:187
KNS3::EntryInternal
KNewStuff data entry container.
Definition: entryinternal.h:55
KNS3::Provider
KNewStuff Base Provider class.
Definition: knewstuff3/core/provider.h:47
KNS3::Provider::SortMode
SortMode
Definition: knewstuff3/core/provider.h:52
QHash
QList< EntryInternal >
QSet
Attica
Definition: atticaprovider.h:28
KNS3
Definition: atticaprovider.cpp:36
KNS3::Provider::SearchRequest
used to keep track of a search
Definition: knewstuff3/core/provider.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal