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

00001 /*
00002  * Funambol is a mobile platform developed by Funambol, Inc. 
00003  * Copyright (C) 2003 - 2007 Funambol, Inc.
00004  * 
00005  * This program is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Affero General Public License version 3 as published by
00007  * the Free Software Foundation with the addition of the following permission 
00008  * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
00009  * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
00010  * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  * 
00017  * You should have received a copy of the GNU Affero General Public License 
00018  * along with this program; if not, see http://www.gnu.org/licenses or write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  * MA 02110-1301 USA.
00021  * 
00022  * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
00023  * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
00024  * 
00025  * The interactive user interfaces in modified source and object code versions
00026  * of this program must display Appropriate Legal Notices, as required under
00027  * Section 5 of the GNU Affero General Public License version 3.
00028  * 
00029  * In accordance with Section 7(b) of the GNU Affero General Public License
00030  * version 3, these Appropriate Legal Notices must retain the display of the
00031  * "Powered by Funambol" logo. If the display of the logo is not reasonably 
00032  * feasible for technical reasons, the Appropriate Legal Notices must display
00033  * the words "Powered by Funambol".
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 
00049 #include <string>
00050 
00051 
00054 #define PROPERTY_USE_SUBFOLDERS                 "useSubfolders"
00055 #define PROPERTY_FOLDER_PATH                    "folderPath"
00056 #define PROPERTY_SCHEDULED_SYNC                 "isScheduled"
00057 
00059 #define PROPERTY_SP                             "portal"
00060 #define PROPERTY_INSTALLDIR                     "installDir"
00061 
00063 #define APPLICATION_URI                         "Funambol/OutlookClient"
00064 
00066 #define PORTAL_DEFAULT_SYNCURL                  "http://my.funambol.com/sync"
00067 #define PORTAL_DEFAULT_USERNAME                 ""
00068 #define PORTAL_DEFAULT_PASSWORD                 ""
00069 
00070 #define TIMEZONE_CONTEXT                       L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
00071 
00072 
00076 typedef struct TimeZone {
00077     int           index;                 // Unique index of timezone
00078     std::wstring  keyName;               // Unique name of timezone (english)
00079     std::wstring  displayName;           // The display name
00080     bool          isDaylight;            // 'true' if currently under Daylight Saving Time (DST).
00081     LONG          bias;                  // The current bias for local time translation on this computer, in minutes.
00082     std::wstring  standardName;          // A description for standard time.
00083     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.
00084     LONG          standardBias;          // The bias value to be used during local time translations that occur during standard time
00085     std::wstring  daylightName;          // A description for daylight saving time.
00086     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.
00087     LONG          daylightBias;          // The bias value to be used during local time translations that occur during daylight saving time.
00088 } TimeZoneInformation;
00089 
00090 
00091 
00092 
00100 class OutlookConfig : public DMTClientConfig {
00101 
00102 private:
00103 
00105     static OutlookConfig* pinstance;
00106 
00107     char* workingDir;                           // The path of current working directory
00108     char* logDir;                               // The path of current log directory (under app data)
00109     bool  fullSync;                             // true if we are running a full sync (slow/refresh)
00110     bool  abortSync;                            // set to true when we want to (soft) abort the current sync
00111     bool  upgraded;                             // Flag to specify that we have upgraded the config.
00112     int   oldSwv;                               // Value of old software version installed (used during upgrades).
00113 
00115     TimeZoneInformation currentTimezone;
00116 
00118     WindowsSyncSourceConfig* winSourceConfigs;
00119 
00122     unsigned int winSourceConfigsCount;
00123 
00124 
00125 
00126     void readWinSourceConfig(unsigned int i);
00127     void saveWinSourceConfig(unsigned int i);
00128 
00129 
00130     // Returns the value of the given property, from rootKey tree (read only).
00131     char* readPropertyValue(const char* context, const char* propertyName, HKEY rootKey);
00132 
00133     // Username/Password are stored encrypted (new since 6.0.9).
00134     int  decryptPrivateData();
00135     void encryptPrivateData();
00136 
00137     int readCurrentTimezone();
00138 
00139 
00140 protected:
00141 
00143     OutlookConfig();
00144 
00145 
00146 public:
00147     
00149     static OutlookConfig* getInstance();
00150 
00152     static bool isInstantiated();
00153 
00155     ~OutlookConfig();
00156 
00157 
00158     // Override read/save methods of DMT (use specific winSourceConfig)
00159     BOOL read();
00160     BOOL save();
00161     BOOL save(SyncReport* report);
00162 
00163 
00165     void readSourcesTimestamps();
00166 
00167 
00169     _declspec(dllexport) WindowsSyncSourceConfig* getSyncSourceConfig(const char* name);
00170     WindowsSyncSourceConfig* getSyncSourceConfig(unsigned int i);
00171 
00172     // Replace setSyncSourceConfig() of SyncManagerConfig (set specific winSourceConfig)
00173     BOOL setSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00174     BOOL addSyncSourceConfig(WindowsSyncSourceConfig& wsc);
00175 
00176 
00177     // get/set of internal members
00178     void setWorkingDir   (const char* v);
00179     void setLogDir       (const char* v);
00180     void setFullSync     (const  bool v);
00181     void setScheduledSync(const  bool v);
00182     void setAbortSync    (const  bool v);
00183 
00184     const bool  getScheduledSync() const;
00185     const bool  getAbortSync()     const;
00186     _declspec(dllexport) const char* getWorkingDir()    const;
00187     _declspec(dllexport) const char* getLogDir()        const;
00188     _declspec(dllexport) const bool  getFullSync()      const;
00189 
00190     const TimeZoneInformation* getCurrentTimezone() const;
00191 
00192 
00194     void createDefaultConfig();
00195 
00197     bool checkToUpgrade();
00198 
00200     void upgradeConfig();
00201 
00203     bool isUpgraded();
00204 
00206     int getOldSwv();
00207 
00209     char* readCurrentSwv();
00210 
00212     int setUniqueDevID();
00213 
00215     bool checkPortalBuild();
00216 
00218     void saveBeginSync();
00219     
00221     void saveSyncModes();
00223     _declspec(dllexport) void readSyncModes();
00224 };
00225 
00228 #endif

Generated on Mon Feb 4 09:50:49 2008 for Funambol Outlook Plug-in Library by  doxygen 1.5.2