亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fileobjectsyncsource.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
字號:
/*
 * 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
 */
#include "pim/FileObjectSyncSource.h"
#include "spds/SyncItemStatus.h"
#include "base/util/utils.h"
#include "base/Log.h"
#include "pim/FILEClient2Server.h"
#include "pim/FILEServer2Client.h"
#include "pim/FILEFileManagement.h"
#include "base/startcmd.h"
#include "Winbase.h"
#include "pim/SettingFunctions.h"
#include "spds/FileData.h"
#include "notify/timed_msgbox.h"

#include "HwndFunctions.h"
#include "OutOfMemoryException.h"

static int call;
static int cnew;
static int ckey;
static int cupdated;
static int cdeleted;

#define ASK_REFRESH_FILE_MESSAGE TEXT("All the local %s will be deleted before adding the server items. Are you sure you want to continue?")
#define ASK_REFRESH_FILE_TIMEOUT 10
#define BACKUP_FILE TEXT("FunambolBackup")

FileObjectSyncSource::FileObjectSyncSource(const wchar_t* name, SyncSourceConfig* sc) : SyncSource(name, sc) {
    c = NULL;
    path = NULL;
    dir = NULL;
    setPath(TEXT("\\"));
    setDir(TEXT("\\"));
    friendlyName[0] = 0;  // char 64
    newFromServer = 0;
    updatedFromServer = 0;
    deletedFromServer = 0;
}

FileObjectSyncSource::~FileObjectSyncSource() {
    if (c)
        delete c;
    if (path)
        delete [] path;
    if(dir)
        delete [] dir;
}

void FileObjectSyncSource::setType(SourceType t) {
    type = t;
}

SourceType FileObjectSyncSource::getType() {
    return type;
}

void FileObjectSyncSource::setPath(const wchar_t* p) {
    if (path)
        delete [] path;

    path = (p) ? wstrdup(p) : wstrdup(TEXT("\\"));
}

const wchar_t* FileObjectSyncSource::getPath() {
    return path;
}

void FileObjectSyncSource::setDir(const wchar_t* p) {
    if (dir)
        delete [] dir;

    dir = (p) ? wstrdup(p) : wstrdup(TEXT("\\"));
}

const wchar_t* FileObjectSyncSource::getDir() {
    return dir;
}
/*
* Return the first SyncItem of all. It is used in case of slow or refresh sync
* and retrieve the entire data source content.
*/

SyncItem* FileObjectSyncSource::getFirstItem() {

    if (c == NULL) {
        c = new Container();
    }

    setAllItemsFILE(c, getType(), TEXT(""), getDir()); //

    LOG.info("The client number of %s to sync are %i", friendlyName, c->getAllItemsSize());

    // send nr of items to sync to UI
    HWND wnd = HwndFunctions::getWindowHandle();
    if(wnd)
        SendMessage(wnd, ID_MYMSG_TOTAL_ITEMS, (WPARAM) -1,(LPARAM)c->getAllItemsSize());

    if (c->getAllItemsSize() == 0) {
        return NULL;
    }
    call = 0;
    ArrayList* list = c->getAllItems();
    return (SyncItem*)list->get(call)->clone();

}

/*
* Return the next SyncItem of all. It is used in case of slow or refresh sync
* and retrieve the entire data source content.
*/

SyncItem* FileObjectSyncSource::getNextItem() {
    if (c == NULL)
        return NULL;

    if (c->getAllItemsSize() == 0)
        return NULL;

    call++;
    if (call == c->getAllItemsSize()) {
        return NULL;
    }
    return (SyncItem*)c->getAllItems()->get(call)->clone();
}

SyncItem* FileObjectSyncSource::getFirstItemKey() {
    if (c == NULL) {
        c = new Container();
    }
    ArrayList* list = NULL;

    setAllItemsFILEKey(c, getType(), TEXT(""), getDir()); //
    if (c->getAllItemsSize() == 0) {
        goto finally;
    }
    ckey = 0;
    list = c->getAllItems();

    if (list && list->size() > 0) {
        for (ckey = 0; ckey < list->size(); ckey++) {
            deleteItem(*(SyncItem*)list->get(ckey));
        }
    }
    deletedFromServer = 0;

finally:
    if (c) { delete c; c = NULL; }
    return NULL;
}

SyncItem* FileObjectSyncSource::getNextItemKey() {

    return NULL;

}

/*
* This method is always called by the sync manager. So the setModifiedItemsPOOM is always called
*/

