Warning, file /frameworks/knewstuff/src/downloadmanager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2010 Frederik Gladhorn <gladhorn@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KNEWSTUFF3_UI_DownloadManager_H
0008 #define KNEWSTUFF3_UI_DownloadManager_H
0009 
0010 #include "entry.h"
0011 #include "knewstuff_export.h"
0012 
0013 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 29)
0014 
0015 namespace KNS3
0016 {
0017 class DownloadManagerPrivate;
0018 /**
0019  * KNewStuff update checker.
0020  * This class can be used to search for KNewStuff items
0021  * without using the widgets and to look for updates of
0022  * already installed items without showing the dialog.
0023  * @since 4.5
0024  * @deprecated Since 5.29, use KNSCore::DownloadManager instead
0025  */
0026 class KNEWSTUFF_EXPORT DownloadManager : public QObject
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     enum SortOrder {
0032         Newest,
0033         Alphabetical,
0034         Rating,
0035         Downloads,
0036     };
0037 
0038     /**
0039      * Create a DownloadManager
0040      * It will try to find a appname.knsrc file.
0041      * Appname is the name of your application as provided in the about data->
0042      *
0043      * @param parent the parent of the dialog
0044      * @deprecated Since 5.29, use KNSCore::DownloadManager instead
0045      */
0046     KNEWSTUFF_DEPRECATED_VERSION(5, 29, "Use KNSCore::DownloadManager")
0047     explicit DownloadManager(QObject *parent = nullptr);
0048 
0049     /**
0050      * Create a DownloadManager. Manually specifying the name of the .knsrc file.
0051      *
0052      * @param configFile the name of the configuration file
0053      * @param parent
0054      * @deprecated Since 5.29, use KNSCore::DownloadManager instead
0055      */
0056     KNEWSTUFF_DEPRECATED_VERSION(5, 29, "Use KNSCore::DownloadManager")
0057     explicit DownloadManager(const QString &configFile, QObject *parent = nullptr);
0058 
0059     /**
0060      * destructor
0061      */
0062     ~DownloadManager() override;
0063 
0064     /**
0065       Search for a list of entries. searchResult will be emitted with the requested list.
0066     */
0067     void search(int page = 0, int pageSize = 100);
0068 
0069     /**
0070       Check for available updates.
0071       Use searchResult to get notified as soon as an update has been found.
0072       */
0073     void checkForUpdates();
0074 
0075     /**
0076       Check for installed resources
0077       Use searchResult to get notified about installed entries.
0078 
0079       @since 5.28
0080       */
0081     void checkForInstalled();
0082 
0083     /**
0084       Installs or updates an entry
0085       @param entry
0086       */
0087     void installEntry(const KNS3::Entry &entry);
0088 
0089     /**
0090      * Uninstalls the given entry.
0091      * @param entry The entry which will be uninstalled.
0092      * @since 4.7
0093      */
0094     void uninstallEntry(const KNS3::Entry &entry);
0095 
0096     /**
0097       Sets the search term to filter the results on the server.
0098       Note that this function does not trigger a search. Use search after setting this.
0099       @param searchTerm
0100       */
0101     void setSearchTerm(const QString &searchTerm);
0102 
0103     /**
0104       Set the sort order of the results. This depends on the server.
0105       Note that this function does not trigger a search. Use search after setting this.
0106       @see SortOrder
0107       @param order
0108       */
0109     void setSearchOrder(SortOrder order);
0110 
0111     /**
0112      * Triggers a search for an entry with @p id as its unique id
0113      *
0114      * @see searchResult
0115      *
0116      * @since 5.28
0117      */
0118     void fetchEntryById(const QString &id);
0119 
0120 Q_SIGNALS:
0121     /**
0122       Returns the search result.
0123       This can be the list of updates after checkForUpdates or the result of a search.
0124       @param entries the list of results. entries is empty when nothing was found.
0125      */
0126     void searchResult(const KNS3::Entry::List &entries);
0127 
0128     /**
0129       The entry status has changed: emitted when the entry has been installed, updated or removed.
0130       Use KNS3::Entry::status() to check the current status.
0131       @param entry the item that has been updated.
0132      */
0133     void entryStatusChanged(const KNS3::Entry &entry);
0134 
0135     /**
0136      * Notifies that the engine couldn't be loaded properly and won't be suitable
0137      */
0138     void errorFound(const QString &errorMessage);
0139 
0140 private:
0141     Q_PRIVATE_SLOT(d, void _k_slotProvidersLoaded())
0142     Q_PRIVATE_SLOT(d, void _k_slotEngineError(const QString &error))
0143     Q_PRIVATE_SLOT(d, void _k_slotEntryStatusChanged(const KNSCore::EntryInternal &entry))
0144     Q_PRIVATE_SLOT(d, void _k_slotEntriesLoaded(const KNSCore::EntryInternal::List &entries))
0145     KNS3::DownloadManagerPrivate *const d;
0146     Q_DISABLE_COPY(DownloadManager)
0147 };
0148 
0149 }
0150 
0151 #endif // KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 29)
0152 
0153 #endif