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

source code of knotifyconfig/src/knotifyconfigwidget.h