SyncItem* FileObjectSyncSource::getFirstNewItem() {
    if (c == NULL) {
        c = new Container();
    }

    setModifiedItemsFILE(c, getType(), getPath(), getDir() );

     //Log the number of item to sync from client
    LOG.info("The client number of new %s to sync are %i", friendlyName, c->getNewItemsSize());
    LOG.info("The client number of updated %s to sync are %i", friendlyName, c->getUpdatedItemsSize());
    LOG.info("The client number of deleted %s to sync are %i", friendlyName, c->getDeletedItemsSize());

    // send nr of items message to UI
    HWND wnd = HwndFunctions::getWindowHandle();
    if(wnd)
        SendMessage(wnd, ID_MYMSG_TOTAL_ITEMS,(WPARAM) -1,c->getNewItemsSize()+c->getUpdatedItemsSize()+c->getDeletedItemsSize());

    if (c->getNewItemsSize() == 0) {
        return NULL;
    }
    cnew = 0;
    ArrayList* list = c->getNewItems();

    return (SyncItem*)list->get(cnew)->clone();

}

SyncItem* FileObjectSyncSource::getNextNewItem() {
   if (c == NULL)
        return NULL;

    cnew++;
    if (cnew == c->getNewItemsSize()) {
        return NULL;
    }
    return (SyncItem*)c->getNewItems()->get(cnew)->clone();
}

SyncItem* FileObjectSyncSource::getFirstUpdatedItem() {
    if (c == NULL) {
        c = new Container();
    }

    if (c->getUpdatedItemsSize() == 0) {
        return NULL;
    }
    cupdated = 0;
    ArrayList* list = c->getUpdatedItems();

    return (SyncItem*)list->get(cupdated)->clone();
}

SyncItem* FileObjectSyncSource::getNextUpdatedItem() {
    if (c == NULL)
        return NULL;

    cupdated++;
    if (cupdated == c->getUpdatedItemsSize()) {
        return NULL;
    }
    return (SyncItem*)c->getUpdatedItems()->get(cupdated)->clone();
}

SyncItem* FileObjectSyncSource::getFirstDeletedItem() {

    if (c == NULL) {
        c = new Container();
    }

    if (c->getDeletedItemsSize() == 0) {
        return NULL;
    }
    cdeleted = 0;
    ArrayList* list = c->getDeletedItems();

    return (SyncItem*)list->get(cdeleted)->clone();
}

SyncItem* FileObjectSyncSource::getNextDeletedItem() {
    if (c == NULL)
        return NULL;
    // TODO: cupdated == c->getDeletedItemsSize()
    // here it should compare with cdeleted
    cdeleted++;
    if (cdeleted == c->getDeletedItemsSize()) {
        return NULL;
    }
    return (SyncItem*)c->getDeletedItems()->get(cdeleted)->clone();
}

void FileObjectSyncSource::setItemStatus(const wchar_t* key, int status) {
    LOG.debug("key: %S, status: %i", key, status);
}

int FileObjectSyncSource::addItem(SyncItem& item) {

    int ret = STC_COMMAND_FAILED; // command Failed;

    if (!isMemoryAvailable()) {
        LOG.error(LOW_DEVICE_MEMORY);
        throw OutOfMemoryException(0, -50);    //defined in startsync /return ret;
    }

    FileData file;
    char* data      = NULL;
    wchar_t* oid    = NULL;
    int size = 0;
    int res = 0;
    size = item.getDataSize();
    res = file.parse(item.getData(), size);
    const wchar_t *encod = file.getEnc();
    // TODO bug #304192
    if (res == -1)// the file was not sent by client as FileObject version 1.2
    {
        oid = FILEmanageNewItems(&item, getType(), getPath(), getDir());
    }
    else
        if (wcslen(encod) > 0)
        {
            item.setKey(file.getName());
            item.setData(file.getBody(), file.getSize());
            oid = FILEmanageNewItems(&item, getType(), getPath(), getDir());
        }


    if (oid != NULL) {
        ret = STC_ITEM_ADDED;
        LOG.debug("Added item: %S LUID: %S", item.getKey(), oid);
        item.setKey(oid);

        delete [] oid; oid = NULL;

        newFromServer++;
    }

    return ret;
}

