1 /*
2     knewstuff3/ui/downloaddialog.h.
3     SPDX-FileCopyrightText: 2005 Enrico Ros <eros.kde@email.it>
4     SPDX-FileCopyrightText: 2005-2007 Josef Spillner <spillner@kde.org>
5     SPDX-FileCopyrightText: 2007 Dirk Mueller <mueller@kde.org>
6     SPDX-FileCopyrightText: 2007-2009 Jeremy Whiting <jpwhiting@kde.org>
7     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
8 
9     SPDX-License-Identifier: LGPL-2.1-or-later
10 */
11 
12 #ifndef KNEWSTUFF3_UI_DOWNLOADDIALOG_H
13 #define KNEWSTUFF3_UI_DOWNLOADDIALOG_H
14 
15 #include <QDialog>
16 
17 #include "entry.h"
18 #include "knewstuff_export.h"
19 
20 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 80)
21 
22 namespace KNSCore
23 {
24 class Engine;
25 }
26 
27 namespace KNS3
28 {
29 class DownloadDialogPrivate;
30 
31 /**
32  * KNewStuff download dialog.
33  *
34  * The download dialog will present items to the user
35  * for installation, updates and removal.
36  * Preview images as well as other meta information can be seen.
37  *
38  * @since 4.4
39  * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
40  */
41 class KNEWSTUFF_EXPORT DownloadDialog : public QDialog
42 {
43     Q_OBJECT
44 
45 public:
46     /**
47      * Create a DownloadDialog that lets the user install, update and uninstall
48      * contents. It will try to find a appname.knsrc file with the configuration.
49      * Appname is the name of your application as provided in the about data->
50      *
51      * @param parent the parent of the dialog
52      * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
53      */
54     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components or the KNS3::QtQuickDialogWrapper instead")
55     explicit DownloadDialog(QWidget *parent = nullptr);
56 
57     /**
58      * Create a DownloadDialog that lets the user install, update and uninstall
59      * contents. Manually specify the name of a .knsrc file where the
60      * KHotNewStuff configuration can be found.
61      *
62      * @param configFile the name of the configuration file
63      * @param parent the parent of the dialog
64      * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
65      */
66     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components or the KNS3::QtQuickDialogWrapper instead")
67     explicit DownloadDialog(const QString &configFile, QWidget *parent = nullptr);
68 
69     /**
70      * destructor
71      */
72     ~DownloadDialog() override;
73 
74     /**
75      * The list of entries with changed status (installed/uninstalled)
76      * @return the list of entries
77      */
78     KNS3::Entry::List changedEntries();
79 
80     /**
81      * The list of entries that have been newly installed
82      * @return the list of entries
83      */
84     KNS3::Entry::List installedEntries();
85 
86     /**
87      * Set the title for display purposes in the widget's title.
88      * @param title the title of the application (or category or whatever)
89      */
90     void setTitle(const QString &title);
91 
92     /**
93      * Get the current title
94      * @return the current title
95      */
96     QString title() const;
97 
98     /**
99      * @return the engine used by this dialog
100      * @since 5.30
101      */
102     KNSCore::Engine *engine();
103 
104 public Q_SLOTS:
105     // Override these slots so we can add KAuthorized checks to them.
106     int exec() override;
107     void open() override;
108 
109 protected:
110     void showEvent(QShowEvent *event) override;
111 
112 private:
113     void init(const QString &configFile);
114 
115     DownloadDialogPrivate *const d;
116     Q_DISABLE_COPY(DownloadDialog)
117 };
118 
119 }
120 
121 #endif
122 #endif
123