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

KNewStuff

  • knewstuff
  • knewstuff3
  • core
knewstuff3/core/provider.h
Go to the documentation of this file.
1 /*
2  knewstuff3/provider.h
3  This file is part of KNewStuff2.
4  Copyright (c) 2009 Jeremy Whiting <jpwhiting@kde.org>
5  Copyright (C) 2009 Frederik Gladhorn <gladhorn@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef KNEWSTUFF3_PROVIDER_H
21 #define KNEWSTUFF3_PROVIDER_H
22 
23 #include <QtCore/QList>
24 #include <QtCore/QString>
25 
26 #include <kurl.h>
27 
28 #include "entryinternal.h"
29 
30 class KJob;
31 
32 namespace KNS3
33 {
46  class Provider: public QObject
47  {
48  Q_OBJECT
49  public:
50  typedef QList<Provider*> List;
51 
52  enum SortMode {
53  Newest,
54  Alphabetical,
55  Rating,
56  Downloads,
57  Installed, // only installed items
58  Updates // entries that can be updated
59  };
60 
64  struct SearchRequest {
65  SortMode sortMode;
66  QString searchTerm;
67  QStringList categories;
68  int page;
69  int pageSize;
70 
71  SearchRequest(SortMode sortMode_ = Newest, const QString& searchTerm_ = QString(), const QStringList& categories_ = QStringList(), int page_ = -1, int pageSize_ = 20)
72  :sortMode(sortMode_), searchTerm(searchTerm_), categories(categories_), page(page_), pageSize(pageSize_)
73  {}
74 
75  QString hashForRequest() const;
76  };
77 
81  Provider();
82 
86  virtual ~Provider();
87 
91  virtual QString id() const = 0;
92 
97  virtual bool setProviderXML(const QDomElement & xmldata) = 0;
98 
99  virtual bool isInitialized() const = 0;
100 
101  virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries) = 0;
102 
108  virtual QString name() const;
109 
115  virtual KUrl icon() const; // FIXME use KIcon or pixmap?
116 
125  virtual void loadEntries(const KNS3::Provider::SearchRequest& request) = 0;
126  virtual void loadEntryDetails(const KNS3::EntryInternal&) {}
127  virtual void loadPayloadLink(const EntryInternal& entry, int linkId) = 0;
128 
129  virtual bool userCanVote() {return false;}
130  virtual void vote(const EntryInternal& entry, uint rating) { Q_UNUSED(entry) Q_UNUSED(rating) }
131 
132  virtual bool userCanBecomeFan() {return false;}
133  virtual void becomeFan(const EntryInternal& entry) { Q_UNUSED(entry) }
134 
135  signals:
136  void providerInitialized(KNS3::Provider*);
137 
138  void loadingFinished(const KNS3::Provider::SearchRequest&, const KNS3::EntryInternal::List&) const;
139  void loadingFailed(const KNS3::Provider::SearchRequest&);
140 
141  void entryDetailsLoaded(const KNS3::EntryInternal&);
142  void payloadLinkLoaded(const KNS3::EntryInternal&);
143 
144  void signalInformation(const QString&) const;
145  void signalError(const QString&) const;
146 
147  protected:
148  QString mName;
149  KUrl mIcon;
150 
151  private:
152  Q_DISABLE_COPY(Provider)
153  };
154 }
155 
156 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Sep 23 2014 10:00:12 by doxygen 1.8.3.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.11.5 API Reference

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