2021-05-21 07:21:08 +00:00
|
|
|
/**
|
|
|
|
* This file is part of GPGFrontend.
|
|
|
|
*
|
|
|
|
* GPGFrontend 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.
|
2021-05-11 21:01:05 +00:00
|
|
|
*
|
2021-05-21 07:21:08 +00:00
|
|
|
* Foobar 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.
|
2021-05-11 21:01:05 +00:00
|
|
|
*
|
2021-05-21 07:21:08 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Foobar. If not, see <https://www.gnu.org/licenses/>.
|
2021-05-11 21:01:05 +00:00
|
|
|
*
|
2021-05-21 07:21:08 +00:00
|
|
|
* The initial version of the source code is inherited from gpg4usb-team.
|
|
|
|
* Their source code version also complies with GNU General Public License.
|
2021-05-11 21:01:05 +00:00
|
|
|
*
|
2021-05-21 07:21:08 +00:00
|
|
|
* The source code version of this software was modified and released
|
|
|
|
* by Saturneric<eric@bktus.com> starting on May 12, 2021.
|
2021-05-11 21:01:05 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GPGWIN_H__
|
|
|
|
#define __GPGWIN_H__
|
|
|
|
|
2021-05-12 02:14:58 +00:00
|
|
|
#include "gpg/GpgConstants.h"
|
2021-06-25 07:04:22 +00:00
|
|
|
#include "ui/widgets/Attachments.h"
|
2021-05-12 02:14:58 +00:00
|
|
|
#include "ui/KeyMgmt.h"
|
2021-06-25 07:04:22 +00:00
|
|
|
#include "ui/widgets/TextEdit.h"
|
2021-05-12 02:14:58 +00:00
|
|
|
#include "ui/FileEncryptionDialog.h"
|
|
|
|
#include "ui/SettingsDialog.h"
|
|
|
|
#include "ui/AboutDialog.h"
|
2021-06-06 19:41:06 +00:00
|
|
|
#include "ui/widgets/InfoBoardWidget.h"
|
2021-05-12 02:14:58 +00:00
|
|
|
#include "ui/FindWidget.h"
|
|
|
|
#include "ui/Wizard.h"
|
2021-06-23 08:14:31 +00:00
|
|
|
#include "ui/KeyUploadDialog.h"
|
2021-05-11 21:01:05 +00:00
|
|
|
|
2021-06-08 20:20:59 +00:00
|
|
|
#include "gpg/result_analyse/SignResultAnalyse.h"
|
|
|
|
#include "gpg/result_analyse/EncryptResultAnalyse.h"
|
|
|
|
#include "gpg/result_analyse/DecryptResultAnalyse.h"
|
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
*
|
|
|
|
*/
|
2021-05-11 22:09:22 +00:00
|
|
|
class MainWindow : public QMainWindow {
|
|
|
|
Q_OBJECT
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
MainWindow();
|
2021-05-11 22:09:22 +00:00
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
public slots:
|
2021-05-11 22:09:22 +00:00
|
|
|
|
2021-05-12 00:50:08 +00:00
|
|
|
void slotSetStatusBarText(const QString& text);
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* @details Close event shows a save dialog, if there are unsaved documents on exit.
|
|
|
|
* @param event
|
|
|
|
*/
|
2021-05-11 22:09:22 +00:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
private slots:
|
2021-05-11 22:09:22 +00:00
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
/**
|
|
|
|
* @details encrypt the text of currently active textedit-page
|
|
|
|
* with the currently checked keys
|
|
|
|
*/
|
|
|
|
void slotEncrypt();
|
|
|
|
|
2021-06-05 20:57:30 +00:00
|
|
|
/**
|
|
|
|
* @details encrypt and sign the text of currently active textedit-page
|
|
|
|
* with the currently checked keys
|
|
|
|
*/
|
|
|
|
void slotEncryptSign();
|
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
/**
|
|
|
|
* @details Show a passphrase dialog and decrypt the text of currently active tab.
|
|
|
|
*/
|
|
|
|
void slotDecrypt();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Sign the text of currently active tab with the checked private keys
|
|
|
|
*/
|
|
|
|
void slotSign();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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();
|
|
|
|
|
2021-06-09 19:02:41 +00:00
|
|
|
/**
|
|
|
|
* @details decrypt and verify the text of currently active textedit-page
|
|
|
|
* with the currently checked keys
|
|
|
|
*/
|
|
|
|
void slotDecryptVerify();
|
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
/**
|
|
|
|
* @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 refreshKeysFromKeyserver();
|
2021-05-11 22:09:22 +00:00
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
/**
|
|
|
|
* @details upload the selected key to the keyserver
|
|
|
|
*/
|
|
|
|
void uploadKeyToServer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Open find widget.
|
|
|
|
*/
|
|
|
|
void slotFind();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details start the wizard
|
|
|
|
*/
|
|
|
|
void slotStartWizard();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Import keys from currently active tab to keylist if possible.
|
|
|
|
*/
|
|
|
|
void slotImportKeyFromEdit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Append the selected keys to currently active textedit.
|
|
|
|
*/
|
|
|
|
void slotAppendSelectedKeys();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Copy the mailaddress of selected key to clipboard.
|
|
|
|
* Method for keylists contextmenu.
|
|
|
|
*/
|
|
|
|
void slotCopyMailAddressToClipboard();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Open key management dialog.
|
|
|
|
*/
|
|
|
|
void slotOpenKeyManagement();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 signing file.
|
|
|
|
*/
|
|
|
|
void slotFileSign();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Open dialog for verifying file.
|
|
|
|
*/
|
|
|
|
void slotFileVerify();
|
|
|
|
|
2021-06-25 07:04:22 +00:00
|
|
|
/**
|
|
|
|
* @details Open File Opera Tab
|
|
|
|
*/
|
|
|
|
void slotOpenFileTab();
|
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
/**
|
|
|
|
* @details Open settings-dialog.
|
|
|
|
*/
|
|
|
|
void slotOpenSettingsDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @details Show a warn message in status bar, if there are files in attachment folder.
|
|
|
|
*/
|
|
|
|
void slotCheckAttachmentFolder();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 and the context-menu of the keylist.
|
|
|
|
*/
|
|
|
|
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 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 return true, if restart is needed
|
|
|
|
*/
|
2021-06-09 19:02:41 +00:00
|
|
|
[[nodiscard]] bool getRestartNeeded() const;
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
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 *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 */
|
2021-05-11 22:09:22 +00:00
|
|
|
QToolButton *importButton; /** Toolbutton for import dropdown menu in toolbar */
|
|
|
|
QToolButton *fileEncButton; /** Toolbutton for file cryption dropdown menu in toolbar */
|
2021-06-23 08:14:31 +00:00
|
|
|
QDockWidget *keyListDock; /** Encrypt Dock*/
|
2021-05-11 21:01:05 +00:00
|
|
|
QDockWidget *attachmentDock; /** Attachment Dock */
|
2021-06-06 19:41:06 +00:00
|
|
|
QDockWidget *infoBoardDock;
|
2021-05-11 21:01:05 +00:00
|
|
|
|
|
|
|
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 */
|
2021-06-09 19:02:41 +00:00
|
|
|
QAction *encryptSignAct; /** Action to encrypt and sign text */
|
|
|
|
QAction *decryptVerifyAct; /** Action to encrypt and sign text */
|
2021-05-11 21:01:05 +00:00
|
|
|
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 *cleanDoubleLinebreaksAct; /** Action to remove double line breaks */
|
|
|
|
|
|
|
|
QAction *appendSelectedKeysAct; /** Action to append selected keys to edit */
|
|
|
|
QAction *copyMailAddressToClipboardAct; /** Action to copy mail to clipboard */
|
|
|
|
QAction *openKeyManagementAct; /** Action to open key management */
|
|
|
|
QAction *copyAct; /** Action to copy text */
|
|
|
|
QAction *quoteAct; /** Action to quote text */
|
|
|
|
QAction *cutAct; /** Action to cut text */
|
|
|
|
QAction *pasteAct; /** Action to paste text */
|
2021-06-23 08:14:31 +00:00
|
|
|
QAction *selectAllAct; /** Action to select whole text */
|
2021-05-11 21:01:05 +00:00
|
|
|
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 *showKeyDetailsAct; /** Action to open key-details dialog */
|
|
|
|
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 */
|
|
|
|
|
|
|
|
QLabel *statusBarIcon; /**< TODO */
|
2021-06-18 08:47:06 +00:00
|
|
|
|
|
|
|
QString appPath;
|
|
|
|
QSettings settings;
|
|
|
|
KeyList *mKeyList;
|
|
|
|
|
2021-06-06 19:41:06 +00:00
|
|
|
InfoBoardWidget *infoBoard;
|
2021-05-11 21:01:05 +00:00
|
|
|
Attachments *mAttachments; /**< TODO */
|
|
|
|
GpgME::GpgContext *mCtx; /**< TODO */
|
|
|
|
KeyMgmt *keyMgmt; /**< TODO */
|
|
|
|
KeyServerImportDialog *importDialog; /**< TODO */
|
2021-06-25 07:04:22 +00:00
|
|
|
|
2021-05-11 21:01:05 +00:00
|
|
|
bool attachmentDockCreated;
|
|
|
|
bool restartNeeded;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GPGWIN_H__
|