⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientsettings.h

📁 funambol windows mobile plugin source code, the source code is taken from the funambol site
💻 H
字号:
/*
 * 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 General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */
/*
 * 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"

#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

#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;
        }

        BOOL dirty;

        // 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 askUser;

        // for the sources
        string useSif; //contact, calendar, task
        string dir; //briefcase, notes
        string schedule;
        ClientSettings(const char* application_uri);
    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();

        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();

        /*
         * 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();

        BOOL 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);
};

// get the ClientSettings object
__declspec(dllexport) ClientSettings* getRegConfig();

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -