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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? appointmentbuilder.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/*
 * 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/AppointmentBuilder.h"
#include "base/Log.h"
#include "pim/difftime.h"
#include "pim/UtilsRecurrence.h"

/*
* Method to populate the appointment XML structure.
* It get every property name and value and build the XML structure to exchange with server.
*
* @param appointmentStringItem : the string that will contain the xml structure
* @param pAppointment          : the appointment object that contain every value
*
*/
void populateAppointmentStringItem(std::wstring &appointmentStringItem, IAppointment *pAppointment, BOOL isCRC) {

    BSTR element        = NULL      ;
    long elementLong    = 0         ;
    DATE startdate      = NULL      ;
    DATE enddate        = NULL      ;
    DATE date           = NULL      ;
    wstring element_s;

    //
    // FOR RECURRENCE
    // to get if a modification in the UTC goes into day before or after
    // store the initial value of day and check the last value
    //
    int x = 0, y = 0, z = 0;
    BOOL changeDay = FALSE, isBackward = FALSE;
    BOOL changeYearBackward = FALSE, changeYearForward = FALSE;


    VARIANT_BOOL variantBool = NULL; // 0==false -1==true
    wchar_t tempDate [DIM_LOCAL_TEMP];
    wchar_t* charBlob = NULL;

    appointmentStringItem = TEXT("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    appointmentStringItem +=  TEXT("<appointment>");

        // BSTR
        pAppointment->get_Subject(&element);
        element_s = wstring(element);
        encodeSpecialChar(element_s);
        appointmentStringItem  += TEXT("<Subject>") + element_s + TEXT("</Subject>");
        SysFreeString(element);

        pAppointment->get_Location(&element);
        element_s = wstring(element); encodeSpecialChar(element_s);
        appointmentStringItem  += TEXT("<Location>") + element_s + TEXT("</Location>");
        SysFreeString(element);

        pAppointment->get_Categories(&element);
        element_s = wstring(element); encodeSpecialChar(element_s);
        appointmentStringItem  +=  TEXT("<Categories>") + element_s + TEXT("</Categories>");
        SysFreeString(element);

        pAppointment->get_ReminderSoundFile(&element);
        element_s = wstring(element); encodeSpecialChar(element_s);
        appointmentStringItem  +=  TEXT("<ReminderSoundFile>") + element_s + TEXT("</ReminderSoundFile>");
        SysFreeString(element);

        pAppointment->get_Body(&element);
        removeEndCarriage(&element);
        element_s = wstring(element);  encodeSpecialChar(element_s);
        appointmentStringItem  +=  TEXT("<Body>") + element_s + TEXT("</Body>");
        SysFreeString(element);

        // DATE
        pAppointment->get_Start(&startdate);
        pAppointment->get_End(&enddate);


        /*
        * see the start and end date. If the start is 00:00 and end is 23:59 the appointment is decided to be
        * an all day event. So the AllDayEvent tag is put to 'true' only in the SIF structure. The format of the date
        * is like the birthday: yyyy-MM-dd
        *
        */

        BOOL isAllDay = FALSE;

        if (isWindowsMobile5()) {
            pAppointment->get_AllDayEvent(&variantBool);
            variantBool == -1 ? isAllDay = TRUE : isAllDay = FALSE;

            if (isAllDay)
                enddate -= 1; // to be decremented of a day if it is all day in windows mobile 5.
                // This because the end date is 00:00:00 of the next day. we want the all day
                // is represented as <startDate>2007-01-15</StartDate> and and date as the same

        } else {
            isAllDayEvent(startdate, enddate);
        }


        wsprintf(tempDate, TEXT(""));
        double toCompare = MAX_DATE_DOUBLE;
        double toCompare4000 = MAX_DATE_DOUBLE_4000;

        SYSTEMTIME st;

        if (startdate != toCompare) {
            VariantTimeToSystemTime(startdate, &st);
            x = st.wHour;
            localTimeToUTC(st);
            y = st.wHour;
            if (isAllDay) {
                doubleToSystemTimeBirthday(tempDate, startdate);
            } else {
                doubleToSystemTime(tempDate, startdate);
            }
        }
        appointmentStringItem  = appointmentStringItem + TEXT("<Start>") + tempDate + TEXT("</Start>");

        wsprintf(tempDate, TEXT(""));
        if (enddate != toCompare) {
            if (isAllDay) {
                doubleToSystemTimeBirthday(tempDate, enddate);
            } else {
                doubleToSystemTime(tempDate, enddate);
            }
        }
        appointmentStringItem  = appointmentStringItem + TEXT("<End>") + tempDate + TEXT("</End>");

        if (isAllDay) {
            wsprintf(tempDate, TEXT("1")); // TRUE
        } else {
            wsprintf(tempDate, TEXT("0")); // TRUE
        }
        appointmentStringItem  = appointmentStringItem + TEXT("<AllDayEvent>") + tempDate + TEXT("</AllDayEvent>");

        pAppointment->get_ReminderSet(&variantBool);
        wsprintf(tempDate, TEXT("%i"), variantBool);
        normalizeBoolean(tempDate);
        appointmentStringItem  = appointmentStringItem + TEXT("<ReminderSet>") + tempDate + TEXT("</ReminderSet>");

        // long
        //pAppointment->get_Duration(&elementLong);
        //wsprintf(tempDate, TEXT("%i"), elementLong);
        //appointmentStringItem  = appointmentStringItem + TEXT("<Duration>") + tempDate + TEXT("</Duration>");

        pAppointment->get_BusyStatus(&elementLong);
        wsprintf(tempDate, TEXT("%i"), elementLong);
        appointmentStringItem  = appointmentStringItem + TEXT("<BusyStatus>") + tempDate + TEXT("</BusyStatus>");

        pAppointment->get_Sensitivity(&elementLong);
        wsprintf(tempDate, TEXT("%i"), elementLong);
        appointmentStringItem  = appointmentStringItem + TEXT("<Sensitivity>") + tempDate + TEXT("</Sensitivity>");

        pAppointment->get_ReminderOptions(&elementLong);
        wsprintf(tempDate, TEXT("%i"), elementLong);
        appointmentStringItem  = appointmentStringItem + TEXT("<ReminderOptions>") + tempDate + TEXT("</ReminderOptions>");

        pAppointment->get_ReminderMinutesBeforeStart(&elementLong);
        wsprintf(tempDate, TEXT("%i"), elementLong);
        appointmentStringItem  = appointmentStringItem + TEXT("<ReminderMinutesBeforeStart>") + tempDate + TEXT("</ReminderMinutesBeforeStart>");


        /******************************************************/

        //Recurrence
        VARIANT_BOOL isRecurring;
        pAppointment->get_IsRecurring(&isRecurring);
        wsprintf(tempDate, TEXT("%i"), isRecurring);
        normalizeBoolean(tempDate);
        appointmentStringItem  = appointmentStringItem + TEXT("<IsRecurring>") + tempDate + TEXT("</IsRecurring>");

        IRecurrencePattern *pRecurrence;
        pAppointment->GetRecurrencePattern (&pRecurrence);

        wstring recurrence = L"";
        if (!isCRC || isRecurring == -1) { // variant bool to say TRUE
            recurrence = getRecurrenceTags(pRecurrence, isRecurring, x, y, olFolderCalendar, startdate, isAllDay);
        }
        // handle recurrence and exceptions events
        // wstring recurrence = getRecurrenceTags(pRecurrence, isRecurring, x, y, olFolderCalendar, startdate, isAllDay);

        pRecurrence->Release();

    appointmentStringItem += recurrence;
    appointmentStringItem = appointmentStringItem +  TEXT("</appointment>");

}

/*
wstring createExceptions(IRecurrencePattern* pRecurrence) {

    IExceptions* pExceptions;
    int numExceptions;

    pRecurrence->get_Exceptions(&pExceptions);
    pExceptions->get_Count(&numExceptions);
    wchar_t temp [DIM_LOCAL_TEMP];

    wstring exceptions = TEXT("<Exceptions>");
        wsprintf(temp, TEXT("<ExceptionNumber>%i</ExceptionNumber>"), numExceptions);
        exceptions += wstring(temp);

    for (int i = 0; i < numExceptions; i++) {
        IException* pException;
        pExceptions->Item(i + 1, &pException);
        wstring exception = createException(pException);
        exceptions += exception;
        pException->Release();
    }

    pExceptions->Release();

    exceptions +=  TEXT("</Exceptions>");

    return exceptions;
}

wstring createException(IException* pException) {

    wstring exceptionItem = TEXT("<Exception>");
    DATE originalDate = 0;
    VARIANT_BOOL varBool; // -1 = TRUE, 0 = FALSE
    SYSTEMTIME st;
    memset(&st, 0, sizeof(SYSTEMTIME));
    BSTR element        = NULL      ;
    wchar_t tempDate [DIM_LOCAL_TEMP];
    wstring element_s;

    pException->get_OriginalDate(&originalDate);
    doubleToSystemTimeBirthday(tempDate, originalDate);    // YYYY-MM-DD

    exceptionItem += TEXT("<OriginalDate>") + wstring(tempDate) + TEXT("</OriginalDate>");

    // if the recurrence is deleted get the delation and go exit
    pException->get_Deleted(&varBool);
    if (varBool == -1)
        goto finally;

    exceptionItem += TEXT("<ExAppointment>");
    IAppointment* pAppointment;
    pException->get_AppointmentItem(&pAppointment);

        pAppointment->get_Subject(&element);
        element_s = wstring(element);
        encodeSpecialChar(element_s);
        exceptionItem  += TEXT("<ExSubject>") + element_s + TEXT("</ExSubject>");
        SysFreeString(element); element = NULL;

        pAppointment->get_Location(&element);
        element_s = wstring(element);
        encodeSpecialChar(element_s);
        exceptionItem  += TEXT("<ExLocation>") + element_s + TEXT("</ExLocation>");
        SysFreeString(element); element = NULL;

        pAppointment->get_Body(&element);
        removeEndCarriage(&element);
        element_s = wstring(element);  encodeSpecialChar(element_s);
        exceptionItem  +=  TEXT("<ExBody>") + element_s + TEXT("</ExBody>");
        SysFreeString(element);

         // VARIANT

        pAppointment->get_AllDayEvent(&varBool);
        wsprintf(tempDate, TEXT("%i"), varBool);
        if (varBool == -1) {
            wsprintf(tempDate, TEXT("1")); // TRUE
        }
        exceptionItem  += TEXT("<ExAllDayEvent>") + wstring(tempDate) + TEXT("</ExAllDayEvent>");

        // DATE
        DATE startdate;
        DATE enddate;
        pAppointment->get_Start(&startdate);
        pAppointment->get_End(&enddate);

        //BOOL isAllDay = isAllDayEvent(startdate, enddate);
        BOOL isAllDay = varBool == -1 ? TRUE : FALSE;

        wsprintf(tempDate, TEXT(""));

        VariantTimeToSystemTime(startdate, &st);
        if (isAllDay) {
            doubleToSystemTimeBirthday(tempDate, startdate);
        } else {
            doubleToSystemTime(tempDate, startdate);
        }

        exceptionItem  += TEXT("<ExStart>") + wstring(tempDate) + TEXT("</ExStart>");
        wsprintf(tempDate, TEXT(""));

        if (isAllDay) {
            doubleToSystemTimeBirthday(tempDate, enddate);
        } else {
            doubleToSystemTime(tempDate, enddate);
        }

        exceptionItem += TEXT("<ExEnd>") + wstring(tempDate) + TEXT("</ExEnd>");

        long elementLong = 0;
        pAppointment->get_BusyStatus(&elementLong);
        wsprintf(tempDate, TEXT("%i"), elementLong);
        exceptionItem  += TEXT("<ExBusyStatus>") + wstring(tempDate) + TEXT("</ExBusyStatus>");

    if (pAppointment)
        pAppointment->Release();

   exceptionItem += TEXT("</ExAppointment>");
finally:

    exceptionItem += TEXT("</Exception>");
    return exceptionItem;

}
*/

/*
* Method that complete an appointment object retrieving property value by an XML structure.
* It parse the XML structure, get the every property value using its name and set it into the object.
*
* @param pAppointment : the appointment object that contain every value
* @param ptrData      : the variable that contain the xml structure
*/

void completeAppointment(IAppointment *pAppointment, wchar_t *ptrData, IP_OUTLOOK_APP* polApp, wchar_t* path) {

    wchar_t* dummy                  = NULL;
    wchar_t* dummyEvent             = NULL;
    wstring  dummyEvent_s;
    VARIANT_BOOL isNotAllDayEvent   = TRUE;
      
    //
    // FOR RECURRENCE
    // to get if a modification in the UTC goes into day before or after
    // store the initial value of day and check the last value
    //
    int x = 0, y = 0, z = 0;
    BOOL changeDay = FALSE, isBackward = FALSE;
    BOOL changeYearBackward = FALSE, changeYearForward = FALSE;

    //VARIANT_BOOL --- AllDayEvent
    dummyEvent = getElementContent(ptrData, TEXT ("AllDayEvent"), NULL);

    if (dummyEvent != NULL &&
        (wcscmp(dummyEvent, TEXT("1")) == 0 ||
         wcscmp(dummyEvent, TEXT("-1")) == 0 || // kept to be compliant with old client. Now TRUE is represented
         wcscmp(dummyEvent, TEXT("True")) == 0)) {  // with "1" only

        if (isWindowsMobile5()) {
            pAppointment->put_AllDayEvent(TRUE);
        } else {
            pAppointment->put_AllDayEvent(FALSE);
        }

        double locDate = NULL;

        dummyEvent = getElementContent(ptrData, TEXT ("Start"), NULL);

        DATE st;
        SYSTEMTIME systemTime;
        BOOL isUTC = FALSE;
        BOOL isAllDayFormat = isDateForAllDayEventFormat(dummyEvent);

        if (isAllDayFormat) {
            systemTimeToDoubleBirthFormat(dummyEvent, &st, TEXT("START"));

        }  else { // the date is in the usual format

            isUTC = getDateAndTimeAsIs(dummyEvent, &st);

            VariantTimeToSystemTime(st, &systemTime);
            x = systemTime.wHour;
            if (isUTC) {
                UTCToLocalTime2(systemTime);
            }
            y = systemTime.wHour;
            systemTime.wHour = 0;
            systemTime.wMinute = 0;
            systemTime.wMilliseconds = 0;
            SystemTimeToVariantTime(&systemTime, &st);
        }
        pAppointment->put_Start(st);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人video| 欧美性受xxxx| 国产精品狼人久久影院观看方式| 国产专区欧美精品| 国产无遮挡一区二区三区毛片日本| 国产乱一区二区| 国产精品天天摸av网| 91影院在线观看| 午夜精品久久久久久久| 日韩视频免费直播| 国产在线精品国自产拍免费| 中文在线一区二区| 欧美午夜在线一二页| 久久99国产精品尤物| 国产精品午夜在线观看| 日本韩国视频一区二区| 视频一区二区中文字幕| 久久午夜免费电影| 在线亚洲一区二区| 美女视频网站黄色亚洲| 国产三级久久久| 欧美午夜片在线观看| 久久99精品久久久久久动态图 | 欧美精品99久久久**| 久久精品噜噜噜成人av农村| 久久亚洲一级片| 欧美亚洲丝袜传媒另类| 国产永久精品大片wwwapp | 亚洲免费观看视频| 欧美久久婷婷综合色| 国产经典欧美精品| 午夜欧美在线一二页| 国产亚洲综合在线| 欧美日韩mp4| 成人免费视频一区二区| 日韩精品五月天| 最新不卡av在线| 日韩欧美一级特黄在线播放| 91老司机福利 在线| 美女免费视频一区| 一区二区三区久久| 欧美国产精品劲爆| 日韩精品一区二区三区视频播放 | 久久久噜噜噜久久人人看| 色爱区综合激月婷婷| 国产精品一线二线三线| 日韩精品一区第一页| 亚洲免费观看高清完整版在线观看熊 | 一区二区在线看| 久久综合资源网| 欧美精品三级在线观看| 色综合久久久久| www.日本不卡| 国产精品456| 经典三级一区二区| 天堂va蜜桃一区二区三区 | 日韩av电影一区| 国产精品大尺度| 国产欧美一区二区三区在线老狼| 在线播放视频一区| 欧美吻胸吃奶大尺度电影| 色婷婷激情久久| 91美女在线看| 97成人超碰视| a在线播放不卡| 成人精品视频一区二区三区尤物| 韩国三级中文字幕hd久久精品| 视频一区在线播放| 爽好久久久欧美精品| 亚洲福利一区二区三区| 亚洲精品菠萝久久久久久久| 中文字幕日韩一区| 亚洲欧美怡红院| 亚洲女性喷水在线观看一区| 国产精品美日韩| 国产精品久久久久久亚洲伦| 国产精品青草综合久久久久99| 欧美经典一区二区| 国产精品蜜臀在线观看| 综合久久久久久| 一区二区三区高清| 午夜欧美大尺度福利影院在线看| 五月婷婷激情综合| 日产精品久久久久久久性色| 日本 国产 欧美色综合| 国产综合色视频| 国产精品一区二区你懂的| 国产成人丝袜美腿| 91亚洲精品久久久蜜桃| 在线观看一区日韩| 91麻豆精品国产91久久久使用方法| 欧美一区二视频| 久久婷婷久久一区二区三区| 国产欧美中文在线| 最新国产の精品合集bt伙计| 亚洲高清在线精品| 久久国产日韩欧美精品| 国产精品99久久久久久有的能看| 国产精品一区二区三区网站| 99re这里都是精品| 欧美疯狂性受xxxxx喷水图片| 日韩欧美中文字幕公布| 国产片一区二区三区| 亚洲免费在线看| 久久99最新地址| 成人h动漫精品| 欧美另类高清zo欧美| 久久婷婷色综合| 一区二区三区中文免费| 老司机一区二区| 99riav一区二区三区| 欧美精品久久99久久在免费线 | 日韩黄色片在线观看| 奇米影视一区二区三区| 国产精品一区二区果冻传媒| 91网页版在线| 精品国产sm最大网站免费看| 国产精品拍天天在线| 亚洲图片有声小说| 国产精品91一区二区| 欧美日韩美女一区二区| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲男人天堂av网| 国产一区二区在线看| 91福利在线导航| 国产视频亚洲色图| 日韩精品亚洲专区| 99在线精品观看| 久久久久久久久免费| 亚洲成人精品在线观看| 成人午夜免费av| 欧美一区二区三区小说| 亚洲狠狠丁香婷婷综合久久久| 麻豆精品国产传媒mv男同| 日本韩国精品在线| 中文字幕免费不卡| 精品亚洲欧美一区| 欧美色视频在线| 亚洲美女视频一区| 风流少妇一区二区| 欧美成人猛片aaaaaaa| 亚洲电影一区二区三区| 99久久99久久综合| 久久久久99精品一区| 日韩和的一区二区| 欧美影视一区在线| 亚洲欧美日韩精品久久久久| 成人精品国产福利| 久久午夜电影网| 国产一区二区三区香蕉| 欧美一级理论片| 香蕉影视欧美成人| 色又黄又爽网站www久久| 中文字幕五月欧美| 99在线精品一区二区三区| 国产精品嫩草久久久久| 国产精品一二三| 久久综合九色综合97婷婷| 久久se这里有精品| 日韩欧美在线123| 蜜臀av一区二区三区| 69p69国产精品| 日韩高清在线观看| 欧美久久久久久久久中文字幕| 亚洲一级二级三级| 欧美亚洲一区三区| 亚洲午夜av在线| 欧美嫩在线观看| 天天色综合天天| 欧美精品久久久久久久久老牛影院| 亚洲成人在线观看视频| 欧美日韩视频在线观看一区二区三区| 亚洲国产日韩一区二区| 欧美日韩中文精品| 视频一区免费在线观看| 日韩欧美一级特黄在线播放| 国内欧美视频一区二区| 久久婷婷国产综合国色天香| 国产91丝袜在线播放| 最新国产成人在线观看| 色香蕉久久蜜桃| 亚洲高清久久久| 精品国产一区二区三区不卡| 国产一区二区精品久久91| 欧美激情在线一区二区三区| 97精品国产露脸对白| 亚洲成人先锋电影| 精品久久久久99| 成人黄色a**站在线观看| 一区二区免费在线播放| 91精品久久久久久久91蜜桃| 激情五月婷婷综合网| 中文字幕电影一区| 欧美亚州韩日在线看免费版国语版| 青草国产精品久久久久久| 国产亚洲成aⅴ人片在线观看| 91麻豆免费看| 日本三级亚洲精品| 日本一区二区三区在线不卡| 欧美专区亚洲专区|