D:/develop/v65/clients/outlook/install/output/export/funambol/clients/outlook/mainclientDll/src/include/utils.h

00001  /*
00002  * Copyright (C) 2006-2007 Funambol, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 02111-1307  USA
00017 */
00018 
00019 #ifndef INCL_UTILS_DLL
00020 #define INCL_UTILS_DLL
00021 
00026 #include "base/fscapi.h"
00027 #include "base/log.h"
00028 #include "spds/SyncReport.h"
00029 #include "WindowsSyncSource.h"
00030 #include "outlook/ClientRecurrence.h"
00031 
00032 #include <string>
00033 
00035 #define SYNCSOURCE_CALENDAR     1
00036 #define SYNCSOURCE_CONTACTS     2
00037 #define SYNCSOURCE_NOTES        3
00038 #define SYNCSOURCE_TASKS        4
00039 
00040 
00041 /*-----------utils functions -----------------*/
00042 
00043 // Open a message box with a timeout
00044 int TimedMessageBox(HWND hwndOwner, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT flags, DWORD dwTimeout);
00045 // Display a message box only if not scheduled sync.
00046 int safeMessageBox (const char*   message, const char*   title = NULL, unsigned int flags = 0);
00047 int wsafeMessageBox(const WCHAR* wmessage, const WCHAR* wtitle = NULL, unsigned int flags = 0);
00048 
00049 _declspec(dllexport) void printLog(const char* msg,  const char* level = LOG_INFO);
00050 _declspec(dllexport) void printLog(const WCHAR* msg, const char* level = LOG_INFO);
00051 
00052 bool  isSIF            (const std::wstring& dataType);
00053 bool  isSIF            (const std::string&  dataType);
00054 bool isAcceptedDataType(const std::wstring& dataType);
00055 bool isAcceptedDataType(const std::string&  dataType);
00056 char* syncModeName     (SyncMode code);
00057 bool isFullSyncMode    (SyncMode mode);
00058 
00059 void  toWindows        (char* str);
00060 WCHAR* readAppDataPath ();
00061 WCHAR* readDataPath    (const WCHAR* itemType);
00062 int    makeDataDirs    ();
00063 int    getWindowsUser  (std::wstring& userName);
00064 int    getWindowsUserEx(std::wstring& userName);
00065 
00066 std::wstring readFromFile          (const std::wstring& filePath);
00067 int          writeToFile           (const std::wstring& content, const std::wstring& filePath, const WCHAR* mode = L"w");
00068 int          writeToFile           (const std::string&  content, const std::string&  filePath, const char*  mode = "w");
00069 std::string  getSyncMutexName      ();
00070 char*        readSystemErrorMsg    (DWORD errorCode = 0);
00071 std::wstring getSafeItemName       (ClientItem* cItem);
00072 void         printReport           (SyncReport* sr, WindowsSyncSource** sources);
00073 char*        friendlyName          (const char* sourceName);
00074 
00075 int          getBuildNumberFromVersion(const char* swv);
00076 long         variantTimeToTimeStamp   (const double vTime);
00077 
00078 int syncSourceNameToIndex(const char*);
00079 
00080 
00081 
00088 inline static bool isErrorStatus(int status) {
00089     return (status) && ((status < 200) || (status > 299));
00090 }
00091 
00094 #endif

Generated on Fri Nov 9 12:21:26 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2