File indexing completed on 2024-05-05 17:56:44
0001 /* 0002 SPDX-FileCopyrightText: 2004-2007 Jonas Bähr <jonas.baehr@web.de> 0003 SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef ACTIONPROPERTY_H 0009 #define ACTIONPROPERTY_H 0010 0011 #include "ui_actionproperty.h" 0012 0013 class KrAction; 0014 0015 /** 0016 * Use this widget where ever you need to manipulate a UserAction 0017 */ 0018 class ActionProperty : public QWidget, public Ui::ActionProperty 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit ActionProperty(QWidget *parent = nullptr, KrAction *action = nullptr); 0023 ~ActionProperty() override; 0024 0025 /** 0026 * @return the currently displayed action 0027 */ 0028 KrAction *action() 0029 { 0030 return _action; 0031 }; 0032 0033 /** 0034 * This inits the widget with the actions properties. 0035 * If no action is provided, the last used will be taken! 0036 * It also resets the changed() state. 0037 * @param action the action which should be displayd 0038 */ 0039 void updateGUI(KrAction *action = nullptr); 0040 0041 /** 0042 * This writes the displayed properties back into the action. 0043 * If no action is provided, the last used will be taken! 0044 * It also resets the changed() state. 0045 * @param action the action which should be manipulated 0046 */ 0047 void updateAction(KrAction *action = nullptr); 0048 0049 /** 0050 * clears everything 0051 */ 0052 void clear(); 0053 0054 /** 0055 * @return true if all properties got valid values 0056 */ 0057 bool validProperties(); 0058 0059 /** 0060 * @return true if any property got changed 0061 */ 0062 bool isModified() 0063 { 0064 return _modified; 0065 }; 0066 0067 signals: 0068 /** 0069 * emitted when any actionproperty changed. This signal is only emitted when 0070 * the _modified attribute changes to true. If there are changes made and 0071 * _modified is already true, no signal is emitted! 0072 */ 0073 void changed(); 0074 0075 protected slots: 0076 void setModified(bool m = true); 0077 /** 0078 * executes the AddPlaceholderPopup 0079 */ 0080 void addPlaceholder(); 0081 /** 0082 * asks for an existing path 0083 */ 0084 void addStartpath(); 0085 /** 0086 * (availability) asks for a new protocol 0087 */ 0088 void newProtocol(); 0089 /** 0090 * (availability) changes a protocol of the list 0091 */ 0092 void editProtocol(); 0093 /** 0094 * (availability) removes a protocol from the list 0095 */ 0096 void removeProtocol(); 0097 /** 0098 * (availability) asks for a new path 0099 */ 0100 void addPath(); 0101 /** 0102 * (availability) edits a path of the list 0103 */ 0104 void editPath(); 0105 /** 0106 * (availability) removes a path from the list 0107 */ 0108 void removePath(); 0109 /** 0110 * (availability) asks for a new mime-type 0111 */ 0112 void addMime(); 0113 /** 0114 * (availability) changes a mime-type of the list 0115 */ 0116 void editMime(); 0117 /** 0118 * (availability) removes a mime-type from the list 0119 */ 0120 void removeMime(); 0121 /** 0122 * (availability) asks for a new file-filter 0123 */ 0124 void newFile(); 0125 /** 0126 * (availability) edits a file-filter of the list 0127 */ 0128 void editFile(); 0129 /** 0130 * (availability) removes a file-filter from the lsit 0131 */ 0132 void removeFile(); 0133 0134 private: 0135 KrAction *_action; 0136 bool _modified; 0137 0138 private slots: 0139 /** 0140 * This updates the ShortcutButton 0141 * @internal 0142 */ 0143 void changedShortcut(const QKeySequence &shortcut); 0144 }; 0145 0146 #endif