File indexing completed on 2024-10-06 09:41:20
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2005 Olivier Goffart <ogoffart at kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KNOTIFYEVENTLIST_H 0009 #define KNOTIFYEVENTLIST_H 0010 0011 #include "knotifyconfigelement.h" 0012 0013 #include <QTreeWidget> 0014 0015 class KNotifyConfigElement; 0016 class KNotifyEventListItem; 0017 class KConfig; 0018 0019 /** 0020 @author Olivier Goffart <ogoffart at kde.org> 0021 */ 0022 class KNotifyEventList : public QTreeWidget 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit KNotifyEventList(QWidget *parent); 0027 ~KNotifyEventList() override; 0028 void fill(const QString &appname, const QString &context_name = QString(), const QString &context_value = QString(), bool loadDefaults = false); 0029 void save(); 0030 void updateCurrentItem(); 0031 void updateAllItems(); 0032 QSize sizeHint() const override; 0033 0034 void selectEvent(const QString &eventId); 0035 bool disableAllSounds(); 0036 0037 private: 0038 KConfig *config; 0039 QList<KNotifyEventListItem *> m_elements; 0040 0041 class KNotifyEventListDelegate; 0042 0043 private Q_SLOTS: 0044 void slotSelectionChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); 0045 0046 Q_SIGNALS: 0047 void eventSelected(KNotifyConfigElement *); 0048 }; 0049 0050 class KNotifyEventListItem : public QTreeWidgetItem 0051 { 0052 public: 0053 KNotifyEventListItem(QTreeWidget *parent, const QString &eventName, const QString &name, const QString &description, KConfig *confir); 0054 ~KNotifyEventListItem() override; 0055 void save(); 0056 0057 KNotifyConfigElement *configElement() 0058 { 0059 return &m_config; 0060 } 0061 0062 void update(); 0063 0064 private: 0065 KNotifyConfigElement m_config; 0066 }; 0067 0068 #endif