File indexing completed on 2024-04-28 09:41:06
0001 /* 0002 KT list view item cron tasks folder. 0003 -------------------------------------------------------------------- 0004 SPDX-FileCopyrightText: 1999 Gary Meyer <gary@meyer.net> 0005 -------------------------------------------------------------------- 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include <QTreeWidget> 0012 0013 #include "cthost.h" 0014 #include "genericListWidget.h" 0015 0016 class VariableWidget; 0017 class CTVariable; 0018 0019 class VariablesWidgetPrivate; 0020 0021 /** 0022 * QListViewItem of a "tasks" folder. 0023 */ 0024 class VariablesWidget : public GenericListWidget 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 /** 0030 * Construct tasks folder from branch. 0031 */ 0032 explicit VariablesWidget(CrontabWidget *crontabWidget); 0033 0034 ~VariablesWidget() override; 0035 0036 QList<VariableWidget *> selectedVariablesWidget() const; 0037 0038 VariableWidget *firstSelectedVariableWidget() const; 0039 0040 void refreshVariables(CTCron *cron); 0041 0042 bool needUserColumn(); 0043 0044 /** 0045 * Enables/disables modification buttons 0046 */ 0047 void toggleModificationActions(bool enabled); 0048 0049 /** 0050 * Enables/disables new entry actions 0051 */ 0052 void toggleNewEntryAction(bool enabled); 0053 0054 Q_SIGNALS: 0055 void variableModified(bool); 0056 0057 public Q_SLOTS: 0058 void modifySelection(); 0059 0060 void deleteSelection() override; 0061 0062 /** 0063 * Create a new variable. Default is which type is most recently selected. 0064 */ 0065 void createVariable(); 0066 0067 void addVariable(CTVariable *variable); 0068 0069 void changeCurrentSelection(); 0070 0071 protected Q_SLOTS: 0072 void modifySelection(QTreeWidgetItem *item, int position) override; 0073 0074 private: 0075 void refreshHeaders(); 0076 0077 int statusColumnIndex(); 0078 0079 void setupActions(); 0080 0081 void prepareContextualMenu(); 0082 0083 QAction *mNewVariableAction = nullptr; 0084 0085 QAction *mModifyAction = nullptr; 0086 0087 QAction *mDeleteAction = nullptr; 0088 }; 0089