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
21 #ifndef PWMDSAVEWIDGET_H
22 #define PWMDSAVEWIDGET_H
25 #include <QDialogButtonBox>
28 #include "pwmdKeyTreeWidget.h"
29 #include "ui_pwmdSaveWidget.h"
32 class PwmdSaveWidget
: public QFrame
36 PwmdSaveWidget (QWidget
*);
38 void setHandle (Pwmd
*, bool newFile
= false);
39 gpg_error_t
save (const QString
&args
= 0, bool fromWidget
= false);
40 void setIsNew (bool = true);
43 // Reset the widget to the key list display.
45 void resetRecipients ();
48 // Set if the filename changed.
49 void setNeedsRefresh (bool = true);
53 void slotResetRecipients ();
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 ();
76 void slotStatusMessage (QString line
, void *user
);
77 void slotDeleteKey ();
78 void slotKeySelectionChanged ();
81 void saveReady (bool);
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,
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
;
114 bool selectSignKeyId
;
115 int currentKeyListIndex
;
116 QList
<PwmdKey
*> keyList
;
117 QList
<PwmdKey
*> selectedKeys
;
122 QString newRecipients
;
124 QString encryptKeyFile
;
127 QString generatedKeyId
;