[344439]: OptionsMisc.cpp  Maximize  Restore  History

Download this file

144 lines (122 with data), 3.9 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
// OptionsMisc.cpp : implementation file
//
#include "stdafx.h"
#include "passwordsafe.h"
#include "corelib/PwsPlatform.h"
#include "corelib/Pwsprefs.h" // for DoubleClickAction enums
#if defined(POCKET_PC)
#include "pocketpc/resource.h"
#else
#include "resource.h"
#endif
#include "OptionsMisc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptionsMisc property page
IMPLEMENT_DYNCREATE(COptionsMisc, CPropertyPage)
COptionsMisc::COptionsMisc() : CPropertyPage(COptionsMisc::IDD)
{
//{{AFX_DATA_INIT(COptionsMisc)
//}}AFX_DATA_INIT
}
COptionsMisc::~COptionsMisc()
{
}
void COptionsMisc::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptionsMisc)
DDX_Check(pDX, IDC_CONFIRMDELETE, m_confirmdelete);
DDX_Check(pDX, IDC_SAVEIMMEDIATELY, m_saveimmediately);
DDX_Check(pDX, IDC_MAINTAINDATETIMESTAMPS, m_maintaindatetimestamps);
DDX_Check(pDX, IDC_ESC_EXITS, m_escexits);
DDX_Control(pDX, IDC_DOUBLE_CLICK_ACTION, m_dblclk_cbox);
DDX_Check(pDX, IDC_HOTKEY_ENABLE, m_hotkey_enabled);
// JHF class CHotKeyCtrl not defined under WinCE
#if !defined(POCKET_PC)
DDX_Control(pDX, IDC_HOTKEY_CTRL, m_hotkey);
#endif
DDX_Check(pDX, IDC_USEDEFUSER, m_usedefuser);
DDX_Check(pDX, IDC_QUERYSETDEF, m_querysetdef);
DDX_Text(pDX, IDC_DEFUSERNAME, m_defusername);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptionsMisc, CPropertyPage)
//{{AFX_MSG_MAP(COptionsMisc)
ON_BN_CLICKED(IDC_HOTKEY_ENABLE, OnEnableHotKey)
ON_BN_CLICKED(IDC_USEDEFUSER, OnUsedefuser)
ON_CBN_SELCHANGE(IDC_DOUBLE_CLICK_ACTION, OnComboChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL COptionsMisc::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// For some reason, MFC calls us twice when initializing.
// Populate the combo box only once.
if(m_dblclk_cbox.GetCount() == 0) {
m_dblclk_cbox.AddString(_T("Copies password to clipboard"));
m_dblclk_cbox.AddString(_T("View/Edit selected entry"));
m_dblclk_cbox.AddString(_T("Autotype"));
m_dblclk_cbox.AddString(_T("Browse to URL"));
}
if (m_doubleclickaction < PWSprefs::minDCA ||
m_doubleclickaction > PWSprefs::maxDCA)
m_doubleclickaction = PWSprefs::DoubleClickCopy;
m_dblclk_cbox.SetCurSel(m_doubleclickaction);
// JHF ditto here
#if !defined(POCKET_PC)
m_hotkey.SetHotKey(LOWORD(m_hotkey_value),HIWORD(m_hotkey_value));
if (m_hotkey_enabled == FALSE)
m_hotkey.EnableWindow(FALSE);
#endif
OnUsedefuser();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// COptionsMisc message handlers
void COptionsMisc::OnEnableHotKey()
{
// JHF : no hotkeys on WinCE
#if !defined(POCKET_PC)
if (((CButton*)GetDlgItem(IDC_HOTKEY_ENABLE))->GetCheck() == 1) {
GetDlgItem(IDC_HOTKEY_CTRL)->EnableWindow(TRUE);
GetDlgItem(IDC_HOTKEY_CTRL)->SetFocus();
} else
GetDlgItem(IDC_HOTKEY_CTRL)->EnableWindow(FALSE);
#endif
}
void COptionsMisc::OnComboChanged()
{
m_doubleclickaction = m_dblclk_cbox.GetCurSel();
}
void COptionsMisc::OnUsedefuser()
{
if (((CButton*)GetDlgItem(IDC_USEDEFUSER))->GetCheck() == 1)
{
GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(TRUE);
GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(TRUE);
GetDlgItem(IDC_QUERYSETDEF)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE);
GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE);
GetDlgItem(IDC_QUERYSETDEF)->EnableWindow(TRUE);
}
}
void COptionsMisc::OnOK()
{
UpdateData(TRUE);
// JHF ditto
#if !defined(POCKET_PC)
WORD wVirtualKeyCode, wModifiers;
m_hotkey.GetHotKey(wVirtualKeyCode, wModifiers);
DWORD v = wVirtualKeyCode | (wModifiers << 16);
m_hotkey_value = v;
#endif
CPropertyPage::OnOK();
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks