2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
16 #include "afs_shl_ext.h"
19 #include "unlog_dlg.h"
25 static char THIS_FILE[] = __FILE__;
28 /////////////////////////////////////////////////////////////////////////////
32 CAuthDlg::CAuthDlg(CWnd* pParent /*=NULL*/)
35 InitModalIndirect (TaLocale_GetDialogResource (CAuthDlg::IDD), pParent);
37 //{{AFX_DATA_INIT(CAuthDlg)
42 void CAuthDlg::DoDataExchange(CDataExchange* pDX)
44 CDialog::DoDataExchange(pDX);
45 //{{AFX_DATA_MAP(CAuthDlg)
46 DDX_Control(pDX, IDC_TOKEN_LIST, m_TokenList);
51 BEGIN_MESSAGE_MAP(CAuthDlg, CDialog)
52 //{{AFX_MSG_MAP(CAuthDlg)
53 ON_BN_CLICKED(ID_GET_TOKENS, OnGetTokens)
54 ON_BN_CLICKED(ID_DISCARD_TOKENS, OnDiscardTokens)
55 ON_BN_CLICKED(IDHELP, OnHelp)
59 /////////////////////////////////////////////////////////////////////////////
60 // CAuthDlg message handlers
62 BOOL CAuthDlg::OnInitDialog()
64 CDialog::OnInitDialog();
66 // The final tab is for an extra CellName entry that is
67 // there so we can easily parse it out when someone wants
68 // to get or discard tokens. It is placed so the user can't
69 // see it. It's kind of a hack, but not too bad.
70 int tabs[] = { 93, 211, 700 };
72 m_TokenList.SetTabStops(sizeof(tabs) / sizeof(int), tabs);
76 return TRUE; // return TRUE unless you set the focus to a control
77 // EXCEPTION: OCX Property Pages should return FALSE
80 void CAuthDlg::OnGetTokens()
84 dlg.SetCellName(GetSelectedCellName());
86 if (dlg.DoModal() == IDOK)
90 void CAuthDlg::OnDiscardTokens()
94 dlg.SetCellName(GetSelectedCellName());
96 if (dlg.DoModal() == IDOK)
100 void CAuthDlg::FillTokenList()
102 m_TokenList.ResetContent();
104 CStringArray tokenInfo;
105 if (!GetTokenInfo(tokenInfo))
108 for (int i = 0; i < tokenInfo.GetSize(); i++)
109 m_TokenList.AddString(tokenInfo[i]);
112 CString CAuthDlg::GetSelectedCellName()
114 int nIndex = m_TokenList.GetCurSel();
118 CString strTokenInfo;
119 m_TokenList.GetText(nIndex, strTokenInfo);
121 int nPos = strTokenInfo.ReverseFind('\t');
123 return strTokenInfo.Mid(nPos + 1);
126 void CAuthDlg::OnHelp()
128 ShowHelp(m_hWnd, AUTHENTICATION_HELP_ID);