D:/develop/v65/clients/outlook/install/output/export/funambol/clients/outlook/mainclientDll/src/include/OutlookConfig.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 
00024 #ifndef INCL_OUTLOOKCONFIG
00025 #define INCL_OUTLOOKCONFIG
00026 
00027 #include "base/Log.h"
00028 #include "spds/SyncReport.h"
00029 #include "Client/DMTClientConfig.h"
00030 #include "WindowsSyncSourceConfig.h"
00031 
00032 #include <string>
00033 
00034 
00037 #define PROPERTY_USE_SUBFOLDERS                 "useSubfolders"
00038 #define PROPERTY_FOLDER_PATH                    "folderPath"
00039 #define PROPERTY_SCHEDULED_SYNC                 "isScheduled"
00040 
00042 #define PROPERTY_SP                             "portal"
00043 #define PROPERTY_INSTALLDIR                     "installDir"
00044 
00046 #define APPLICATION_URI                         "Funambol/OutlookClient"
00047 
00049 #define PORTAL_DEFAULT_SYNCURL                  "http://my.funambol.com/sync"
00050 #define PORTAL_DEFAULT_USERNAME                 ""
00051 #define PORTAL_DEFAULT_PASSWORD                 ""
00052 
00053 #define TIMEZONE_CONTEXT                       L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
00054 
00055 
00059 typedef struct TimeZone {
00060     int           index;                 // Unique index of timezone
00061     std::wstring  keyName;               // Unique name of timezone (english)
00062     std::wstring  displayName;           // The display name
00063     bool          isDaylight;            // 'true' if currently under Daylight Saving Time (DST).
00064     LONG          bias;                  // The current bias for local time translation on this computer, in minutes.
00065     std::wstring  standardName;          // A description for standard time.
00066     SYSTEMTIME    standardDate;          // A SYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs on this operating system.
00067     LONG          standardBias;          // The bias value to be used during local time translations that occur during standard time
00068     std::wstring  daylightName;          // A description for daylight saving time.
00069     SYSTEMTIME    daylightDate;          // A SYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs on this operating system.
00070     LONG          daylightBias;          // The bias value to be used during local time translations that occur during daylight saving time.
00071 } TimeZoneInformation;
00072 
00073 
00074 
00075 
00083 class OutlookConfig : public DMTClientConfig {
00084 
00085 private:
00086 
00088     static OutlookConfig* pinstance;
00089 
00090     char* workingDir;                           // The path of current working directory
00091     char* logDir;                               // The path of current log directory (under app data)
00092     bool  fullSync;                             // true if we are running a full sync (slow/refresh)
00093     bool  abortSync;                            // set to true when we want to (soft) abort the current sync
00094     bool  upgraded;                             // Flag to specify that we have upgraded the config.
00095     int   oldSwv;                               // Value of old software version installed (used during upgrades).
00096 
00098     TimeZoneInformation currentTimezone;
00099 
00101     WindowsSyncSourceConfig* winSourceConfigs;
00102 
00105     unsigned int winSourceConfigsCount;
00106 
00107 
00108 
00109     void readWinSourceConfig(unsigned int i);
00110     void saveWinSourceConfig(unsigned int i);
00111 
00112 
00113     // Returns the value of the given property, from rootKey tree (read only).
00114     char* readPropertyValue(const char* context, const char* propertyName, HKEY rootKey);
00115 
00116     // Username/Password are stored encrypted (new since 6.0.9).
00117     int  decryptPrivateData();
00118     void encryptPrivateData();
00119 
00120     int readCurrentTimezone();
00121 
00122 
00123 protected:
00124 
00126     OutlookConfig();
00127 
00128 
00129 public:
00130     
00132     static OutlookConfig* getInstance();
00133 
00135     static bool isInstantiated();
00136 
00138     ~OutlookConfig();
00139 
00140 
00141     // Override read/save methods of DMT (use specific winSourceConfig)
00142     BOOL read();
00143     BOOL save();
00144     BOOL save(SyncReport* report);
00145 
00146 
00148     void readSourcesTimestamps();
00149 
00150 
00152     _declspec(dllexport) WindowsSyncSourceConfig* getSyncSourceConfig(const char* name);
00153     WindowsSyncSourceConfig* getSyncSourceConfig(unsigned int i);
00154 
00155     // Replace setSyncSourceConfig() of SyncManagerConfig (set specific winSourceConfig)
00156     BOOL setSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00157     BOOL addSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00158 
00159 
00160     // get/set of internal members
00161     void setWorkingDir   (const char* v);
00162     void setLogDir       (const char* v);
00163     void setFullSync     (const  bool v);
00164     void setScheduledSync(const  bool v);
00165     void setAbortSync    (const  bool v);
00166 
00167     const bool  getScheduledSync() const;
00168     const bool  getAbortSync()     const;
00169     _declspec(dllexport) const char* getWorkingDir()    const;
00170     _declspec(dllexport) const char* getLogDir()        const;
00171     _declspec(dllexport) const bool  getFullSync()      const;
00172 
00173     const TimeZoneInformation* getCurrentTimezone() const;
00174 
00175 
00177     void createDefaultConfig();
00178 
00180     bool checkToUpgrade();
00181 
00183     void upgradeConfig();
00184 
00186     bool isUpgraded();
00187 
00189     int getOldSwv();
00190 
00192     char* readCurrentSwv();
00193 
00195     int setUniqueDevID();
00196 
00198     bool checkPortalBuild();
00199 
00201     void saveBeginSync();
00202     
00204     void saveSyncModes();
00206     _declspec(dllexport) void readSyncModes();
00207 };
00208 
00211 #endif

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