Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

369 lines
10 KiB

  1. // NewQuery.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "viewex.h"
  5. #include "newquery.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CNewQuery dialog
  13. #define ENTRIES_HISTORY 15
  14. /***********************************************************
  15. Function:
  16. Arguments:
  17. Return:
  18. Purpose:
  19. Author(s):
  20. Revision:
  21. Date:
  22. ***********************************************************/
  23. CNewQuery::CNewQuery(CWnd* pParent /*=NULL*/)
  24. : CDialog(CNewQuery::IDD, pParent)
  25. {
  26. //{{AFX_DATA_INIT(CNewQuery)
  27. m_strPassword = _T("");
  28. m_bEncryptPassword = FALSE;
  29. m_bUseSQL = FALSE;
  30. m_strScope = _T("");
  31. m_strAttributes = _T("");
  32. m_strQuery = _T("");
  33. m_strSource = _T("");
  34. m_strUser = _T("");
  35. m_bUseSearch = FALSE;
  36. //}}AFX_DATA_INIT
  37. }
  38. /***********************************************************
  39. Function:
  40. Arguments:
  41. Return:
  42. Purpose:
  43. Author(s):
  44. Revision:
  45. Date:
  46. ***********************************************************/
  47. void CNewQuery::DoDataExchange(CDataExchange* pDX)
  48. {
  49. CDialog::DoDataExchange(pDX);
  50. //{{AFX_DATA_MAP(CNewQuery)
  51. DDX_Text(pDX, IDC_PASSWORD, m_strPassword);
  52. DDX_Check(pDX, IDC_ENCRYPT, m_bEncryptPassword);
  53. DDX_Check(pDX, IDC_USESQL, m_bUseSQL);
  54. DDX_CBString(pDX, IDC_SCOPE, m_strScope);
  55. DDX_Check(pDX, IDC_USESEARCH, m_bUseSearch);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(CNewQuery, CDialog)
  59. //{{AFX_MSG_MAP(CNewQuery)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CNewQuery message handlers
  64. /***********************************************************
  65. Function:
  66. Arguments:
  67. Return:
  68. Purpose:
  69. Author(s):
  70. Revision:
  71. Date:
  72. ***********************************************************/
  73. BOOL CNewQuery::OnInitDialog()
  74. {
  75. CString strLastValue;
  76. // GetLastProfileString( _T("LastADsQueryPassword"), m_strPassword );
  77. m_strPassword = _T("");
  78. SetLastProfileString( _T("LastADsQueryPassword"), m_strPassword);
  79. GetLastProfileString( _T("LastADsQueryEncryptPassword"), strLastValue );
  80. m_bEncryptPassword = strLastValue.CompareNoCase( _T("No") );
  81. GetLastProfileString( _T("LastADsQueryUseSQL"), strLastValue );
  82. m_bUseSQL = !( strLastValue.CompareNoCase( _T("Yes") ) );
  83. GetLastProfileString( _T("LastADsQueryUseDsSearch"), strLastValue );
  84. m_bUseSearch = !( strLastValue.CompareNoCase( _T("Yes") ) );
  85. GetLRUList( IDC_ATTRIBUTES, _T("Query_Attributes") );
  86. GetLRUList( IDC_QUERY, _T("Query_Query") );
  87. GetLRUList( IDC_SOURCE, _T("Query_Source") );
  88. GetLRUList( IDC_USER, _T("Query_OpenAs") );
  89. CDialog::OnInitDialog();
  90. // TODO: Add extra initialization here
  91. return TRUE; // return TRUE unless you set the focus to a control
  92. // EXCEPTION: OCX Property Pages should return FALSE
  93. }
  94. /***********************************************************
  95. Function:
  96. Arguments:
  97. Return:
  98. Purpose:
  99. Author(s):
  100. Revision:
  101. Date:
  102. ***********************************************************/
  103. void CNewQuery::OnOK()
  104. {
  105. // TODO: Add extra validation here
  106. CString strVal;
  107. CDialog::OnOK();
  108. GetDlgItemText( IDC_ATTRIBUTES, m_strAttributes );
  109. GetDlgItemText( IDC_QUERY, m_strQuery );
  110. GetDlgItemText( IDC_SOURCE, m_strSource );
  111. GetDlgItemText( IDC_PASSWORD, m_strPassword );
  112. GetDlgItemText( IDC_USER, m_strUser );
  113. GetDlgItemText( IDC_SCOPE, m_strScope );
  114. m_bEncryptPassword = ( (CButton*)GetDlgItem( IDC_ENCRYPT ) )->GetCheck( );
  115. m_bUseSQL = ( (CButton*)GetDlgItem( IDC_USESQL ) )->GetCheck( );
  116. m_bUseSearch = ( (CButton*)GetDlgItem( IDC_USESEARCH ) )->GetCheck( );
  117. // SetLastProfileString( _T("LastADsQueryPassword"), m_strPassword );
  118. strVal = m_bEncryptPassword ? _T("Yes") : _T("No");
  119. SetLastProfileString( _T("LastADsQueryEncryptPassword"), strVal );
  120. strVal = m_bUseSQL ? _T("Yes") : _T("No");
  121. SetLastProfileString( _T("LastADsQueryUseSQL"), strVal );
  122. strVal = m_bUseSearch ? _T("Yes") : _T("No");
  123. SetLastProfileString( _T("LastADsQueryUseDsSearch"), strVal );
  124. SaveLRUList( IDC_ATTRIBUTES, _T("Query_Attributes"), 100 );
  125. SaveLRUList( IDC_QUERY, _T("Query_Query"), 100 );
  126. SaveLRUList( IDC_SOURCE, _T("Query_Source"), 100 );
  127. SaveLRUList( IDC_USER, _T("Query_OpenAs"), 100 );
  128. }
  129. /***********************************************************
  130. Function:
  131. Arguments:
  132. Return:
  133. Purpose:
  134. Author(s):
  135. Revision:
  136. Date:
  137. ***********************************************************/
  138. void CNewQuery::SaveLRUList( int idCBox, TCHAR* pszSection, int nMax )
  139. {
  140. CComboBox* pCombo;
  141. TCHAR szEntry[ MAX_PATH ];
  142. TCHAR szIndex[ 8 ];
  143. CString strText, strItem;
  144. int nVal, nIdx, nItems;
  145. pCombo = (CComboBox*)GetDlgItem( idCBox );
  146. pCombo->GetWindowText( strText );
  147. _tcscpy( szEntry, _T("Value_1") );
  148. if( strText.GetLength( ) )
  149. {
  150. WritePrivateProfileString( pszSection, szEntry, (LPCTSTR)strText, ADSVW_INI_FILE );
  151. }
  152. nItems = pCombo->GetCount( );
  153. nVal = 2;
  154. for( nIdx = 0; nItems != CB_ERR && nIdx < nItems && nIdx < nMax ; nIdx ++ )
  155. {
  156. pCombo->GetLBText( nIdx, strItem );
  157. if( strItem.CompareNoCase( strText ) )
  158. {
  159. _itot( nVal++, szIndex, 10 );
  160. _tcscpy( szEntry, _T("Value_") );
  161. _tcscat( szEntry, szIndex );
  162. WritePrivateProfileString( pszSection, szEntry, (LPCTSTR)strItem, ADSVW_INI_FILE );
  163. }
  164. }
  165. }
  166. /***********************************************************
  167. Function:
  168. Arguments:
  169. Return:
  170. Purpose:
  171. Author(s):
  172. Revision:
  173. Date:
  174. ***********************************************************/
  175. void CNewQuery::GetLRUList( int idCBox, TCHAR* pszSection )
  176. {
  177. CComboBox* pCombo;
  178. int nIter;
  179. TCHAR szEntry[ MAX_PATH ];
  180. TCHAR szIndex[ 8 ];
  181. TCHAR szValue[ 1024 ];
  182. pCombo = (CComboBox*)GetDlgItem( idCBox );
  183. for( nIter = 0; nIter < ENTRIES_HISTORY ; nIter++ )
  184. {
  185. _itot( nIter + 1, szIndex, 10 );
  186. _tcscpy( szEntry, _T("Value_") );
  187. _tcscat( szEntry, szIndex );
  188. GetPrivateProfileString( pszSection, szEntry,
  189. _T(""), szValue, 1023, ADSVW_INI_FILE );
  190. if( _tcslen( szValue ) )
  191. {
  192. pCombo->AddString( szValue );
  193. }
  194. }
  195. pCombo->SetCurSel( 0 );
  196. }
  197. /////////////////////////////////////////////////////////////////////////////
  198. // CSearchPreferencesDlg dialog
  199. CSearchPreferencesDlg::CSearchPreferencesDlg(CWnd* pParent /*=NULL*/)
  200. : CDialog(CSearchPreferencesDlg::IDD, pParent)
  201. {
  202. //{{AFX_DATA_INIT(CSearchPreferencesDlg)
  203. m_strAsynchronous = _T("");
  204. m_strAttributesOnly = _T("");
  205. m_strDerefAliases = _T("");
  206. m_strPageSize = _T("");
  207. m_strScope = _T("");
  208. m_strSizeLimit = _T("");
  209. m_strTimeLimit = _T("");
  210. m_strTimeOut = _T("");
  211. m_strChaseReferrals = _T("");
  212. //}}AFX_DATA_INIT
  213. }
  214. void CSearchPreferencesDlg::DoDataExchange(CDataExchange* pDX)
  215. {
  216. CDialog::DoDataExchange(pDX);
  217. //{{AFX_DATA_MAP(CSearchPreferencesDlg)
  218. DDX_Text(pDX, IDC_ASYNCHRONOUS, m_strAsynchronous);
  219. DDX_Text(pDX, IDC_ATTR_ONLY, m_strAttributesOnly);
  220. DDX_Text(pDX, IDC_DEREF_ALIASES, m_strDerefAliases);
  221. DDX_Text(pDX, IDC_PAGE_SIZE, m_strPageSize);
  222. DDX_Text(pDX, IDC_SCOPE, m_strScope);
  223. DDX_Text(pDX, IDC_SIZE_LIMIT, m_strSizeLimit);
  224. DDX_Text(pDX, IDC_TIME_LIMIT, m_strTimeLimit);
  225. DDX_Text(pDX, IDC_TIME_OUT, m_strTimeOut);
  226. DDX_Text(pDX, IDC_CHASE_REFERRALS, m_strChaseReferrals);
  227. //}}AFX_DATA_MAP
  228. }
  229. BEGIN_MESSAGE_MAP(CSearchPreferencesDlg, CDialog)
  230. //{{AFX_MSG_MAP(CSearchPreferencesDlg)
  231. //}}AFX_MSG_MAP
  232. END_MESSAGE_MAP()
  233. /////////////////////////////////////////////////////////////////////////////
  234. // CSearchPreferencesDlg message handlers
  235. /***********************************************************
  236. Function:
  237. Arguments:
  238. Return:
  239. Purpose:
  240. Author(s):
  241. Revision:
  242. Date:
  243. ***********************************************************/
  244. BOOL CSearchPreferencesDlg::OnInitDialog()
  245. {
  246. GetLastProfileString( _T("SearchPref_Asynchronous"), m_strAsynchronous );
  247. GetLastProfileString( _T("SearchPref_AttributesOnly"),m_strAttributesOnly );
  248. GetLastProfileString( _T("SearchPref_DerefAliases"), m_strDerefAliases );
  249. GetLastProfileString( _T("SearchPref_PageSize"), m_strPageSize );
  250. GetLastProfileString( _T("SearchPref_Scope"), m_strScope );
  251. GetLastProfileString( _T("SearchPref_SizeLimit"), m_strSizeLimit );
  252. GetLastProfileString( _T("SearchPref_TimeLimit"), m_strTimeLimit );
  253. GetLastProfileString( _T("SearchPref_TimeOut"), m_strTimeOut );
  254. GetLastProfileString( _T("SearchPref_ChaseReferrals"),m_strChaseReferrals );
  255. CDialog::OnInitDialog();
  256. // TODO: Add extra initialization here
  257. return TRUE; // return TRUE unless you set the focus to a control
  258. // EXCEPTION: OCX Property Pages should return FALSE
  259. }
  260. /***********************************************************
  261. Function:
  262. Arguments:
  263. Return:
  264. Purpose:
  265. Author(s):
  266. Revision:
  267. Date:
  268. ***********************************************************/
  269. void CSearchPreferencesDlg::OnOK()
  270. {
  271. // TODO: Add extra validation here
  272. CDialog::OnOK();
  273. SetLastProfileString( _T("SearchPref_Asynchronous"), m_strAsynchronous );
  274. SetLastProfileString( _T("SearchPref_AttributesOnly"),m_strAttributesOnly );
  275. SetLastProfileString( _T("SearchPref_DerefAliases"), m_strDerefAliases );
  276. SetLastProfileString( _T("SearchPref_PageSize"), m_strPageSize );
  277. SetLastProfileString( _T("SearchPref_Scope"), m_strScope );
  278. SetLastProfileString( _T("SearchPref_SizeLimit"), m_strSizeLimit );
  279. SetLastProfileString( _T("SearchPref_TimeLimit"), m_strTimeLimit );
  280. SetLastProfileString( _T("SearchPref_TimeOut"), m_strTimeOut );
  281. SetLastProfileString( _T("SearchPref_ChaseReferrals"),m_strChaseReferrals );
  282. }
  283. /////////////////////////////////////////////////////////////////////////////
  284. // CACEDialog dialog
  285. CACEDialog::CACEDialog(CWnd* pParent )
  286. : CDialog(CACEDialog::IDD, pParent)
  287. {
  288. //{{AFX_DATA_INIT(CACEDialog)
  289. m_strTrustee = _T("");
  290. //}}AFX_DATA_INIT
  291. }
  292. void CACEDialog::DoDataExchange(CDataExchange* pDX)
  293. {
  294. CDialog::DoDataExchange(pDX);
  295. //{{AFX_DATA_MAP(CACEDialog)
  296. DDX_Text(pDX, IDC_TRUSTEE, m_strTrustee);
  297. //}}AFX_DATA_MAP
  298. }
  299. BEGIN_MESSAGE_MAP(CACEDialog, CDialog)
  300. //{{AFX_MSG_MAP(CACEDialog)
  301. // NOTE: the ClassWizard will add message map macros here
  302. //}}AFX_MSG_MAP
  303. END_MESSAGE_MAP()
  304.