[292622]: DboxMain.h  Maximize  Restore  History

Download this file

198 lines (164 with data), 5.4 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
191
192
193
194
195
196
197
// DboxMain.h
//-----------------------------------------------------------------------------
#ifndef DboxMain_h
#define DboxMain_h
#include "corelib/PWScore.h"
#include "PwsPlatform.h"
#if defined(POCKET_PC)
#include "pocketpc/resource.h"
#include "pocketpc/MyListCtrl.h"
#else
#include "resource.h"
#endif
#if defined(POCKET_PC) || (_MFC_VER <= 1200)
DECLARE_HANDLE(HDROP);
#endif
//-----------------------------------------------------------------------------
class DboxMain
: public CDialog
{
#if defined(POCKET_PC)
friend class CMyListCtrl;
#endif
// static methods
private:
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
public:
// default constructor
DboxMain(CWnd* pParent = NULL);
CMyString GetPassword(void) const;
// Find in core by title and user name, exact match
POSITION Find(const CMyString &a_title, const CMyString &a_user)
{return m_core.Find(a_title, a_user);}
// Find entry in core with same title and user name as the i'th entry in m_ctlItemList
POSITION Find(int i);
// FindAll is used by CFindDlg, returns # of finds.
// indices allocated by caller
int FindAll(const CString &str, BOOL CaseSensitive, int *indices);
int GetNumEntries() const {return m_core.GetNumEntries();}
BOOL SelectEntry(int i, BOOL MakeVisible = FALSE); // MakeVisible will scroll list, if needed
void RefreshList();
void SetCurFile(const CString &arg) {m_core.SetCurFile(CMyString(arg));}
int CheckPassword(const CMyString &filename, CMyString &passkey)
{return m_core.CheckPassword(filename, passkey);}
//{{AFX_DATA(DboxMain)
enum { IDD = IDD_PASSWORDSAFE_DIALOG };
#if defined(POCKET_PC)
CMyListCtrl m_ctlItemList;
#else
CListCtrl m_ctlItemList;
#endif
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DboxMain)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
HICON m_hIcon;
// used to speed up the resizable dialog so OnSize/SIZE_RESTORED isn't called
bool m_bSizing;
unsigned int uGlobalMemSize;
HGLOBAL hGlobalMemory;
CMyString m_currbackup;
#if !defined(POCKET_PC)
CMyString m_title; // what's displayed in the title bar
#endif
#if defined(POCKET_PC)
CCeCommandBar *m_wndCommandBar;
CMenu *m_wndMenu;
#else
CToolBar m_wndToolBar;
CStatusBar m_statusBar;
BOOL m_toolbarsSetup;
#endif
bool m_windowok;
BOOL m_existingrestore;
bool m_needsreading;
bool m_bSortAscending;
int m_iSortedColumn;
bool m_bShowPasswordInEdit;
bool m_bShowPasswordInList;
BOOL m_bAlwaysOnTop;
int insertItem(CItemData &itemData, int iIndex = -1);
int getSelectedItem();
void ChangeOkUpdate();
BOOL SelItemOk();
void ClearClipboard();
void setupBars();
BOOL OpenOnInit();
void ConfigureSystemMenu();
void OnSysAlwaysOnTop();
afx_msg void OnSysCommand( UINT nID, LPARAM lParam );
void UpdateAlwaysOnTop();
void ClearData();
int NewFile(void);
//Version of message functions with return values
int Save(void);
int SaveAs(void);
int Open(void);
int Open( const CMyString &pszFilename );
int BackupSafe(void);
int New(void);
int Restore(void);
// Generated message map functions
//{{AFX_MSG(DboxMain)
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
virtual void OnCancel();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnAbout();
afx_msg void OnCopyUsername();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnKeydownItemlist(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnListDoubleClick( NMHDR * pNotifyStruct, LRESULT * result );
afx_msg void OnCopyPassword();
afx_msg void OnNew();
afx_msg void OnOpen();
afx_msg void OnRestore();
afx_msg void OnSaveAs();
afx_msg void OnBackupSafe();
afx_msg void OnPasswordChange();
afx_msg void OnClearclipboard();
afx_msg void OnDelete();
afx_msg void OnEdit();
afx_msg void OnFind();
afx_msg void OnOptions();
afx_msg void OnSave();
afx_msg void OnAdd();
afx_msg void OnOK();
#if defined(POCKET_PC)
afx_msg void OnShowPassword();
#else
afx_msg void OnSetfocusItemlist( NMHDR * pNotifyStruct, LRESULT * result );
afx_msg void OnKillfocusItemlist( NMHDR * pNotifyStruct, LRESULT * result );
afx_msg void OnDropFiles(HDROP hDrop);
#endif
afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnUpdateMRU(CCmdUI* pCmdUI);
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
//}}AFX_MSG
afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnExportV17();
afx_msg void OnExportText();
#if _MFC_VER > 1200
afx_msg BOOL OnOpenMRU(UINT nID);
#else
afx_msg void OnOpenMRU(UINT nID);
#endif
DECLARE_MESSAGE_MAP()
BOOL CheckExtension(const CMyString &name, const CMyString &ext) const;
int GetAndCheckPassword(const CMyString &filename, CMyString& passkey,
bool first = false);
private:
PWScore m_core;
};
//-----------------------------------------------------------------------------
#endif // DboxMain_h
//-----------------------------------------------------------------------------
// Local variables:
// mode: c++
// End: