• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 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
30class KJob;
31
32namespace 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
KJob
KNS3::EntryInternal
KNewStuff data entry container.
Definition entryinternal.h:55
KNS3::Provider
KNewStuff Base Provider class.
Definition knewstuff3/core/provider.h:47
KNS3::Provider::signalInformation
void signalInformation(const QString &) const
KNS3::Provider::userCanVote
virtual bool userCanVote()
Definition knewstuff3/core/provider.h:129
KNS3::Provider::payloadLinkLoaded
void payloadLinkLoaded(const KNS3::EntryInternal &)
KNS3::Provider::signalError
void signalError(const QString &) const
KNS3::Provider::id
virtual QString id() const =0
A unique Id for this provider (the url in most cases)
KNS3::Provider::setCachedEntries
virtual void setCachedEntries(const KNS3::EntryInternal::List &cachedEntries)=0
KNS3::Provider::mIcon
KUrl mIcon
Definition knewstuff3/core/provider.h:149
KNS3::Provider::loadEntryDetails
virtual void loadEntryDetails(const KNS3::EntryInternal &)
Definition knewstuff3/core/provider.h:126
KNS3::Provider::~Provider
virtual ~Provider()
Destructor.
Definition knewstuff3/core/provider.cpp:45
KNS3::Provider::loadingFinished
void loadingFinished(const KNS3::Provider::SearchRequest &, const KNS3::EntryInternal::List &) const
KNS3::Provider::SortMode
SortMode
Definition knewstuff3/core/provider.h:52
KNS3::Provider::Rating
@ Rating
Definition knewstuff3/core/provider.h:55
KNS3::Provider::Updates
@ Updates
Definition knewstuff3/core/provider.h:58
KNS3::Provider::Alphabetical
@ Alphabetical
Definition knewstuff3/core/provider.h:54
KNS3::Provider::Installed
@ Installed
Definition knewstuff3/core/provider.h:57
KNS3::Provider::Downloads
@ Downloads
Definition knewstuff3/core/provider.h:56
KNS3::Provider::Newest
@ Newest
Definition knewstuff3/core/provider.h:53
KNS3::Provider::setProviderXML
virtual bool setProviderXML(const QDomElement &xmldata)=0
Set the provider data xml, to initialize the provider.
KNS3::Provider::mName
QString mName
Definition knewstuff3/core/provider.h:148
KNS3::Provider::loadEntries
virtual void loadEntries(const KNS3::Provider::SearchRequest &request)=0
load the given search and return given page
KNS3::Provider::userCanBecomeFan
virtual bool userCanBecomeFan()
Definition knewstuff3/core/provider.h:132
KNS3::Provider::providerInitialized
void providerInitialized(KNS3::Provider *)
KNS3::Provider::List
QList< Provider * > List
Definition knewstuff3/core/provider.h:50
KNS3::Provider::vote
virtual void vote(const EntryInternal &entry, uint rating)
Definition knewstuff3/core/provider.h:130
KNS3::Provider::entryDetailsLoaded
void entryDetailsLoaded(const KNS3::EntryInternal &)
KNS3::Provider::loadingFailed
void loadingFailed(const KNS3::Provider::SearchRequest &)
KNS3::Provider::isInitialized
virtual bool isInitialized() const =0
KNS3::Provider::loadPayloadLink
virtual void loadPayloadLink(const EntryInternal &entry, int linkId)=0
KNS3::Provider::Provider
Provider()
Constructor.
Definition knewstuff3/core/provider.cpp:42
KNS3::Provider::icon
virtual KUrl icon() const
Retrieves the icon URL for this provider.
Definition knewstuff3/core/provider.cpp:53
KNS3::Provider::becomeFan
virtual void becomeFan(const EntryInternal &entry)
Definition knewstuff3/core/provider.h:133
KNS3::Provider::name
virtual QString name() const
Retrieves the common name of the provider.
Definition knewstuff3/core/provider.cpp:48
KUrl
QList
QObject
entryinternal.h
kurl.h
KNS3
Definition atticaprovider.cpp:36
KNS3::Provider::SearchRequest
used to keep track of a search
Definition knewstuff3/core/provider.h:64
KNS3::Provider::SearchRequest::searchTerm
QString searchTerm
Definition knewstuff3/core/provider.h:66
KNS3::Provider::SearchRequest::page
int page
Definition knewstuff3/core/provider.h:68
KNS3::Provider::SearchRequest::pageSize
int pageSize
Definition knewstuff3/core/provider.h:69
KNS3::Provider::SearchRequest::SearchRequest
SearchRequest(SortMode sortMode_=Newest, const QString &searchTerm_=QString(), const QStringList &categories_=QStringList(), int page_=-1, int pageSize_=20)
Definition knewstuff3/core/provider.h:71
KNS3::Provider::SearchRequest::sortMode
SortMode sortMode
Definition knewstuff3/core/provider.h:65
KNS3::Provider::SearchRequest::categories
QStringList categories
Definition knewstuff3/core/provider.h:67
KNS3::Provider::SearchRequest::hashForRequest
QString hashForRequest() const
Definition knewstuff3/core/provider.cpp:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Jul 20 2023 00:00:00 by doxygen 1.9.8 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