-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAxMenuMailViewBase.h
223 lines (189 loc) · 9.07 KB
/
AxMenuMailViewBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#ifndef __AxMenuMailViewBase_H__
#define __AxMenuMailViewBase_H__
//=============================================================================
/*
* See the file README in the main directory for a description of
* this software, copyright information, and how to reach the author.
*
* Author: alex
* Date: 19.06.2004
*
* Last modfied:
* $Author: alex $
* $Date: 2013-11-02 09:26:18 +0100 (Sa, 02 Nov 2013) $
*/
//=============================================================================
//=============================================================================
// includes
//=============================================================================
//----- qt --------------------------------------------------------------------
//----- CORBA -----------------------------------------------------------------
//----- C++ -------------------------------------------------------------------
#include <string>
//----- C ---------------------------------------------------------------------
//----- vdr -------------------------------------------------------------------
#include <vdr/osd.h>
#include <vdr/menuitems.h>
//----- AxLib -----------------------------------------------------------------
#include <Ax/Mail/Globals.h>
#include <Ax/Vdr/OsdMenu.h>
//----- local -----------------------------------------------------------------
//=============================================================================
// forward declarations
//=============================================================================
class AxMenuMailListView;
class AxPluginMailBox;
class AxOsdItem;
//=============================================================================
// class AxMenuMailViewBase
//=============================================================================
/** Menu to display one mail.
*/
class AxMenuMailViewBase : public Ax::Vdr::OsdMenu
{
//-------------------------------------------------------------------------
// typedefs
//-------------------------------------------------------------------------
typedef Ax::Vdr::OsdMenu PARENT;
typedef AxMenuMailViewBase MYSELF;
protected:
//=============================================================================
// class AxActionToggleFlag
//=============================================================================
class AxActionToggleFlag : public Ax::Vdr::Action
{
//-------------------------------------------------------------------------
typedef Ax::Vdr::Action PARENT;
public:
//-------------------------------------------------------------------------
AxActionToggleFlag( AxMenuMailViewBase *theMailView
, int theID
, Ax::Mail::MailFlag theFlag
, const char *theButtonTextOff
, const char *theButtonTextOn
, const std::string &theName
, const std::string &theDesc
);
//-------------------------------------------------------------------------
virtual ~AxActionToggleFlag();
protected:
//------------------------------------------------------------------------
virtual const char *getButtonTextInternal() const;
//-------------------------------------------------------------------------
virtual eOSState runInternal(eOSState theStateBefore);
protected:
//------------------------------------------------------------------------
AxMenuMailViewBase *myMailView;
Ax::Mail::MailFlag myFlag;
const char *myButtonTextOn ;
const char *myButtonTextOff;
}; // class AxActionToggleFlagged
//-------------------------------------------------------------------------
// enums
//-------------------------------------------------------------------------
enum AxEAction
{
A_FIRST = PARENT::A_LAST
, A_UPDATE_ACTIONS = A_FIRST
, A_JUMP_2_PREV
, A_JUMP_2_NEXT
, A_JUMP_2_PREV_NEW
, A_JUMP_2_NEXT_NEW
, A_TOGGLE_FLAGGED
, A_TOGGLE_SEEN
, A_TOGGLE_DELETED
, A_LAST
};
public:
//-------------------------------------------------------------------------
// AxMenuMailViewBase()
//-------------------------------------------------------------------------
/** Constructor
*/
AxMenuMailViewBase( AxPluginMailBox *thePlugin
, Ax::Mail::MailFolder *theFolder
, Ax::Mail::Mail *theMail
, AxMenuMailViewBase *theParentMailView
, std::string theInstName
, const char *theTitle
, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0
);
//-------------------------------------------------------------------------
// ~AxMenuMailViewBase()
//-------------------------------------------------------------------------
/** Destructor
*/
virtual ~AxMenuMailViewBase();
//-------------------------------------------------------------------------
// MenuKind()
//-------------------------------------------------------------------------
virtual const char* MenuKind() { return "MenuMailboxView"; }
//-------------------------------------------------------------------------
// processAction()
//-------------------------------------------------------------------------
virtual eOSState processAction(const Ax::Vdr::Action &theAction, eOSState = osUnknown);
//-------------------------------------------------------------------------
// setCurrentMail()
//-------------------------------------------------------------------------
virtual void setCurrentMail(Ax::Mail::Mail *theMail);
//-------------------------------------------------------------------------
// getCurrentMail()
//-------------------------------------------------------------------------
Ax::Mail::Mail *getCurrentMail();
//-------------------------------------------------------------------------
// getMailBox()
//-------------------------------------------------------------------------
Ax::Mail::MailBox *getMailBox() const;
//-------------------------------------------------------------------------
// getFolder()
//-------------------------------------------------------------------------
Ax::Mail::MailFolder *getFolder() const;
//-------------------------------------------------------------------------
// AxPluginMailBox()
//-------------------------------------------------------------------------
AxPluginMailBox *getPlugin() const { return myPlugin; }
//-------------------------------------------------------------------------
// updateActions()
//-------------------------------------------------------------------------
virtual void updateActions();
protected:
//-------------------------------------------------------------------------
// updateWithCurrentMail()
//-------------------------------------------------------------------------
virtual void updateWithCurrentMail() = 0;
//-------------------------------------------------------------------------
// informSubOSDClosed()
//-------------------------------------------------------------------------
virtual void informSubOSDClosed(const Ax::Vdr::Action &theAction, eKeys theKey);
public:
//-------------------------------------------------------------------------
// getFlagsStr()
//-------------------------------------------------------------------------
/** Returns a displayable string of the flags of the mail.
*
* The following characters are used to represent the flags:
*
* \code
aFlag[0] = getIsSeen () ? '_' : 'N';
aFlag[1] = getIsFlagged () ? 'F' : '_';
aFlag[2] = getIsAnswered() ? 'A' : '_';
aFlag[3] = getIsDeleted () ? 'D' : '_';
* \endcode
*
* @returns a displayable string of the flags of the mail.
*/
static std::string getFlagsStr(const Ax::Mail::Mail *theMail);
private:
//-------------------------------------------------------------------------
// attributes
//-------------------------------------------------------------------------
AxPluginMailBox *myPlugin ; ///< pointer to the plugin
Ax::Mail::MailFolder *myFolder ; ///< pointer to the mail-folder
Ax::Mail::Mail *myMail ; ///< the mail which is displayed
Ax::Mail::Mail *myPrevNew; ///< cache the prev new mail, updated in showMail()
Ax::Mail::Mail *myNextNew; ///< cache the next new mail, updated in showMail()
Ax::Mail::Mail *myPrev ; ///< cache the prev mail , updated in showMail()
Ax::Mail::Mail *myNext ; ///< cache the next mail , updated in showMail()
AxMenuMailViewBase *myParent ; ///< the 'parent'-view from which this was opened
}; // class AxMenuMailViewBase
#endif