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 KNOTIFYEVENTLIST_H |
9 | #define KNOTIFYEVENTLIST_H |
10 | |
11 | #include "knotifyconfigelement.h" |
12 | |
13 | #include <QTreeWidget> |
14 | |
15 | class KNotifyConfigElement; |
16 | class KNotifyEventListItem; |
17 | class KConfig; |
18 | |
19 | /** |
20 | @author Olivier Goffart <ogoffart at kde.org> |
21 | */ |
22 | class KNotifyEventList : public QTreeWidget |
23 | { |
24 | Q_OBJECT |
25 | public: |
26 | explicit KNotifyEventList(QWidget *parent); |
27 | ~KNotifyEventList() override; |
28 | void fill(const QString &appname, bool loadDefaults = false); |
29 | void save(); |
30 | void updateCurrentItem(); |
31 | void updateAllItems(); |
32 | QSize sizeHint() const override; |
33 | |
34 | void selectEvent(const QString &eventId); |
35 | bool disableAllSounds(); |
36 | |
37 | private: |
38 | KConfig *config; |
39 | QList<KNotifyEventListItem *> m_elements; |
40 | |
41 | class KNotifyEventListDelegate; |
42 | |
43 | private Q_SLOTS: |
44 | void slotSelectionChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); |
45 | |
46 | Q_SIGNALS: |
47 | void eventSelected(KNotifyConfigElement *); |
48 | }; |
49 | |
50 | class KNotifyEventListItem : public QTreeWidgetItem |
51 | { |
52 | public: |
53 | KNotifyEventListItem(QTreeWidget *parent, const QString &eventName, const QString &name, const QString &description, KConfig *confir); |
54 | ~KNotifyEventListItem() override; |
55 | void save(); |
56 | |
57 | KNotifyConfigElement *configElement() |
58 | { |
59 | return &m_config; |
60 | } |
61 | |
62 | void update(); |
63 | |
64 | private: |
65 | KNotifyConfigElement m_config; |
66 | }; |
67 | |
68 | #endif |
69 |