Skip to content

Commit

Permalink
Added User Manual;search progress bar;new -PROGRESS_BAR_DELAY option arg
Browse files Browse the repository at this point in the history
  • Loading branch information
zigm committed Mar 6, 2018
1 parent 1b15652 commit b8e7c40
Show file tree
Hide file tree
Showing 16 changed files with 208 additions and 47 deletions.
7 changes: 4 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Changes

v 1.0.1.12

- added delayed search progress bar to view search progress and allow to cancel the search in progress;
- added User Manual;
- added delayed search progress bar to view search progress and to allow to cancel the search in progress;
- added -PROGRESS_BAR_DELAY=seconds command line option to control the start the progress bar. The value of -1 disables the bar;
- fixed an issue with searching of RAW messages;
- addedd ability to set/override EXPORT_EML and PROGRESS_BAR_DELAY from GUI;
- fixed small issue with searching of RAW messages;
- note: -MAIL_FILE=filename new option was stated incorrectly as -EMAIL_FILE=filename in the v1.0.1.11 READMEs;
- added User Manual;

v 1.0.1.11

Expand Down
7 changes: 4 additions & 3 deletions ReadMe.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ Changes

v 1.0.1.12

- added delayed search progress bar to view search progress and allow to cancel the search in progress;
- added User Manual;
- added delayed search progress bar to view search progress and to allow to cancel the search in progress;
- added -PROGRESS_BAR_DELAY=seconds command line option to control the start the progress bar. The value of -1 disables the bar;
- fixed an issue with searching of RAW messages;
- addedd ability to set/override EXPORT_EML and PROGRESS_BAR_DELAY from GUI;
- fixed small issue with searching of RAW messages;
- note: -MAIL_FILE=filename new option was stated incorrectly as -EMAIL_FILE=filename in the v1.0.1.11 READMEs;
- added User Manual;

v 1.0.1.11

Expand Down
Binary file modified UserGuide.odt
Binary file not shown.
Binary file modified UserGuide.pdf
Binary file not shown.
26 changes: 22 additions & 4 deletions src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,29 @@ void CMainFrame::OnFileOptions()
{
COptionsDlg d;
if (d.DoModal() == IDOK) {
GetListView()->m_format = GetDateFormat(d.m_format);
GetListView()->Invalidate();
GetMsgView()->m_browser.m_ie.Invalidate(); // .RedrawWindow();
}
CString format = GetDateFormat(d.m_format);
if (GetListView()->m_format.Compare(format) != 0) {
GetListView()->m_format = GetDateFormat(d.m_format);
GetListView()->Invalidate();
GetMsgView()->m_browser.m_ie.Invalidate(); // .RedrawWindow();
}

if (GetListView()->m_maxSearchDuration != d.m_barDelay) {
GetListView()->m_maxSearchDuration = d.m_barDelay;
DWORD barDelay = d.m_barDelay;
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), barDelay);
}

BOOL exportEml = (d.m_exportEML > 0) ? TRUE : FALSE;
if (GetListView()->m_bExportEml != exportEml) {
GetListView()->m_bExportEml = exportEml;
CString str_exportEML = _T("n");
if (exportEml == TRUE)
str_exportEML = _T("y");
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), str_exportEML);
}

}
}
void CMainFrame::OnFileOpen()
{
Expand Down
2 changes: 0 additions & 2 deletions src/MboxMail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <afxtempl.h>
#include "mboxview.h"
#include "MboxMail.h"
//#include "TextUtilities.h"


_int64 MboxMail::s_curmap = 0;
_int64 MboxMail::s_step = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/MboxMail.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ class MboxMail
}
return res;
};

_int64 m_startOff;
int m_hasAttachments;
int m_length, m_headLength, m_recv;
time_t m_timeDate;
CString m_from, m_to, m_subj;

static _int64 s_fSize; // current File size
static _int64 s_oSize; // old file size
static CString s_path;
Expand Down
55 changes: 44 additions & 11 deletions src/NListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ NListView::NListView() : m_lastStartDate((time_t)-1), m_lastEndDate((time_t)-1)
m_bEditFindFirst = FALSE;
m_lastFindPos = 0;
m_searchPos = 0;
m_maxSearchDuration = 4;
m_searchString.Empty();
m_bCaseSens = TRUE;
m_bWholeWord = FALSE;
Expand All @@ -99,17 +98,31 @@ NListView::NListView() : m_lastStartDate((time_t)-1), m_lastEndDate((time_t)-1)
m_bInFind = FALSE;
int iFormat = CProfile::_GetProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, "format");
m_format = GetDateFormat(iFormat);
CString exportEML = CProfile::_GetProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"));
if (exportEML.IsEmpty())
m_bExportEml = FALSE;
else if (exportEML.Compare(_T("y")) == 0)
m_bExportEml = TRUE;
else

