aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/before_exit.cpp32
-rw-r--r--src/gpg/CMakeLists.txt12
-rw-r--r--src/init.cpp33
-rw-r--r--src/main.cpp14
-rw-r--r--src/signal.cpp15
-rw-r--r--src/ui/CMakeLists.txt17
-rw-r--r--src/ui/MainWindow.h3
-rw-r--r--src/ui/main_window/MainWindowUI.cpp12
-rw-r--r--src/ui/settings/GlobalSettingStation.cpp46
-rw-r--r--src/ui/settings/GlobalSettingStation.h25
-rw-r--r--src/ui/smtp/IMAPFolder.cpp92
-rw-r--r--src/ui/smtp/IMAPFolder.h50
-rw-r--r--src/ui/smtp/ReceiveMailDialog.cpp38
-rw-r--r--src/ui/smtp/ReceiveMailDialog.h59
15 files changed, 431 insertions, 20 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 25c1a8bc..512b7cbd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -114,6 +114,7 @@ if (APPLICATION_BUILD)
# Copy Resource Files
file(COPY ${CMAKE_SOURCE_DIR}/resource/css DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN)
file(COPY ${CMAKE_SOURCE_DIR}/resource/icons DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN)
+ file(COPY ${CMAKE_SOURCE_DIR}/resource/certs DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN)
file(COPY ${CMAKE_SOURCE_DIR}/TRANSLATORS DESTINATION ${RESOURCE_OUTPUT_DIRECTORY} FOLLOW_SYMLINK_CHAIN)
if (GPG_STANDALONE_MODE)
file(COPY ${CMAKE_SOURCE_DIR}/resource/gpg1.4 DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN)
@@ -243,7 +244,7 @@ if (APPLICATION_BUILD)
set(GPGFRONTEND_BEFORE_UI_LIBS ${GPGFRONTEND_BEFORE_UI_LIBS} smtp)
endif ()
- set(GPGFRONTEND_LIBS ${GPGFRONTEND_AFTER_UI_LIBS} gpgfrontend-ui gpg_core ${GPGFRONTEND_BEFORE_UI_LIBS} easy_logging_pp)
+ set(GPGFRONTEND_LIBS ${GPGFRONTEND_AFTER_UI_LIBS} gpgfrontend_ui gpgfrontend_core ${GPGFRONTEND_BEFORE_UI_LIBS} easy_logging_pp)
set(QT_DEPENDENCY_LIBS Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
IF (MINGW)
diff --git a/src/before_exit.cpp b/src/before_exit.cpp
new file mode 100644
index 00000000..ba731203
--- /dev/null
+++ b/src/before_exit.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 <easyloggingpp/easylogging++.h>
+
+#include "ui/settings/GlobalSettingStation.h"
+
+void before_exit(int status, void *arg) {
+ LOG(INFO) << "called exit status" << status;
+ GpgFrontend::UI::GlobalSettingStation::GetInstance().ResetRootCerts();
+}
diff --git a/src/gpg/CMakeLists.txt b/src/gpg/CMakeLists.txt
index 87328504..f0c4c72e 100644
--- a/src/gpg/CMakeLists.txt
+++ b/src/gpg/CMakeLists.txt
@@ -3,7 +3,7 @@ aux_source_directory(./function GPG_SOURCE)
aux_source_directory(./model GPG_SOURCE)
aux_source_directory(. GPG_SOURCE)
-add_library(gpg_core STATIC ${GPG_SOURCE})
+add_library(gpgfrontend_core STATIC ${GPG_SOURCE})
set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils)
@@ -18,21 +18,21 @@ set(BOOST_LIBS Boost::date_time Boost::filesystem)
if (MINGW)
message(STATUS "Link GPG Static Library For MINGW")
- target_link_libraries(gpg_core ${THIRD_PARTY_LIBS}
+ target_link_libraries(gpgfrontend_core ${THIRD_PARTY_LIBS}
${BOOST_LIBS}
gpgme gpg-error assuan wsock32)
- target_compile_features(gpg_core PUBLIC cxx_std_17)
+ target_compile_features(gpgfrontend_core PUBLIC cxx_std_17)
elseif (APPLE)
find_library(libgpgme NAMES libgpgme.a)
find_library(libgpg-error NAMES libgpg-error.a)
find_library(libassuan NAMES libassuan.a)
message(STATUS "Link GPG Static Library For macOS")
- target_link_libraries(gpg_core ${THIRD_PARTY_LIBS}
+ target_link_libraries(gpgfrontend_core ${THIRD_PARTY_LIBS}
${BOOST_LIBS}
${libgpgme} ${libgpg-error} ${libassuan}
dl)
if (XCODE_BUILD)
- set_target_properties(gpg_core
+ set_target_properties(gpgfrontend_core
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
@@ -43,7 +43,7 @@ else ()
find_library(libgpg-error NAMES libgpg-error.a)
find_library(libassuan NAMES libassuan.a)
message(STATUS "Link GPG Static Library For Unix")
- target_link_libraries(gpg_core ${THIRD_PARTY_LIBS}
+ target_link_libraries(gpgfrontend_core ${THIRD_PARTY_LIBS}
${libgpgme} ${libgpg-error} ${libassuan}
${BOOST_LIBS}
pthread dl)
diff --git a/src/init.cpp b/src/init.cpp
index 4f441c29..fffaaa1b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -23,9 +23,25 @@
*/
#include <boost/date_time.hpp>
+#include <vmime/vmime.hpp>
#include "ui/settings/GlobalSettingStation.h"
+std::vector<boost::filesystem::path> get_files_of_directory(
+ const boost::filesystem::path& _path) {
+ namespace fs = boost::filesystem;
+ std::vector<fs::path> path_list;
+ if (!_path.empty()) {
+ fs::recursive_directory_iterator end;
+
+ for (fs::recursive_directory_iterator i(_path); i != end; ++i) {
+ const fs::path cp = (*i);
+ path_list.push_back(cp);
+ }
+ }
+ return path_list;
+}
+
void init_logging() {
using namespace boost::posix_time;
using namespace boost::gregorian;
@@ -49,7 +65,20 @@ void init_logging() {
el::Loggers::reconfigureLogger("default", defaultConf);
- LOG(INFO) << _("Logfile Path") << logfile_path;
+ LOG(INFO) << _("logfile Path") << logfile_path;
+}
+
+void init_certs() {
+ std::vector<vmime::shared_ptr<vmime::security::cert::X509Certificate>>
+ root_certs;
+ auto cert_file_paths = get_files_of_directory(
+ GpgFrontend::UI::GlobalSettingStation::GetInstance().GetCertsDir());
+
+ auto& _instance = GpgFrontend::UI::GlobalSettingStation::GetInstance();
+ for (const auto& cert_file_path : cert_file_paths) {
+ _instance.AddRootCert(cert_file_path);
+ }
+ LOG(INFO) << _("root certs loaded") << _instance.GetRootCerts().size();
}
void init_locale() {
@@ -72,7 +101,7 @@ void init_locale() {
// read from settings file
std::string lang;
if (!general.lookupValue("lang", lang)) {
- LOG(ERROR) << _("Could not read properly from configure file");
+ LOG(ERROR) << _("could not read properly from configure file");
};
LOG(INFO) << "lang from settings" << lang;
diff --git a/src/main.cpp b/src/main.cpp
index fa4195ce..cf97380a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -27,11 +27,9 @@
#include <cstdlib>
#include "GpgFrontendBuildInfo.h"
-#include "gpg/GpgContext.h"
#include "gpg/GpgFunctionObject.h"
#include "ui/MainWindow.h"
#include "ui/function/CtxCheckThread.h"
-#include "ui/settings/GlobalSettingStation.h"
// Easy Logging Cpp
INITIALIZE_EASYLOGGINGPP
@@ -40,8 +38,10 @@ INITIALIZE_EASYLOGGINGPP
jmp_buf recover_env;
extern void init_logging();
+extern void init_certs();
extern void init_locale();
extern void handle_signal(int sig);
+extern void before_exit(int status, void* arg);
int main(int argc, char* argv[]) {
// Register Signals
@@ -49,6 +49,9 @@ int main(int argc, char* argv[]) {
signal(SIGFPE, handle_signal);
signal(SIGILL, handle_signal);
+ // clean something before exit
+ on_exit(before_exit, nullptr);
+
// Qt
Q_INIT_RESOURCE(gpgfrontend);
@@ -64,9 +67,12 @@ int main(int argc, char* argv[]) {
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
- // logging system
+ // config logging system
init_logging();
+ // root certs for tls connection
+ init_certs();
+
// App config
QApplication::setApplicationVersion(BUILD_VERSION);
QApplication::setApplicationName(PROJECT_NAME);
@@ -178,12 +184,12 @@ int main(int argc, char* argv[]) {
}
} else {
- QApplication::exit(RESTART_CODE);
QMessageBox::information(
nullptr, _("A serious error has occurred"),
_("Oh no! GpgFrontend caught a serious error in the software, so it "
"needs to be restarted. If the problem recurs, please manually "
"terminate the program and report the problem to the developer."));
+ QCoreApplication::quit();
return_from_event_loop_code = RESTART_CODE;
LOG(INFO) << "return_from_event_loop_code" << return_from_event_loop_code;
continue;
diff --git a/src/signal.cpp b/src/signal.cpp
index efcd8146..c5b6727e 100644
--- a/src/signal.cpp
+++ b/src/signal.cpp
@@ -29,7 +29,20 @@
extern jmp_buf recover_env;
void handle_signal(int sig) {
- LOG(INFO) << "signal caught";
+ static int _repeat_handle_num = 1, last_sig = sig;
+ LOG(INFO) << "signal caught" << sig;
+
+ if (last_sig == sig)
+ _repeat_handle_num++;
+ else
+ _repeat_handle_num = 1, last_sig = sig;
+
+ if (_repeat_handle_num > 3) {
+ LOG(INFO) << "The same signal appears three times, execute the termination "
+ "operation. ";
+ exit(-1);
+ }
+
#ifndef WINDOWS
siglongjmp(recover_env, 1);
#else
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 3e44a0d6..e9e88104 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,18 +15,24 @@ if (SMTP_SUPPORT)
aux_source_directory(./smtp UI_SOURCE)
endif ()
-add_library(gpgfrontend-ui STATIC ${UI_SOURCE})
-set(GPGFRONTEND_UI_LIB_NAME gpgfrontend-ui)
+
+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)
-target_include_directories(gpgfrontend-ui PUBLIC
+# link vmime
+find_library(libvmime NAMES libvmime.a)
+target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ ${libvmime} anl ssl crypto)
+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}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif ()
-target_compile_features(gpgfrontend-ui PUBLIC cxx_std_17) \ No newline at end of file
+target_compile_features(gpgfrontend_ui PUBLIC cxx_std_17) \ No newline at end of file
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/settings/GlobalSettingStation.cpp b/src/ui/settings/GlobalSettingStation.cpp
index e88de93b..4e9bac73 100644
--- a/src/ui/settings/GlobalSettingStation.cpp
+++ b/src/ui/settings/GlobalSettingStation.cpp
@@ -24,6 +24,12 @@
#include "GlobalSettingStation.h"
+#include <openssl/bio.h>
+#include <openssl/pem.h>
+
+#include <vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp>
+#include <vmime/vmime.hpp>
+
std::unique_ptr<GpgFrontend::UI::GlobalSettingStation>
GpgFrontend::UI::GlobalSettingStation::_instance = nullptr;
@@ -92,3 +98,43 @@ GpgFrontend::UI::GlobalSettingStation::GlobalSettingStation() noexcept {
}
}
}
+
+void GpgFrontend::UI::GlobalSettingStation::AddRootCert(
+ const boost::filesystem::path& path) {
+ auto out_buffer = GpgFrontend::read_all_data_in_file(path.string());
+
+ auto mem_bio = std::shared_ptr<BIO>(
+ BIO_new_mem_buf(out_buffer.data(), static_cast<int>(out_buffer.size())),
+ [](BIO* _p) { BIO_free(_p); });
+
+ auto x509 = std::shared_ptr<X509>(
+ PEM_read_bio_X509(mem_bio.get(), nullptr, nullptr, nullptr),
+ [](X509* _p) { X509_free(_p); });
+
+ if (!x509) return;
+
+ root_certs_.push_back(x509);
+}
+
+vmime::shared_ptr<vmime::security::cert::defaultCertificateVerifier>
+GpgFrontend::UI::GlobalSettingStation::GetCertVerifier() const {
+ auto p_cv =
+ vmime::make_shared<vmime::security::cert::defaultCertificateVerifier>();
+
+ std::vector<vmime::shared_ptr<vmime::security::cert::X509Certificate>>
+ _root_certs;
+ for (const auto& cert : root_certs_) {
+ _root_certs.push_back(
+ std::make_shared<vmime::security::cert::X509Certificate_OpenSSL>(
+ cert.get()));
+ }
+ return p_cv;
+}
+
+const std::vector<std::shared_ptr<X509>>&
+GpgFrontend::UI::GlobalSettingStation::GetRootCerts() {
+ return root_certs_;
+}
+
+GpgFrontend::UI::GlobalSettingStation::~GlobalSettingStation() noexcept =
+ default;
diff --git a/src/ui/settings/GlobalSettingStation.h b/src/ui/settings/GlobalSettingStation.h
index a89bf32d..11c5e5f3 100644
--- a/src/ui/settings/GlobalSettingStation.h
+++ b/src/ui/settings/GlobalSettingStation.h
@@ -25,12 +25,19 @@
#ifndef GPGFRONTEND_GLOBALSETTINGSTATION_H
#define GPGFRONTEND_GLOBALSETTINGSTATION_H
+#include <openssl/x509.h>
+
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include "GpgFrontendBuildInstallInfo.h"
#include "ui/GpgFrontendUI.h"
+namespace vmime::security::cert {
+class defaultCertificateVerifier;
+class X509Certificate;
+} // namespace vmime::security::cert
+
namespace GpgFrontend::UI {
class GlobalSettingStation : public QObject {
@@ -40,6 +47,8 @@ class GlobalSettingStation : public QObject {
GlobalSettingStation() noexcept;
+ ~GlobalSettingStation() noexcept override;
+
libconfig::Setting& GetUISettings() noexcept { return ui_cfg.getRoot(); }
[[nodiscard]] boost::filesystem::path GetAppDir() const { return app_path; }
@@ -68,6 +77,20 @@ class GlobalSettingStation : public QObject {
return app_resource_path;
}
+ [[nodiscard]] boost::filesystem::path GetCertsDir() const {
+ return app_resource_path / "certs";
+ }
+
+ [[nodiscard]] std::shared_ptr<
+ vmime::security::cert::defaultCertificateVerifier>
+ GetCertVerifier() const;
+
+ void AddRootCert(const boost::filesystem::path& path);
+
+ const std::vector<std::shared_ptr<X509>>& GetRootCerts();
+
+ void ResetRootCerts() { root_certs_.clear(); }
+
void Sync() noexcept;
private:
@@ -113,6 +136,8 @@ class GlobalSettingStation : public QObject {
libconfig::Config ui_cfg;
+ std::vector<std::shared_ptr<X509>> root_certs_;
+
static std::unique_ptr<GlobalSettingStation> _instance;
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/smtp/IMAPFolder.cpp b/src/ui/smtp/IMAPFolder.cpp
new file mode 100644
index 00000000..446b1bea
--- /dev/null
+++ b/src/ui/smtp/IMAPFolder.cpp
@@ -0,0 +1,92 @@
+/**
+ * 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 "IMAPFolder.h"
+
+#include <utility>
+#include <vmime/vmime.hpp>
+
+GpgFrontend::UI::IMAPFolder::IMAPFolder(
+ std::shared_ptr<vmime::net::folder> folder)
+ : folder_(std::move(folder)),
+ tree_node_(new QTreeWidgetItem(static_cast<QTreeWidget *>(nullptr),
+ {"server"})) {
+ const std::string folder_name = folder_->getName().getBuffer();
+ LOG(INFO) << "folder" << folder_name;
+
+ const vmime::net::folderAttributes attr = folder_->getAttributes();
+ std::ostringstream attrStr;
+
+ tree_node_->setIcon(0, QIcon(":folder.png"));
+ if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_ALL) {
+ LOG(INFO) << "use:All";
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_ARCHIVE) {
+ tree_node_->setIcon(0, QIcon(":archive.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_DRAFTS) {
+ tree_node_->setIcon(0, QIcon(":drafts.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_FLAGGED) {
+ tree_node_->setIcon(0, QIcon(":flag.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_JUNK) {
+ tree_node_->setIcon(0, QIcon(":junk.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_SENT) {
+ tree_node_->setIcon(0, QIcon(":sent.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_TRASH) {
+ tree_node_->setIcon(0, QIcon(":trash.png"));
+ } else if (attr.getSpecialUse() ==
+ vmime::net::folderAttributes::SPECIALUSE_IMPORTANT) {
+ tree_node_->setIcon(0, QIcon(":importance.png"));
+ }
+
+ if (attr.getFlags() & vmime::net::folderAttributes::FLAG_HAS_CHILDREN) {
+ LOG(INFO) << " flag:HasChildren";
+ }
+ if (attr.getFlags() & vmime::net::folderAttributes::FLAG_NO_OPEN) {
+ LOG(INFO) << " flag:NoOpen";
+ // tree_node_->setDisabled(true);
+ }
+
+ if (!folder_name.empty())
+ tree_node_->setText(0, folder_name.c_str());
+ else
+ tree_node_->setIcon(0, QIcon(":server.png"));
+
+}
+
+void GpgFrontend::UI::IMAPFolder::SetParentFolder(IMAPFolder *parent_folder) {
+ parent_folder->GetTreeWidgetItem()->addChild(tree_node_);
+}
+
+QTreeWidgetItem *GpgFrontend::UI::IMAPFolder::GetTreeWidgetItem() {
+ return tree_node_;
+}
+
+vmime::net::folder *GpgFrontend::UI::IMAPFolder::GetVmimeFolder() {
+ return folder_.get();
+}
diff --git a/src/ui/smtp/IMAPFolder.h b/src/ui/smtp/IMAPFolder.h
new file mode 100644
index 00000000..255f3d71
--- /dev/null
+++ b/src/ui/smtp/IMAPFolder.h
@@ -0,0 +1,50 @@
+/**
+ * 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_IMAPFOLDER_H
+#define GPGFRONTEND_IMAPFOLDER_H
+
+#include "GpgFrontendUI.h"
+
+namespace vmime::net {
+class folder;
+};
+
+namespace GpgFrontend::UI {
+class IMAPFolder {
+ public:
+ explicit IMAPFolder(std::shared_ptr<vmime::net::folder> folder);
+
+ void SetParentFolder(IMAPFolder* parent_node);
+
+ QTreeWidgetItem* GetTreeWidgetItem();
+
+ vmime::net::folder* GetVmimeFolder();
+
+ private:
+ std::shared_ptr<vmime::net::folder> folder_;
+ QTreeWidgetItem* tree_node_;
+};
+} // namespace GpgFrontend::UI
+
+#endif // GPGFRONTEND_IMAPFOLDER_H
diff --git a/src/ui/smtp/ReceiveMailDialog.cpp b/src/ui/smtp/ReceiveMailDialog.cpp
new file mode 100644
index 00000000..81d8ccd8
--- /dev/null
+++ b/src/ui/smtp/ReceiveMailDialog.cpp
@@ -0,0 +1,38 @@
+/**
+ * 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);
+}
+
+void GpgFrontend::UI::ReceiveMailDialog::slotRefreshData() {}
+
+void GpgFrontend::UI::ReceiveMailDialog::list_sub_folders(
+ GpgFrontend::UI::IMAPFolder *parent_folder,
+ const std::shared_ptr<vmime::net::folder> &) {}
diff --git a/src/ui/smtp/ReceiveMailDialog.h b/src/ui/smtp/ReceiveMailDialog.h
new file mode 100644
index 00000000..9dc6088c
--- /dev/null
+++ b/src/ui/smtp/ReceiveMailDialog.h
@@ -0,0 +1,59 @@
+/**
+ * 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 vmime::net {
+class folder;
+};
+
+namespace GpgFrontend::UI {
+
+class IMAPFolder;
+
+class ReceiveMailDialog : public QDialog {
+ Q_OBJECT
+ public:
+ explicit ReceiveMailDialog(QWidget* parent);
+
+ private slots:
+ void slotRefreshData();
+
+ private:
+ std::shared_ptr<Ui_ReceiveMailDialog> ui;
+
+ void list_sub_folders(IMAPFolder* parent_folder,
+ const std::shared_ptr<vmime::net::folder>&);
+
+ std::vector<std::shared_ptr<IMAPFolder>> folders;
+};
+
+} // namespace GpgFrontend::UI
+
+#endif // GPGFRONTEND_RECEIVEMAILDIALOG_H