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

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 
00022 #include <attica/providermanager.h>
00023 #include <attica/provider.h>
00024 
00025 #include "core/provider.h"
00026 
00027 namespace Attica {
00028     class BaseJob;
00029 }
00030 
00031 namespace KNS3
00032 {
00045     class AtticaProvider: public Provider
00046     {
00047         Q_OBJECT
00048     public:
00049         AtticaProvider(const QStringList& categories);
00050         AtticaProvider(const Attica::Provider& provider, const QStringList& categories);
00051 
00052         virtual QString id() const;
00053 
00057         virtual bool setProviderXML(const QDomElement & xmldata);
00058 
00059         virtual bool isInitialized() const;
00060         virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries);
00061 
00062         virtual void loadEntries(const KNS3::Provider::SearchRequest& request);
00063         virtual void loadEntryDetails(const KNS3::EntryInternal& entry);
00064         virtual void loadPayloadLink(const EntryInternal& entry, int linkId);
00065 
00066         virtual bool userCanVote() {return true;}
00067         virtual void vote(const EntryInternal& entry, uint rating);
00068 
00069         virtual bool userCanBecomeFan() {return true;}
00070         virtual void becomeFan(const EntryInternal& entry);
00071 
00072     private Q_SLOTS:
00073         void providerLoaded(const Attica::Provider& provider);
00074         void listOfCategoriesLoaded(Attica::BaseJob*);
00075         void categoryContentsLoaded(Attica::BaseJob* job);
00076         void downloadItemLoaded(Attica::BaseJob* job);
00077         void accountBalanceLoaded(Attica::BaseJob* job);
00078         void authenticationCredentialsMissing(const Provider&);
00079         void votingFinished(Attica::BaseJob*);
00080         void becomeFanFinished(Attica::BaseJob* job);
00081         void detailsLoaded(Attica::BaseJob* job);
00082 
00083     private:
00084         void checkForUpdates();
00085         EntryInternal::List installedEntries() const;
00086         bool jobSuccess(Attica::BaseJob* job) const;
00087 
00088         Attica::Provider::SortMode atticaSortMode(const SortMode& sortMode);
00089 
00090         EntryInternal entryFromAtticaContent(const Attica::Content&);
00091         
00092         // the attica categories we are interested in (e.g. Wallpaper, Application, Vocabulary File...)
00093         QHash<QString, Attica::Category> mCategoryMap;
00094         
00095         Attica::ProviderManager m_providerManager;
00096         Attica::Provider m_provider;
00097         
00098         KNS3::EntryInternal::List mCachedEntries;
00099         QHash<QString, Attica::Content> mCachedContent;
00100         
00101         // Associate job and entry, this is needed when fetching
00102         // download links or the account balance in order to continue
00103         // when the result is there.
00104         QHash<Attica::BaseJob*, QPair<EntryInternal, int> > mDownloadLinkJobs;
00105         
00106         // keep track of the current request
00107         Attica::BaseJob* mEntryJob;
00108         Provider::SearchRequest mCurrentRequest;
00109         
00110         QSet<Attica::BaseJob*> m_updateJobs;
00111         
00112         bool mInitialized;
00113         
00114         Q_DISABLE_COPY(AtticaProvider)
00115     };
00116 
00117 }
00118 
00119 #endif

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal