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.

179 lines
6.6 KiB

  1. //==========================================================================
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright 1998 - 1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------
  11. #ifndef _SAMPLESETTINGS
  12. #define _SAMPLESETTINGS
  13. class CSettings;
  14. class CSyncMgrHandler;
  15. // setting information that is given out publicly
  16. typedef struct _tagHANDLERITEMSETTINGS
  17. {
  18. // all the info we need to perform a sync.
  19. GUID ItemID;
  20. TCHAR szItemName[MAX_SYNCMGRITEMNAME];
  21. TCHAR dir1[MAX_PATH];
  22. TCHAR dir2[MAX_PATH];
  23. BOOL fRecursive;
  24. FILETIME ft;
  25. } HANDLERITEMSETTINGS;
  26. typedef HANDLERITEMSETTINGS *LPHANDLERITEMSETTINGS;
  27. // private settings information.
  28. // structure for enumerator items. first item is the GENERICITEM so
  29. // can use the gerneric enumerator class.
  30. // structure passed as lParam to configuration dialog
  31. typedef struct _tagSAMPLEITEMSETTINGS
  32. {
  33. GENERICITEM genericItem;
  34. SYNCMGRITEM syncmgrItem; // item as passed in enumerator.
  35. // handler specific data
  36. TCHAR dir1[MAX_PATH];
  37. TCHAR dir2[MAX_PATH];
  38. BOOL fRecursive;
  39. BOOL fSyncLock; // handler has put a lock on this item.
  40. CSyncMgrHandler *pLockHandler; // ptr to handler who has lock on item.
  41. } SAMPLEITEMSETTINGS;
  42. typedef SAMPLEITEMSETTINGS *LPSAMPLEITEMSETTINGS;
  43. // definitions for global settings class
  44. typedef struct _tagCONFIGSETTINGSLPARAM
  45. {
  46. CSettings *pSettings;
  47. HRESULT hr;
  48. } CONFIGSETTINGSLPARAM;
  49. typedef struct _tagITEMCONFIGSETTINGSLPARAM
  50. {
  51. CSettings *pSettings;
  52. BOOL fNewItem;
  53. SYNCMGRITEMID ItemID;
  54. LPSAMPLEITEMSETTINGS pItemSettings;
  55. HRESULT hr;
  56. // vars used internally by dialog
  57. BOOL fDirty;
  58. } ITEMCONFIGSETTINGSLPARAM;
  59. typedef struct _tagCONFIGITEMLISTVIEWLPARAM
  60. {
  61. SYNCMGRITEMID ItemID;
  62. } CONFIGITEMLISTVIEWLPARAM;
  63. BOOL CALLBACK ConfigureDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  64. BOOL CALLBACK ItemConfigDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  65. class CSettings : CLockHandler {
  66. public:
  67. CSettings();
  68. ~CSettings();
  69. STDMETHODIMP_(ULONG) AddRef();
  70. STDMETHODIMP_(ULONG) Release();
  71. STDMETHODIMP EnumSyncMgrItems(ISyncMgrEnumItems **ppenumOffineItems);
  72. STDMETHODIMP ShowProperties(HWND hWndParent,REFSYNCMGRITEMID ItemID);
  73. BOOL RequestItemLock(CSyncMgrHandler *pLockHandler,REFSYNCMGRITEMID ItemID);
  74. BOOL ReleaseItemLock(CSyncMgrHandler *pLockHandler,REFSYNCMGRITEMID ItemID);
  75. BOOL ReleaseItemLock(CSyncMgrHandler *pLockHandler,REFSYNCMGRITEMID ItemID,FILETIME *pfUpdateTime);
  76. BOOL CopyHandlerSyncInfo(REFSYNCMGRITEMID ItemID,
  77. /* [in,out] */ LPHANDLERITEMSETTINGS pHandlerSyncItem);
  78. private:
  79. LPSAMPLEITEMSETTINGS FindItemSettings(REFSYNCMGRITEMID ItemID);
  80. STDMETHODIMP ReadSettings(BOOL fForce);
  81. BOOL WriteItemSettings(LPSAMPLEITEMSETTINGS pSampleItemSettings);
  82. BOOL DeleteItemSettings(LPSAMPLEITEMSETTINGS pSampleItemSettings);
  83. BOOL ReleaseItemLockX(CSyncMgrHandler *pLockHandler,REFSYNCMGRITEMID ItemID,
  84. BOOL fUpdateft,FILETIME *pfUpdateTime);
  85. STDMETHODIMP ShowItemProperties(HWND hWndParent,BOOL fNew,
  86. LPSAMPLEITEMSETTINGS pItemSettings,SYNCMGRITEMID ItemID);
  87. int Alert(HWND hWnd,LPCTSTR lpText);
  88. // methods used by configuration properties dialog
  89. void OnConfigDlgInit(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  90. UINT uMessage, WPARAM wParam, LPARAM lParam);
  91. void OnConfigDlgDestroy(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  92. UINT uMessage, WPARAM wParam,LPARAM lParam);
  93. void OnConfigDlgNotify(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  94. UINT uMessage, WPARAM wParam,LPARAM lParam);
  95. void OnConfigDlgCommand(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  96. UINT uMessage, WPARAM wParam,LPARAM lParam);
  97. void OnConfigDlgAdd(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam);
  98. void OnConfigDlgRemove(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  99. SYNCMGRITEMID ItemID,int iSelection);
  100. void OnConfigDlgEdit(HWND hWnd,CONFIGSETTINGSLPARAM *pConfigSettingslParam,
  101. SYNCMGRITEMID ItemID,int iSelection);
  102. int ConfigDlgAddListViewItem(HWND hWndList,SYNCMGRITEM syncMgrItem,int iItem,int iIconIndex);
  103. BOOL ConfigDlgDeleteListViewItem(HWND hWndList,int iItem);
  104. // methods used by Item properties dialog
  105. void OnItemConfigDlgInit(HWND hWnd,ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam,
  106. UINT uMessage, WPARAM wParam, LPARAM lParam);
  107. void OnItemConfigDlgDestroy(HWND hWnd,ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam,
  108. UINT uMessage, WPARAM wParam,LPARAM lParam);
  109. void OnItemConfigDlgNotify(HWND hWnd,ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam,
  110. UINT uMessage, WPARAM wParam,LPARAM lParam);
  111. void OnItemConfigDlgCommand(HWND hWnd,ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam,
  112. UINT uMessage, WPARAM wParam,LPARAM lParam);
  113. BOOL OnItemConfigDlgApply(HWND hWnd,ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam,
  114. UINT uMessage, WPARAM wParam,LPARAM lParam);
  115. LPSAMPLEITEMSETTINGS ItemConfigDlgGetItemSettings(ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam);
  116. private:
  117. LPGENERICITEMLIST m_pHandlerItems;
  118. LONG m_cRefs;
  119. friend BOOL CALLBACK ConfigureDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  120. friend BOOL CALLBACK ItemConfigDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  121. };
  122. // Enumerator for ISyncMgrEnumItems
  123. class CEnumSyncMgrItems : public CGenericEnum , public ISyncMgrEnumItems
  124. {
  125. public:
  126. CEnumSyncMgrItems(LPGENERICITEMLIST pContactItemList,DWORD cOffset);
  127. virtual void DeleteThisObject();
  128. //IUnknown members
  129. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  130. STDMETHODIMP_(ULONG) AddRef();
  131. STDMETHODIMP_(ULONG) Release();
  132. //IEnumSyncMgrItems members
  133. STDMETHODIMP Next(ULONG celt, LPSYNCMGRITEM rgelt,ULONG *pceltFetched);
  134. STDMETHODIMP Clone(ISyncMgrEnumItems **ppenum);
  135. STDMETHODIMP Skip(ULONG celt);
  136. STDMETHODIMP Reset();
  137. };
  138. #endif // _SAMPLESETTINGS