GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/mailwindow.h Lines: 0 2 0.0 %
Date: 2021-03-17 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2019  The ManaPlus Developers
4
 *  Copyright (C) 2019-2021  Andrei Karas
5
 *
6
 *  This file is part of The ManaPlus Client.
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful,
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *  GNU General Public License for more details.
17
 *
18
 *  You should have received a copy of the GNU General Public License
19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#ifndef GUI_WINDOWS_MAILWINDOW_H
23
#define GUI_WINDOWS_MAILWINDOW_H
24
25
#include "gui/widgets/window.h"
26
27
#include "enums/net/mailopentype.h"
28
29
#include "listeners/actionlistener.h"
30
31
class Button;
32
class ExtendedListBox;
33
class ExtendedNamesModel;
34
class ScrollArea;
35
36
struct MailMessage;
37
38
/**
39
 * A dialog to choose between buying or selling at a shop.
40
 *
41
 * \ingroup Interface
42
 */
43
class MailWindow final : public Window,
44
                         public ActionListener
45
{
46
    public:
47
        MailWindow();
48
49
        A_DELETE_COPY(MailWindow)
50
51
        ~MailWindow() override final;
52
53
        void action(const ActionEvent &event) override final;
54
55
        void addMail(MailMessage *const message);
56
57
        void clear() override final;
58
59
        void showMessage(MailMessage *const mail,
60
                         const int itemsCount);
61
62
        void removeMail(const int64_t id);
63
64
        void viewNext(const int64_t id);
65
66
        void viewPrev(const int64_t id);
67
68
        void mouseClicked(MouseEvent &event) override final;
69
70
        void postConnection();
71
72
        static void createMail(const std::string &to);
73
74
        MailMessage *findMail(const int64_t id) A_WARN_UNUSED;
75
76
        void setOpenType(const MailOpenTypeT &type)
77
        { mOpenType = type; }
78
79
        MailOpenTypeT getOpenType() const A_WARN_UNUSED
80
        { return mOpenType; }
81
82
        void setLastPage();
83
84
        void refreshMailNames();
85
86
    private:
87
        void refreshMails();
88
89
        std::string getMailHeader(const MailMessage *const message) const
90
                                  A_WARN_UNUSED A_NONNULL(2);
91
92
        STD_VECTOR<MailMessage*> mMessages;
93
        std::map<int64_t, MailMessage*> mMessagesMap;
94
        ExtendedNamesModel *mMailModel;
95
        ExtendedListBox *mListBox;
96
        ScrollArea *mListScrollArea;
97
        Button *mRefreshButton;
98
        Button *mNewButton;
99
        Button *mDeleteButton;
100
        Button *mReturnButton;
101
        Button *mOpenButton;
102
        MailOpenTypeT mOpenType;
103
        bool mUseMail2;
104
        bool mLastPage;
105
};
106
107
extern MailWindow *mailWindow;
108
109
#endif  // GUI_WINDOWS_MAILWINDOW_H