1 #ifndef CONDITIONS_WIDGET_H 2 #define CONDITIONS_WIDGET_H 3 /* SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz> 4 5 SPDX-License-Identifier: LGPL-2.0-or-later 6 */ 7 8 #include <QMap> 9 #include <QWidget> 10 11 #include "ui_conditions_widget.h" 12 13 class QAction; 14 class QTreeWidgetItem; 15 16 namespace KHotKeys 17 { 18 class Condition_list; 19 class Condition; 20 } 21 22 /** 23 * @author Michael Jansen <kde@michael-jansen.biz> 24 */ 25 class ConditionsWidget : public QWidget 26 { 27 Q_OBJECT 28 29 public: 30 /** 31 * Default constructor 32 */ 33 ConditionsWidget(QWidget *parent = nullptr); 34 35 /** 36 * Destructor 37 */ 38 virtual ~ConditionsWidget(); 39 40 void copyFromObject(); 41 void copyToObject(); 42 43 void setConditionsList(KHotKeys::Condition_list *list); 44 45 //! Are there uncommitted changes? 46 bool hasChanges() const; 47 48 Q_SIGNALS: 49 50 void changed(bool); 51 52 private Q_SLOTS: 53 54 void slotNew(QAction *); 55 void slotEdit(); 56 void slotDelete(); 57 58 private: 59 // Emit the changed(bool) signal if our changed status changes 60 void emitChanged(bool); 61 62 //! The original 63 KHotKeys::Condition_list *_conditions_list; 64 65 //! The working copy 66 KHotKeys::Condition_list *_working; 67 68 //! User Interface Definition 69 Ui::ConditionsWidget ui; 70 71 //! Are there uncommited changes? 72 bool _changed; 73 74 //! Map between treewidgetitems and conditions 75 QMap<QTreeWidgetItem *, KHotKeys::Condition *> _items; 76 }; 77 78 #endif /* #ifndef CONDITIONS_WIDGET_H */ 79