summaryrefslogtreecommitdiff
path: root/NSCmpts/EncryptAdvancedProp.cpp
blob: 2149139f3169ce040a2bd4c92a0e6a6ec3a88f11 (plain)
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
// EncryptAdvancedProp.cpp : Implementation of CEncryptAdvancedProp
#include "stdafx.h"
#include "NSCmpts.h"
#include "EncryptAdvancedProp.h"

/////////////////////////////////////////////////////////////////////////////
// CEncryptAdvancedProp

LRESULT CEncryptAdvancedProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	// Let it choose an object for data
	m_Data.Initialize(m_nObjects, m_ppUnk);

	// Set this for CIgnoreProp
	m_hwndIgnore = m_hWnd;

	CIgnoreProp::OnInitDialog(uMsg, wParam, lParam, bHandled);

	// Other Data Init
	m_bDisablePassword = m_Data.GetInt(NS_ENCRYPT_REG_DISABLE, true) ? true : false;
	m_bEncryptReadOnly = m_Data.GetInt(NS_ENCRYPT_REG_READONLY, false) ? true : false;

	UpdateData(false);

	bHandled = true;
	return TRUE;
}

LRESULT CEncryptAdvancedProp::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	// Just in case, save before destroy
	UpdateData(true);
	return 0; 
}

void CEncryptAdvancedProp::UpdateData(bool bSave) 
{
	// Do Ignore Extensions first
	CIgnoreProp::UpdateData(bSave);

	if(bSave)
	{
		m_bDisablePassword = IsDlgButtonChecked(IDC_DISABLEPASSWORD) ? true : false;
		m_bEncryptReadOnly = IsDlgButtonChecked(IDC_ENCRYPTREADONLY) ? true : false;
	}
	else
	{
		CheckDlgButton(IDC_DISABLEPASSWORD, m_bDisablePassword ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(IDC_ENCRYPTREADONLY, m_bEncryptReadOnly ? BST_CHECKED : BST_UNCHECKED);
	}
}