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.

104 lines
3.7 KiB

  1. #ifndef __helper_h
  2. #define __helper_h
  3. #define TrimWhiteSpaceW(psz) StrTrimW(psz, L" \t")
  4. #define TrimWhiteSpaceA(psz) StrTrimA(psz, " \t")
  5. #ifdef UNICODE
  6. #define TrimWhiteSpace TrimWhiteSpaceW
  7. #else
  8. #define TrimWhiteSpace TrimWhiteSpaceA
  9. #endif
  10. HRESULT LoadWithCookie(LPCTSTR url, POOEBuf pBuf, DWORD * pdwBufferSize, SUBSCRIPTIONCOOKIE * pcookie);
  11. HRESULT GetDefaultOOEBuf(OOEBuf * pBuf, SUBSCRIPTIONTYPE subType);
  12. HICON LoadItemIcon(ISubscriptionItem *psi, BOOL bLarge);
  13. BOOL HandleScheduleNameConflict(TCHAR *pszSchedName, SYNCSCHEDULECOOKIE *pSchedCookie);
  14. HRESULT RemoveItemFromAllSchedules(SUBSCRIPTIONCOOKIE *pCookie);
  15. HRESULT AddRemoveScheduledItem(SYNC_HANDLER_ITEM_INFO *pSyncHandlerItemInfo, // For Add
  16. SUBSCRIPTIONCOOKIE *pCookie, // For Remove
  17. SYNCSCHEDULECOOKIE *pSchedCookie, BOOL bAdd);
  18. inline HRESULT AddScheduledItem(SYNC_HANDLER_ITEM_INFO *pSyncHandlerItemInfo,
  19. SYNCSCHEDULECOOKIE *pSchedCookie)
  20. {
  21. return AddRemoveScheduledItem(pSyncHandlerItemInfo, NULL, pSchedCookie, TRUE);
  22. }
  23. inline HRESULT RemoveScheduledItem(SUBSCRIPTIONCOOKIE *pCookie,
  24. SYNCSCHEDULECOOKIE *pSchedCookie)
  25. {
  26. return AddRemoveScheduledItem(NULL, pCookie, pSchedCookie, FALSE);
  27. }
  28. HRESULT CreateSchedule(LPWSTR pwszScheduleName, DWORD dwSyncScheduleFlags,
  29. SYNCSCHEDULECOOKIE *pSchedCookie, TASK_TRIGGER *pTrigger,
  30. BOOL fDupCookieOK);
  31. BOOL IsCookieOnSchedule(ISyncSchedule *pSyncSchedule, SUBSCRIPTIONCOOKIE *pCookie);
  32. typedef BOOL (CALLBACK * SCHEDULEENUMCALLBACK)(ISyncSchedule *pSyncSchedule,
  33. SYNCSCHEDULECOOKIE *pSchedCookie,
  34. LPARAM lParam);
  35. HRESULT EnumSchedules(SCHEDULEENUMCALLBACK pCallback, LPARAM lParam);
  36. BOOL ScheduleCookieExists(SYNCSCHEDULECOOKIE *pSchedCookie);
  37. void SetPropSheetFlags(POOEBuf pBuf, BOOL bSet, DWORD dwPropSheetFlags);
  38. int KeepSpinNumberInRange(HWND hdlg, int idEdit, int idSpin, int minVal, int maxVal);
  39. HRESULT GetItemSchedule(SUBSCRIPTIONCOOKIE *pSubsCookie, SYNCSCHEDULECOOKIE *pSchedCookie);
  40. enum { CONFLICT_NONE,
  41. CONFLICT_RESOLVED_USE_NEW,
  42. CONFLICT_RESOLVED_USE_OLD,
  43. CONFLICT_UNRESOLVED,
  44. CONFLICT_EMPTY};
  45. int HandleScheduleNameConflict(/* in */ TCHAR *pszSchedName,
  46. /* in */ TASK_TRIGGER *pTrigger,
  47. /* in */ HWND hwndParent,
  48. /* out */ SYNCSCHEDULECOOKIE *pSchedCookie);
  49. HRESULT UpdateScheduleTrigger(SYNCSCHEDULECOOKIE *pSchedCookie, TASK_TRIGGER *pTrigger);
  50. HRESULT ScheduleIt(ISubscriptionItem *psi, TCHAR *pszName, TASK_TRIGGER *pTrigger);
  51. void CreatePublisherScheduleNameW(WCHAR *pwszSchedName, int cchSchedName,
  52. const TCHAR *pszName, const WCHAR *pwszName);
  53. void CreatePublisherScheduleName(TCHAR *pszSchedName, int cchSchedName,
  54. const TCHAR *pszName, const WCHAR *pwszName);
  55. #ifdef NEWSCHED_AUTONAME
  56. void NewSched_AutoNameHelper(HWND hDlg);
  57. #endif
  58. BOOL NewSched_ResolveNameConflictHelper(HWND hDlg, TASK_TRIGGER *pTrig,
  59. SYNCSCHEDULECOOKIE *pSchedCookie);
  60. void NewSched_CreateScheduleHelper(HWND hDlg, TASK_TRIGGER *pTrig,
  61. SYNCSCHEDULECOOKIE *pSchedCookie);
  62. void NewSched_OnInitDialogHelper(HWND hDlg);
  63. class CWaitCursor
  64. {
  65. HCURSOR hPrevCursor;
  66. public:
  67. CWaitCursor()
  68. {
  69. hPrevCursor = SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
  70. };
  71. ~CWaitCursor()
  72. {
  73. if (hPrevCursor)
  74. SetCursor(hPrevCursor);
  75. }
  76. };
  77. #endif //__helper_h