utilsrecurrence.h

来自「funambol window mobile客户端源代码」· C头文件 代码 · 共 151 行

H
151
字号
/*
 * 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".
 */

#ifndef INCL_UTILS_RECURRENCE
#define INCL_UTILS_RECURRENCE

#include "spdm/spdmutils.h"
#include "pimstore.h"
#include "Tlhelp32.h"
#include "vocl/WinRecurrence.h"
#include "pim/RecurrenceException.h"

#include <string>
#include <list>
#include <vector>

using namespace std;


// Enumeration of recurrence fields used by WM plugin.
// It's defined in UtilsRecurrence.cpp.
extern const wchar_t* recurrenceFields[];



wstring createExceptions(IRecurrencePattern* pRecurrence, DATE startdate, BOOL isAllday);
wstring createException(IException* pException, DATE startdate, BOOL isAllday);

long createAppointmentFromException(IAppointment* pAppointment, RecurrenceException rec, IP_OUTLOOK_APP* polApp);
void writeOidToReset(vector<long> oids, const wchar_t* wpath);


// -- These functions should be removed once the update from old CRC is no more necessary --
wstring getRecurrenceTags(IRecurrencePattern* pRecurrence, VARIANT_BOOL isRecurring,
                          int x, int y, OlDefaultFolders olFolder, DATE startdate, BOOL isAllDay);
int convertDayOfWeekMaskBackward(int dayOfWeekMaskSent);
int convertDayOfWeekMaskForward(int dayOfWeekMaskSent);
void parseRecurrenceTags(IRecurrencePattern *pRecurrence, const wchar_t* ptrData,
                         DATE recurrenceStart, int x, int y);
// -----------------------------------------------------------------------------------------



/**
 * Gets all recurring properties from IPOutlook2 and set them to WinRecurrence (Client to Server).
 * @param winRec          [IN-OUT] WinRecurrence object to fill with all props
 * @param prgPropvalPoom  CEPROPVAL pointer to read properties from
 * @param firstProperty   the index of the first property to retrieve from CEPROPVAL array
 * @param start           Start date of the event/task
 * @param isAllDay        true if the event is an all-day
 * @param isAppointment   says if this recurrence belongs to an appointment or tasks.
 *
 * @note  need to retrieve all values together to apply safe checks and conversions.
 */
void setWinRecurrenceProps(WinRecurrence& winRec, const CEPROPVAL* prgPropvalPoom, int firstProperty,
                           const wstring& start, const bool isAllDay, bool isAppointment);

/**
 * Gets all recurring properties from WinRecurrence and set them to IPOutlook2 (Server to Client).
 * @param prgPropvalPoom  CEPROPVAL pointer to write properties to
 * @param propsNumber     the exact number of properties already set into prgPropvalPoom
 *                        recurring props will be set starting from index 'propsNumber'
 * @param winRec          WinRecurrence object to read properties from
 * @param start           Start date of the event/task
 * @param end             End date of the event/task
 * @param isAllDay        true if the event is an all-day
 * @param tzInfo          the timezone information of the event, NULL if not used or if it's a task
 *                        (it's used in case the PatternStartDate is missing, like in vCal 1.0)
 * @param isAppointment   says if this recurrence belongs to an appointment or tasks. Not used yet
 * @return                the updated number of properties set in prgPropvalPoom.
 *                        this value will be 'propsNumber' + the number of rec props set.
 *
 * @note  need to get all props together to apply safe checks and conversions.
 */
int setMAPIRecurrenceProps(CEPROPVAL* prgPropvalPoom, const int propsNumber, 
                           WinRecurrence& winRec, const wstring& start, const wstring& end, 
                           const bool isAllDay, const TIME_ZONE_INFORMATION* tzInfo, bool isAppointment);


/**
 * Change-day option: UTC <-> local time.
 * Rec pattern properties are changed (if necessary) according to start value.
 * @param dest           destination for the change-day: 
 *                       "UTC" we are moving from local time to UTC (Client to Server)
 *                       "Local" we are moving from UTC to local time (Server to Client)
 * @param start          Start date of the event
 * @param monthOfYear    [IN-OUT]the monthOfYear value, may be changed +-1
 * @param dayOfMonth     [IN-OUT]the dayOfMonth value, may be changed +-1
 * @param dayOfWeekMask  [IN-OUT]the dayOfWeekMask value, may be shifted +-1
 * @return               true if change-day is applied
 */
bool changeDay(const wstring& dest, const wstring& start, 
               int* monthOfYear, int* dayOfMonth, int* dayOfWeekMask);

/**
 * Returns "PatternStartDate" from "Start" value.
 * If 'start' is local time, PatternStartDate is the same.
 * If 'start' is in UTC: get the local time in the timezone of the appointment (tzInfo)
 * to convert 'start' in the correct local time.
 * To do this, backup the current tzInfo of the system, make conversion, and restore tzInfo.
 *
 * @param start   the Start value, "yyyyMMddThhmmss" or "yyyyMMddThhmmssZ"
 * @param tzInfo  the timezone information for this event (can be different from system tz)
 * @return        the "PatternStartDate" value, in local time, like "yyyyMMddThhmmss" or "yyyyMMdd"
 * @note          'start' value is required, MUST NOT be empty
 */
wstring getPatternStartDateFromStart(const wstring& start, const TIME_ZONE_INFORMATION* tzInfo);


// **** TODO: remove? ****
//BOOL checkAlreadyAnException(IRecurrencePattern* pRecurrence, DATE originalDate, DATE startDate);
//vector<RecurrenceException> getExceptionList(IRecurrencePattern* pRecurrence,
//                                             const wchar_t* ptrData,
//                                             const wchar_t* action);
//void executeException(IRecurrencePattern* pRecurrence, RecurrenceException rec);
//void deleteIntraOccurrences(IRecurrencePattern* pRecurrence, DATE originalDate, DATE startdate);

ArrayList* getRecurrenceProperties();
#endif

⌨️ 快捷键说明

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