int FileObjectSyncSource::updateItem(SyncItem& item) {

    int ret = STC_COMMAND_FAILED; // command Failed;
    if (!isMemoryAvailable()) {
        LOG.error(LOW_DEVICE_MEMORY);
        throw OutOfMemoryException(0, -50);    //defined in startsync //return ret;
    }

    FileData file;
    char* data      = NULL;
    long h          = 0;
    wchar_t* encod  = NULL;
    int size = 0;
    int res = 0;
    size = item.getDataSize();
    res = file.parse(item.getData(), size);
    encod = (wchar_t*)file.getEnc();
    if (res == -1)// the file was not sent by client as FileObject version 1.2
    {
        h = FILEmanageUpdatedItems(&item, getType(), getPath(), getDir());
    }
    else
        if (wcslen(encod) > 0)
        {
            item.setData(file.getBody(), file.getSize());
            h = FILEmanageUpdatedItems(&item, getType(), getPath(), getDir());
        }
    if (h == 0) {
        ret = STC_OK;
        LOG.debug("updated item: %S", item.getKey());

        updatedFromServer++;
    }
    return ret;
}

int FileObjectSyncSource::deleteItem(SyncItem& item) {

    int ret = STC_COMMAND_FAILED; // command Failed;
    long h = FILEmanageDeletedItems(&item, getType(), getPath(), getDir());

    if (h == 0) {
        ret = STC_OK;
        LOG.debug("deleted item: %S", item.getKey());

        deletedFromServer++;

    }
    return ret;
}

int FileObjectSyncSource::beginSync() {
    /*
    OL_CONTACTS     = 10,
    OL_CALENDAR     = 9,
    OL_TASK         = 13,
    OL_BRIEFCASE    = 600,
    OL_NOTES        = 601,
    OL_FAVORITES    = 60
    */

    if (getType() == OL_NOTES){
        strcpy(friendlyName, "notes");
    }
    else if (getType() == OL_BRIEFCASE){
        strcpy(friendlyName, "briefcase");
    };


    // counter to get the number of items from server
    newFromServer = 0;
    updatedFromServer = 0;
    deletedFromServer = 0;



    return 0;

}

int FileObjectSyncSource::endSync() {

    writeCurrentFileItems(getType(), getPath(), getDir());

    //Log the number of item synced from server
    LOG.info("The server number of new %s synced are %i", friendlyName, newFromServer);
    LOG.info("The server number of updated %s synced are %i", friendlyName, updatedFromServer);
    LOG.info("The server number of deleted %s synced are %i", friendlyName, deletedFromServer);

    return 0;
}

