diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/MainWindow.h | 15 | ||||
-rw-r--r-- | include/gpg/GpgContext.h | 2 | ||||
-rw-r--r-- | include/ui/FindWidget.h | 2 | ||||
-rw-r--r-- | include/ui/KeyImportDetailDialog.h | 2 | ||||
-rw-r--r-- | include/ui/KeyServerImportDialog.h | 37 | ||||
-rw-r--r-- | include/ui/KeyUploadDialog.h | 51 | ||||
-rw-r--r-- | include/ui/VerifyDetailsDialog.h | 2 | ||||
-rw-r--r-- | include/ui/keypair_details/KeyPairDetailTab.h | 15 | ||||
-rw-r--r-- | include/ui/widgets/Attachments.h (renamed from include/ui/Attachments.h) | 2 | ||||
-rw-r--r-- | include/ui/widgets/EditorPage.h (renamed from include/ui/EditorPage.h) | 0 | ||||
-rw-r--r-- | include/ui/widgets/FilePage.h | 56 | ||||
-rw-r--r-- | include/ui/widgets/HelpPage.h (renamed from include/ui/HelpPage.h) | 0 | ||||
-rw-r--r-- | include/ui/widgets/InfoBoardWidget.h | 2 | ||||
-rw-r--r-- | include/ui/widgets/KeyList.h | 11 | ||||
-rw-r--r-- | include/ui/widgets/TextEdit.h (renamed from include/ui/TextEdit.h) | 25 |
15 files changed, 182 insertions, 40 deletions
diff --git a/include/MainWindow.h b/include/MainWindow.h index 48d77d25..c5937e0d 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -26,15 +26,16 @@ #define __GPGWIN_H__ #include "gpg/GpgConstants.h" -#include "ui/Attachments.h" +#include "ui/widgets/Attachments.h" #include "ui/KeyMgmt.h" -#include "ui/TextEdit.h" +#include "ui/widgets/TextEdit.h" #include "ui/FileEncryptionDialog.h" #include "ui/SettingsDialog.h" #include "ui/AboutDialog.h" #include "ui/widgets/InfoBoardWidget.h" #include "ui/FindWidget.h" #include "ui/Wizard.h" +#include "ui/KeyUploadDialog.h" #include "gpg/result_analyse/SignResultAnalyse.h" #include "gpg/result_analyse/EncryptResultAnalyse.h" @@ -175,6 +176,11 @@ private slots: void slotFileVerify(); /** + * @details Open File Opera Tab + */ + void slotOpenFileTab(); + + /** * @details Open settings-dialog. */ void slotOpenSettingsDialog(); @@ -279,7 +285,7 @@ private: 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 *keyListDock; /** Encrypt Dock*/ QDockWidget *attachmentDock; /** Attachment Dock */ QDockWidget *infoBoardDock; @@ -308,7 +314,7 @@ private: 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 *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 */ @@ -338,6 +344,7 @@ private: GpgME::GpgContext *mCtx; /**< TODO */ KeyMgmt *keyMgmt; /**< TODO */ KeyServerImportDialog *importDialog; /**< TODO */ + bool attachmentDockCreated; bool restartNeeded; }; diff --git a/include/gpg/GpgContext.h b/include/gpg/GpgContext.h index eed7afe2..1e5334d1 100644 --- a/include/gpg/GpgContext.h +++ b/include/gpg/GpgContext.h @@ -77,6 +77,8 @@ namespace GpgME { bool exportKeys(QStringList *uidList, QByteArray *outBuffer); + bool exportKeys(const QVector<GpgKey> &keys, QByteArray &outBuffer); + bool generateKey(GenKeyInfo *params); bool generateSubkey(const GpgKey &key, GenKeyInfo *params); diff --git a/include/ui/FindWidget.h b/include/ui/FindWidget.h index 2e9c67b0..1142b649 100644 --- a/include/ui/FindWidget.h +++ b/include/ui/FindWidget.h @@ -25,7 +25,7 @@ #ifndef FINDWIDGET_H #define FINDWIDGET_H -#include "EditorPage.h" +#include "ui/widgets/EditorPage.h" /** * @brief Class for handling the find widget shown at buttom of a textedit-page diff --git a/include/ui/KeyImportDetailDialog.h b/include/ui/KeyImportDetailDialog.h index 49b52028..0c6f5813 100644 --- a/include/ui/KeyImportDetailDialog.h +++ b/include/ui/KeyImportDetailDialog.h @@ -33,7 +33,7 @@ class KeyImportDetailDialog : public QDialog Q_OBJECT public: - KeyImportDetailDialog(GpgME::GpgContext* ctx, GpgImportInformation result, QWidget *parent = 0); + KeyImportDetailDialog(GpgME::GpgContext *ctx, GpgImportInformation result, bool automatic, QWidget *parent = 0); private: void createGeneralInfoBox(); diff --git a/include/ui/KeyServerImportDialog.h b/include/ui/KeyServerImportDialog.h index 74ae864e..6fd45fc5 100644 --- a/include/ui/KeyServerImportDialog.h +++ b/include/ui/KeyServerImportDialog.h @@ -34,11 +34,16 @@ class KeyServerImportDialog : public QDialog { Q_OBJECT public: - KeyServerImportDialog(GpgME::GpgContext *ctx, KeyList *keyList, QWidget *parent = nullptr); + KeyServerImportDialog(GpgME::GpgContext *ctx, KeyList *keyList, bool automatic, + QWidget *parent); - void slotImport(QStringList keyIds); + KeyServerImportDialog(GpgME::GpgContext *ctx, QWidget *parent); - void slotImport(QStringList keyIds, const QUrl& keyserverUrl); + void slotImport(const QStringList& keyIds); + + void slotImport(const QStringList& keyIds, const QUrl& keyserverUrl); + + void slotImportKey(const QVector<GpgKey>& keys); private slots: @@ -57,23 +62,29 @@ private: void importKeys(QByteArray inBuffer); + void setLoading(bool status); + QPushButton *createButton(const QString &text, const char *member); QComboBox *createComboBox(); + bool mAutomatic; + QString appPath; QSettings settings; + GpgME::GpgContext *mCtx; - KeyList *mKeyList; - QLineEdit *searchLineEdit; - QComboBox *keyServerComboBox; - QLabel *searchLabel; - QLabel *keyServerLabel; - QLabel *message; - QLabel *icon; - QPushButton *closeButton; - QPushButton *importButton; - QPushButton *searchButton; + KeyList *mKeyList{}; + QLineEdit *searchLineEdit{}; + QComboBox *keyServerComboBox{}; + QProgressBar *waitingBar; + QLabel *searchLabel{}; + QLabel *keyServerLabel{}; + QLabel *message{}; + QLabel *icon{}; + QPushButton *closeButton{}; + QPushButton *importButton{}; + QPushButton *searchButton{}; QTableWidget *keysTable{}; QNetworkAccessManager *qnam{}; diff --git a/include/ui/KeyUploadDialog.h b/include/ui/KeyUploadDialog.h new file mode 100644 index 00000000..013c0b72 --- /dev/null +++ b/include/ui/KeyUploadDialog.h @@ -0,0 +1,51 @@ +/** + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#ifndef GPGFRONTEND_KEYUPLOADWIDGET_H +#define GPGFRONTEND_KEYUPLOADWIDGET_H + +#include "GpgFrontend.h" +#include "gpg/GpgContext.h" + +class KeyUploadDialog : public QDialog { +Q_OBJECT +public: + KeyUploadDialog(GpgME::GpgContext *ctx, const QVector<GpgKey> &keys, QWidget *parent = nullptr); + +private slots: + + void uploadKeyToServer(QByteArray &keys); + + void slotUploadFinished(); + +private: + + QString appPath; + QSettings settings; + QByteArray mKeyData; + +}; + + +#endif //GPGFRONTEND_KEYUPLOADWIDGET_H diff --git a/include/ui/VerifyDetailsDialog.h b/include/ui/VerifyDetailsDialog.h index a1f28e5d..ece2f1e7 100644 --- a/include/ui/VerifyDetailsDialog.h +++ b/include/ui/VerifyDetailsDialog.h @@ -25,7 +25,7 @@ #ifndef __VERIFYDETAILSDIALOG_H__ #define __VERIFYDETAILSDIALOG_H__ -#include "ui/EditorPage.h" +#include "ui/widgets/EditorPage.h" #include "ui/widgets/VerifyKeyDetailBox.h" class VerifyDetailsDialog : public QDialog { diff --git a/include/ui/keypair_details/KeyPairDetailTab.h b/include/ui/keypair_details/KeyPairDetailTab.h index ad0b13f6..6d041f97 100644 --- a/include/ui/keypair_details/KeyPairDetailTab.h +++ b/include/ui/keypair_details/KeyPairDetailTab.h @@ -27,10 +27,13 @@ #include "GpgFrontend.h" #include "gpg/GpgContext.h" + +#include "ui/KeyUploadDialog.h" +#include "ui/KeyServerImportDialog.h" #include "KeySetExpireDateDialog.h" class KeyPairDetailTab : public QWidget { - Q_OBJECT +Q_OBJECT /** * @details Return QString with a space inserted at every fourth character @@ -39,6 +42,8 @@ class KeyPairDetailTab : public QWidget { */ static QString beautifyFingerprint(QString fingerprint); + void createKeyServerOperaMenu(); + private slots: /** @@ -55,6 +60,10 @@ private slots: void slotRefreshKeyInfo(); + void slotUploadKeyToServer(); + + void slotUpdateKeyToServer(); + private: QString *keyid; /** The id of the key the details should be shown for */ @@ -80,8 +89,10 @@ private: QLabel *actualUsageVarLabel; QLabel *masterKeyExistVarLabel; + QMenu *keyServerOperaMenu; + public: - explicit KeyPairDetailTab(GpgME::GpgContext *ctx, const GpgKey& mKey, QWidget *parent = nullptr); + explicit KeyPairDetailTab(GpgME::GpgContext *ctx, const GpgKey &mKey, QWidget *parent = nullptr); }; diff --git a/include/ui/Attachments.h b/include/ui/widgets/Attachments.h index 19b6ef37..00433028 100644 --- a/include/ui/Attachments.h +++ b/include/ui/widgets/Attachments.h @@ -25,7 +25,7 @@ #ifndef __ATTACHMENTS_H__ #define __ATTACHMENTS_H__ -#include "AttachmentTableModel.h" +#include "ui/AttachmentTableModel.h" class Attachments : public QWidget { Q_OBJECT diff --git a/include/ui/EditorPage.h b/include/ui/widgets/EditorPage.h index a06d6cd6..a06d6cd6 100644 --- a/include/ui/EditorPage.h +++ b/include/ui/widgets/EditorPage.h diff --git a/include/ui/widgets/FilePage.h b/include/ui/widgets/FilePage.h new file mode 100644 index 00000000..6585bed9 --- /dev/null +++ b/include/ui/widgets/FilePage.h @@ -0,0 +1,56 @@ +/** + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#ifndef GPGFRONTEND_FILEPAGE_H +#define GPGFRONTEND_FILEPAGE_H + +#include <GpgFrontend.h> + +class FilePage : public QWidget { +Q_OBJECT +public: + + explicit FilePage(QWidget* parent = nullptr); + + void getSelected(QString &path); + + +private slots: + + void fileTreeViewItemClicked(const QModelIndex &index); + void fileTreeViewItemDoubleClicked(const QModelIndex &index); + + void slotUpLevel(); + +private: + QFileSystemModel *dirModel; + QTreeView *dirTreeView; + QString mPath; + + QPushButton *upLevelButton; + +}; + + +#endif //GPGFRONTEND_FILEPAGE_H diff --git a/include/ui/HelpPage.h b/include/ui/widgets/HelpPage.h index 0b5e4ca3..0b5e4ca3 100644 --- a/include/ui/HelpPage.h +++ b/include/ui/widgets/HelpPage.h diff --git a/include/ui/widgets/InfoBoardWidget.h b/include/ui/widgets/InfoBoardWidget.h index 88c7cb04..9d3dbd16 100644 --- a/include/ui/widgets/InfoBoardWidget.h +++ b/include/ui/widgets/InfoBoardWidget.h @@ -25,7 +25,7 @@ #ifndef __VERIFYNOTIFICATION_H__ #define __VERIFYNOTIFICATION_H__ -#include "ui/EditorPage.h" +#include "EditorPage.h" #include "ui/VerifyDetailsDialog.h" #include "gpg/result_analyse/VerifyResultAnalyse.h" diff --git a/include/ui/widgets/KeyList.h b/include/ui/widgets/KeyList.h index 295ba224..413d0969 100644 --- a/include/ui/widgets/KeyList.h +++ b/include/ui/widgets/KeyList.h @@ -85,9 +85,10 @@ public: void setChecked(QStringList *keyIds); - //QStringList *getPrivateChecked(); QStringList *getSelected(); + GpgKey getSelectedKey(); + [[maybe_unused]] static void markKeys(QStringList *keyIds); [[maybe_unused]] bool containsPrivateKeys(); @@ -96,12 +97,13 @@ public slots: void slotRefresh(); - void uploadKeyToServer(QByteArray *keys); - private: void importKeys(QByteArray inBuffer); + QString appPath; + QSettings settings; + GpgME::GpgContext *mCtx; QTableWidget *mKeyList; QMenu *popupMenu; @@ -117,11 +119,8 @@ private: private slots: - void uploadFinished(); - void slotDoubleClicked(const QModelIndex &index); - protected: void contextMenuEvent(QContextMenuEvent *event) override; diff --git a/include/ui/TextEdit.h b/include/ui/widgets/TextEdit.h index 8219814b..f98da145 100644 --- a/include/ui/TextEdit.h +++ b/include/ui/widgets/TextEdit.h @@ -25,9 +25,10 @@ #ifndef __TEXTEDIT_H__ #define __TEXTEDIT_H__ -#include "ui/EditorPage.h" -#include "ui/HelpPage.h" -#include "QuitDialog.h" +#include "ui/widgets/EditorPage.h" +#include "ui/widgets/HelpPage.h" +#include "ui/widgets/FilePage.h" +#include "ui/QuitDialog.h" /** @@ -59,22 +60,22 @@ public: */ bool maybeSaveAnyTab(); - int tabCount() const; + [[nodiscard]] int tabCount() const; /** * @details textpage of the currently activated tab * @return \li reference to QTextEdit if tab has one * \li 0 otherwise (e.g. if helppage) */ - QTextEdit *curTextPage() const; + [[nodiscard]] QTextEdit *curTextPage() const; - QTextBrowser *curHelpPage() const; + [[nodiscard]] QTextBrowser *curHelpPage() const; /** * @details List of currently unsaved tabs. * @returns QHash<int, QString> Hash of tabindexes and title of unsaved tabs. */ - QHash<int, QString> unsavedDocuments() const; + [[nodiscard]] QHash<int, QString> unsavedDocuments() const; QTabWidget *tabWidget; /** Widget containing the tabs of the editor */ @@ -84,7 +85,7 @@ public slots: * @details Return pointer to the currently activated tabpage. * */ - EditorPage *slotCurPage() const; + [[nodiscard]] EditorPage *slotCurPage() const; /** * @details Insert a ">" at the begining of every line of current textedit. @@ -137,6 +138,11 @@ public slots: void slotNewHelpTab(const QString& title, const QString& path) const; /** + * New File Tab to do file operation + */ + void slotNewFileTab() const; + + /** * @details put a * in front of current tabs title, if current textedit is modified */ void slotShowModified() const; @@ -240,8 +246,7 @@ private slots: void slotSelectAll() const; protected: - // void dragEnterEvent(QDragEnterEvent *event); - // void dropEvent(QDropEvent* event); + /**************************************************************************************** * Name: saveFile * Description: Saves the content of currentTab to the file filename |