1/*
2 SPDX-FileCopyrightText: 2004 Aaron J. Seigo <aseigo@kde.org>
3 SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef KNEWSTUFFWIDGETSBUTTON_H
9#define KNEWSTUFFWIDGETSBUTTON_H
10
11#include <KNSCore/Entry>
12#include <QPushButton>
13#include <memory>
14
15#include "knewstuffwidgets_export.h"
16
17namespace KNSWidgets
18{
19class ButtonPrivate;
20/*!
21 * \class KNSWidgets::Button
22 * \inmodule KNewStuffWidgets
23 *
24 * \brief QPushButton subclass that encapsulates the logic for showing the KNewStuff dialog.
25 *
26 * If KNewStuff is disabled using KAuthorized, the button is hidden.
27 *
28 * \sa KAuthorized::GenericRestriction::GHNS
29 *
30 * \since 5.91
31 */
32class KNEWSTUFFWIDGETS_EXPORT Button : public QPushButton
33{
34 Q_OBJECT
35
36public:
37 /*!
38 * Constructor used when the details of the KHotNewStuff
39 * download is known when the button is created.
40 *
41 * \a text describing what is being downloaded.
42 * It should be a text beginning with "Download New ..." for consistency
43 *
44 * \a configFile the name of the .knsrc file
45 *
46 * \a parent the parent widget
47 *
48 */
49 explicit Button(const QString &text, const QString &configFile, QWidget *parent);
50
51 /*!
52 * Constructor used when the code is generated from a .ui file
53 * After the UI is set up, you must call setConfigFile(QString)
54 */
55 explicit Button(QWidget *parent);
56
57 ~Button() override;
58
59 /*!
60 * \note This should only be used when creating the button from a UI-file.
61 */
62 void setConfigFile(const QString &configFile);
63
64Q_SIGNALS:
65 /*!
66 * Emitted when the dialog has been closed.
67 *
68 * \a changedEntries contains the entries that were changed
69 *
70 */
71 void dialogFinished(const QList<KNSCore::Entry> &changedEntries);
72
73private:
74 const std::unique_ptr<ButtonPrivate> d;
75};
76
77}
78
79#endif // KNEWSTUFFBUTTON_H
80

source code of knewstuff/src/widgets/button.h