aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-01-05 14:33:08 +0000
committerSaturneric <[email protected]>2022-01-05 14:33:08 +0000
commitaf944181eed588b103bcda19dbd69eac83a27404 (patch)
treeeb35d8bf01f2af96e48cd3abf52e5c5f6c809931 /src
parent<chore>(project): rename gpg_core and gpgfrontend-ui. (diff)
downloadGpgFrontend-af944181eed588b103bcda19dbd69eac83a27404.tar.gz
GpgFrontend-af944181eed588b103bcda19dbd69eac83a27404.zip
<feature>(ui, project): start to add imap support.
1. introduce vmime library. 2. add ReceiveMailDialog and related actions in MainWindowUI. 3. add git submodule vmime.
Diffstat (limited to 'src')
-rw-r--r--src/ui/CMakeLists.txt8
-rw-r--r--src/ui/MainWindow.h3
-rw-r--r--src/ui/main_window/MainWindowUI.cpp12
-rw-r--r--src/ui/smtp/ReceiveMailDialog.cpp32
-rw-r--r--src/ui/smtp/ReceiveMailDialog.h45
5 files changed, 98 insertions, 2 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index ecf83ee3..3ec2eb3e 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,3 +1,4 @@
+# tracking source files
aux_source_directory(. UI_SOURCE)
aux_source_directory(./aes UI_SOURCE)
aux_source_directory(./keypair_details UI_SOURCE)
@@ -14,15 +15,20 @@ if (SMTP_SUPPORT)
aux_source_directory(./smtp UI_SOURCE)
endif ()
+find_library(libvmime NAMES libvmime.a)
add_library(gpgfrontend_ui STATIC ${UI_SOURCE})
set(GPGFRONTEND_UI_LIB_NAME gpgfrontend_ui)
+# link Qt
target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
+# link vmime
+target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ ${libvmime})
target_include_directories(gpgfrontend_ui PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${GPGFRONTEND_UI_LIB_NAME}_autogen/include)
if (XCODE_BUILD)
- set_target_properties(gpgfrontend_ui
+ set_target_properties(${GPGFRONTEND_UI_LIB_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h
index 5f9d9b50..9c4d5a1c 100644
--- a/src/ui/MainWindow.h
+++ b/src/ui/MainWindow.h
@@ -382,7 +382,8 @@ class MainWindow : public QMainWindow {
QAction* addPgpHeaderAct{}; /** Action for adding the PGP header */
#ifdef SMTP_SUPPORT
- QAction* sendMailAct{}; /** Action for sending a email */
+ QAction* sendMailAct{}; /** Action for sending a email */
+ QAction* receiveMailAct{}; /** Action for receive emails */
#endif
QAction* importKeyFromFileAct{};
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp
index cb7962f7..c1cd5749 100644
--- a/src/ui/main_window/MainWindowUI.cpp
+++ b/src/ui/main_window/MainWindowUI.cpp
@@ -24,7 +24,10 @@
#include "MainWindow.h"
#include "ui/UserInterfaceUtils.h"
+#ifdef SMTP_SUPPORT
+#include "ui/smtp/ReceiveMailDialog.h"
#include "ui/smtp/SendMailDialog.h"
+#endif
namespace GpgFrontend::UI {
@@ -303,6 +306,13 @@ void MainWindow::createActions() {
auto* dialog = new SendMailDialog({}, this);
dialog->show();
});
+
+ receiveMailAct = new QAction(_("Message Inbox"), this);
+ receiveMailAct->setIcon(QIcon(":receive_email.png"));
+ connect(receiveMailAct, &QAction::triggered, this, [=]() {
+ auto* dialog = new ReceiveMailDialog(this);
+ dialog->show();
+ });
#endif
}
@@ -363,6 +373,7 @@ void MainWindow::createMenus() {
#ifdef SMTP_SUPPORT
emailMenu = menuBar()->addMenu(_("Email"));
emailMenu->addAction(sendMailAct);
+ emailMenu->addAction(receiveMailAct);
#endif
#ifdef ADVANCED_SUPPORT
@@ -424,6 +435,7 @@ void MainWindow::createToolBars() {
emailToolBar = addToolBar(_("Email"));
emailToolBar->setObjectName("emailToolBar");
emailToolBar->addAction(sendMailAct);
+ emailToolBar->addAction(receiveMailAct);
viewMenu->addAction(emailToolBar->toggleViewAction());
// Add dropdown menu for key import to keytoolbar
diff --git a/src/ui/smtp/ReceiveMailDialog.cpp b/src/ui/smtp/ReceiveMailDialog.cpp
new file mode 100644
index 00000000..6fb8fe95
--- /dev/null
+++ b/src/ui/smtp/ReceiveMailDialog.cpp
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ *
+ */
+
+#include "ReceiveMailDialog.h"
+
+#include "ui_ReceiveMailDialog.h"
+
+GpgFrontend::UI::ReceiveMailDialog::ReceiveMailDialog(QWidget *parent)
+ : QDialog(parent), ui(std::make_shared<Ui_ReceiveMailDialog>()) {
+ ui->setupUi(this);
+}
diff --git a/src/ui/smtp/ReceiveMailDialog.h b/src/ui/smtp/ReceiveMailDialog.h
new file mode 100644
index 00000000..5aa2c52e
--- /dev/null
+++ b/src/ui/smtp/ReceiveMailDialog.h
@@ -0,0 +1,45 @@
+/**
+ * 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_RECEIVEMAILDIALOG_H
+#define GPGFRONTEND_RECEIVEMAILDIALOG_H
+
+#include "ui/GpgFrontendUI.h"
+
+class Ui_ReceiveMailDialog;
+
+namespace GpgFrontend::UI {
+
+class ReceiveMailDialog : public QDialog {
+ Q_OBJECT
+ public:
+ ReceiveMailDialog(QWidget *parent);
+
+ private:
+ std::shared_ptr<Ui_ReceiveMailDialog> ui;
+};
+
+} // namespace GpgFrontend::UI
+
+#endif // GPGFRONTEND_RECEIVEMAILDIALOG_H