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

KNewStuff

  • home
  • ichiro
  • data
  • ssd
  • Momonga
  • trunk
  • pkgs
  • kdelibs
  • BUILD
  • kdelibs-4.14.3
  • knewstuff
  • knewstuff3
  • core
knewstuff3/core/engine.h
Go to the documentation of this file.
1 /*
2  knewstuff3/engine.h.
3  Copyright (c) 2007 Josef Spillner <spillner@kde.org>
4  Copyright (C) 2007-2010 Frederik Gladhorn <gladhorn@kde.org>
5  Copyright (c) 2009 Jeremy Whiting <jpwhiting@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 
21 #ifndef KNEWSTUFF3_ENGINE_H
22 #define KNEWSTUFF3_ENGINE_H
23 
24 #include <QtCore/QObject>
25 #include <QtCore/QString>
26 #include <QtCore/QMap>
27 
28 #include "provider.h"
29 #include "entryinternal.h"
30 
31 class QTimer;
32 class KJob;
33 
34 namespace Attica {
35  class ProviderManager;
36  class Provider;
37 }
38 
39 namespace KNS3
40 {
41 class Cache;
42 class Installation;
43 
52 class Engine : public QObject
53 {
54  Q_OBJECT
55 public:
59  Engine(QObject* parent = 0);
60 
65  ~Engine();
66 
75  bool init(const QString &configfile);
76 
89  void install(KNS3::EntryInternal entry, int linkId = 1);
90 
97  void uninstall(KNS3::EntryInternal entry);
98 
99  void loadPreview(const KNS3::EntryInternal& entry, EntryInternal::PreviewType type);
100  void loadDetails(const KNS3::EntryInternal& entry);
101 
102  void setSortMode(Provider::SortMode mode);
103 
107  void setCategoriesFilter(const QStringList& categories);
108  void setSearchTerm(const QString& searchString);
109  void reloadEntries();
110  void requestMoreData();
111  void requestData(int page, int pageSize);
112 
113  void checkForUpdates();
114 
118  void contactAuthor(const EntryInternal& entry);
119 
120  bool userCanVote(const EntryInternal& entry);
121  void vote(const EntryInternal& entry, uint rating);
122  bool userCanBecomeFan(const EntryInternal& entry);
123  void becomeFan(const EntryInternal& entry);
124 
125  QStringList categories() const;
126  QStringList categoriesFilter() const;
127 
128 Q_SIGNALS:
132  void signalMessage(const QString& message);
133 
134  void signalProvidersLoaded();
135  void signalEntriesLoaded(const KNS3::EntryInternal::List& entries);
136  void signalUpdateableEntriesLoaded(const KNS3::EntryInternal::List& entries);
137  void signalEntryChanged(const KNS3::EntryInternal& entry);
138  void signalEntryDetailsLoaded(const KNS3::EntryInternal& entry);
139 
140  // a new search result is there, clear the list of items
141  void signalResetView();
142 
143  void signalEntryPreviewLoaded(const KNS3::EntryInternal&, KNS3::EntryInternal::PreviewType);
144  void signalPreviewFailed();
145 
146  void signalEntryUploadFinished();
147  void signalEntryUploadFailed();
148 
149  void signalDownloadDialogDone(KNS3::EntryInternal::List);
150  void jobStarted(KJob*,const QString&);
151 
152  void signalError(const QString&);
153  void signalBusy(const QString&);
154  void signalIdle(const QString&);
155 
156 private Q_SLOTS:
157  // the .knsrc file was loaded
158  void slotProviderFileLoaded(const QDomDocument& doc);
159  // instead of getting providers from knsrc, use what was configured in ocs systemsettings
160  void atticaProviderLoaded(const Attica::Provider& provider);
161 
162  // loading the .knsrc file failed
163  void slotProvidersFailed();
164 
165  // called when a provider is ready to work
166  void providerInitialized(KNS3::Provider*);
167 
168  void slotEntriesLoaded(const KNS3::Provider::SearchRequest&, KNS3::EntryInternal::List);
169  void slotEntryDetailsLoaded(const KNS3::EntryInternal& entry);
170  void slotPreviewLoaded(const KNS3::EntryInternal& entry, KNS3::EntryInternal::PreviewType type);
171 
172  void slotSearchTimerExpired();
173 
174  void slotEntryChanged(const KNS3::EntryInternal& entry);
175  void slotInstallationFinished();
176  void slotInstallationFailed(const QString& message);
177  void downloadLinkLoaded(const KNS3::EntryInternal& entry);
178 
179  void providerJobStarted(KJob*);
180 
181 private:
186  void loadProviders();
187 
191  void addProvider(QSharedPointer<KNS3::Provider> provider);
192 
193  void updateStatus();
194 
195  void doRequest();
196 
197  // If the provider is ready to be used
198  bool m_initialized;
199  // handle installation of entries
200  Installation* m_installation;
201  // read/write cache of entries
202  QSharedPointer<Cache> m_cache;
203  QTimer* m_searchTimer;
204  // The url of the file containing information about content providers
205  QString m_providerFileUrl;
206  // Categories from knsrc file
207  QStringList m_categories;
208 
209  QHash<QString, QSharedPointer<KNS3::Provider> > m_providers;
210 
211  // the name of the app that uses hot new stuff
212  QString m_applicationName;
213 
214  // the current request from providers
215  Provider::SearchRequest m_currentRequest;
216 
217  // the page that is currently displayed, so it is not requested repeatedly
218  int m_currentPage;
219 
220  // when requesting entries from a provider, how many to ask for
221  int m_pageSize;
222 
223  int m_numDataJobs;
224  int m_numPictureJobs;
225  int m_numInstallJobs;
226  Attica::ProviderManager* m_atticaProviderManager;
227 
228  Q_DISABLE_COPY(Engine)
229 };
230 
231 }
232 
233 #endif
message
void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
KNS3::Provider
KNewStuff Base Provider class.
Definition: knewstuff3/core/provider.h:46
KNS3::EntryInternal
KNewStuff data entry container.
Definition: entryinternal.h:54
provider.h
KNS3::Engine
KNewStuff engine.
Definition: knewstuff3/core/engine.h:52
KNS3::Provider::SortMode
SortMode
Definition: knewstuff3/core/provider.h:52
QHash
QObject
KNS3::Provider::SearchRequest
used to keep track of a search
Definition: knewstuff3/core/provider.h:64
KNS3::EntryInternal::PreviewType
PreviewType
Definition: entryinternal.h:70
entryinternal.h
KNS3::Installation
KNewStuff entry installation.
Definition: knewstuff3/core/installation.h:45
KNS3
Definition: atticaprovider.cpp:35
KJob
Attica
Definition: atticaprovider.h:28
QList< EntryInternal >
This file is part of the KDE documentation.
Documentation copyright © 1996-2018 The KDE developers.
Generated on Fri Oct 19 2018 17:21:33 by doxygen 1.8.13 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.3 API Reference

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