void FileObjectSyncSource::assign(FileObjectSyncSource& s) {
    setSyncMode(s.getSyncMode());
    setLastSync(s.getLastSync());
    setNextSync(s.getNextSync());
    setLastAnchor(s.getLastAnchor());
    setNextAnchor(s.getNextAnchor());
    setFilter(s.getFilter());
    setPath(getPath());
    setType(getType());
    setDir(getDir());

    setReport(s.getReport());

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品麻豆日日躁夜夜躁| 久久久久久久久久电影| 日韩欧美一级二级三级| 国产亚洲精品免费| 国模娜娜一区二区三区| 视频一区欧美日韩| 色综合久久天天| 中文字幕一区二区三区av| 国产精品88888| 在线成人av影院| 日韩在线a电影| 91精品国产aⅴ一区二区| 日本视频一区二区三区| 日韩欧美www| 狠狠色丁香久久婷婷综合_中 | 午夜精品福利视频网站| 在线观看日产精品| 午夜免费欧美电影| 欧美丰满一区二区免费视频| 日本va欧美va精品| 色综合色综合色综合| 欧美日韩在线直播| 丝袜亚洲另类欧美综合| 777亚洲妇女| 天堂av在线一区| 日韩精品最新网址| 高清国产一区二区三区| 日韩一区有码在线| 色八戒一区二区三区| 亚洲第一电影网| 精品福利二区三区| 99re这里都是精品| 午夜私人影院久久久久| 久久老女人爱爱| 欧美在线观看视频一区二区| 美女网站色91| 综合激情网...| 7777精品伊人久久久大香线蕉完整版| 国产精品二三区| 555www色欧美视频| 国产精品夜夜爽| 尤物视频一区二区| 欧美一区三区四区| 成人黄色国产精品网站大全在线免费观看 | 欧美日韩一区小说| 性做久久久久久久免费看| 日韩欧美自拍偷拍| 国产剧情一区在线| 亚洲一区二区在线观看视频 | 欧美在线观看视频一区二区三区| 亚洲欧美成aⅴ人在线观看| 欧美三级电影在线看| 国产真实精品久久二三区| 亚洲欧美日韩国产中文在线| 欧美日韩在线亚洲一区蜜芽| 国内外成人在线| 日韩欧美亚洲国产精品字幕久久久| 日韩精品在线一区二区| 亚洲精品久久久久久国产精华液| 91精品婷婷国产综合久久| 成人黄色一级视频| 免费三级欧美电影| 亚洲黄色免费网站| 欧美激情一区二区三区蜜桃视频 | 韩国av一区二区| 亚洲一区在线观看视频| 欧美不卡一区二区三区四区| 欧美在线免费观看视频| 94-欧美-setu| 久久不见久久见免费视频7| 亚洲成av人片观看| 亚洲精品成人在线| 国产午夜一区二区三区| 日韩一区二区免费高清| 欧美色图激情小说| 91欧美一区二区| 国产成人午夜精品影院观看视频 | 欧美一区二区黄色| 在线视频一区二区三区| 99re这里只有精品首页| 色综合中文字幕国产 | 性做久久久久久免费观看欧美| 亚洲一线二线三线久久久| 夜色激情一区二区| 亚洲va韩国va欧美va| 污片在线观看一区二区| 日本不卡在线视频| 免费一级片91| 国产一区二区三区观看| 成人自拍视频在线| 91蜜桃免费观看视频| 欧美中文一区二区三区| 69堂国产成人免费视频| 精品久久久久久久久久久久包黑料 | 国产欧美精品在线观看| 欧美国产精品一区二区| 亚洲同性gay激情无套| 亚洲永久精品大片| 久久激情综合网| 成人综合婷婷国产精品久久蜜臀| 一本色道久久加勒比精品| 91麻豆精品国产91久久久久久久久 | 日韩欧美精品在线视频| 国产性做久久久久久| 亚洲精品成人少妇| 久久精品国产一区二区| 丁香婷婷深情五月亚洲| 91久久线看在观草草青青| 在线成人免费视频| 国产丝袜在线精品| 夜夜嗨av一区二区三区| 韩国理伦片一区二区三区在线播放| 成人免费高清在线| 91精品在线免费观看| 久久久亚洲午夜电影| 亚洲三级电影网站| 久久99精品久久久久久动态图| av在线播放一区二区三区| 91精品视频网| 亚洲欧美日韩成人高清在线一区| 青青草国产精品97视觉盛宴 | 国产精品亚洲综合一区在线观看| 色噜噜狠狠色综合欧洲selulu| 欧美mv日韩mv国产网站app| 亚洲免费看黄网站| 国产美女av一区二区三区| 精品视频一区二区三区免费| 久久久久国产免费免费| 五月激情六月综合| 91色综合久久久久婷婷| 国产亚洲婷婷免费| 蜜桃av噜噜一区| 在线观看免费亚洲| 国产精品看片你懂得| 毛片av一区二区| 欧美日韩久久久| 亚洲精品乱码久久久久久| 成人一区二区三区视频在线观看| 日韩片之四级片| 天使萌一区二区三区免费观看| 91首页免费视频| 国产午夜亚洲精品羞羞网站| 老色鬼精品视频在线观看播放| 欧美日韩一二三| 亚洲人成亚洲人成在线观看图片 | 国产精品一区二区果冻传媒| 欧美男男青年gay1069videost| 亚洲日本va午夜在线电影| 国产精品一区二区三区四区| 精品久久国产字幕高潮| 丝袜美腿成人在线| 欧美日韩久久久久久| 亚洲一区日韩精品中文字幕| 色婷婷综合中文久久一本| 综合激情成人伊人| 99久久99久久免费精品蜜臀| 国产精品久久久久久久久免费桃花 | 亚洲无人区一区| 日本道色综合久久| 亚洲精选视频免费看| 97se亚洲国产综合自在线| 中文字幕在线观看一区| 成人av免费在线| 中文字幕一区二区三区在线不卡| 国产99久久精品| 欧美国产国产综合| 成人av网站大全| 亚洲欧洲中文日韩久久av乱码| av不卡一区二区三区| 综合网在线视频| 91国偷自产一区二区开放时间 | 91.成人天堂一区| 秋霞国产午夜精品免费视频| 日韩欧美国产一区二区三区| 精品写真视频在线观看| www亚洲一区| 春色校园综合激情亚洲| √…a在线天堂一区| 91国偷自产一区二区三区成为亚洲经典| 夜夜嗨av一区二区三区网页| 欧美剧情片在线观看| 另类调教123区| 中文字幕第一区综合| 91蝌蚪porny九色| 亚洲电影中文字幕在线观看| 欧美高清视频在线高清观看mv色露露十八| 天涯成人国产亚洲精品一区av| 日韩三级视频在线看| 成人做爰69片免费看网站| 亚洲精品福利视频网站| 欧美丰满少妇xxxbbb| 久久成人羞羞网站| 国产精品久久久久影院色老大| 91国偷自产一区二区三区观看| 日本一区中文字幕| 国产日韩欧美a| 欧美日韩激情一区二区| 国产麻豆视频一区| 亚洲国产精品影院| 国产三级久久久|