summaryrefslogtreecommitdiff
path: root/Userland/Applications/Mail/MailboxTreeModel.h
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-07-22 18:44:59 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-24 20:11:28 +0430
commitb716e902ba53f4128c64e558c07524689a07a8c2 (patch)
treef084beb072f665d921fe76ab52c8215304cb2902 /Userland/Applications/Mail/MailboxTreeModel.h
parente80f8746b1e6772632f7655846bee9daa6a7b2ef (diff)
downloadserenity-b716e902ba53f4128c64e558c07524689a07a8c2.zip
Mail: Add an e-mail application called Mail
This utilises LibIMAP and LibWeb to provide an e-mail client. The only way currently to connect to a server and login is with a config file. This config file should be stored in ~/.config/Mail.ini Here is an example config file: ``` [Connection] Server=email.example.com Port=993 TLS=true [User] Username=test@example.com Password=Example!1 ``` Since this is stored in plaintext and uses a less secure login method, I'd recommend not using this on your main accounts :^) This has been tested on Gmail and Outlook. For Gmail, you either have to generate an app password if you have 2FA enabled, or enable access from less secure apps in your account settings.
Diffstat (limited to 'Userland/Applications/Mail/MailboxTreeModel.h')
-rw-r--r--Userland/Applications/Mail/MailboxTreeModel.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/Userland/Applications/Mail/MailboxTreeModel.h b/Userland/Applications/Mail/MailboxTreeModel.h
new file mode 100644
index 0000000000..d24a766ce3
--- /dev/null
+++ b/Userland/Applications/Mail/MailboxTreeModel.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibGUI/Model.h>
+#include <LibIMAP/Objects.h>
+
+class AccountHolder;
+
+class MailboxTreeModel final : public GUI::Model {
+public:
+ static NonnullRefPtr<MailboxTreeModel> create(AccountHolder const& account_holder)
+ {
+ return adopt_ref(*new MailboxTreeModel(account_holder));
+ }
+
+ virtual ~MailboxTreeModel() override;
+
+ virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
+ virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
+ virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
+ virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override;
+ virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
+ virtual void update() override;
+
+private:
+ explicit MailboxTreeModel(AccountHolder const&);
+
+ AccountHolder const& m_account_holder;
+
+ GUI::Icon m_mail_icon;
+ GUI::Icon m_folder_icon;
+ GUI::Icon m_account_icon;
+};