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
00041 #ifndef INCL_OUTLOOKCONFIG
00042 #define INCL_OUTLOOKCONFIG
00043
00044 #include "base/Log.h"
00045 #include "spds/SyncReport.h"
00046 #include "Client/DMTClientConfig.h"
00047 #include "WindowsSyncSourceConfig.h"
00048 #include "updater/UpdaterConfig.h"
00049 #include "WindowsDeviceConfig.h"
00050
00051 #include <string>
00052
00053
00056 #define PROPERTY_USE_SUBFOLDERS "useSubfolders"
00057 #define PROPERTY_FOLDER_PATH "folderPath"
00058 #define PROPERTY_SCHEDULED_SYNC "isScheduled"
00059 #define PROPERTY_SOURCE_ORDER "sourceOrder"
00060
00062 #define PROPERTY_FILTER_DATE_LOWER "filterDateLower"
00063 #define PROPERTY_FILTER_DATE_UPPER "filterDateUpper"
00064 #define PROPERTY_FILTER_DATE_DIRECTION "filterDateDirection"
00065
00067 #define PROPERTY_SP "portal"
00068 #define PROPERTY_INSTALLDIR "installDir"
00069 #define PROPERTY_FUNAMBOL_SWV "funambol_swv"
00070 #define PROPERTY_CUSTOMER "Customer"
00071
00073 #define APPLICATION_URI PROGRAM_NAME "/OutlookClient"
00074
00075 #define TIMEZONE_CONTEXT L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
00076
00080 typedef struct TimeZone {
00081 int index;
00082 std::wstring keyName;
00083 std::wstring displayName;
00084 bool isDaylight;
00085 LONG bias;
00086 std::wstring standardName;
00087 SYSTEMTIME standardDate;
00088 LONG standardBias;
00089 std::wstring daylightName;
00090 SYSTEMTIME daylightDate;
00091 LONG daylightBias;
00092 } TimeZoneInformation;
00093
00094
00095
00096
00104 class OutlookConfig : public DMTClientConfig {
00105
00106 private:
00107
00109 static OutlookConfig* pinstance;
00110
00111 char* workingDir;
00112 char* logDir;
00113 bool fullSync;
00114 bool abortSync;
00115 bool upgraded;
00116 int oldSwv;
00117 StringBuffer funambolSwv;
00118 int oldFunambolSwv;
00119
00120 bool attach;
00121
00123 TimeZoneInformation currentTimezone;
00124
00126 WindowsSyncSourceConfig* winSourceConfigs;
00127
00128
00129 WindowsDeviceConfig* winDC;
00130
00133 unsigned int winSourceConfigsCount;
00134
00140 ArrayList sourcesVisible;
00141
00142
00143 void readWinSourceConfig(unsigned int i);
00144 void saveWinSourceConfig(unsigned int i);
00145
00146
00147
00148 char* readPropertyValue(const char* context, const char* propertyName, HKEY rootKey);
00149
00150
00151 int decryptPrivateData();
00152 void encryptPrivateData();
00153
00154 int readCurrentTimezone();
00155
00162 void readSourcesVisible(HKEY rootKey = HKEY_CURRENT_USER);
00163
00168 void saveSourcesVisible();
00169
00176 void savePropertyValue(const StringBuffer& context, const StringBuffer& name, const StringBuffer& value);
00177
00181 UpdaterConfig updaterConfig;
00182
00183 protected:
00184
00186 OutlookConfig();
00187
00188 public:
00189
00191 _declspec(dllexport)
00192 static OutlookConfig* getInstance();
00193
00195 static bool isInstantiated();
00196
00198 virtual ~OutlookConfig();
00199
00200
00201
00202 bool read();
00203 bool save();
00204 bool save(SyncReport* report);
00205
00206
00208 void readSourcesTimestamps();
00209
00210
00212 const ArrayList& getSourcesVisible();
00213
00214
00216 _declspec(dllexport) WindowsSyncSourceConfig* getSyncSourceConfig(const char* name);
00217 WindowsSyncSourceConfig* getSyncSourceConfig(unsigned int i);
00218
00228 bool addWindowsSyncSourceConfig(const std::wstring& sourceName);
00229
00235 bool safeAddSourceVisible(const char* sourceName);
00236
00241 bool removeSourceVisible(const char* sourceName);
00242
00243
00244
00245 bool setSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00246 bool addSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00247
00248
00249
00250 void setWorkingDir (const char* v);
00251 void setLogDir (const char* v);
00252 void setFullSync (const bool v);
00253 void setScheduledSync(const bool v);
00254 void setAbortSync (const bool v);
00255 void setFunambolSwv (const StringBuffer& v);
00256
00257
00258 const bool getScheduledSync() const;
00259 const bool getAbortSync() const;
00260 _declspec(dllexport) const char* getWorkingDir() const;
00261 _declspec(dllexport) const char* getLogDir() const;
00262 _declspec(dllexport) const bool getFullSync() const;
00263 const StringBuffer& getFunambolSwv();
00264
00265 _declspec(dllexport)
00266 const TimeZoneInformation* getCurrentTimezone() const;
00267
00268
00270 void createDefaultConfig();
00271
00273 _declspec(dllexport)
00274 bool checkToUpgrade();
00275
00277 void upgradeConfig();
00278
00280 bool isUpgraded();
00281
00283 _declspec(dllexport)
00284 int getOldSwv();
00285 int getOldFunambolSwv();
00286
00288 char* readCurrentSwv();
00289
00294 StringBuffer readFunambolSwv(HKEY rootKey);
00295
00297 int setUniqueDevID();
00298
00299
00300
00301
00302
00304 void saveBeginSync();
00305
00307 void OutlookConfig::saveFunambolSwv();
00308
00310 void saveSyncModes();
00311
00313 _declspec(dllexport) void readSyncModes();
00314
00315 BOOL readUpdaterConfig(bool refresh);
00316
00320 void storeUpdaterConfig();
00321
00322 UpdaterConfig& getUpdaterConfig();
00323
00325 void initializeVersionsAndUserAgent();
00326
00327
00328 void setDeviceConfig(const WindowsDeviceConfig & wdc);
00329 _declspec(dllexport) WindowsDeviceConfig & getWindowsDeviceConfig();
00330 WindowsDeviceConfig & getDeviceConfig();
00331
00332 void saveDeviceConfig(ManagementNode& n, bool server = false);
00333 bool readDeviceConfig(ManagementNode& n, bool server = false);
00334
00335 };
00336
00339 #endif