| 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 | class KNotifyEventList : public QTreeWidget |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | public: |
| 23 | explicit KNotifyEventList(QWidget *parent); |
| 24 | ~KNotifyEventList() override; |
| 25 | void fill(const QString &appname, bool loadDefaults = false); |
| 26 | void save(); |
| 27 | void updateCurrentItem(); |
| 28 | void updateAllItems(); |
| 29 | QSize sizeHint() const override; |
| 30 | |
| 31 | void selectEvent(const QString &eventId); |
| 32 | bool disableAllSounds(); |
| 33 | |
| 34 | private: |
| 35 | KConfig *config; |
| 36 | QList<KNotifyEventListItem *> m_elements; |
| 37 | |
| 38 | class KNotifyEventListDelegate; |
| 39 | |
| 40 | private Q_SLOTS: |
| 41 | void slotSelectionChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); |
| 42 | |
| 43 | Q_SIGNALS: |
| 44 | void eventSelected(KNotifyConfigElement *); |
| 45 | }; |
| 46 | |
| 47 | class KNotifyEventListItem : public QTreeWidgetItem |
| 48 | { |
| 49 | public: |
| 50 | KNotifyEventListItem(QTreeWidget *parent, const QString &eventName, const QString &name, const QString &description, KConfig *confir); |
| 51 | ~KNotifyEventListItem() override; |
| 52 | void save(); |
| 53 | |
| 54 | KNotifyConfigElement *configElement() |
| 55 | { |
| 56 | return &m_config; |
| 57 | } |
| 58 | |
| 59 | void update(); |
| 60 | |
| 61 | private: |
| 62 | KNotifyConfigElement m_config; |
| 63 | }; |
| 64 | |
| 65 | #endif |
| 66 |
