Add help text for attribute S/R.
[qpwmc.git] / pwmdSaveWidget.h
blob09554c7c6002e861ccd4fcd31215db22c9e85114
1 /*
2 Copyright (C) 2010-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
19 USA
21 #ifndef PWMDSAVEWIDGET_H
22 #define PWMDSAVEWIDGET_H
24 #include <QFrame>
25 #include <QDialogButtonBox>
26 #include "pwmd.h"
27 #include "pwmdKey.h"
28 #include "pwmdKeyTreeWidget.h"
29 #include "ui_pwmdSaveWidget.h"
31 class PwmdSaveDialog;
32 class PwmdSaveWidget : public QFrame
34 Q_OBJECT
35 public:
36 PwmdSaveWidget (QWidget *);
37 ~PwmdSaveWidget ();
38 void setHandle (Pwmd *, bool newFile = false);
39 gpg_error_t save (const QString &args = 0, bool fromWidget = false);
40 void setIsNew (bool = true);
41 QString recipients();
42 QString signers();
43 // Reset the widget to the key list display.
44 void reset ();
45 void resetRecipients ();
46 bool isSearching ();
48 // Set if the filename changed.
49 void setNeedsRefresh (bool = true);
50 bool needsRefresh ();
52 public slots:
53 void slotResetRecipients ();
55 private slots:
56 void slotKeyIdChanged (QTreeWidgetItem *, QTreeWidgetItem *);
57 void slotConfirmKeySelection ();
58 void slotRefreshKeyList ();
59 void slotSearchKeyList ();
60 void slotSearchKeyListChanged (const QString &);
61 void slotFindKeyActivated ();
62 void slotAddRecipients ();
63 void slotRemoveRecipients ();
64 void slotAddSubKey ();
65 void slotHeaderSectionResized (int, int, int);
66 void slotSymmetricChanged (int);
67 void slotSecretOnlyChanged (int);
68 void slotJumpToKey (const QString & = 0);
69 void slotSelectKeyFile ();
70 void slotCommandResult (PwmdCommandQueueItem *item, QString result,
71 unsigned err, bool queued);
72 void slotCopyKeyIdToClipboard ();
73 void slotCopyRecipientKeyIdToClipboard ();
74 void slotLearn ();
75 void slotGenerate ();
76 void slotStatusMessage (QString line, void *user);
77 void slotDeleteKey ();
78 void slotKeySelectionChanged ();
80 signals:
81 void saveReady (bool);
83 private:
84 friend class PwmdKeyTreeWidget;
86 void getKeyList (const QString &, bool = false, bool = false);
87 void setKeyId (bool = false);
88 void keyPressEvent (QKeyEvent *);
89 void selectKeyId (bool = false);
90 void createSubKeyItem (PwmdKey *);
91 void createSubKeyItemOnce (QTreeWidgetItem *, QString , PwmdKey *, QString = 0);
92 void showEvent (QShowEvent *);
93 void updateCurrentKeyInfo ();
94 void updateKeyList (bool);
95 void setKeyListRecipients ();
96 void addRecipient (PwmdKeyItemData *);
97 void changeKeyListFocus (PwmdKeyTreeWidget *, bool = false);
98 void doSetKeyListRecipients (QString);
99 void setDefaultKeyParam ();
100 void refreshKeyLists (bool);
101 QTreeWidgetItem *searchKeyList (const QString &, int &, bool = false,
102 bool = false);
103 void updateCurrentKeyInfoFinalize (const QString &);
104 void getKeyListFinalize (const QString &, bool);
105 void saveFinalize ();
106 void clearKeyList ();
107 void clearRecipientList ();
108 void setSymmetric ();
109 bool testRecipients ();
111 Ui::PwmdSaveWidget ui;
112 Pwmd *pwm;
113 bool newFile;
114 bool selectSignKeyId;
115 int currentKeyListIndex;
116 QList <PwmdKey *> keyList;
117 QList <PwmdKey *> selectedKeys;
118 QString _recipients;
119 QString _signers;
120 bool _needsRefresh;
121 QString newSigners;
122 QString newRecipients;
123 QString keyFile;
124 QString encryptKeyFile;
125 QString signKeyFile;
126 bool init;
127 QString generatedKeyId;
130 #endif