[bcbb26]: OptionsSecurity.cpp Maximize Restore History

Download this file

OptionsSecurity.cpp    105 lines (84 with data), 2.8 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
/*
* Copyright (c) 2003-2007 Rony Shapiro <ronys@users.sourceforge.net>.
* All rights reserved. Use of the code is allowed under the
* Artistic License terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license.php
*/
// OptionsSecurity.cpp : implementation file
//
#include "stdafx.h"
#include "passwordsafe.h"
#include "corelib/PwsPlatform.h"
#if defined(POCKET_PC)
#include "pocketpc/resource.h"
#else
#include "resource.h"
#include "resource3.h" // String resources
#endif
#include "OptionsSecurity.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptionsSecurity property page
IMPLEMENT_DYNCREATE(COptionsSecurity, CPropertyPage)
COptionsSecurity::COptionsSecurity() : CPropertyPage(COptionsSecurity::IDD)
{
//{{AFX_DATA_INIT(COptionsSecurity)
//}}AFX_DATA_INIT
}
COptionsSecurity::~COptionsSecurity()
{
}
void COptionsSecurity::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptionsSecurity)
DDX_Check(pDX, IDC_CLEARBOARD, m_clearclipboard);
DDX_Check(pDX, IDC_LOCKBASE, m_lockdatabase);
DDX_Check(pDX, IDC_CONFIRMCOPY, m_confirmcopy);
DDX_Check(pDX, IDC_LOCKONSCREEN, m_LockOnWindowLock);
DDX_Check(pDX, IDC_LOCK_TIMER, m_LockOnIdleTimeout);
DDX_Text(pDX, IDC_IDLE_TIMEOUT, m_IdleTimeOut);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptionsSecurity, CPropertyPage)
//{{AFX_MSG_MAP(COptionsSecurity)
ON_BN_CLICKED(IDC_LOCKBASE, OnLockbase)
ON_BN_CLICKED(IDC_LOCK_TIMER, OnLockbase)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptionsSecurity message handlers
void COptionsSecurity::OnLockbase()
{
BOOL enable = (((CButton*)GetDlgItem(IDC_LOCK_TIMER))->GetCheck() == 1) ? TRUE : FALSE;
GetDlgItem(IDC_IDLESPIN)->EnableWindow(enable);
GetDlgItem(IDC_IDLE_TIMEOUT)->EnableWindow(enable);
}
BOOL COptionsSecurity::OnInitDialog()
{
CPropertyPage::OnInitDialog();
OnLockbase();
CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_IDLESPIN);
pspin->SetBuddy(GetDlgItem(IDC_IDLE_TIMEOUT));
pspin->SetRange(1, 120);
pspin->SetBase(10);
pspin->SetPos(m_IdleTimeOut);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL COptionsSecurity::OnKillActive()
{
CPropertyPage::OnKillActive();
// Check that options, as set, are valid.
if ((m_IdleTimeOut < 1) || (m_IdleTimeOut > 120)) {
AfxMessageBox(IDS_INVALIDTIMEOUT);
((CEdit*)GetDlgItem(IDC_IDLE_TIMEOUT))->SetFocus();
return FALSE;
}
return TRUE;
}