File indexing completed on 2024-05-05 17:56:45

0001 /*
0002     SPDX-FileCopyrightText: 2006 Shie Erlich <erlich@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2006 Rafi Yanai <yanai@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2006-2022 Krusader Krew <https://krusader.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef USERACTIONPAGE_H
0010 #define USERACTIONPAGE_H
0011 
0012 // QtWidgets
0013 #include <QWidget>
0014 
0015 class UserActionListView;
0016 class ActionProperty;
0017 class QToolButton;
0018 
0019 class UserActionPage : public QWidget
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit UserActionPage(QWidget *parent);
0024     ~UserActionPage() override;
0025 
0026     /**
0027      * Be sure to call this function before you delete this page!!
0028      * @return true if this page can be closed
0029      */
0030     bool readyToQuit();
0031 
0032     void applyChanges();
0033 
0034 signals:
0035     void changed(); ///< emitted on changes to an action (used to enable the apply-button)
0036     void applied(); ///< emitted when changes are applied to an action (used to disable the apply-button)
0037 
0038 private:
0039     /**
0040      * If there are modifications in the property-widget, the user is asked
0041      * what to do. Apply, discard or continue editing. In the first case,
0042      * saving is done in this function.
0043      * @return true if a new action can be loaded in the property-widget.
0044      */
0045     bool continueInSpiteOfChanges();
0046     /**
0047      * applies all changes by writing the actionfile and emits "applied"
0048      */
0049     void apply();
0050 
0051     // bool _modified; ///< true if the action-tree was changed (= changes were applied to an action)
0052     UserActionListView *actionTree;
0053     ActionProperty *actionProperties;
0054     QToolButton *importButton, *exportButton;
0055     QToolButton *copyButton, *pasteButton;
0056     QToolButton *removeButton, *newButton;
0057 
0058 private slots:
0059     void slotChangeCurrent(); // loads a new action into the detail-view
0060     void slotUpdateAction(); // updates the action to the xml-file
0061     void slotNewAction();
0062     void slotRemoveAction();
0063     void slotImport();
0064     void slotExport();
0065     void slotToClip();
0066     void slotFromClip();
0067 };
0068 
0069 #endif