File indexing completed on 2024-04-14 14:26:41

0001 /*
0002     knewstuff3/ui/downloaddialog.h.
0003     SPDX-FileCopyrightText: 2005 Enrico Ros <eros.kde@email.it>
0004     SPDX-FileCopyrightText: 2005-2007 Josef Spillner <spillner@kde.org>
0005     SPDX-FileCopyrightText: 2007 Dirk Mueller <mueller@kde.org>
0006     SPDX-FileCopyrightText: 2007-2009 Jeremy Whiting <jpwhiting@kde.org>
0007     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
0008 
0009     SPDX-License-Identifier: LGPL-2.1-or-later
0010 */
0011 
0012 #ifndef KNEWSTUFF3_UI_DOWNLOADDIALOG_H
0013 #define KNEWSTUFF3_UI_DOWNLOADDIALOG_H
0014 
0015 #include <QDialog>
0016 
0017 #include "entry.h"
0018 #include "knewstuff_export.h"
0019 
0020 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 80)
0021 
0022 namespace KNSCore
0023 {
0024 class Engine;
0025 }
0026 
0027 namespace KNS3
0028 {
0029 class DownloadDialogPrivate;
0030 
0031 /**
0032  * KNewStuff download dialog.
0033  *
0034  * The download dialog will present items to the user
0035  * for installation, updates and removal.
0036  * Preview images as well as other meta information can be seen.
0037  *
0038  * @since 4.4
0039  * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
0040  */
0041 class KNEWSTUFF_EXPORT DownloadDialog : public QDialog
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046     /**
0047      * Create a DownloadDialog that lets the user install, update and uninstall
0048      * contents. It will try to find a appname.knsrc file with the configuration.
0049      * Appname is the name of your application as provided in the about data->
0050      *
0051      * @param parent the parent of the dialog
0052      * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
0053      */
0054     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components or the KNS3::QtQuickDialogWrapper instead")
0055     explicit DownloadDialog(QWidget *parent = nullptr);
0056 
0057     /**
0058      * Create a DownloadDialog that lets the user install, update and uninstall
0059      * contents. Manually specify the name of a .knsrc file where the
0060      * KHotNewStuff configuration can be found.
0061      *
0062      * @param configFile the name of the configuration file
0063      * @param parent the parent of the dialog
0064      * @deprecated Since 5.80, use the QML components or the KNS3::QtQuickDialogWrapper instead
0065      */
0066     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components or the KNS3::QtQuickDialogWrapper instead")
0067     explicit DownloadDialog(const QString &configFile, QWidget *parent = nullptr);
0068 
0069     /**
0070      * destructor
0071      */
0072     ~DownloadDialog() override;
0073 
0074     /**
0075      * The list of entries with changed status (installed/uninstalled)
0076      * @return the list of entries
0077      */
0078     KNS3::Entry::List changedEntries();
0079 
0080     /**
0081      * The list of entries that have been newly installed
0082      * @return the list of entries
0083      */
0084     KNS3::Entry::List installedEntries();
0085 
0086     /**
0087      * Set the title for display purposes in the widget's title.
0088      * @param title the title of the application (or category or whatever)
0089      */
0090     void setTitle(const QString &title);
0091 
0092     /**
0093      * Get the current title
0094      * @return the current title
0095      */
0096     QString title() const;
0097 
0098     /**
0099      * @return the engine used by this dialog
0100      * @since 5.30
0101      */
0102     KNSCore::Engine *engine();
0103 
0104 public Q_SLOTS:
0105     // Override these slots so we can add KAuthorized checks to them.
0106     int exec() override;
0107     void open() override;
0108 
0109 protected:
0110     void showEvent(QShowEvent *event) override;
0111 
0112 private:
0113     void init(const QString &configFile);
0114 
0115     DownloadDialogPrivate *const d;
0116     Q_DISABLE_COPY(DownloadDialog)
0117 };
0118 
0119 }
0120 
0121 #endif
0122 #endif