KNewStuff
atticaprovider.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2009-2010 Frederik Gladhorn <gladhorn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #ifndef KNEWSTUFF3_ATTICA_PROVIDER_H 00018 #define KNEWSTUFF3_ATTICA_PROVIDER_H 00019 00020 #include <QtCore/QSet> 00021 #include <QtCore/QPointer> 00022 00023 #include <attica/providermanager.h> 00024 #include <attica/provider.h> 00025 00026 #include "core/provider.h" 00027 00028 namespace Attica { 00029 class BaseJob; 00030 } 00031 00032 namespace KNS3 00033 { 00046 class AtticaProvider: public Provider 00047 { 00048 Q_OBJECT 00049 public: 00050 AtticaProvider(const QStringList& categories); 00051 AtticaProvider(const Attica::Provider& provider, const QStringList& categories); 00052 00053 virtual QString id() const; 00054 00058 virtual bool setProviderXML(const QDomElement & xmldata); 00059 00060 virtual bool isInitialized() const; 00061 virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries); 00062 00063 virtual void loadEntries(const KNS3::Provider::SearchRequest& request); 00064 virtual void loadEntryDetails(const KNS3::EntryInternal& entry); 00065 virtual void loadPayloadLink(const EntryInternal& entry, int linkId); 00066 00067 virtual bool userCanVote() {return true;} 00068 virtual void vote(const EntryInternal& entry, uint rating); 00069 00070 virtual bool userCanBecomeFan() {return true;} 00071 virtual void becomeFan(const EntryInternal& entry); 00072 00073 private Q_SLOTS: 00074 void providerLoaded(const Attica::Provider& provider); 00075 void listOfCategoriesLoaded(Attica::BaseJob*); 00076 void categoryContentsLoaded(Attica::BaseJob* job); 00077 void downloadItemLoaded(Attica::BaseJob* job); 00078 void accountBalanceLoaded(Attica::BaseJob* job); 00079 void authenticationCredentialsMissing(const Provider&); 00080 void votingFinished(Attica::BaseJob*); 00081 void becomeFanFinished(Attica::BaseJob* job); 00082 void detailsLoaded(Attica::BaseJob* job); 00083 00084 private: 00085 void checkForUpdates(); 00086 EntryInternal::List installedEntries() const; 00087 bool jobSuccess(Attica::BaseJob* job) const; 00088 00089 Attica::Provider::SortMode atticaSortMode(const SortMode& sortMode); 00090 00091 EntryInternal entryFromAtticaContent(const Attica::Content&); 00092 00093 // the attica categories we are interested in (e.g. Wallpaper, Application, Vocabulary File...) 00094 QHash<QString, Attica::Category> mCategoryMap; 00095 00096 Attica::ProviderManager m_providerManager; 00097 Attica::Provider m_provider; 00098 00099 KNS3::EntryInternal::List mCachedEntries; 00100 QHash<QString, Attica::Content> mCachedContent; 00101 00102 // Associate job and entry, this is needed when fetching 00103 // download links or the account balance in order to continue 00104 // when the result is there. 00105 QHash<Attica::BaseJob*, QPair<EntryInternal, int> > mDownloadLinkJobs; 00106 00107 // keep track of the current request 00108 QPointer<Attica::BaseJob> mEntryJob; 00109 Provider::SearchRequest mCurrentRequest; 00110 00111 QSet<Attica::BaseJob*> m_updateJobs; 00112 00113 bool mInitialized; 00114 00115 Q_DISABLE_COPY(AtticaProvider) 00116 }; 00117 00118 } 00119 00120 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:36:55 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:36:55 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.