2 Copyright (C) 2013-2024 Ben Kibbey <bjk@luxsci.net>
4 This file is part of qpwmc.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21 #ifndef APPLICATIONFORM_H
22 #define APPLICATIONFORM_H
25 #include "applicationFormFinalizePage.h"
26 #include "pwmdTreeWidget.h"
27 #include "applicationFormWidget.h"
29 #include "ui_applicationForm.h"
32 class ApplicationFormXmlStream
;
33 class ApplicationFormWidget
;
34 class ApplicationForm
: public QWizard
38 ApplicationForm (const QString
&filename
);
39 ApplicationForm (Pwmd
* = 0, const QString
&filename
= 0,
40 PwmdTreeWidget
* = 0, PwmdMainWindow
* = 0);
41 ApplicationForm (const QString
&filename
, QString
, QString
, QString
);
44 void setHasError (bool = true);
48 QString
elementPath ();
51 void slotRadioButtonClicked (bool);
52 void slotPageChanged (int);
55 void knownHostRc (gpg_error_t
);
58 void slotCancel (bool);
59 void slotChangeExpiry ();
61 void slotElementSelector ();
62 void slotDateSelector (const QDate
&);
63 void slotSocketSelector ();
64 void slotFormElementSelected (QTreeWidgetItem
*, QTreeWidgetItem
*);
65 void slotKnownHostCallback (void *data
, const char *host
, const char *key
,
69 QString
buildElementPath (QString path
, QString element
, bool &);
70 void updateForm (QString
, QString
, QString
);
71 void doForm (const QString
&);
72 void addFormRow (QFormLayout
*fl
, QHBoxLayout
*hb
, ApplicationFormWidget
*w
,
73 QWizardPage
*wp
, bool withLabel
);
74 void addExpiry (ApplicationFormWidget
*w
, QHBoxLayout
*hb
);
75 void keyPressEvent (QKeyEvent
*);
78 friend class ApplicationFormXmlStream
;
79 friend class ApplicationFormFinalizePage
;
80 ApplicationFormFinalizePage
*finalPage
;
81 Ui::ApplicationForm ui
;
82 ApplicationFormXmlStream
*stream
;
83 PwmdMainWindow
*parent
;
84 PwmdTreeWidget
*elementTree
;
87 QList
<QObject
*> widgetsToDelete
;
88 QRegularExpressionValidator
*lineEditValidator
;
90 QString _dataFilename
;
95 class ApplicationElement
98 ApplicationElement (QString path
, bool hidden
)
114 QString
pathNoContent ()
118 if (s
.endsWith ("\t"))
124 int n
= _path
.lastIndexOf ("\t");
126 return _path
.left (n
);
131 void setAttrs (QList
<ApplicationFormAttr
*> a
)
136 QList
<ApplicationFormAttr
*> attrs ()
144 QList
<ApplicationFormAttr
*> _attrs
;