• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.8.5 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 
22 #include <attica/providermanager.h>
23 #include <attica/provider.h>
24 
25 #include "core/provider.h"
26 
27 namespace Attica {
28  class BaseJob;
29 }
30 
31 namespace KNS3
32 {
45  class AtticaProvider: public Provider
46  {
47  Q_OBJECT
48  public:
49  AtticaProvider(const QStringList& categories);
50  AtticaProvider(const Attica::Provider& provider, const QStringList& categories);
51 
52  virtual QString id() const;
53 
57  virtual bool setProviderXML(const QDomElement & xmldata);
58 
59  virtual bool isInitialized() const;
60  virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries);
61 
62  virtual void loadEntries(const KNS3::Provider::SearchRequest& request);
63  virtual void loadEntryDetails(const KNS3::EntryInternal& entry);
64  virtual void loadPayloadLink(const EntryInternal& entry, int linkId);
65 
66  virtual bool userCanVote() {return true;}
67  virtual void vote(const EntryInternal& entry, uint rating);
68 
69  virtual bool userCanBecomeFan() {return true;}
70  virtual void becomeFan(const EntryInternal& entry);
71 
72  private Q_SLOTS:
73  void providerLoaded(const Attica::Provider& provider);
74  void listOfCategoriesLoaded(Attica::BaseJob*);
75  void categoryContentsLoaded(Attica::BaseJob* job);
76  void downloadItemLoaded(Attica::BaseJob* job);
77  void accountBalanceLoaded(Attica::BaseJob* job);
78  void authenticationCredentialsMissing(const Provider&);
79  void votingFinished(Attica::BaseJob*);
80  void becomeFanFinished(Attica::BaseJob* job);
81  void detailsLoaded(Attica::BaseJob* job);
82 
83  private:
84  void checkForUpdates();
85  EntryInternal::List installedEntries() const;
86  bool jobSuccess(Attica::BaseJob* job) const;
87 
88  Attica::Provider::SortMode atticaSortMode(const SortMode& sortMode);
89 
90  EntryInternal entryFromAtticaContent(const Attica::Content&);
91 
92  // the attica categories we are interested in (e.g. Wallpaper, Application, Vocabulary File...)
93  QHash<QString, Attica::Category> mCategoryMap;
94 
95  Attica::ProviderManager m_providerManager;
96  Attica::Provider m_provider;
97 
98  KNS3::EntryInternal::List mCachedEntries;
99  QHash<QString, Attica::Content> mCachedContent;
100 
101  // Associate job and entry, this is needed when fetching
102  // download links or the account balance in order to continue
103  // when the result is there.
104  QHash<Attica::BaseJob*, QPair<EntryInternal, int> > mDownloadLinkJobs;
105 
106  // keep track of the current request
107  Attica::BaseJob* mEntryJob;
108  Provider::SearchRequest mCurrentRequest;
109 
110  QSet<Attica::BaseJob*> m_updateJobs;
111 
112  bool mInitialized;
113 
114  Q_DISABLE_COPY(AtticaProvider)
115  };
116 
117 }
118 
119 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Fri Nov 16 2012 15:16:19 by doxygen 1.8.1 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.8.5 API Reference

Skip menu "kdelibs-4.8.5 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