File indexing completed on 2024-10-06 13:19:03
0001 #ifndef CONDITIONS_WIDGET_H 0002 #define CONDITIONS_WIDGET_H 0003 /* SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include <QMap> 0009 #include <QWidget> 0010 0011 #include "ui_conditions_widget.h" 0012 0013 class QAction; 0014 class QTreeWidgetItem; 0015 0016 namespace KHotKeys 0017 { 0018 class Condition_list; 0019 class Condition; 0020 } 0021 0022 /** 0023 * @author Michael Jansen <kde@michael-jansen.biz> 0024 */ 0025 class ConditionsWidget : public QWidget 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 /** 0031 * Default constructor 0032 */ 0033 ConditionsWidget(QWidget *parent = nullptr); 0034 0035 /** 0036 * Destructor 0037 */ 0038 ~ConditionsWidget() override; 0039 0040 void copyFromObject(); 0041 void copyToObject(); 0042 0043 void setConditionsList(KHotKeys::Condition_list *list); 0044 0045 //! Are there uncommitted changes? 0046 bool hasChanges() const; 0047 0048 Q_SIGNALS: 0049 0050 void changed(bool); 0051 0052 private Q_SLOTS: 0053 0054 void slotNew(QAction *); 0055 void slotEdit(); 0056 void slotDelete(); 0057 0058 private: 0059 // Emit the changed(bool) signal if our changed status changes 0060 void emitChanged(bool); 0061 0062 //! The original 0063 KHotKeys::Condition_list *_conditions_list; 0064 0065 //! The working copy 0066 KHotKeys::Condition_list *_working; 0067 0068 //! User Interface Definition 0069 Ui::ConditionsWidget ui; 0070 0071 //! Are there uncommited changes? 0072 bool _changed; 0073 0074 //! Map between treewidgetitems and conditions 0075 QMap<QTreeWidgetItem *, KHotKeys::Condition *> _items; 0076 }; 0077 0078 #endif /* #ifndef CONDITIONS_WIDGET_H */