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
15 #include <afs/param.h>
19 #include "afs_shl_ext.h"
22 #include "unlog_dlg.h"
28 static char THIS_FILE[] = __FILE__;
31 /////////////////////////////////////////////////////////////////////////////
35 CAuthDlg::CAuthDlg(CWnd* pParent /*=NULL*/)
38 InitModalIndirect (TaLocale_GetDialogResource (CAuthDlg::IDD), pParent);
40 //{{AFX_DATA_INIT(CAuthDlg)
45 void CAuthDlg::DoDataExchange(CDataExchange* pDX)
47 CDialog::DoDataExchange(pDX);
48 //{{AFX_DATA_MAP(CAuthDlg)
49 DDX_Control(pDX, IDC_TOKEN_LIST, m_TokenList);
54 BEGIN_MESSAGE_MAP(CAuthDlg, CDialog)
55 //{{AFX_MSG_MAP(CAuthDlg)
56 ON_BN_CLICKED(ID_GET_TOKENS, OnGetTokens)
57 ON_BN_CLICKED(ID_DISCARD_TOKENS, OnDiscardTokens)
58 ON_BN_CLICKED(IDHELP, OnHelp)
62 /////////////////////////////////////////////////////////////////////////////
63 // CAuthDlg message handlers
65 BOOL CAuthDlg::OnInitDialog()
67 CDialog::OnInitDialog();
69 // The final tab is for an extra CellName entry that is
70 // there so we can easily parse it out when someone wants
71 // to get or discard tokens. It is placed so the user can't
72 // see it. It's kind of a hack, but not too bad.
73 int tabs[] = { 93, 211, 700 };
75 m_TokenList.SetTabStops(sizeof(tabs) / sizeof(int), tabs);
79 return TRUE; // return TRUE unless you set the focus to a control
80 // EXCEPTION: OCX Property Pages should return FALSE
83 void CAuthDlg::OnGetTokens()
87 dlg.SetCellName(GetSelectedCellName());
89 if (dlg.DoModal() == IDOK)
93 void CAuthDlg::OnDiscardTokens()
97 dlg.SetCellName(GetSelectedCellName());
99 if (dlg.DoModal() == IDOK)
103 void CAuthDlg::FillTokenList()
105 m_TokenList.ResetContent();
107 CStringArray tokenInfo;
108 if (!GetTokenInfo(tokenInfo))
111 for (int i = 0; i < tokenInfo.GetSize(); i++)
112 m_TokenList.AddString(tokenInfo[i]);
115 CString CAuthDlg::GetSelectedCellName()
117 int nIndex = m_TokenList.GetCurSel();
121 CString strTokenInfo;
122 m_TokenList.GetText(nIndex, strTokenInfo);
124 int nPos = strTokenInfo.ReverseFind('\t');
126 return strTokenInfo.Mid(nPos + 1);
129 void CAuthDlg::OnHelp()
131 ShowHelp(m_hWnd, AUTHENTICATION_HELP_ID);