File indexing completed on 2024-09-15 10:32:55
0001 /* 0002 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef SIMPLE_ACTION_DATA_WIDGET_H 0007 #define SIMPLE_ACTION_DATA_WIDGET_H 0008 0009 #include "hotkeys_widget_base.h" 0010 0011 #include "action_data/simple_action_data.h" 0012 0013 #include <QWidget> 0014 0015 /** 0016 * @author Michael Jansen <kde@michael-jansen.biz> 0017 */ 0018 class SimpleActionDataWidget : public HotkeysWidgetBase 0019 { 0020 Q_OBJECT 0021 0022 typedef HotkeysWidgetBase Base; 0023 0024 public: 0025 /** 0026 * Default constructor 0027 */ 0028 SimpleActionDataWidget(QWidget *parent = nullptr); 0029 0030 /** 0031 * Edit \a action. 0032 */ 0033 void setActionData(KHotKeys::SimpleActionData *action); 0034 0035 /// Throws away the held widgets and state. 0036 void unsetActionData(); 0037 0038 KHotKeys::SimpleActionData *data() 0039 { 0040 return static_cast<KHotKeys::SimpleActionData *>(_data); 0041 } 0042 0043 const KHotKeys::SimpleActionData *data() const 0044 { 0045 return static_cast<const KHotKeys::SimpleActionData *>(_data); 0046 } 0047 0048 /** 0049 * Destructor 0050 */ 0051 ~SimpleActionDataWidget() override; 0052 0053 bool isChanged() const override; 0054 0055 protected: 0056 void doCopyFromObject() override; 0057 void doCopyToObject() override; 0058 0059 private: 0060 HotkeysWidgetIFace *currentTrigger; 0061 HotkeysWidgetIFace *currentAction; 0062 }; 0063 0064 #endif /* #ifndef SIMPLE_ACTION_DATA_WIDGET_H */