clientsettings.h
来自「funambol window mobile客户端源代码」· C头文件 代码 · 共 323 行
H
323 行
/*
* Funambol is a mobile platform developed by Funambol, Inc.
* Copyright (C) 2003 - 2007 Funambol, Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addition of the following permission
* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*
* You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
* 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Powered by Funambol" logo. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Powered by Funambol".
*/
/*
* TO SHARE WITH THE SAME CONTACTSETTING AS IN FUNAMBOL CLIENT PROJECT
*/
#ifndef INCL_CLIENT_SETTINGS2
#define INCL_CLIENT_SETTINGS2
#include "base/util/utils.h"
#include "client/DMTClientConfig.h"
#include "client/MailSourceManagementNode.h"
#include "spdm/ManagementNode.h"
#include "spdm/DMTreeFactory.h"
#include "spdm/DMTree.h"
#include "pim/WindowsSyncSourceConfig.h"
#include "UpdateParams.h"
#include "BrandingParams.h"
#define CS_DIRTY_DEVICE_CONFIG 0x00001
#define CS_DIRTY_SOURCE_ALL 0x00002
#define CS_DIRTY_SOURCE_MAIL 0x00004
#define CS_DIRTY_SOURCE_CONTACTS 0x00008
#define CS_DIRTY_SOURCE_CALENDAR 0x00010
#define CS_DIRTY_SOURCE_TASKS 0x00020
#define CS_DIRTY_SOURCE_NOTES 0x00040
#define CS_DIRTY_SOURCE_BRIEFCASE 0x00080
#define CS_DIRTY_ACCESS_CONFIG 0x00100
#define CS_DIRTY_ROOT_CONFIG 0x00200
#define CS_DIRTY_SOURCE_ENABLED 0x00400
#define CS_DIRTY_SOURCE_CONFIG 0x00800
// important: the follow define must be in this way
// PASS_KEY<4 blanks>NULL
#define PASS_KEY NULL
#include <string>
using namespace std;
__declspec(dllexport) class ClientSettings : public DMTClientConfig {
public:
__declspec(dllexport) static ClientSettings* getInstance();
private:
static ClientSettings* pinstance;
ClientSettings(const ClientSettings&) {}
// assignment operator
ClientSettings& operator=(const ClientSettings&) {
return *this;
}
int dirty;
/**
* Flag used to know which params have been modified locally, on the device.
* It's modified ONLY setting params that are synced with the configSyncSource.
* Each bit is cleared once the status 200 is received for each property.
*/
int configSyncDirty;
/**
* The parameters related to the update procedure
*/
UpdateParams updateParams;
/**
* It contains the data used for the branding of the client. They are retrieved
* from the registry
*/
BrandingParams brandingParams;
// read only. It is for communcation settings
string ipaddress;
// client parameters. they are in the root
string push;
string pushPort;
string sms;
string polling;
string svrNotified;
string path;
string isPortal;
string cradleNotif;
string enableCompression;
string emailFilter;
string toSyncConfiguration;
string askUser;
string clientPushInterval;
string lastEmailAddress;
string lastEmailVisibleName;
// for the sources
string useSif; //contact, calendar, task
string dir; //briefcase, notes
string schedule;
ClientSettings(const char* application_uri);
char* decodePassword(const char* password);
StringBuffer encodePassword(const char* password);
public:
~ClientSettings();
void refreshIP();
void dispose(){
if(pinstance) {
delete pinstance;
}
pinstance = NULL;
}
// generic syncSourceConfig. It has the common fields
//SyncSourceConfig ssconfig;
// Config for the email
MailSyncSourceConfig* mailssconfig;
// Array of specific SSConfig.
WindowsSyncSourceConfig* winSourceConfigs;
// Counter for winSourceConfigs array.
// (internal use, should be equal to 'sourceConfigsCount' member)
unsigned int winSourceConfigsCount;
/**
* read all the AccessConfig configuration of the client.
* there is the Acc, Ext, Conn nodes.
* The parameter needs to close remove the internal variables.
* Use toClose = false when you want to keep the internal variable (as syncMLNode) used
* to save the configuration
*/
bool readConfig();
bool saveConfig();
// Extra data that can be used by the client
// for communication form
void setIp(string extip);
__declspec(dllexport) string getIp();
// only for client
void setPush(string extpush);
string getPush();
__declspec(dllexport) void setEmailFilter(string filter);
__declspec(dllexport) string getEmailFilter();
void setPushPost(string extpushPort);
string getPushPort();
void setSms(string extsms);
string getSms();
void setPolling(string extpolling);
string getPolling();
void setSvrNotified(string extsvrNotified);
string getSvrNotified();
void setPath(string extpath);
string getPath();
void setCradleNotification(string cradleNotif);
string getCradleNotification();
void setIsPortal(string extportal);
bool getIsPortal();
void setAskUser(string extAskUser);
string getAskUser();
void setClientPushInterval(string extclientPushInterval);
string getClientPushInterval();
void setToSyncConfiguration(string extToSyncConfiguration);
string getToSyncConfiguration();
void setLastEmailAdress(const string& address) { lastEmailAddress = address; }
string& getLastEmailAdress() { return lastEmailAddress; }
void setLastEmailVisibleName(const string& name) { lastEmailVisibleName = name; }
string& getLastEmailVisibleName() { return lastEmailVisibleName; }
/*
* read sync Sources config.
* sourceType: the name of the source (contact, calendar, task...)
* toClose: if the internal ManagementNode must be freed. They don't when read
* is used before saving the paramenters
* If sourceType is "all" all the sources with they basic paramenters are read.
* the basic parameters are the common int the SyncSource class (like "sync", "type"...)
* the "last" is not replaced.
*/
//bool readConfigSources(const char* sourceType, BOOL toClose = true);
/*
* saveAll: to save all the sources config. It is used by the form
* in which there are all the sources whith the list of the sync property.
* If not specified saveAll parameter, it saves only the source that was loaded
* and stored into ssconfig or mailssconfig
*/
//bool saveConfigSources(const char* saveAll);
const char* getConfigSourcesParameter(const char* sourceName, const char* parameter);
bool setConfigSourcesParameter(const char* sourceName, const char* parameter, const char* value);
/**
* set/get sync folder, to be removed and start using setSyncDir and getSyncDir from WindowsSyncSourceConfig
*/
void setDir(string extdir);
string getDir();
int saveSyncSourceConfig(const char* name);
int getConfigSourcesLastTimestamp(const char* sourceName);
//void readSourcesTimestamps();
//void readSyncModes();
void saveWinSourceConfig(unsigned int i);
bool setSyncSourceConfig(WindowsSyncSourceConfig& wsc);
bool save();
bool read();
WindowsSyncSourceConfig* getWinSyncSourceConfig(const char* name);
bool addSyncSourceConfig(WindowsSyncSourceConfig& wsc);
void saveSyncModes();
char* readPropertyValue(const char* context, const char* propertyName, HKEY rootKey);
void readWinSourceConfig(unsigned int i);
string getAppPath();
bool saveDirty();
void setDirty(int flag);
/// Updates the configSyncDirty flag.
__declspec(dllexport) void setConfigSyncDirty(int flag);
/// Clears only the specified bit in the configSyncDirty flag.
__declspec(dllexport) void clearConfigSyncDirty(int flag);
int getConfigSyncDirty() { return configSyncDirty; }
void resetConfigSyncDirty() { configSyncDirty = 0; }
/**
* Get the information about the parameters of the previous time.
* The refresh parameter indicates to read from the memory.
*/
BOOL readUpdateParams(bool refresh = true);
/**
* Set the parameters in the registry
*/
BOOL storeUpdateParams();
UpdateParams& getUpdateParams();
int saveWinSourceLastTimeStamp(unsigned int i);
int saveWinSourceLastTimeStamp(const char* name);
void saveTimeStamp(ManagementNode* node, unsigned long stamp);
/**
* Read the info from the registry. It is read only.
*/
BOOL readBrandingParams();
/**
* get the BrandingParams object to get the proper information
* It need to be flexible
*/
BrandingParams& getBrandingParams() {
return brandingParams;
}
};
// get the ClientSettings object
__declspec(dllexport) ClientSettings* getRegConfig();
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?