aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gpgfrontend.qrc10
-rw-r--r--resource/icons/archive.pngbin0 -> 4613 bytes
-rw-r--r--resource/icons/drafts.pngbin0 -> 6313 bytes
-rw-r--r--resource/icons/flag-fill.pngbin0 -> 2128 bytes
-rw-r--r--resource/icons/folder.pngbin0 -> 2944 bytes
-rw-r--r--resource/icons/importance.pngbin0 -> 6036 bytes
-rw-r--r--resource/icons/inbox.pngbin0 -> 5627 bytes
-rw-r--r--resource/icons/junk.pngbin0 -> 7485 bytes
-rw-r--r--resource/icons/sent.pngbin0 -> 8314 bytes
-rw-r--r--resource/icons/server.pngbin0 -> 3663 bytes
-rw-r--r--resource/icons/trash.pngbin0 -> 3901 bytes
-rw-r--r--src/ui/smtp/IMAPFolder.cpp92
-rw-r--r--src/ui/smtp/IMAPFolder.h50
-rw-r--r--src/ui/smtp/ReceiveMailDialog.h18
-rw-r--r--ui/ReceiveMailDialog.ui33
15 files changed, 199 insertions, 4 deletions
diff --git a/gpgfrontend.qrc b/gpgfrontend.qrc
index 98cfd0ac..f034cf37 100644
--- a/gpgfrontend.qrc
+++ b/gpgfrontend.qrc
@@ -11,7 +11,9 @@
<file alias="keys3.jpg">resource/icons/keys13.jpg</file>
<file alias="error.png">resource/icons/error.png</file>
<file alias="info.png">resource/icons/info.png</file>
+ <file alias="inbox.png">resource/icons/inbox.png</file>
<file alias="warning.png">resource/icons/warning.png</file>
+ <file alias="archive.png">resource/icons/archive.png</file>
<file alias="button_cancel.png">resource/icons/button_cancel.png</file>
<file alias="button_cut.png">resource/icons/button_cut.png</file>
<file alias="button_ok.png">resource/icons/button_ok.png</file>
@@ -19,6 +21,7 @@
<file alias="button_delete.png">resource/icons/button_delete.png</file>
<file alias="configure.png">resource/icons/configure.png</file>
<file alias="decrypted.png">resource/icons/decrypted.png</file>
+ <file alias="drafts.png">resource/icons/drafts.png</file>
<file alias="edit.png">resource/icons/edit.png</file>
<file alias="email.png">resource/icons/email.png</file>
<file alias="encrypted.png">resource/icons/encrypted.png</file>
@@ -33,14 +36,18 @@
<file alias="fileprint.png">resource/icons/fileprint.png</file>
<file alias="filesave.png">resource/icons/filesave.png</file>
<file alias="filesaveas.png">resource/icons/filesaveas.png</file>
+ <file alias="flag.png">resource/icons/flag-fill.png</file>
+ <file alias="folder.png">resource/icons/folder.png</file>
<file alias="format-line-spacing-double.png">resource/icons/format-line-spacing-double.png</file>
<file alias="format-line-spacing-normal.png">resource/icons/format-line-spacing-normal.png</file>
<file alias="format-line-spacing-triple.png">resource/icons/format-line-spacing-triple.png</file>
<file alias="gpgfrontend.png">resource/icons/gpgfrontend.png</file>
+ <file alias="importance.png">resource/icons/importance.png</file>
<file alias="importkey_editor.png">resource/icons/importkey_editor.png</file>
<file alias="import_key_from_clipboard.png">resource/icons/import_key_from_clipboard.png</file>
<file alias="import_key_from_file.png">resource/icons/import_key_from_file.png</file>
<file alias="import_key_from_server.png">resource/icons/import_key_from_server.png</file>
+ <file alias="junk.png">resource/icons/junk.png</file>
<file alias="key_export.png">resource/icons/key_export.png</file>
<file alias="key_generate.png">resource/icons/key_generate.png</file>
<file alias="key_import.png">resource/icons/key_import.png</file>
@@ -49,9 +56,12 @@
<file alias="misc_doc.png">resource/icons/misc_doc.png</file>
<file alias="quote.png">resource/icons/quote.png</file>
<file alias="receive_email.png">resource/icons/receive_email.png</file>
+ <file alias="sent.png">resource/icons/sent.png</file>
+ <file alias="server.png">resource/icons/server.png</file>
<file alias="signature.png">resource/icons/signature.png</file>
<file alias="ssh-key.png">resource/icons/ssh-key.png</file>
<file alias="statusbar_icon.png">resource/icons/statusbar_icon.png</file>
+ <file alias="trash.png">resource/icons/trash.png</file>
<file alias="txt.png">resource/icons/txt.png</file>
<file alias="undo.png">resource/icons/undo.png</file>
<file alias="verify.png">resource/icons/verify.png</file>
diff --git a/resource/icons/archive.png b/resource/icons/archive.png
new file mode 100644
index 00000000..37a87950
--- /dev/null
+++ b/resource/icons/archive.png
Binary files differ
diff --git a/resource/icons/drafts.png b/resource/icons/drafts.png
new file mode 100644
index 00000000..bc44f88a
--- /dev/null
+++ b/resource/icons/drafts.png
Binary files differ
diff --git a/resource/icons/flag-fill.png b/resource/icons/flag-fill.png
new file mode 100644
index 00000000..b8723616
--- /dev/null
+++ b/resource/icons/flag-fill.png
Binary files differ
diff --git a/resource/icons/folder.png b/resource/icons/folder.png
new file mode 100644
index 00000000..b0e7989c
--- /dev/null
+++ b/resource/icons/folder.png
Binary files differ
diff --git a/resource/icons/importance.png b/resource/icons/importance.png
new file mode 100644
index 00000000..e59ff133
--- /dev/null
+++ b/resource/icons/importance.png
Binary files differ
diff --git a/resource/icons/inbox.png b/resource/icons/inbox.png
new file mode 100644
index 00000000..5d0fbf2f
--- /dev/null
+++ b/resource/icons/inbox.png
Binary files differ
diff --git a/resource/icons/junk.png b/resource/icons/junk.png
new file mode 100644
index 00000000..3fa05c63
--- /dev/null
+++ b/resource/icons/junk.png
Binary files differ
diff --git a/resource/icons/sent.png b/resource/icons/sent.png
new file mode 100644
index 00000000..b11d0425
--- /dev/null
+++ b/resource/icons/sent.png
Binary files differ
diff --git a/resource/icons/server.png b/resource/icons/server.png
new file mode 100644
index 00000000..2efc30ef
--- /dev/null
+++ b/resource/icons/server.png
Binary files differ
diff --git a/resource/icons/trash.png b/resource/icons/trash.png
new file mode 100644
index 00000000..9cf606b8
--- /dev/null
+++ b/resource/icons/trash.png
Binary files differ
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.h b/src/ui/smtp/ReceiveMailDialog.h
index 5aa2c52e..7199cd2a 100644
--- a/src/ui/smtp/ReceiveMailDialog.h
+++ b/src/ui/smtp/ReceiveMailDialog.h
@@ -29,15 +29,31 @@
class Ui_ReceiveMailDialog;
+namespace vmime::net {
+class folder;
+};
+
namespace GpgFrontend::UI {
+class IMAPFolder;
+
class ReceiveMailDialog : public QDialog {
Q_OBJECT
public:
- ReceiveMailDialog(QWidget *parent);
+ ReceiveMailDialog(QWidget* parent);
+
+ private slots:
+ void slotRefreshData();
private:
std::shared_ptr<Ui_ReceiveMailDialog> ui;
+
+ std::string get_folder_path(const std::shared_ptr<vmime::net::folder>& f);
+
+ void list_sub_folders(IMAPFolder* parent_folder,
+ const std::shared_ptr<vmime::net::folder>&);
+
+ std::vector<std::shared_ptr<IMAPFolder>> folders;
};
} // namespace GpgFrontend::UI
diff --git a/ui/ReceiveMailDialog.ui b/ui/ReceiveMailDialog.ui
index 7f55710c..5895599b 100644
--- a/ui/ReceiveMailDialog.ui
+++ b/ui/ReceiveMailDialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>643</width>
+ <width>814</width>
<height>657</height>
</rect>
</property>
@@ -43,10 +43,19 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QTreeWidget" name="treeWidget">
+ <widget class="QTreeWidget" name="accountTreeWidget">
+ <property name="indentation">
+ <number>15</number>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <property name="animated">
+ <bool>true</bool>
+ </property>
<column>
<property name="text">
- <string notr="true">1</string>
+ <string>Name</string>
</property>
</column>
</widget>
@@ -56,6 +65,24 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</item>
</layout>