forked from eneam/mboxviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForwardMailDlg.cpp
More file actions
190 lines (146 loc) · 4.5 KB
/
Copy pathForwardMailDlg.cpp
File metadata and controls
190 lines (146 loc) · 4.5 KB
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
//
//////////////////////////////////////////////////////////////////
//
// Windows Mbox Viewer is a free tool to view, search and print mbox mail archives.
//
// Source code and executable can be downloaded from
// https://sourceforge.net/projects/mbox-viewer/ and
// https://github.com/eneam/mboxviewer
//
// Copyright(C) 2019 Enea Mansutti, Zbigniew Minciel
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the version 3 of GNU Affero General Public License
// as published by the Free Software Foundation;
//
// This program 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110 - 1301, USA.
//
//////////////////////////////////////////////////////////////////
//
// ForwardMailDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ForwardMailDlg.h"
#include "TextUtilsEx.h"
#include "afxdialogex.h"
// ForwardMailDlg dialog
IMPLEMENT_DYNAMIC(ForwardMailDlg, CDialogEx)
ForwardMailDlg::ForwardMailDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_FORWARD_EMAIL, pParent)
{
}
ForwardMailDlg::~ForwardMailDlg()
{
}
void ForwardMailDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_FORWARD_TO, m_Data.m_To);
DDX_Text(pDX, IDC_EDIT_FORWARD_CC, m_Data.m_CC);
DDX_Text(pDX, IDC_EDIT_FORWARD_BCC, m_Data.m_BCC);
DDX_Control(pDX, IDC_EDIT_FORWARD_TEXT, m_EditText);
DDX_Control(pDX, IDC_EDIT_FORWARD_SUBJECT, m_Subject);
DDX_Text(pDX, IDC_EDIT_FORWARD_FROM, m_Data.m_From);
DDX_Text(pDX, IDC_EDIT_FORWARD_SERVICE, m_Data.m_MailService);
}
BEGIN_MESSAGE_MAP(ForwardMailDlg, CDialogEx)
ON_BN_CLICKED(IDOK, &ForwardMailDlg::OnBnClickedOk)
ON_WM_CREATE()
ON_BN_CLICKED(IDC_FORWARD_CLEAR, &ForwardMailDlg::OnBnClickedForwardClear)
END_MESSAGE_MAP()
// ForwardMailDlg message handlers
int ForwardMailDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//DWORD dwStyle = ES_READONLY| ES_LEFT;
//BOOL ret = m_Subject.Create(dwStyle, CRect(), this, IDC_EDIT_FORWARD_SUBJECT);
m_Subject.SetSubject(m_Data.m_subjectW);
return TRUE;
}
BOOL ForwardMailDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_EditText.SetWindowText(m_Data.m_Text);
if (GetSafeHwnd())
{
CWnd* p = GetDlgItem(IDC_EDIT_FORWARD_FROM);
if (p)
{
if (m_Data.m_MailService.CompareNoCase(L"Custom") == 0)
p->EnableWindow(TRUE);
else
p->EnableWindow(FALSE);
}
}
return TRUE;
}
void ForwardMailDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
UpdateData();
m_EditText.GetWindowText(m_Data.m_Text);
if (m_Data.m_To.GetAllocLength() == 0)
{
CString txt;
txt.Format(L"Empty \"To:\" field not allowed!");
AfxMessageBox(txt, MB_OK | MB_ICONHAND);
return;
}
CDialogEx::OnOK();
}
void ForwardMailData::Copy(ForwardMailData &data)
{
if (this == &data)
return;
m_MailService = data.m_MailService;
m_From = data.m_From;
m_To = data.m_To;
m_CC = data.m_CC;
m_BCC = data.m_BCC;
m_Text = data.m_Text;
m_subjectW = data.m_subjectW;
}
MyCustomEdit::MyCustomEdit()
{
int deb = 1;
}
void MyCustomEdit::OnPaint()
{
CPaintDC dc(this);
RECT rect;
GetClientRect(&rect);
HDC hDC = dc.GetSafeHdc();
CFont newFont;
newFont.CreatePointFont(85, L"Tahoma");
// Set new font. Should reinstall old oldFont?? doesn't seem to matter
CFont *pOldFont = dc.SelectObject(&newFont);
COLORREF color = ::GetSysColor(COLOR_3DFACE);
dc.FillRect(&rect, &CBrush(color));
dc.SetBkMode(TRANSPARENT);
//dc.SetTextColor(txcolor);
int xpos = 3;
int ypos = 3;
BOOL ret = ::ExtTextOutW(hDC, xpos, ypos, ETO_CLIPPED, &rect, (LPCWSTR)m_subjectW, m_subjectW.GetLength(), NULL);
int deb = 1;
}
BEGIN_MESSAGE_MAP(MyCustomEdit, CEdit)
ON_WM_PAINT()
END_MESSAGE_MAP()
void ForwardMailDlg::OnBnClickedForwardClear()
{
// TODO: Add your control notification handler code here
m_Data.m_To.Empty();
m_Data.m_CC.Empty();
m_Data.m_BCC.Empty();
m_EditText.SetWindowText(L"");
UpdateData(FALSE);
}