| 1 | /* |
| 2 | This file is part of the KDE libraries |
| 3 | SPDX-FileCopyrightText: 2005 Olivier Goffart <ogoffart at kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-only |
| 6 | */ |
| 7 | |
| 8 | #ifndef KNOTIFYCONFIGWIDGET_H |
| 9 | #define KNOTIFYCONFIGWIDGET_H |
| 10 | |
| 11 | #include <QString> |
| 12 | #include <QWidget> |
| 13 | #include <knotifyconfig_export.h> |
| 14 | |
| 15 | #include <memory> |
| 16 | |
| 17 | class KNotifyConfigElement; |
| 18 | class KNotifyConfigWidgetPrivate; |
| 19 | /*! |
| 20 | * \class KNotifyConfigWidget |
| 21 | * \inmodule KNotifyConfig |
| 22 | * |
| 23 | * \brief Configure the notification for a given application. |
| 24 | * |
| 25 | * You probably will want to use the static function configure |
| 26 | * |
| 27 | * If you create the widget yourself, you must call setApplication before showing it. |
| 28 | */ |
| 29 | class KNOTIFYCONFIG_EXPORT KNotifyConfigWidget : public QWidget |
| 30 | { |
| 31 | Q_OBJECT |
| 32 | public: |
| 33 | /*! |
| 34 | * |
| 35 | */ |
| 36 | explicit KNotifyConfigWidget(QWidget *parent); |
| 37 | ~KNotifyConfigWidget() override; |
| 38 | |
| 39 | /*! |
| 40 | * Show a dialog with the widget. |
| 41 | * |
| 42 | * \a parent the parent widget of the dialog |
| 43 | * |
| 44 | * \a appname the application name, if null, it is autodetected |
| 45 | * |
| 46 | * Returns the widget itself the topLevelWidget of it is probably a KDialog |
| 47 | */ |
| 48 | static KNotifyConfigWidget *configure(QWidget *parent = nullptr, const QString &appname = QString()); |
| 49 | |
| 50 | /*! |
| 51 | * Change the application |
| 52 | * |
| 53 | * \a appname name of the application. If null QCoreApplication::instance()->applicationName() is used |
| 54 | */ |
| 55 | void setApplication(const QString &appname = QString()); |
| 56 | |
| 57 | /*! |
| 58 | * Select a given notification in the current list |
| 59 | * |
| 60 | * \a id The id of the notification |
| 61 | * \since 5.18 |
| 62 | */ |
| 63 | void selectEvent(const QString &eventId); |
| 64 | |
| 65 | public Q_SLOTS: |
| 66 | /*! |
| 67 | * save to the config file |
| 68 | */ |
| 69 | void save(); |
| 70 | |
| 71 | /*! |
| 72 | * Reset the UI to display the default values |
| 73 | * \sa KCModule::defaults |
| 74 | * \since 5.15 |
| 75 | */ |
| 76 | void revertToDefaults(); |
| 77 | |
| 78 | /*! |
| 79 | * Disable all sounds for the current application |
| 80 | * \since 5.23 |
| 81 | */ |
| 82 | void disableAllSounds(); |
| 83 | |
| 84 | Q_SIGNALS: |
| 85 | /*! |
| 86 | * Indicate that the state of the modules contents has changed. |
| 87 | * This signal is emitted whenever the state of the configuration changes. |
| 88 | * \sa KCModule::changed |
| 89 | */ |
| 90 | void changed(bool state); |
| 91 | |
| 92 | private Q_SLOTS: |
| 93 | KNOTIFYCONFIG_NO_EXPORT void slotEventSelected(KNotifyConfigElement *e); |
| 94 | KNOTIFYCONFIG_NO_EXPORT void slotActionChanged(); |
| 95 | |
| 96 | private: |
| 97 | std::unique_ptr<KNotifyConfigWidgetPrivate> const d; |
| 98 | }; |
| 99 | |
| 100 | #endif |
| 101 | |