CString exportEML;
BOOL retval = CProfile::_GetProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), exportEML);
if (retval == TRUE) {
if (exportEML.Compare(_T("y")) == 0)
m_bExportEml = TRUE;
else
m_bExportEml = FALSE;
}
else {
exportEML = _T("n");
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), exportEML);
m_bExportEml = FALSE;
}

CString barDelay = CProfile::_GetProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"));
if (!barDelay.IsEmpty())
m_maxSearchDuration = _tstoi(barDelay);
DWORD barDelay;
retval = CProfile::_GetProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), barDelay);
if (retval == TRUE) {
m_maxSearchDuration = barDelay;
}
else {
barDelay = 1;
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), barDelay);
m_maxSearchDuration = barDelay;
}
}

NListView::~NListView()
Expand Down Expand Up @@ -1626,14 +1639,34 @@ void NListView::SelectItemFound(int which)


void NListView::OnEditVieweml()
{
{ // Save raw message
if (m_bExportEml == FALSE)
{
POSITION pos = m_list.GetFirstSelectedItemPosition();
int nItem = m_list.GetNextSelectedItem(pos);
MboxMail *m = 0;
if (nItem >= 0) {
m = MboxMail::s_mails[nItem];
// Get raw mail body
CString bdy = m->GetBody();
// Save mail
CFile fp(GetmboxviewTempPath() + "message.eml", CFile::modeWrite | CFile::modeCreate);
fp.Write(bdy, bdy.GetLength());
fp.Close();
}
}

CString path = GetmboxviewTempPath();
HINSTANCE result = ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWNORMAL);
}


void NListView::OnUpdateEditVieweml(CCmdUI *pCmdUI)
{
POSITION pos = m_list.GetFirstSelectedItemPosition();
int nItem = m_list.GetNextSelectedItem(pos);
if (nItem >= 0)
MboxMail *m = MboxMail::s_mails[nItem];
pCmdUI->Enable(m_list.GetFirstSelectedItemPosition()>0);
}

Expand Down
34 changes: 30 additions & 4 deletions src/OptionsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IMPLEMENT_DYNAMIC(COptionsDlg, CDialog)

COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
: CDialog(COptionsDlg::IDD, pParent)
, m_format(FALSE)
, m_format(0)
{

}
Expand All @@ -25,6 +25,8 @@ void COptionsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Radio(pDX, IDC_DMY, m_format);
DDX_Radio(pDX, IDC_EXPORT_EML, m_exportEML);
DDX_Text(pDX, IDC_PROGRESS_BAR_DELAY, m_barDelay);
}


Expand All @@ -38,9 +40,16 @@ END_MESSAGE_MAP()

void COptionsDlg::OnBnClickedOk()
{
UpdateData(TRUE);
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, "format", m_format);
CDialog::OnOK();
if (UpdateData(TRUE)) {
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, "format", m_format);
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), m_barDelay);
if (m_exportEML == 1)
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), CString(_T("y")));
else
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), CString(_T("n")));

CDialog::OnOK();
}
}


Expand All @@ -49,6 +58,23 @@ BOOL COptionsDlg::OnInitDialog()
CDialog::OnInitDialog();

m_format = CProfile::_GetProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, "format");
DWORD barDelay = 0;
BOOL retval;
if (retval = CProfile::_GetProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), barDelay))
m_barDelay = barDelay;
else
m_barDelay = 1;

CString exportEML;
if (retval = CProfile::_GetProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), exportEML)) {
if (exportEML.Compare(_T("y")) == 0)
m_exportEML = 1;
else
m_exportEML = 0;
}
else
m_exportEML = 0; // we should not be here; it should be initialized in NListView::NListView()

UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// ECCEZIONE: le pagine delle proprietà OCX devono restituire FALSE
Expand Down
4 changes: 3 additions & 1 deletion src/OptionsDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ class COptionsDlg : public CDialog
public:
afx_msg void OnBnClickedOk();
virtual BOOL OnInitDialog();
BOOL m_format;
int m_format;
int m_exportEML;
int m_barDelay;
};
47 changes: 47 additions & 0 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,53 @@ int CProfile::_GetProfileInt( HKEY hKey, LPCTSTR section, LPCTSTR key )
return (int)result;
}

