00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INCL_UTILS_DLL
00037 #define INCL_UTILS_DLL
00038
00043 #include "base/fscapi.h"
00044 #include "base/log.h"
00045 #include "spds/SyncReport.h"
00046 #include "WindowsSyncSource.h"
00047 #include "outlook/ClientRecurrence.h"
00048 #include "winmaincpp.h"
00049
00050 #include <string>
00051
00053 #define SYNCSOURCE_CALENDAR 1
00054 #define SYNCSOURCE_CONTACTS 2
00055 #define SYNCSOURCE_NOTES 3
00056 #define SYNCSOURCE_TASKS 4
00057 #define SYNCSOURCE_PICTURES 5
00058
00059
00060
00063
00064 #define TYPE_SKIPPED_ACTION 0 // the user has choosen to skip the optional update
00065 #define TYPE_NOW_LATER_SKIP_OPTIONAL 1
00066 #define TYPE_NOW_LATER_RECCOMENDED 2
00067 #define TYPE_NOW_LATER_MANDATORY 3
00068 #define TYPE_NOW_EXIT_MANDATORY 4
00069
00070
00071
00072
00073
00074
00075 int TimedMessageBox(HWND hwndOwner, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT flags, DWORD dwTimeout);
00076
00077 int safeMessageBox (const char* message, const char* title = NULL, unsigned int flags = 0);
00078 int wsafeMessageBox(const WCHAR* wmessage, const WCHAR* wtitle = NULL, unsigned int flags = 0);
00079
00080 _declspec(dllexport) void printLog(const char* msg, const char* level = LOG_INFO);
00081 _declspec(dllexport) void printLog(const WCHAR* msg, const char* level = LOG_INFO);
00082
00083 bool isSIF (const std::wstring& dataType);
00084 bool isSIF (const std::string& dataType);
00085 bool isAcceptedDataType(const std::wstring& dataType);
00086 bool isAcceptedDataType(const std::string& dataType);
00087 char* syncModeName (SyncMode code);
00088 bool isFullSyncMode (SyncMode mode);
00089
00090 void toWindows (char* str);
00091 WCHAR* readAppDataPath ();
00092 WCHAR* readDataPath (const WCHAR* itemType);
00093 int makeDataDirs ();
00094 int getWindowsUser (std::wstring& userName);
00095 int getWindowsUserEx(std::wstring& userName);
00096
00101 StringBuffer getDefaultPicturesPath();
00102
00103 std::wstring readFromFile (const std::wstring& filePath);
00104 int writeToFile (const std::wstring& content, const std::wstring& filePath, const WCHAR* mode = L"w");
00105 int writeToFile (const std::string& content, const std::string& filePath, const char* mode = "w");
00106 std::string getSyncMutexName ();
00107 char* readSystemErrorMsg (DWORD errorCode = 0);
00108 std::wstring getSafeItemName (ClientItem* cItem);
00109 void printReport (SyncReport* sr, SyncSource** sources);
00110 char* friendlyName (const char* sourceName);
00111
00112 int getBuildNumberFromVersion(const char* swv);
00113 long variantTimeToTimeStamp (const double vTime);
00114
00115 int syncSourceNameToIndex(const StringBuffer& sourceName);
00116 StringBuffer syncSourceIndexToName(const int sourceID);
00117
00118 StringBuffer getDefaultSyncMode(const char* sourceName);
00119
00124 bool isSourceVisibleA(const char* sourceName);
00125
00130 bool isSourceVisible(const WCHAR* sourceName);
00131
00136 int countSourceVisible();
00137
00142 bool isSourceEnabled(const char* sourceName);
00143
00144
00151 inline static bool isErrorStatus(int status) {
00152 return (status) && ((status < 200) || (status > 299));
00153 }
00154
00157 #endif