KNewStuff

downloadmanager.h
1 /*
2  SPDX-FileCopyrightText: 2010 Frederik Gladhorn <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef KNEWSTUFF3_UI_DownloadManager_H
8 #define KNEWSTUFF3_UI_DownloadManager_H
9 
10 #include "entry.h"
11 #include "knewstuff_export.h"
12 
13 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 29)
14 
15 namespace KNS3
16 {
17 class DownloadManagerPrivate;
18 /**
19  * KNewStuff update checker.
20  * This class can be used to search for KNewStuff items
21  * without using the widgets and to look for updates of
22  * already installed items without showing the dialog.
23  * @since 4.5
24  * @deprecated Since 5.29, use KNSCore::DownloadManager instead
25  */
26 class KNEWSTUFF_EXPORT DownloadManager : public QObject
27 {
28  Q_OBJECT
29 
30 public:
31  enum SortOrder {
32  Newest,
33  Alphabetical,
34  Rating,
35  Downloads,
36  };
37 
38  /**
39  * Create a DownloadManager
40  * It will try to find a appname.knsrc file.
41  * Appname is the name of your application as provided in the about data->
42  *
43  * @param parent the parent of the dialog
44  * @deprecated Since 5.29, use KNSCore::DownloadManager instead
45  */
46  KNEWSTUFF_DEPRECATED_VERSION(5, 29, "Use KNSCore::DownloadManager")
47  explicit DownloadManager(QObject *parent = nullptr);
48 
49  /**
50  * Create a DownloadManager. Manually specifying the name of the .knsrc file.
51  *
52  * @param configFile the name of the configuration file
53  * @param parent
54  * @deprecated Since 5.29, use KNSCore::DownloadManager instead
55  */
56  KNEWSTUFF_DEPRECATED_VERSION(5, 29, "Use KNSCore::DownloadManager")
57  explicit DownloadManager(const QString &configFile, QObject *parent = nullptr);
58 
59  /**
60  * destructor
61  */
62  ~DownloadManager() override;
63 
64  /**
65  Search for a list of entries. searchResult will be emitted with the requested list.
66  */
67  void search(int page = 0, int pageSize = 100);
68 
69  /**
70  Check for available updates.
71  Use searchResult to get notified as soon as an update has been found.
72  */
73  void checkForUpdates();
74 
75  /**
76  Check for installed resources
77  Use searchResult to get notified about installed entries.
78 
79  @since 5.28
80  */
81  void checkForInstalled();
82 
83  /**
84  Installs or updates an entry
85  @param entry
86  */
87  void installEntry(const KNS3::Entry &entry);
88 
89  /**
90  * Uninstalls the given entry.
91  * @param entry The entry which will be uninstalled.
92  * @since 4.7
93  */
94  void uninstallEntry(const KNS3::Entry &entry);
95 
96  /**
97  Sets the search term to filter the results on the server.
98  Note that this function does not trigger a search. Use search after setting this.
99  @param searchTerm
100  */
101  void setSearchTerm(const QString &searchTerm);
102 
103  /**
104  Set the sort order of the results. This depends on the server.
105  Note that this function does not trigger a search. Use search after setting this.
106  @see SortOrder
107  @param order
108  */
109  void setSearchOrder(SortOrder order);
110 
111  /**
112  * Triggers a search for an entry with @p id as its unique id
113  *
114  * @see searchResult
115  *
116  * @since 5.28
117  */
118  void fetchEntryById(const QString &id);
119 
120 Q_SIGNALS:
121  /**
122  Returns the search result.
123  This can be the list of updates after checkForUpdates or the result of a search.
124  @param entries the list of results. entries is empty when nothing was found.
125  */
126  void searchResult(const KNS3::Entry::List &entries);
127 
128  /**
129  The entry status has changed: emitted when the entry has been installed, updated or removed.
130  Use KNS3::Entry::status() to check the current status.
131  @param entry the item that has been updated.
132  */
133  void entryStatusChanged(const KNS3::Entry &entry);
134 
135  /**
136  * Notifies that the engine couldn't be loaded properly and won't be suitable
137  */
138  void errorFound(const QString &errorMessage);
139 
140 private:
141  Q_PRIVATE_SLOT(d, void _k_slotProvidersLoaded())
142  Q_PRIVATE_SLOT(d, void _k_slotEngineError(const QString &error))
143  Q_PRIVATE_SLOT(d, void _k_slotEntryStatusChanged(const KNSCore::EntryInternal &entry))
144  Q_PRIVATE_SLOT(d, void _k_slotEntriesLoaded(const KNSCore::EntryInternal::List &entries))
145  KNS3::DownloadManagerPrivate *const d;
146  Q_DISABLE_COPY(DownloadManager)
147 };
148 
149 }
150 
151 #endif // KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 29)
152 
153 #endif
Rating
KNewStuff data entry container.
Definition: entryinternal.h:52
KNewStuff update checker.
KNewStuff information about changed entries.
Definition: entry.h:35
KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception)
The namespace for the KNewStuff classes.
Definition: button.cpp:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 03:54:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.