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.

90 lines
2.0 KiB

  1. // the machine objects
  2. // this is internal to the keyring application
  3. #include "stdafx.h"
  4. #include "KeyObjs.h"
  5. #include "machine.h"
  6. #include "KRDoc.h"
  7. #include "resource.h"
  8. IMPLEMENT_DYNCREATE(CLocalMachine, CMachine);
  9. IMPLEMENT_DYNCREATE(CRemoteMachine, CMachine);
  10. // a global reference to this doc object
  11. extern CKeyRingDoc* g_pDocument;
  12. //----------------------------------------------------------------
  13. void CInternalMachine::SetDirty( BOOL fDirty )
  14. {
  15. // we are dirtying, tell the doc so the commit flag
  16. // can be activated
  17. if ( fDirty )
  18. {
  19. ASSERT( g_pDocument );
  20. g_pDocument->SetDirty( fDirty );
  21. }
  22. // set the dirty flag
  23. m_fDirty = fDirty;
  24. }
  25. //----------------------------------------------------------------
  26. BOOL CInternalMachine::FCommitNow()
  27. {
  28. // if we are not diry, there is nothing to do
  29. if ( !m_fDirty ) return TRUE;
  30. // the success flag
  31. BOOL fSuccess = TRUE;
  32. // loop through the services and tell each to commit
  33. CService* pService = (CService*)GetFirstChild();
  34. while( pService )
  35. {
  36. // tell the service to commit
  37. fSuccess &= pService->FCommitChangesNow();
  38. // get the next service
  39. pService = (CService*)GetNextChild( pService );
  40. }
  41. // set the dirty flag
  42. SetDirty( !fSuccess );
  43. // return whether or not it all worked
  44. return fSuccess;
  45. }
  46. //----------------------------------------------------------------
  47. BOOL CMachine::FLocal()
  48. {
  49. return TRUE;
  50. }
  51. //----------------------------------------------------------------
  52. void CMachine::GetMachineName( CString& sz )
  53. {
  54. sz = m_szNetMachineName;
  55. }
  56. //----------------------------------------------------------------
  57. void CLocalMachine::UpdateCaption( void )
  58. {
  59. CString szCaption;
  60. szCaption.LoadString(IDS_MACHINE_LOCAL);
  61. FSetCaption( szCaption );
  62. }
  63. //----------------------------------------------------------------
  64. CRemoteMachine::CRemoteMachine( CString sz )
  65. {
  66. m_szNetMachineName = sz;
  67. }
  68. //----------------------------------------------------------------
  69. void CRemoteMachine::UpdateCaption( void )
  70. {
  71. FSetCaption( m_szNetMachineName );
  72. }