KNotifyConfig

knotifyconfigwidget.h
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 
16 class KNotifyConfigWidgetPrivate;
17 /**
18  * @class KNotifyConfigWidget knotifyconfigwidget.h <KNotifyConfigWidget>
19  *
20  * Configure the notification for a given application / context
21  *
22  * You probably will want to use the static function configure
23  *
24  * If you create the widget yourself, you must call setApplication before showing it
25  *
26  * @author Olivier Goffart <ogoffart @ kde.org>
27  */
28 class KNOTIFYCONFIG_EXPORT KNotifyConfigWidget : public QWidget
29 {
30  Q_OBJECT
31 public:
32  explicit KNotifyConfigWidget(QWidget *parent);
33  ~KNotifyConfigWidget() override;
34 
35  /**
36  * Show a dialog with the widget.
37  * @param parent the parent widget of the dialog
38  * @param appname the application name, if null, it is autodetected
39  * @return the widget itself the topLevelWidget of it is probably a KDialog
40  */
41  static KNotifyConfigWidget *configure(QWidget *parent = nullptr, const QString &appname = QString());
42 
43  /**
44  * Change the application and the context
45  *
46  * @param appname name of the application. if null QCoreApplication::instance()->applicationName() is used
47  * @param context_name the name of the context, if null , avery context are considered
48  * @param context_value the context value
49  */
50  void setApplication(const QString &appname = QString(), const QString &context_name = QString(), const QString &context_value = 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 
60 public 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 
79 Q_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 
87 private:
88  KNotifyConfigWidgetPrivate *const d;
89 private Q_SLOTS:
90  void slotEventSelected(KNotifyConfigElement *e);
91  void slotActionChanged();
92 };
93 
94 #endif
Represent the config for an event.
Configure the notification for a given application / context.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jan 22 2022 22:35:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.