1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
/*
* mainwindow.h
*
* Copyright 2008 gpg4usb-team <[email protected]>
*
* This file is part of gpg4usb.
*
* Gpg4usb is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Gpg4usb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gpg4usb. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef __GPGWIN_H__
#define __GPGWIN_H__
#include "gpgconstants.h"
#include "attachments.h"
#include "textedit.h"
#include "fileencryptiondialog.h"
#include "settingsdialog.h"
#include "aboutdialog.h"
#include "verifynotification.h"
#include "findwidget.h"
#include "wizard.h"
//#include "kgpg/kgpgtextinterface.h"
#include "kgpg/core/kgpgkey.h"
#include "kgpg/transactions/kgpgencrypt.h"
#include "kgpg/transactions/kgpgdecrypt.h"
#include "kgpg/transactions/kgpgexport.h"
#include "kgpg/transactions/kgpgimport.h"
#include "kgpg/transactions/kgpgsigntext.h"
#include "kgpg/transactions/kgpgdelkey.h"
QT_BEGIN_NAMESPACE
class QMainWindow;
class QTextEdit;
class QWidget;
class QVBoxLayout;
class QGridLayout;
class iostream;
class QtGui;
class QString;
class QFileDialog;
class QStringList;
class QIcon;
class QMessageBox;
class QVBoxLayout;
class QAction;
class QMenu;
class QTextEdit;
class QComboBox;
class QPushButton;
class QRadioButton;
class QButtonGroup;
class QApplication;
class QDockWidget;
QT_END_NAMESPACE
/**
* @brief
*
*/
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
/**
* @brief
*
*/
MainWindow();
public slots:
void slotSetStatusBarText(QString text);
protected:
/**
* @details Close event shows a save dialog, if there are unsaved documents on exit.
* @param event
*/
void closeEvent(QCloseEvent *event);
private slots:
/**
* @details encrypt the text of currently active textedit-page
* with the currently checked keys
*/
void slotEncrypt();
void slotEncryptDone(int result);
/**
* @details Show a passphrase dialog and decrypt the text of currently active tab.
*/
void slotDecrypt();
void slotDecryptDone(int result);
/**
* @details Sign the text of currently active tab with the checked private keys
*/
void slotSign();
void slotSignDone(int result);
/**
* @details Verify the text of currently active tab and show verify information.
* If document is signed with a key, which is not in keylist, show import missing
* key from keyserver in Menu of verifynotification.
*/
void slotVerify();
/**
* @details Open find widget.
*/
void slotFind();
/**
* @details Show the details of the first of the first of selected keys
*/
void slotShowKeyDetails();
/**
* @details Refresh key information of selected keys from default keyserver
*/
void slotRefreshKeysFromKeyserver();
/**
* @details upload the selected key to the keyserver
*/
void slotUploadKeyToServer();
void slotUploadKeyToServerReady(int result);
/**
* @details start the wizard
*/
void slotStartWizard();
/**
* @details Delete selected keys in keyklist
*/
void slotDeleteSelectedKeys();
/**
* @details Delete checked keys in keyklist
*/
void slotDeleteCheckedKeys();
/**
* @details Slot called after deleting keys
*/
void slotKeyDeleted(int retcode);
/**
* @details Slot to show generate key dialog
*/
void slotGenerateKeyDialog();
/**
* @details Delete keys, but show a warn dialog before
*/
void slotDdeleteKeysWithWarning(QStringList *uidList);
/**
* @details Import keys from currently active tab to keylist if possible.
*/
void slotImportKeyFromEdit();
void slotImportKeyFromKeyServer();
void slotStartImport(KGpgImport *import);
void slotImportDone(int result);
/**
* @details Export checked keys to file.
*/
void slotExportKeyToFile();
/**
* @details Export checked keys to clipboard.
*/
void slotExportKeyToClipboard();
void slotExportKeyToClipboardReady(int result);
/**
* @details Append the selected keys to currently active textedit.
*/
void slotAppendSelectedKeys();
void slotAppendSelectedKeysReady(int result);
/**
* @details Copy the mailaddress of selected key to clipboard.
* Method for keylists contextmenu.
*/
void slotCopyMailAddressToClipboard();
/**
* @details Open about-dialog.
*/
void slotAbout();
/**
* @details Open dialog for encrypting file.
*/
void slotFileEncrypt();
/**
* @details Open dialog for decrypting file.
*/
void slotFileDecrypt();
/**
* @details Open dialog for encrypting file.
*/
void slotFileSign();
/**
* @details Open dialog for decrypting file.
*/
void slotFileVerify();
/**
* @details Open settings-dialog.
*/
void slotOpenSettingsDialog();
/**
* @details Open online-tutorial in default browser.
*/
void slotOpenTutorial();
/**
* @details Open integrated help in new tab.
*/
void slotOpenHelp();
/**
* @details Open integrated help in new tab with the specified page.
*/
void slotOpenHelp(const QString page);
/**
* @details Show a warn message in status bar, if there are files in attachment folder.
*/
void slotCheckAttachmentFolder();
/**
* @details Open online translation tutorial in default browser.
*/
void slotOpenTranslate();
/**
* @details Replace double linebreaks by single linebreaks in currently active tab.
*/
void slotCleanDoubleLinebreaks();
/**
* @details Cut the existing PGP header and footer from current tab.
*/
void slotCutPgpHeader();
/**
* @details Add PGP header and footer to current tab.
*/
void slotAddPgpHeader();
// void dropEvent(QDropEvent *event);
/**
* @details Disable tab related actions, if number of tabs is 0.
* @param number number of the opened tabs and -1, if no tab is opened
*/
void slotDisableTabActions(int number);
/**
* @details get value of member restartNeeded to needed.
* @param needed true, if application has to be restarted
*/
void slotSetRestartNeeded(bool needed);
private:
/**
* @details Create actions for the main-menu.
*/
void createActions();
/**
* @details create the menu of the main-window.
*/
void createMenus();
/**
* @details Create edit-, crypt- and key-toolbars.
*/
void createToolBars();
/**
* @details Create statusbar of mainwindow.
*/
void createStatusBar();
/**
* @details Create keylist- and attachment-dockwindows.
*/
void createDockWindows();
/**
* @details Create the context menu of the keylist.
*/
void createKeyListMenu();
/**
* @details Create attachment-dockwindow.
*/
void createAttachmentDock();
/**
* @details close attachment-dockwindow.
*/
void closeAttachmentDock();
/**
* @details Load settings from ini-file.
*/
void restoreSettings();
/**
* @details Save settings to ini-file.
*/
void saveSettings();
/**
* @brief
*
* @param message
*/
void parseMime(QByteArray *message);
/**
* @brief show a message in the status bar
* @param msg the text to show
* @param keep if the text should stay visible or may be hidden after a while
*/
void changeMessage(const QString &msg, const bool keep = false);
/**
* @brief return true, if restart is needed
*/
bool getRestartNeeded();
TextEdit *edit; /** Tabwidget holding the edit-windows */
QMenu *fileMenu; /** Submenu for file operations*/
QMenu *editMenu; /** Submenu for text operations*/
QMenu *cryptMenu; /** Submenu for crypt operations */
QMenu* fileEncMenu; /** Submenu for file crypt operations */
QMenu *helpMenu; /** Submenu for help-operations */
QMenu *keyMenu; /** Submenu for key-operations */
QMenu *viewMenu; /** Submenu for view operations */
QMenu *importKeyMenu; /** Sumenu for import operations */
QMenu *exportKeyMenu; /** Sumenu for export operations */
QMenu *steganoMenu; /** Submenu for steganographic operations*/
QToolBar *cryptToolBar; /** Toolbar holding crypt actions */
QToolBar *fileToolBar; /** Toolbar holding file actions */
QToolBar *editToolBar; /** Toolbar holding edit actions */
QToolBar *specialEditToolBar; /** Toolbar holding special edit actions */
QToolBar *keyToolBar; /** Toolbar holding key operations */
QToolButton* importButton; /** Toolbutton for import dropdown menu in toolbar */
QToolButton* fileEncButton; /** Toolbutton for file cryption dropdown menu in toolbar */
QDockWidget *keylistDock; /** Encrypt Dock*/
QDockWidget *attachmentDock; /** Attachment Dock */
QDialog *genkeyDialog; /** Dialog for key generation */
QAction *newTabAct; /** Action to create new tab */
QAction *switchTabUpAct; /** Action to switch tab up*/
QAction *switchTabDownAct; /** Action to switch tab down */
QAction *openAct; /** Action to open file */
QAction *saveAct; /** Action to save file */
QAction *saveAsAct; /** Action to save file as */
QAction *printAct; /** Action to print */
QAction *closeTabAct; /** Action to print */
QAction *quitAct; /** Action to quit application */
QAction *encryptAct; /** Action to encrypt text */
QAction *decryptAct; /** Action to decrypt text */
QAction *signAct; /** Action to sign text */
QAction *verifyAct; /** Action to verify text */
QAction *importKeyFromEditAct; /** Action to import key from edit */
QAction *exportKeyToClipboardAct; /** Action to export selected keys to clipboard */
QAction *exportKeyToFileAct; /** Action to export selected keys to file */
QAction *cleanDoubleLinebreaksAct; /** Action to remove double line breaks */
QAction *appendSelectedKeysAct; /** Action to append selected keys to edit */
QAction *generateKeyDialogAct; /** Action to open key generation dialog */
QAction *copyMailAddressToClipboardAct; /** Action to copy mail to clipboard */
QAction *copyAct; /** Action to copy text */
QAction *quoteAct; /** Action to quote text */
QAction *cutAct; /** Action to cut text */
QAction *pasteAct; /** Action to paste text */
QAction *selectallAct; /** Action to select whole text */
QAction *findAct; /** Action to find text */
QAction *undoAct; /** Action to undo last action */
QAction *redoAct; /** Action to redo last action */
QAction *zoomInAct; /** Action to zoom in */
QAction *zoomOutAct; /** Action to zoom out */
QAction *aboutAct; /** Action to open about dialog */
QAction *fileEncryptAct; /** Action to open dialog for encrypting file */
QAction *fileDecryptAct; /** Action to open dialog for decrypting file */
QAction *fileSignAct; /** Action to open dialog for signing file */
QAction *fileVerifyAct; /** Action to open dialog for verifying file */
QAction *openSettingsAct; /** Action to open settings dialog */
QAction *openTranslateAct; /** Action to open translate doc*/
QAction *openTutorialAct; /** Action to open tutorial */
QAction *openHelpAct; /** Action to open tutorial */
QAction *showKeyDetailsAct; /** Action to open key-details dialog */
QAction *deleteSelectedKeysAct; /** Action to delete selected keys */
QAction *deleteCheckedKeysAct; /** Action to delete checked keys */
QAction *refreshKeysFromKeyserverAct; /** Action to refresh a key from keyserver */
QAction *uploadKeyToServerAct; /** Action to append selected keys to edit */
QAction *startWizardAct; /** Action to open the wizard */
QAction *cutPgpHeaderAct; /** Action for cutting the PGP header */
QAction *addPgpHeaderAct; /** Action for adding the PGP header */
QAction *importKeyFromFileAct;
QAction *importKeyFromClipboardAct;
QAction *importKeyFromKeyServerAct;
QLabel *statusBarIcon; /**< TODO */
QSettings settings; /**< TODO */
KeyList *mKeyList; /**< TODO */
Attachments *mAttachments; /**< TODO */
GpgME::GpgContext *mCtx; /**< TODO */
KeyServerImportDialog *importDialog; /**< TODO */
bool attachmentDockCreated;
bool restartNeeded;
};
#endif // __GPGWIN_H__
|