aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/MainWindow.h81
-rw-r--r--include/gpg/GpgFileOpera.h51
-rwxr-xr-xinclude/ui/SettingsDialog.h1
-rw-r--r--include/ui/widgets/FilePage.h31
-rw-r--r--include/ui/widgets/InfoBoardWidget.h11
-rw-r--r--include/ui/widgets/TextEdit.h21
6 files changed, 169 insertions, 27 deletions
diff --git a/include/MainWindow.h b/include/MainWindow.h
index c5937e0d..a6ddfc3a 100644
--- a/include/MainWindow.h
+++ b/include/MainWindow.h
@@ -41,6 +41,8 @@
#include "gpg/result_analyse/EncryptResultAnalyse.h"
#include "gpg/result_analyse/DecryptResultAnalyse.h"
+#include "gpg/GpgFileOpera.h"
+
/**
* @brief
@@ -67,6 +69,44 @@ protected:
*/
void closeEvent(QCloseEvent *event) override;
+public slots:
+
+ /**
+ * @details Open a new tab for path
+ */
+ void slotOpenFile(QString &path);
+
+ /**
+ * @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();
+
+ /**
+ * @details Open dialog for signing file.
+ */
+ void slotFileEncryptSign();
+
+ /**
+ * @details Open dialog for verifying file.
+ */
+ void slotFileDecryptVerify();
+
+
private slots:
/**
@@ -105,6 +145,26 @@ private slots:
void slotDecryptVerify();
/**
+ * @details Open dialog for encrypting file.
+ */
+ void slotFileEncryptCustom();
+
+ /**
+ * @details Open dialog for decrypting file.
+ */
+ void slotFileDecryptCustom();
+
+ /**
+ * @details Open dialog for signing file.
+ */
+ void slotFileSignCustom();
+
+ /**
+ * @details Open dialog for verifying file.
+ */
+ void slotFileVerifyCustom();
+
+ /**
* @details Show the details of the first of the first of selected keys
*/
void slotShowKeyDetails();
@@ -156,26 +216,6 @@ private slots:
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();
-
- /**
* @details Open File Opera Tab
*/
void slotOpenFileTab();
@@ -293,6 +333,7 @@ private:
QAction *switchTabUpAct; /** Action to switch tab up*/
QAction *switchTabDownAct; /** Action to switch tab down */
QAction *openAct; /** Action to open file */
+ QAction *browserAct; /** Action to open file browser*/
QAction *saveAct; /** Action to save file */
QAction *saveAsAct; /** Action to save file as */
QAction *printAct; /** Action to print */
diff --git a/include/gpg/GpgFileOpera.h b/include/gpg/GpgFileOpera.h
new file mode 100644
index 00000000..9b5e118c
--- /dev/null
+++ b/include/gpg/GpgFileOpera.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_GPGFILEOPERA_H
+#define GPGFRONTEND_GPGFILEOPERA_H
+
+#include "GpgFrontend.h"
+#include "gpg/GpgContext.h"
+
+class GpgFileOpera {
+public:
+ static gpgme_error_t encryptFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath,
+ gpgme_encrypt_result_t *result);
+
+ static gpgme_error_t decryptFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_decrypt_result_t *result);
+
+ static gpgme_error_t signFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath,
+ gpgme_sign_result_t *result);
+
+ static gpgme_error_t verifyFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_verify_result_t *result);
+
+ static gpg_error_t
+ encryptSignFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath, gpgme_encrypt_result_t *encr_res, gpgme_sign_result_t *sign_res);
+
+ static gpg_error_t decryptVerifyFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_decrypt_result_t *decr_res, gpgme_verify_result_t *verify_res);
+
+};
+
+
+#endif //GPGFRONTEND_GPGFILEOPERA_H
diff --git a/include/ui/SettingsDialog.h b/include/ui/SettingsDialog.h
index 5cb526f9..f1a2863c 100755
--- a/include/ui/SettingsDialog.h
+++ b/include/ui/SettingsDialog.h
@@ -49,6 +49,7 @@ private:
QComboBox *ownKeySelectBox;
QHash<QString, QString> lang;
QHash<QString, QString> keyIds;
+ QVector<QString> keyIdsList;
QString ownKeyId;
KeyList *mKeyList;
GpgME::GpgContext *mCtx; /** The current gpg context */
diff --git a/include/ui/widgets/FilePage.h b/include/ui/widgets/FilePage.h
index 6585bed9..3d2c8e72 100644
--- a/include/ui/widgets/FilePage.h
+++ b/include/ui/widgets/FilePage.h
@@ -25,7 +25,7 @@
#ifndef GPGFRONTEND_FILEPAGE_H
#define GPGFRONTEND_FILEPAGE_H
-#include <GpgFrontend.h>
+#include "GpgFrontend.h"
class FilePage : public QWidget {
Q_OBJECT
@@ -33,8 +33,12 @@ public:
explicit FilePage(QWidget* parent = nullptr);
- void getSelected(QString &path);
+ [[nodiscard]] QString getSelected() const;
+ void createPopupMenu();
+
+signals:
+ void pathChanged(const QString &path);
private slots:
@@ -42,13 +46,36 @@ private slots:
void fileTreeViewItemDoubleClicked(const QModelIndex &index);
void slotUpLevel();
+ void slotGoPath();
+
+ void slotOpenItem();
+ void slotDeleteItem();
+ void slotEncryptItem();
+ void slotDecryptItem();
+ void slotSignItem();
+ void slotVerifyItem();
+
+ void onCustomContextMenu(const QPoint &point);
+
private:
+
QFileSystemModel *dirModel;
QTreeView *dirTreeView;
+ QLineEdit *pathEdit;
QString mPath;
QPushButton *upLevelButton;
+ QPushButton *goPathButton;
+ QPushButton *refreshButton;
+
+ QMenu *popUpMenu{};
+ QAction *encryptItemAct{};
+ QAction *decryptItemAct{};
+ QAction *signItemAct{};
+ QAction *verifyItemAct{};
+
+ QWidget *firstParent;
};
diff --git a/include/ui/widgets/InfoBoardWidget.h b/include/ui/widgets/InfoBoardWidget.h
index 9d3dbd16..f487b72c 100644
--- a/include/ui/widgets/InfoBoardWidget.h
+++ b/include/ui/widgets/InfoBoardWidget.h
@@ -26,6 +26,7 @@
#define __VERIFYNOTIFICATION_H__
#include "EditorPage.h"
+#include "FilePage.h"
#include "ui/VerifyDetailsDialog.h"
#include "gpg/result_analyse/VerifyResultAnalyse.h"
@@ -56,6 +57,10 @@ public:
void associateTextEdit(QTextEdit *edit);
+ void associateFileTreeView(FilePage *treeView);
+
+ void associateTabWidget(QTabWidget *tab);
+
void addOptionalAction(const QString& name, const std::function<void()>& action);
void resetOptionActionsMenu();
@@ -95,7 +100,11 @@ private:
QTextEdit *infoBoard;
GpgME::GpgContext *mCtx; /** GpgME Context */
KeyList *mKeyList; /** Table holding the keys */
- QTextEdit *mTextPage{ nullptr }; /** Textedit associated to the notification */
+
+ QTextEdit *mTextPage{ nullptr }; /** TextEdit associated to the notification */
+ FilePage *mFileTreeView{nullptr }; /** TreeView associated to the notification */
+ QTabWidget *mTabWidget{ nullptr }; /** TreeView associated to the notification */
+
QHBoxLayout *actionButtonLayout;
diff --git a/include/ui/widgets/TextEdit.h b/include/ui/widgets/TextEdit.h
index f98da145..b807d6c6 100644
--- a/include/ui/widgets/TextEdit.h
+++ b/include/ui/widgets/TextEdit.h
@@ -40,7 +40,7 @@ public:
/**
* @brief
*/
- TextEdit();
+ TextEdit(QWidget *parent);
/**
* @details Load the content of file into the current textpage
@@ -69,7 +69,7 @@ public:
*/
[[nodiscard]] QTextEdit *curTextPage() const;
- [[nodiscard]] QTextBrowser *curHelpPage() const;
+ [[nodiscard]] FilePage * curFilePage() const;
/**
* @details List of currently unsaved tabs.
@@ -82,10 +82,16 @@ public:
public slots:
/**
- * @details Return pointer to the currently activated tabpage.
+ * @details Return pointer to the currently activated text edit tab page.
*
*/
- [[nodiscard]] EditorPage *slotCurPage() const;
+ [[nodiscard]] EditorPage *slotCurPageTextEdit() const;
+
+ /**
+ * @details Return pointer to the currently activated file treeview tab page.
+ *
+ */
+ [[nodiscard]] FilePage *slotCurPageFileTreeView() const;
/**
* @details Insert a ">" at the begining of every line of current textedit.
@@ -130,6 +136,11 @@ public slots:
void slotNewTab();
/**
+ * @details Adds a new tab with opening file by path
+ */
+ void slotOpenFile(QString &path);
+
+ /**
* @details Adds a new tab with the given title and opens given html file.
* Increase Tab-Count by one
* @param title title for the tab
@@ -189,6 +200,8 @@ private:
private slots:
+ void slotFilePagePathChanged(const QString& path);
+
/**
* @details Remove the tab with given index
*