KNewStuff

provider.cpp
1/*
2 knewstuff3/provider.cpp
3 SPDX-FileCopyrightText: 2002 Cornelius Schumacher <schumacher@kde.org>
4 SPDX-FileCopyrightText: 2003-2007 Josef Spillner <spillner@kde.org>
5 SPDX-FileCopyrightText: 2009 Jeremy Whiting <jpwhiting@kde.org>
6 SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
7
8 SPDX-License-Identifier: LGPL-2.1-or-later
9*/
10
11#include "provider.h"
12
13#include "provider_p.h"
14#include "xmlloader_p.h"
15
16#include <KLocalizedString>
17
18#include <QTimer>
19
20#if KNEWSTUFFCORE_BUILD_DEPRECATED_SINCE(6, 9)
21
22namespace KNSCore
23{
24
25QString Provider::SearchRequest::hashForRequest() const
26{
27 return QString::number((int)sortMode) + QLatin1Char(',') + searchTerm + QLatin1Char(',') + categories.join(QLatin1Char('-')) + QLatin1Char(',')
28 + QString::number(page) + QLatin1Char(',') + QString::number(pageSize);
29}
30
32 : d(new ProviderPrivate(this))
33{
34}
35
36Provider::~Provider() = default;
37
39{
40 return d->name;
41}
42
44{
45 return d->icon;
46}
47
48void Provider::setTagFilter(const QStringList &tagFilter)
49{
50 d->tagFilter = tagFilter;
51 Q_EMIT tagFilterChanged();
52}
53
55{
56 return d->tagFilter;
57}
58
59void Provider::setDownloadTagFilter(const QStringList &downloadTagFilter)
60{
61 d->downloadTagFilter = downloadTagFilter;
62 Q_EMIT downloadTagFilterChanged();
63}
64
66{
67 return d->downloadTagFilter;
68}
69
70QDebug operator<<(QDebug dbg, const Provider::SearchRequest &search)
71{
72 QDebugStateSaver saver(dbg);
73 dbg.nospace();
74 dbg << "Provider::SearchRequest(";
75 dbg << "searchTerm: " << search.searchTerm << ',';
76 dbg << "categories: " << search.categories << ',';
77 dbg << "filter: " << search.filter << ',';
78 dbg << "page: " << search.page << ',';
79 dbg << "pageSize: " << search.pageSize;
80 dbg << ')';
81 return dbg;
82}
83
84QString Provider::version() const
85{
86 d->updateOnFirstBasicsGet();
87 return d->version;
88}
89
90void Provider::setVersion(const QString &version)
91{
92 if (d->version != version) {
93 d->version = version;
94 d->throttleBasics();
95 }
96}
97
98QUrl Provider::website() const
99{
100 d->updateOnFirstBasicsGet();
101 return d->website;
102}
103
104void Provider::setWebsite(const QUrl &website)
105{
106 if (d->website != website) {
107 d->website = website;
108 d->throttleBasics();
109 }
110}
111
112QUrl Provider::host() const
113{
114 d->updateOnFirstBasicsGet();
115 return d->host;
116}
117
118void Provider::setHost(const QUrl &host)
119{
120 if (d->host != host) {
121 d->host = host;
122 d->throttleBasics();
123 }
124}
125
126QString Provider::contactEmail() const
127{
128 d->updateOnFirstBasicsGet();
129 return d->contactEmail;
130}
131
132void Provider::setContactEmail(const QString &contactEmail)
133{
134 if (d->contactEmail != contactEmail) {
135 d->contactEmail = contactEmail;
136 d->throttleBasics();
137 }
138}
139
140bool Provider::supportsSsl() const
141{
142 d->updateOnFirstBasicsGet();
143 return d->supportsSsl;
144}
145
146void Provider::setSupportsSsl(bool supportsSsl)
147{
148 if (d->supportsSsl != supportsSsl) {
149 d->supportsSsl = supportsSsl;
150 d->throttleBasics();
151 }
152}
153
154void Provider::setName(const QString &name)
155{
156 d->name = name;
157}
158
159void Provider::setIcon(const QUrl &icon)
160{
161 d->icon = icon;
162}
163}
164
165#include "moc_provider.cpp"
166
167#endif
~Provider() override
Destructor.
QStringList tagFilter() const
The tag filter used for downloads by this provider.
Definition provider.cpp:54
void setVersion(const QString &version)
Definition provider.cpp:90
void setTagFilter(const QStringList &tagFilter)
Set the tag filter used for entries by this provider.
Definition provider.cpp:48
virtual QString name() const
Retrieves the common name of the provider.
Definition provider.cpp:38
void setContactEmail(const QString &contactEmail)
Sets the general contact email address for this provider.
Definition provider.cpp:132
Provider()
Constructor.
Definition provider.cpp:31
void setHost(const QUrl &host)
Definition provider.cpp:118
void setWebsite(const QUrl &website)
Definition provider.cpp:104
QStringList downloadTagFilter() const
The tag filter used for downloads by this provider.
Definition provider.cpp:65
virtual QUrl icon() const
Retrieves the icon URL for this provider.
Definition provider.cpp:43
void setSupportsSsl(bool supportsSsl)
Set whether or not the provider supports SSL connections.
Definition provider.cpp:146
void setDownloadTagFilter(const QStringList &downloadTagFilter)
Set the tag filter used for download items by this provider.
Definition provider.cpp:59
QDebug & nospace()
Q_EMITQ_EMIT
QString number(double n, char format, int precision)
QString join(QChar separator) const const
used to keep track of a search
Definition provider.h:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:20:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.