summaryrefslogtreecommitdiffabout
path: root/ACLTargetCombo.cpp
Unidiff
Diffstat (limited to 'ACLTargetCombo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--ACLTargetCombo.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/ACLTargetCombo.cpp b/ACLTargetCombo.cpp
new file mode 100644
index 0000000..cdbd075
--- a/dev/null
+++ b/ACLTargetCombo.cpp
@@ -0,0 +1,85 @@
1// ACLTargetCombo.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "PumpKIN.h"
6#include "PumpKINDlg.h"
7#include "ACLTargetCombo.h"
8
9#ifdef _DEBUG
10#define new DEBUG_NEW
11#undef THIS_FILE
12static char THIS_FILE[] = __FILE__;
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16// CACLTargetCombo
17
18CACLTargetCombo::CACLTargetCombo()
19: m_op(-1)
20{
21}
22
23CACLTargetCombo::~CACLTargetCombo()
24{
25}
26
27
28BEGIN_MESSAGE_MAP(CACLTargetCombo, CComboBox)
29 //{{AFX_MSG_MAP(CACLTargetCombo)
30 // NOTE - the ClassWizard will add and remove mapping macros here.
31 //}}AFX_MSG_MAP
32END_MESSAGE_MAP()
33
34/////////////////////////////////////////////////////////////////////////////
35// CACLTargetCombo message handlers
36
37void CACLTargetCombo::SetOp(int op)
38{
39 m_op=op;
40 ResetContent();
41 switch(op) {
42 case tftp::opRRQ:
43 m_tmap.RemoveAll();
44 SetItemData(m_tmap[acl_rule::rrqNone]=AddString("fallback to global"),acl_rule::rrqNone);
45 SetItemData(m_tmap[acl_rule::rrqDeny]=AddString("deny access"),acl_rule::rrqDeny);
46 SetItemData(m_tmap[acl_rule::rrqPrompt]=AddString("prompt"),acl_rule::rrqPrompt);
47 SetItemData(m_tmap[acl_rule::rrqGrant]=AddString("grant access"),CPumpKINDlg::rrqGrant);
48 SetCurSel(0);
49 EnableWindow(TRUE);
50 break;
51 case tftp::opWRQ:
52 m_tmap.RemoveAll();
53 SetItemData(m_tmap[acl_rule::wrqNone]=AddString("fallback to global"),acl_rule::wrqNone);
54 SetItemData(m_tmap[acl_rule::wrqDeny]=AddString("deny access"),acl_rule::wrqDeny);
55 SetItemData(m_tmap[acl_rule::wrqPrompt]=AddString("prompt"),acl_rule::wrqPrompt);
56 SetItemData(m_tmap[acl_rule::wrqPromptIfExists]=AddString("prompt if file exists"),acl_rule::wrqPromptIfExists);
57 SetItemData(m_tmap[acl_rule::wrqGrant]=AddString("grant access"),acl_rule::wrqGrant);
58 SetCurSel(0);
59 EnableWindow(TRUE);
60 break;
61 default:
62 EnableWindow(FALSE);
63 break;
64 }
65}
66
67int CACLTargetCombo::GetTarget()
68{
69 int cs=GetCurSel();
70 if(cs==CB_ERR)
71 return -1;
72 return GetItemData(cs);
73}
74
75void CACLTargetCombo::SetTarget(int t,int op)
76{
77 if(op>=0)
78 SetOp(op);
79 ASSERT(m_op>=0);
80 int i;
81 if(m_tmap.Lookup(t,i))
82 SetCurSel(i);
83 else
84 SetCurSel(0);
85}