BOOL CProfile::_GetProfileString(HKEY hKey, LPCTSTR section, LPCTSTR key, CString &str)
{
DWORD size = 4096;
unsigned char data[4096];
data[0] = 0;
HKEY myKey;
CString result = (char *)("");
int l = result.GetLength();
if (result.IsEmpty()) {
int deb = 1;
}
long res;
CString path = (char *)section;
if (!RegOpenKeyEx(hKey, (LPCTSTR)path,
NULL, KEY_READ | KEY_QUERY_VALUE, &myKey)) {
res = RegQueryValueEx(myKey, (LPCTSTR)key,
NULL, NULL, data, &size);
RegCloseKey(myKey);
if (res == ERROR_SUCCESS) {
result = (char *)data;
str = result;
return TRUE;
}
}
return FALSE;
}

BOOL CProfile::_GetProfileInt(HKEY hKey, LPCTSTR section, LPCTSTR key, DWORD &intval)
{
DWORD size = sizeof(DWORD);
HKEY myKey;
DWORD result = 0;
long res;
CString path = (char *)section;
if (!RegOpenKeyEx(hKey, (LPCTSTR)path,
NULL, KEY_READ | KEY_QUERY_VALUE, &myKey)) {
res = RegQueryValueEx(myKey, (LPCTSTR)key,
NULL, NULL, (BYTE *)&result, &size);
RegCloseKey(myKey);
if (res == ERROR_SUCCESS) {
intval = result;
return TRUE;
}
}
return FALSE;
}

/*
BOOL CProfile::_WriteProfileString( LPCTSTR section, LPCTSTR key, CString &value )
{
Expand Down
2 changes: 2 additions & 0 deletions src/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class CProfile {
}*/
static int _GetProfileInt( HKEY hKey, LPCTSTR section, LPCTSTR key );
static CString _GetProfileString( HKEY hKey, LPCTSTR section, LPCTSTR key );
static BOOL _GetProfileInt(HKEY hKey, LPCTSTR section, LPCTSTR key, DWORD &intval);
static BOOL _GetProfileString(HKEY hKey, LPCTSTR section, LPCTSTR key, CString &str);
private:
// CString m_regAppKey;
};
34 changes: 22 additions & 12 deletions src/mboxview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ BOOL _PathFileExist(LPCSTR path)
return FALSE;
}

BOOL isNumeric(CString &str) {
int i = 0;
if (str[i] == '-')
i++;
if (i == str.GetLength())
return FALSE;
for (; i < str.GetLength(); i++) {
if (!_istdigit(str[i])) {
return FALSE;
}
}
return TRUE;
}

#include <afxadv.h> //Has CRecentFileList class definition.
#include "afxlinkctrl.h"
#include "afxwin.h"
Expand Down Expand Up @@ -310,7 +324,7 @@ void CCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL) // bLast )
else if (strncmp(lpszParam, _T("EXPORT_EML="), 11) == 0) {
CString exportEML = lpszParam + 11;
exportEML.MakeLower();
if (!((exportEML.Compare("y") == 0) || (exportEML.Compare("n") == 0) || exportEML.IsEmpty())) {
if (!((exportEML.Compare("y") == 0) || (exportEML.Compare("n") == 0))) {
CString txt = _T("Invalid Command Line Option Value \"");
CString opt = lpszParam;
txt += opt + _T("\". Valid are \"y|n\". Note that once defined valid EXPORT_EML persists in the registry.\nDo you want to continue?");
Expand All @@ -319,20 +333,14 @@ void CCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL) // bLast )
if (answer == IDNO)
m_bError = TRUE;
}
else
else {
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("exportEML"), exportEML);
}
}
else if (strncmp(lpszParam, _T("PROGRESS_BAR_DELAY="), 19) == 0) {
CString barDelay = lpszParam + 19;
// Validate
int i = 0;
if (barDelay[i] == '-')
i++;
for ( ; i < barDelay.GetLength(); i++) {
if (!_istdigit(barDelay[i]))
break;
}
if (i != barDelay.GetLength())
if (!isNumeric(barDelay))
{
CString txt = _T("Invalid Command Line Option Value \"");
CString opt = lpszParam;
Expand All @@ -342,8 +350,10 @@ void CCmdLine::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL) // bLast )
if (answer == IDNO)
m_bError = TRUE;
}
else
CProfile::_WriteProfileString(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), barDelay);
else {
DWORD progressBarDelay = _tstoi(barDelay);
CProfile::_WriteProfileInt(HKEY_CURRENT_USER, sz_Software_mboxview, _T("progressBarDelay"), progressBarDelay);
}
}
else {
// Unknown argument
Expand Down
2 changes: 2 additions & 0 deletions src/mboxview.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class CmboxviewApp : public CWinApp

extern CmboxviewApp theApp;

BOOL isNumeric(CString &str);

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
Expand Down
Loading

0 comments on commit b8e7c40

Please sign in to comment.