ToDoList.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:265k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * ToDoList.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file implements To Do List application.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : ToDoList.c
- PURPOSE : To Do List Application
- REMARKS : nil
- AUTHOR : Arvind
- DATE : 29th Oct, 2003
- **************************************************************/
- #ifndef _MMI_TODOLIST_C
- #define _MMI_TODOLIST_C
- #include "MMI_features.h"
- #ifdef __MMI_TODOLIST__
- /* Include: MMI header file */
- #include "StdC.h"
- #include "L4Dr.h"
- #include "L4Dr1.h"
- #include "GlobalConstants.h"
- #include "DebugInitDef.h"
- #include "CustMenuRes.h"
- #include "CustDataRes.h"
- #include "ProtocolEvents.h"
- #include "EventsGprot.h"
- #include "TimerEvents.h"
- #include "GlobalDefs.h"
- #include "HistoryGprot.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "wgui_categories_popup.h"
- #include "CommonScreens.h"
- #include "mainmenudef.h"
- #include "DateTimeGprot.h"
- #include "AlarmFrameworkProt.h"
- #include "ToDoListDef.h"
- #include "ToDoListEnum.h"
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "Nvram_enums.h"
- #include "NVRAMHwMapFile.h"
- #include "Organizerdef.h"
- #include "SubLCDHistoryGprot.h"
- #include "AlarmGprot.h"
- #include "gpioInc.h"
- #include "ProfileGprots.h"
- #include "KeyBrd.h"
- #include "WrapperGprot.h"
- #include "vCalendar.h"
- #include "vObjects.h"
- #include "vCalendar.h"
- #include "SimDetectionGexdcl.h"
- #include "SimDetectionGprot.h"
- #include "app_datetime.h"
- #if defined (__MMI_CLNDR_ICON_SUPPORT__) || defined (__MMI_BIRTHDAY_REMINDER__)
- #include "CalendarDef.h"
- #endif
- #ifdef __MMI_BIRTHDAY_REMINDER__
- #include "SMSapi.h"
- #include "PhoneBookGprot.h"
- #include "ScrMemMgrGprot.h"
- #include "CallManagementGprot.h"
- #include "wapadp.h"
- #endif
- #ifdef __MMI_CLNDR_WEEKLY_VIEW_SUPPORT__
- #include "CalendarProt.h"
- #endif /* __MMI_CLNDR_WEEKLY_VIEW_SUPPORT__ */
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- #include "JMMSGprot.h"
- #endif
- #ifdef __J2ME__
- #include "j2me_custom_option.h"
- #if defined(SUPPORT_JSR_75_PIM)
- #include "app_datetime.h"
- #include "ToDoListDB.h"
- #endif
- #endif
- /* SyncML */
- #ifdef __SYNCML_SUPPORT__
- #include "SyncMLDef.h"
- #include "SyncMLGProt.h"
- #include "FileSystemDef.h"
- #endif /* __SYNCML_SUPPORT__ */
- /* Include: PS header file */
- /* ... Add More PS header */
- /*
- * Define
- */
- /*
- * Typedef
- */
- tdl_context_struct g_tdl_cntx;
- /*
- * Local Variable
- */
- // buffer used in inline editors */
- /*
- * Local Function
- */
- /*
- * Global Variable
- */
- extern U8 gAlmDayOfWeek[];
- S8 *gAlmOnOffStringforTDL[NUM_STATE_FOR_TDL]; /* array to store on/off state of an alarm */
- extern U8 gAlmDaysStates[];
- extern wgui_inline_item wgui_inline_items[];
- /* Add yearly for Anniversary */
- const U8 g_tdl_freq_set[TODO_FREQ_NUM + 1] =
- {ALM_FREQ_ONCE, ALM_FREQ_EVERYDAY, ALM_FREQ_DAYS, ALM_FREQ_WEEKLY, ALM_FREQ_MONTHLY, ALM_FREQ_YEARLY};
- S8 gnoteString[MAX_TODO_LIST_NOTE];
- U16 gTDLicon[NUM_OF_TDL];
- #ifdef __MMI_ADVANCED_TODO__
- S8 glocationString[MAX_TODO_LIST_NOTE];
- S8 *gTdlPriorityString[NUM_OF_TASK_PRIORITY]; /* array to store on/off state of an alarm */
- #endif /* __MMI_ADVANCED_TODO__ */
- /*
- * Global Function
- */
- /*****************************************************************************
- * FUNCTION
- * InitToDoListApp
- * DESCRIPTION
- * Set highlight handlers and retrieve data from NVRAM.
- * Register key handlers.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitToDoListApp(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetHiliteHandler(ORGANIZER_TODOLIST_MENU, HighlightTDLMenu);
- SetHiliteHandler(MITEM_TODO_LIST_VIEW, HighlightTdlView);
- SetHiliteHandler(MITEM_TODO_LIST_ADD, HighlightTdlAdd);
- SetHiliteHandler(MITEM_TODO_LIST_EDIT, HighlightTdlEdit);
- SetHiliteHandler(MITEM_TODO_LIST_DELETE, HighlightTdlDelete);
- SetHiliteHandler(MITEM_TODO_LIST_DELETE_ALL, HighlightTdlDeleteAll);
- SetHiliteHandler(MITEM_TODO_LIST_SAVE, mmi_tdl_highlight_hdlr_note_option_save);
- SetHiliteHandler(MITEM_TODO_LIST_USE_TEMPLATE, mmi_tdl_highlight_hdlr_note_option_template);
- SetHiliteHandler(MITEM_TODO_LIST_BOPOMOFO, mmi_tdl_highlight_hdlr_note_option_input_method);
- #if defined(SUPPORT_JSR_75_PIM)
- mmi_tdl_evtdb_handler_init();
- #endif
- #ifdef __MMI_ADVANCED_TODO__
- SetHiliteHandler(MITEM_TODO_LIST_MEETING, mmi_tdl_highlight_meeting);
- SetHiliteHandler(MITEM_TODO_LIST_COURSE, mmi_tdl_highlight_course);
- SetHiliteHandler(MITEM_TODO_LIST_DATE, mmi_tdl_highlight_date);
- SetHiliteHandler(MITEM_TODO_LIST_CALL, mmi_tdl_highlight_call);
- SetHiliteHandler(MITEM_TODO_LIST_ANNIVERSARY, mmi_tdl_highlight_anniversary);
- SetHiliteHandler(MITEM_TODO_LIST_REMINDER, mmi_tdl_highlight_reminder);
- #endif /* __MMI_ADVANCED_TODO__ */
- #ifdef __MMI_BIRTHDAY_REMINDER__
- SetHiliteHandler(MITEM_BIRTHDAY_OPTION_MAKE_CALL, mmi_birthday_highlight_make_call);
- SetHiliteHandler(MITEM_BIRTHDAY_OPTION_SEND_SMS, mmi_birthday_highlight_send_sms);
- #ifdef MMS_SUPPORT
- SetHiliteHandler(MITEM_BIRTHDAY_OPTION_SEND_MMS, mmi_birthday_highlight_send_mms);
- #endif /*# MMS_SUPPORT */
- #endif /* __MMI_BIRTHDAY_REMINDER__ */
- TDLReadFromNvram();
- }
- /*****************************************************************************
- * FUNCTION
- * TDLExpiryHandler
- * DESCRIPTION
- * CallBack handler to execute todolist expiry.
- * PARAMETERS
- * index [IN]
- * period [?]
- * power_on [IN]
- * BOOL(?) [IN] Power status
- * U8(?) [IN] Index of alarm item
- * RETURNS
- * void
- *****************************************************************************/
- U8 TDLExpiryHandler(U8 index, U16 *period, BOOL power_on)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (power_on)
- {
- EntryTDLReminder();
- *period = ALM_DEFAULT_EXPIRY_PERIOD;
- return ALM_HAS_IND;
- }
- else
- {
- EntryTDLReminder();
- *period = ALM_WITHOUD_EXPIRY_PERIOD;
- return ALM_HAS_NO_IND;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * TDLExpiryTimeCBH
- * DESCRIPTION
- * Callback handler to get information of todolist expiry setting.
- * PARAMETERS
- * index [IN]
- * alarmTime [?]
- * Freq [?]
- * WeekDays [?]
- * MYTIME(?) [IN/OUT] Expiry time set by user
- * U8(?) [IN/OUT] Expiry days of week
- * RETURNS
- * void
- *****************************************************************************/
- void TDLExpiryTimeCBH(U8 index, MYTIME *alarmTime, U8 *Freq, U8 *WeekDays, MYTIME *preReminder)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_ADVANCED_TODO__
- mmi_tdl_compute_reminder_time(&g_tdl_cntx.TaskList[index], preReminder);
- #endif
- *alarmTime = g_tdl_cntx.TaskList[index].StartTime;
- *Freq = g_tdl_freq_set[g_tdl_cntx.TaskList[index].Repeat];
- *WeekDays = g_tdl_cntx.TaskList[index].Days;
- }
- /*****************************************************************************
- * FUNCTION
- * TDLReInitQueueCBH
- * DESCRIPTION
- * Reinit todolist to alarm queue
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TDLReInitQueueCBH(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYTIME currTime;
- #ifdef __MMI_ADVANCED_TODO__
- MYTIME alarmTime, incTime;
- #endif
- U8 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DTGetRTCTime(&currTime);
- for (i = 0; i < NUM_OF_TDL; i++)
- {
- if (g_tdl_cntx.TaskList[i].Present == 1 && g_tdl_cntx.TaskList[i].Alarm >= TODO_LIST_ALARM_ON)
- {
- if (g_tdl_freq_set[g_tdl_cntx.TaskList[i].Repeat] == ALM_FREQ_ONCE)
- {
- #ifdef __MMI_ADVANCED_TODO__
- memset(&incTime, 0, sizeof(MYTIME));
- memcpy(&alarmTime, &g_tdl_cntx.TaskList[i].StartTime, sizeof(MYTIME));
- mmi_tdl_compute_reminder_time(&g_tdl_cntx.TaskList[i], &incTime);
- #ifdef MMI_ON_WIN32
- DecrementTime(alarmTime, incTime, & alarmTime);
- #else
- applib_dt_decrease_time(
- (applib_time_struct*) & alarmTime,
- (applib_time_struct*) & incTime,
- (applib_time_struct*) & alarmTime);
- #endif
- if (CompareTime(alarmTime, currTime, NULL) == TIME_GREATER)
- #else /* __MMI_ADVANCED_TODO__ */
- if (CompareTime(g_tdl_cntx.TaskList[i].StartTime, currTime, NULL) == TIME_GREATER)
- #endif /* __MMI_ADVANCED_TODO__ */
- {
- AlmInsertIntoQueue((U8) (i + ALM_TDL_START), FALSE);
- }
- }
- else
- {
- AlmInsertIntoQueue((U8) (i + ALM_TDL_START), FALSE);
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * TDLFCBInit
- * DESCRIPTION
- * Set callback function needed by alarm framework
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TDLFCBInit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_alm_set_start_index(ALM_TYPE_TDL, ALM_TDL_START);
- AlmSetExpiryTimeCB(ALM_TYPE_TDL, TDLExpiryTimeCBH);
- AlmSetExpiryHandlerCB(ALM_TYPE_TDL, TDLExpiryHandler);
- AlmSetInitHandlerCB(ALM_TYPE_TDL, InitToDoListApp, TDLReInitQueueCBH);
- AlmSetStopAlarmCB(ALM_TYPE_TDL, TDLExitReminderScreen);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTDLMenu
- * DESCRIPTION
- * Highlight handler of To Do List menu item.
- * Register key handlers.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTDLMenu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(TDLShowAllList, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(TDLShowAllList, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * DeInitToDoListApp
- * DESCRIPTION
- * Deinitialize To Do List application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DeInitToDoListApp(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTDLTaskList
- * DESCRIPTION
- * Highlight handler of to do list task list, store the index of selected task.
- * PARAMETERS
- * nIndex [IN] Index of selected task.
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTDLTaskList(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifndef __MMI_BIRTHDAY_REMINDER__
- g_tdl_cntx.CurrSelectedTask = (U8) nIndex;
- #else /* __MMI_BIRTHDAY_REMINDER__ */
- if (nIndex < g_tdl_cntx.TotalListedTask)
- {
- g_tdl_cntx.CurrSelectedTask = (U8) nIndex;
- SetLeftSoftkeyFunction(EntryTDLTaskListOption, KEY_EVENT_UP);
- if (g_tdl_cntx.IsCalledByCalender >= MMI_TRUE)
- {
- SetKeyHandler(mmi_tdl_get_next_day_redraw, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_tdl_get_previous_day_redraw, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- SetKeyHandler(mmi_tdl_task_list_goback, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(EntryTDLTaskListOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /* Himanshu Fix MAUI_00228900 START */
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- SetLeftSoftkeyFunction(mmi_jmms_insert_vcal_tdl, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- /* Himanshu Fix MAUI_00228900 END */
- }
- else if (nIndex >= g_tdl_cntx.TotalListedTask &&
- nIndex < mmi_clndr_get_daily_birthday_amount(g_tdl_cntx.ClndrDate.nDay) + g_tdl_cntx.TotalListedTask)
- {
- g_tdl_cntx.CurrHighlightBRIndex = g_tdl_cntx.PBIndexList[nIndex - g_tdl_cntx.TotalListedTask];
- if (mmi_bootup_is_sim_valid())
- {
- SetLeftSoftkeyFunction(mmi_entry_birthday_option_screen, KEY_EVENT_UP);
- SetKeyHandler(mmi_entry_birthday_option_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- /* Himanshu Fix MAUI_00228900 START */
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- SetLeftSoftkeyFunction(mmi_jmms_insert_vcal_tdl, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- /* Himanshu Fix MAUI_00228900 END */
- }
- else
- {
- ChangeLeftSoftkey(0, 0);
- SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- #endif /* __MMI_BIRTHDAY_REMINDER__ */
- }
- /*****************************************************************************
- * FUNCTION
- * TDLGetTotalItem
- * DESCRIPTION
- * Get number of present task
- * PARAMETERS
- * void
- * RETURNS
- * number of task
- *****************************************************************************/
- U8 TDLGetTotalItem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- U8 TotalItem = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < NUM_OF_TDL; i++)
- if (g_tdl_cntx.TaskList[i].Present == 1)
- {
- TotalItem++;
- }
- return TotalItem;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_task_list_goback
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_tdl_task_list_goback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (IsScreenPresent(SCR_TDL_TASK_LIST))
- {
- GoBackToHistory(SCR_TDL_TASK_LIST);
- }
- #ifdef __MMI_ADVANCED_TODO__
- else if (IsScreenPresent(SCR_ID_CLNDR_SCREEN))
- {
- GoBackToHistory(SCR_ID_CLNDR_SCREEN);
- }
- #endif /* __MMI_ADVANCED_TODO__ */
- else
- {
- GoBackHistory();
- }
- }
- #ifdef __MMI_ADVANCED_TODO__
- /*****************************************************************************
- * FUNCTION
- * EntryTDLTaskList
- * DESCRIPTION
- * Entry function of To Do List application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryTDLTaskList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 TotalItem = 0;
- GetAsyncItemFuncPtr createMenuPtr;
- S8 datestring[CLNDR_DATE_STRING_LENGTH + 1]; /* yyyy/mm/dd */
- S8 title[(CLNDR_DATE_STRING_LENGTH + 1) * ENCODING_LENGTH];
- #ifdef __MMI_BIRTHDAY_REMINDER__
- U16 bm;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_TDL_TASK_LIST, ExitTDLTaskList, EntryTDLTaskList, NULL);
- #ifdef __MMI_ADVANCED_TODO__
- if (g_tdl_cntx.DateUpdate == 1)
- {
- if (IsScreenPresent(SCR_TDL_TASK_LIST))
- {
- DeleteNScrId(SCR_TDL_TASK_LIST);
- }
- }
- #endif /* __MMI_ADVANCED_TODO__ */
- memset(title, 0, (CLNDR_DATE_STRING_LENGTH + 1) * ENCODING_LENGTH);
- #ifdef __MMI_BIRTHDAY_REMINDER__
- /* Since PBIndexList is screen based memory, it need to be searched for every time entering TDL daily view */
- if (g_tdl_cntx.IsCalledByCalender == CLNDR_MONTHLY_VIEW)
- {
- mmi_tdl_construct_birthday_memory();
- mmi_clndr_set_birthday_table(g_tdl_cntx.ClndrDate.nYear, g_tdl_cntx.ClndrDate.nMonth);
- bm = mmi_clndr_get_daily_birthday_amount(g_tdl_cntx.ClndrDate.nDay);
- memset(g_tdl_cntx.PBIndexList, 0, sizeof(U16) * bm);
- mmi_clndr_get_daily_birthday_info(
- g_tdl_cntx.ClndrDate.nYear,
- g_tdl_cntx.ClndrDate.nMonth,
- g_tdl_cntx.ClndrDate.nDay,
- bm,
- g_tdl_cntx.PBIndexList);
- }
- #endif
- if (g_tdl_cntx.IsListModified == TRUE)
- {
- #ifdef __MMI_CALENDAR_V2__
- if (g_tdl_cntx.IsCalledByCalender == CLNDR_MONTHLY_VIEW) /* Match the Date and list them */
- {
- TDLMakeListOfSelectedDate(CLNDR_MONTHLY_VIEW);
- }
- else if (g_tdl_cntx.IsCalledByCalender == CLNDR_WEEKLY_VIEW)
- {
- mmi_tdl_get_period_task();
- }
- #else /* __MMI_CALENDAR_V2__ */
- if (g_tdl_cntx.IsCalledByCalender >= MMI_TRUE)
- {
- TDLMakeListOfSelectedDate(MMI_TRUE);
- }
- #endif /* __MMI_CALENDAR_V2__ */
- else /* Set the Current Date and list the task in descending order. */
- {
- TDLMakeListOfAllTask();
- }
- g_tdl_cntx.IsListModified = FALSE;
- }
- #ifdef __MMI_BIRTHDAY_REMINDER__
- if (g_tdl_cntx.IsCalledByCalender == CLNDR_MONTHLY_VIEW)
- {
- TotalItem = g_tdl_cntx.TotalListedTask + mmi_clndr_get_daily_birthday_amount(g_tdl_cntx.ClndrDate.nDay);
- }
- else
- {
- TotalItem = g_tdl_cntx.TotalListedTask;
- }
- #else
- TotalItem = g_tdl_cntx.TotalListedTask;
- #endif
- guiBuffer = GetCurrGuiBuffer(SCR_TDL_TASK_LIST);
- SetParentHandler(0);
- if (g_tdl_cntx.IsCalledByCalender >= MMI_TRUE)
- {
- mmi_tdl_get_date_string(
- g_tdl_cntx.ClndrDate.nYear,
- g_tdl_cntx.ClndrDate.nMonth,
- g_tdl_cntx.ClndrDate.nDay,
- datestring);
- createMenuPtr = mmi_tdl_get_daily_async_items;
- AnsiiToUnicodeString(title, datestring);
- wgui_set_touch_title_bar_buttons();
- #ifdef __MMI_TOUCH_SCREEN__
- register_touch_button_handlers(mmi_tdl_get_previous_day_redraw, NULL, mmi_tdl_get_next_day_redraw, NULL);
- #endif
- }
- else
- {
- createMenuPtr = mmi_tdl_get_all_async_items;
- pfnUnicodeStrcpy(title, GetString(STR_TODO_LIST_CAP_TASK_LIST));
- }
- RegisterHighlightHandler(HighlightTDLTaskList);
- if (TotalItem == 0) /* display <Empty> */
- {
- ShowCategory85Screen(
- (U8*) title,
- 0,
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- TotalItem,
- createMenuPtr,
- NULL,
- 0,
- IMG_GLOBAL_OK,
- IMG_GLOBAL_OK,
- guiBuffer);
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_ADD;
- #ifdef __MMI_ADVANCED_TODO__
- SetLeftSoftkeyFunction(mmi_tdl_entry_select_task_type, KEY_EVENT_UP);
- SetKeyHandler(mmi_tdl_entry_select_task_type, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #else /* __MMI_ADVANCED_TODO__ */
- SetLeftSoftkeyFunction(TdlExecEdit, KEY_EVENT_UP);
- SetKeyHandler(TdlExecEdit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #endif /* __MMI_ADVANCED_TODO__ */
- /* if task full, disable LSK */
- if (g_tdl_cntx.IsCalledByCalender)
- {
- if (TDLGetTotalItem() == NUM_OF_TDL)
- {
- ChangeLeftSoftkey(0, 0);
- SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(0, 0);
- SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- }
- else /* display list of task */
- {
- ShowCategory85Screen(
- (U8*) title,
- 0,
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- TotalItem,
- createMenuPtr,
- NULL,
- 0,
- IMG_TODO_LIST_ICON_REMINDER,
- IMG_TODO_LIST_ICON_ALARM,
- guiBuffer);
- //SetLeftSoftkeyFunction(EntryTDLTaskListOption, KEY_EVENT_UP);
- //SetKeyHandler(EntryTDLTaskListOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- SetLeftSoftkeyFunction(mmi_jmms_insert_vcal_tdl, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- }
- /* Register function for right soft key */
- SetRightSoftkeyFunction(mmi_tdl_task_list_goback, KEY_EVENT_UP);
- SetKeyHandler(mmi_tdl_task_list_goback, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- if (g_tdl_cntx.IsCalledByCalender >= MMI_TRUE)
- {
- SetKeyHandler(mmi_tdl_get_next_day_redraw, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_tdl_get_previous_day_redraw, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_all_async_items
- * DESCRIPTION
- *
- * PARAMETERS
- * start_index [IN]
- * menuData [?]
- * num_item [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_tdl_get_all_async_items(S32 start_index, gui_iconlist_menu_item *menuData, S32 num_item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 dateStr[CLNDR_DATE_STRING_LENGTH + 1]; /* YYYY/MM/DD */
- MYTIME todoTime;
- U32 i, count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (start_index < g_tdl_cntx.TotalListedTask)
- {
- /* construct task list */
- for (i = start_index; count < num_item && i < g_tdl_cntx.TotalListedTask; i++, count++)
- {
- memcpy(&todoTime, &(g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].StartTime), sizeof(MYTIME));
- mmi_tdl_get_date_string(todoTime.nYear, todoTime.nMonth, todoTime.nDay, dateStr);
- AnsiiToUnicodeString((S8*) menuData[count].item_list[0], dateStr);
- pfnUnicodeStrcpy(
- (S8*) menuData[count].item_list[1],
- (S8*) g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Note);
- /* Alarm */
- if (g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Alarm >= TODO_LIST_ALARM_ON)
- {
- menuData[count].image_list[0] = (PU8) GetImage(IMG_TODO_LIST_ICON_ALARM);
- }
- else
- {
- menuData[count].image_list[0] = 0;
- }
- /* Type */
- menuData[count].image_list[1] =
- (PU8)
- GetImage((U16) (g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Type + IMG_TODO_LIST_ICON_REMINDER));
- }
- }
- return num_item;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_daily_async_items
- * DESCRIPTION
- *
- * PARAMETERS
- * start_index [IN]
- * menuData [?]
- * num_item [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_tdl_get_daily_async_items(S32 start_index, gui_iconlist_menu_item *menuData, S32 num_item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 timeStr[CLNDR_TIME_STRING_LENGTH * 2 + 1 + 1]; /* MM:SS-MM:SS */
- U32 i, count = 0;
- #ifdef __MMI_BIRTHDAY_REMINDER__
- U8 pbNumber[MAX_PB_NUMBER_LENGTH + 1], pbName[(MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH]; /* used to get phone number. */
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (start_index < g_tdl_cntx.TotalListedTask)
- {
- /* construct task list */
- for (i = start_index; count < num_item && i < g_tdl_cntx.TotalListedTask; i++, count++)
- {
- mmi_tdl_get_time_string(
- &(g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]]),
- &(g_tdl_cntx.ClndrDate),
- timeStr);
- AnsiiToUnicodeString((S8*) menuData[count].item_list[0], timeStr);
- pfnUnicodeStrcpy(
- (S8*) menuData[count].item_list[1],
- (S8*) g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Note);
- /* Alarm */
- if (g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Alarm >= TODO_LIST_ALARM_ON)
- {
- menuData[count].image_list[0] = (PU8) GetImage(IMG_TODO_LIST_ICON_ALARM);
- }
- else
- {
- menuData[count].image_list[0] = 0;
- }
- /* Type */
- menuData[count].image_list[1] =
- (PU8)
- GetImage((U16) (g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Type + IMG_TODO_LIST_ICON_REMINDER));
- }
- }
- #ifdef __MMI_BIRTHDAY_REMINDER__
- if (count < num_item) /* display birthday */
- {
- memset(timeStr, 0, CLNDR_TIME_STRING_LENGTH + 1); /* 00:00n */
- sprintf(timeStr, "%02d:%02d", 0, 0);
- i = count + start_index - g_tdl_cntx.TotalListedTask;
- for (; count < num_item && i < mmi_clndr_get_daily_birthday_amount(g_tdl_cntx.ClndrDate.nDay);
- i++, count++)
- {
- AnsiiToUnicodeString((S8*) menuData[count].item_list[0], timeStr);
- memset(pbNumber, 0, MAX_PB_NUMBER_LENGTH + 1);
- memset(pbName, 0, (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH);
- mmi_phb_get_name_number(g_tdl_cntx.PBIndexList[i],
- pbName,
- pbNumber);
- pfnUnicodeStrcpy((S8*)menuData[count].item_list[1], (S8*)pbName);
- if (pfnUnicodeStrlen((S8*) menuData[count].item_list[1]) == 0)
- {
- memcpy(menuData[count].item_list[1], GetString(STR_GLOBAL_EMPTY), (pfnUnicodeStrlen(GetString(STR_GLOBAL_EMPTY)) + 1) * ENCODING_LENGTH);
- }
- menuData[count].image_list[0] = 0;
- menuData[count].image_list[1] = (PU8) GetImage(IMG_TODO_LIST_BIRTHDAY_REMINDER);
- }
- }
- #endif /* __MMI_BIRTHDAY_REMINDER__ */
- return count;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_time_string
- * DESCRIPTION
- *
- * PARAMETERS
- * task [?]
- * year [IN]
- * month [IN]
- * day [IN]
- * timeString [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_tdl_get_time_string(ToDoListNode *task, MYTIME* seletedDate, S8 *timeString)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *timeString2;
- U8 IsStartDay = 0;
- MYTIME startTime;
- MYTIME endTime;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(timeString, 0, CLNDR_TIME_STRING_LENGTH * 2 + 1 + 1);
- memcpy(&startTime, &(task->StartTime), sizeof(MYTIME));
- memcpy(&endTime, &(task->EndTime), sizeof(MYTIME));
- if (startTime.nYear == seletedDate->nYear && startTime.nMonth == seletedDate->nMonth && startTime.nDay == seletedDate->nDay)
- {
- IsStartDay = MMI_TRUE;
- }
- /* start time */
- if (task->Type == TDL_TASK_REMINDER && g_tdl_freq_set[task->Repeat] == ALM_FREQ_ONCE && IsStartDay == MMI_FALSE)
- {
- sprintf((S8*) timeString, "%02d:%02d", 0, 0);
- }
- else
- {
- sprintf((S8*) timeString, "%02d:%02d", startTime.nHour, startTime.nMin);
- }
- switch (task->Type)
- {
- case TDL_TASK_MEETING:
- case TDL_TASK_COURSE:
- case TDL_TASK_REMINDER:
- /* time separator */
- timeString[CLNDR_TIME_STRING_LENGTH] = '-';
- /* end time */
- timeString2 = timeString + CLNDR_TIME_STRING_LENGTH + 1;
- if (task->Type == TDL_TASK_REMINDER && g_tdl_freq_set[task->Repeat] == ALM_FREQ_ONCE)
- {
- if (endTime.nYear != seletedDate->nYear ||
- endTime.nMonth != seletedDate->nMonth ||
- endTime.nDay != seletedDate->nDay)
- {
- sprintf((S8*) timeString2, "%02d:%02d", 23, 59);
- return;
- }
- }
- sprintf((S8*) timeString2, "%02d:%02d", endTime.nHour, endTime.nMin);
- break;
- default:
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_date_string
- * DESCRIPTION
- *
- * PARAMETERS
- * year [IN]
- * month [IN]
- * day [IN]
- * timeString [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_tdl_get_date_string(U16 year, U8 month, U8 day, S8 *timeString)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(timeString, 0, CLNDR_DATE_STRING_LENGTH + 1);
- sprintf(timeString, "%04d/%02d/%02d", year, month, day);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_next_day_redraw
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_tdl_get_next_day_redraw(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYTIME incTime;
- S8 datestring[CLNDR_DATE_STRING_LENGTH + 1]; /* yyyy/mm/dd */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check date */
- if (g_tdl_cntx.ClndrDate.nYear == CLNDR_END_YEAR && g_tdl_cntx.ClndrDate.nMonth == 12 && g_tdl_cntx.ClndrDate.nDay == 31)
- {
- DisplayPopup(
- (U8*) GetString(STR_CLNDR_OUT_OF_CALENDAR),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- return;
- }
- /* Update Date */
- memset(&incTime, 0, sizeof(MYTIME));
- incTime.nDay = 1;
- IncrementTime(g_tdl_cntx.ClndrDate, incTime, &(g_tdl_cntx.ClndrDate));
- /* Month is changed, set birthday information. */
- if (g_tdl_cntx.ClndrDate.nDay== 1)
- {
- mmi_clndr_set_birthday_table(g_tdl_cntx.ClndrDate.nYear, g_tdl_cntx.ClndrDate.nMonth);
- }
- /* Update Title */
- mmi_tdl_get_date_string(
- g_tdl_cntx.ClndrDate.nYear,
- g_tdl_cntx.ClndrDate.nMonth,
- g_tdl_cntx.ClndrDate.nDay,
- datestring);
- /* TDL Updation flag */
- g_tdl_cntx.IsListModified = TRUE;
- g_tdl_cntx.DateUpdate = 1;
- EntryTDLTaskList();
- g_tdl_cntx.DateUpdate = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_get_previous_day_redraw
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_tdl_get_previous_day_redraw(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYTIME incTime;
- S8 datestring[CLNDR_DATE_STRING_LENGTH + 1]; /* yyyy/mm/dd */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check date */
- if (g_tdl_cntx.ClndrDate.nYear == CLNDR_START_YEAR && g_tdl_cntx.ClndrDate.nMonth == 1 && g_tdl_cntx.ClndrDate.nDay == 1)
- {
- DisplayPopup(
- (U8*) GetString(STR_CLNDR_OUT_OF_CALENDAR),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- return;
- }
- /* Update Date */
- memset(&incTime, 0, sizeof(MYTIME));
- incTime.nDay = 1;
- DecrementTime(g_tdl_cntx.ClndrDate, incTime, &(g_tdl_cntx.ClndrDate));
- /* Month is changed, set birthday information. */
- #ifdef MMI_ON_WIN32
- if (g_tdl_cntx.ClndrDate.nDay== LastDayOfMonth(g_tdl_cntx.ClndrDate.nMonth, g_tdl_cntx.ClndrDate.nYear))
- {
- mmi_clndr_set_birthday_table(g_tdl_cntx.ClndrDate.nYear, g_tdl_cntx.ClndrDate.nMonth);
- }
- #else
- if (g_tdl_cntx.ClndrDate.nDay== applib_dt_last_day_of_mon(g_tdl_cntx.ClndrDate.nMonth, g_tdl_cntx.ClndrDate.nYear))
- {
- mmi_clndr_set_birthday_table(g_tdl_cntx.ClndrDate.nYear, g_tdl_cntx.ClndrDate.nMonth);
- }
- #endif
- /* Update Title */
- mmi_tdl_get_date_string(
- g_tdl_cntx.ClndrDate.nYear,
- g_tdl_cntx.ClndrDate.nMonth,
- g_tdl_cntx.ClndrDate.nDay,
- datestring);
- /* TDL Updation flag */
- g_tdl_cntx.IsListModified = TRUE;
- g_tdl_cntx.DateUpdate = 1;
- EntryTDLTaskList();
- g_tdl_cntx.DateUpdate = 0;
- }
- #else /* __MMI_ADVANCED_TODO__ */
- /*****************************************************************************
- * FUNCTION
- * EntryTDLTaskList
- * DESCRIPTION
- * Entry function of To Do List application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryTDLTaskList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i;
- S32 TotalItem = 0;
- U16 nEmptyId = STR_TODO_LIST_EMPTY;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __SYNCML_SUPPORT__
- /* popup "please wait" when syncML is executing */
- if (mmi_syncml_is_tdl_sync_now())
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_SYNC_PLEASE_WAIT),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- return;
- }
- #endif
- EntryNewScreen(SCR_TDL_TASK_LIST, ExitTDLTaskList, EntryTDLTaskList, NULL);
- if (g_tdl_cntx.IsListModified == TRUE)
- {
- #ifdef __MMI_CALENDAR_V2__
- if (g_tdl_cntx.IsCalledByCalender == CLNDR_MONTHLY_VIEW) /* Match the Date and list them */
- {
- TDLMakeListOfSelectedDate(CLNDR_MONTHLY_VIEW);
- }
- else if (g_tdl_cntx.IsCalledByCalender == CLNDR_WEEKLY_VIEW)
- {
- mmi_tdl_get_period_task();
- }
- #else /* __MMI_CALENDAR_V2__ */
- if (g_tdl_cntx.IsCalledByCalender == MMI_TRUE) /* Match the Date and list them */
- {
- TDLMakeListOfSelectedDate(MMI_TRUE);
- }
- #endif /* __MMI_CALENDAR_V2__ */
- else /* Set the Current Date and list the task in descending order. */
- {
- TDLMakeListOfAllTask();
- }
- g_tdl_cntx.IsListModified = FALSE;
- }
- TotalItem = g_tdl_cntx.TotalListedTask;
- guiBuffer = GetCurrGuiBuffer(SCR_TDL_TASK_LIST);
- SetParentHandler(0);
- RegisterHighlightHandler(HighlightTDLTaskList);
- if (TotalItem == 0) /* display <Empty> */
- {
- ShowCategory1Screen(
- STR_TODO_LIST_CAP_TASK_LIST,
- GetRootTitleIcon(ORGANIZER_TODOLIST_MENU),
- STR_TODO_LIST_ADD,
- 0,
- STR_GLOBAL_BACK,
- 0,
- 1,
- &nEmptyId,
- 0,
- guiBuffer);
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_ADD;
- SetLeftSoftkeyFunction(TdlExecEdit, KEY_EVENT_UP);
- SetKeyHandler(TdlExecEdit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- /* if task full, disable LSK */
- if (g_tdl_cntx.IsCalledByCalender)
- {
- if (TDLGetTotalItem() == NUM_OF_TDL)
- {
- ChangeLeftSoftkey(0, 0);
- SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(0, 0);
- SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- }
- else /* display list of task */
- {
- /* construct task list */
- for (i = 0; i < g_tdl_cntx.TotalListedTask; i++)
- {
- pfnUnicodeStrcpy((S8*) subMenuDataPtrs[i], (S8*) g_tdl_cntx.TaskList[g_tdl_cntx.SortedList[i]].Note);
- gTDLicon[i] = IMG_TODO_ICON;
- }
- ShowCategory84Screen(
- STR_TODO_LIST_CAP_TASK_LIST,
- GetRootTitleIcon(ORGANIZER_TODOLIST_MENU),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- TotalItem,
- (U8 **) subMenuDataPtrs,
- (U16*) gTDLicon,
- 0,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(EntryTDLTaskListOption, KEY_EVENT_UP);
- SetKeyHandler(EntryTDLTaskListOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- if (mmi_jmms_is_from_jmms() > 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- SetLeftSoftkeyFunction(mmi_jmms_insert_vcal_tdl, KEY_EVENT_UP);
- SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */
- }
- /* Register function for right soft key */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* __MMI_ADVANCED_TODO__ */
- /*****************************************************************************
- * FUNCTION
- * ExitTDLTaskList
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitTDLTaskList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_ADVANCED_TODO__
- mmi_clndr_set_date(&g_tdl_cntx.ClndrDate);
- #endif
- #ifdef __MMI_BIRTHDAY_REMINDER__
- mmi_tdl_destruct_birthday_memory();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * TdlExecView
- * DESCRIPTION
- * Execute View option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TdlExecView(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_tdl_cntx.TotalListedTask != 0)
- {
- g_tdl_cntx.CurrTaskIndex = g_tdl_cntx.SortedList[g_tdl_cntx.CurrSelectedTask];
- }
- g_tdl_cntx.SelectedItemInView = 0;
- TDLInitInlineVariables();
- EntryTDLViewTask();
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTdlView
- * DESCRIPTION
- * Highlight handler of View option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTdlView(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_VIEW;
- SetLeftSoftkeyFunction(TdlExecView, KEY_EVENT_UP);
- SetKeyHandler(TdlExecView, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * TdlExecEdit
- * DESCRIPTION
- * Execute Edit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TdlExecEdit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_tdl_cntx.TotalListedTask != 0)
- {
- g_tdl_cntx.CurrTaskIndex = g_tdl_cntx.SortedList[g_tdl_cntx.CurrSelectedTask];
- }
- g_tdl_cntx.IsDOWSet = 0;
- g_tdl_cntx.SelectedItemInView = 0;
- TDLInitInlineVariables();
- EntryTDLEditTask();
- }
- /*****************************************************************************
- * FUNCTION
- * TdlExecDelete
- * DESCRIPTION
- * Execute Delete option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TdlExecDelete(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_tdl_cntx.TotalListedTask != 0)
- {
- g_tdl_cntx.CurrTaskIndex = g_tdl_cntx.SortedList[g_tdl_cntx.CurrSelectedTask];
- }
- EntryTDLDelete();
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTdlEdit
- * DESCRIPTION
- * Highlight handler of Edit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTdlEdit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_EDIT;
- SetLeftSoftkeyFunction(TdlExecEdit, KEY_EVENT_UP);
- SetKeyHandler(TdlExecEdit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTdlAdd
- * DESCRIPTION
- * Highlight handler of Add option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTdlAdd(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_ADD;
- #ifdef __MMI_ADVANCED_TODO__
- SetLeftSoftkeyFunction(mmi_tdl_entry_select_task_type, KEY_EVENT_UP);
- SetKeyHandler(mmi_tdl_entry_select_task_type, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #else /* __MMI_ADVANCED_TODO__ */
- SetLeftSoftkeyFunction(TdlExecEdit, KEY_EVENT_UP);
- SetKeyHandler(TdlExecEdit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #endif /* __MMI_ADVANCED_TODO__ */
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTdlDelete
- * DESCRIPTION
- * Highlight handler of Delete option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTdlDelete(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_DELETE;
- SetLeftSoftkeyFunction(TdlExecDelete, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTdlDeleteAll
- * DESCRIPTION
- * Highlight handler of Delete All option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTdlDeleteAll(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_DELETE_ALL;
- SetLeftSoftkeyFunction(EntryTDLDeleteAll, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryTDLTaskListOption
- * DESCRIPTION
- * Show option list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryTDLTaskListOption(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[6]; /* Stores the strings id of submenus returned */
- U16 nNumofItem; /* Stores no of children in the submenu */
- U16 MenuId;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_TDL_OPTION_LIST, NULL, EntryTDLTaskListOption, NULL);
- /* view, add, edit, delete, delete all */
- if (TDLGetTotalItem() < NUM_OF_TDL)
- {
- MenuId = MITEM_TODO_LIST_TASK_OPTION_1;
- }
- else /* view, edit, delete, delete all */
- {
- MenuId = MITEM_TODO_LIST_TASK_OPTION_2;
- }
- nNumofItem = GetNumOfChild(MenuId);
- GetSequenceStringIds(MenuId, nStrItemList);
- SetParentHandler(MenuId);
- guiBuffer = GetCurrGuiBuffer(SCR_TDL_OPTION_LIST);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- #if defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P)
- if (mmi_bootup_is_sim_valid() == MMI_FALSE
- #ifdef __FLIGHT_MODE_SUPPORT__
- || mmi_bootup_get_active_flight_mode() == 1
- #endif
- ) /* diamond, 2005/09/19 hide this item in flight mode */
- nNumofItem--;
- #endif /* defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P) */
- ShowCategory15Screen(
- STR_TODO_LIST_CAP_OPTION,
- GetRootTitleIcon(ORGANIZER_TODOLIST_MENU),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTDLViewInlineItem
- * DESCRIPTION
- * Highlight handler of items in View screen
- * Register key handlers.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTDLViewInlineItem(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.SelectedItemInView = (U8) index;
- ChangeLeftSoftkey(STR_TODO_LIST_LSK_EDIT, 0);
- SetLeftSoftkeyFunction(EditToDoListTask, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryTDLViewTask
- * DESCRIPTION
- * Display task information using an inline editor screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryTDLViewTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- U8 inline_total;
- #ifdef __MMI_ADVANCED_TODO__
- U16 ToDoList_View_icon_list[MAX_INLINE_ITEM_TODO_LIST];
- #else /* __MMI_ADVANCED_TODO__ */
- U16 ToDoList_View_icon_list[MAX_INLINE_ITEM_TODO_LIST] =
- {
- IMG_TODO_LIST_DATE, IMG_TODO_LIST_TIME, IMG_TODO_LIST_NOTE,
- 0, IMG_TODO_LIST_ALARM, 0, IMG_TODO_LIST_REPEAT, 0, 0
- };
- #endif /* __MMI_ADVANCED_TODO__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_TDL_TASK_VIEW, ExitTDLViewTask, NULL, NULL);
- InitializeCategory57Screen();
- guiBuffer = GetCurrGuiBuffer(SCR_TDL_TASK_VIEW);
- inputBuffer = GetCurrNInputBuffer(SCR_TDL_TASK_VIEW, &inputBufferSize);
- SetParentHandler(0);
- inline_total = TDLFillInlineStructForView();
- #ifdef __MMI_ADVANCED_TODO__
- memset(&ToDoList_View_icon_list, 0, sizeof(U16) * MAX_INLINE_ITEM_TODO_LIST);
- mmi_tdl_set_inline_icon(ToDoList_View_icon_list, inline_total);
- #endif /* __MMI_ADVANCED_TODO__ */
- RegisterHighlightHandler(HighlightTDLViewInlineItem);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, MAX_INLINE_ITEM_TODO_LIST, inputBuffer);
- }
- ShowCategory57Screen(
- STR_TODO_LIST_CAP_VIEW,
- GetRootTitleIcon(ORGANIZER_TODOLIST_MENU),
- STR_TODO_LIST_LSK_EDIT,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- inline_total,
- ToDoList_View_icon_list,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(mmi_tdl_task_list_goback, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * ExitTDLViewTask
- * DESCRIPTION
- * Exit function of View screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitTDLViewTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history ScrDA; /* Variable to hold the history data */
- S16 nHistory = 0;
- U16 size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- ScrDA.scrnID = SCR_TDL_TASK_VIEW;
- ScrDA.entryFuncPtr = EntryTDLViewTask;
- pfnUnicodeStrcpy((S8*) ScrDA.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(ScrDA.guiBuffer);
- size = (U16) GetCategory57DataSize();
- GetCategory57Data((U8*) ScrDA.inputBuffer);
- AddNHistory(ScrDA, size);
- }
- /*****************************************************************************
- * FUNCTION
- * EditToDoListTask
- * DESCRIPTION
- * Edit to do list task from View screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EditToDoListTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_tdl_cntx.CurrHiliteOption = TODO_LIST_TASK_OPTION_EDIT;
- EntryTDLEditTask();
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightTDLEditInlineItem
- * DESCRIPTION
- * Highlight handler of edit task screen.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightTDLEditInlineItem(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_ADVANCED_TODO__
- if (index == g_tdl_cntx.NoteIndex || index == g_tdl_cntx.LocationIndex)
- {
- g_tdl_cntx.HilitedInlineEditor = index;
- if (index == g_tdl_cntx.LocationIndex)
- {
- pfnUnicodeStrcpy(glocationString, g_tdl_cntx.LocationBuff);
- }
- else
- {
- pfnUnicodeStrcpy(gnoteString, g_tdl_cntx.NoteBuff);
- }
- ChangeLeftSoftkey(STR_TODO_LIST_LSK_EDIT, 0);
- SetLeftSoftkeyFunction(EntryTDLEditNote, KEY_EVENT_UP);
- }
- #else /* __MMI_ADVANCED_TODO__ */
- if (index == g_tdl_cntx.NoteIndex)
- {
- pfnUnicodeStrcpy(gnoteString, g_tdl_cntx.NoteBuff);
- ChangeLeftSoftkey(STR_TODO_LIST_LSK_EDIT, 0);
- SetLeftSoftkeyFunction(EntryTDLEditNote, KEY_EVENT_UP);
- }
- #endif /* __MMI_ADVANCED_TODO__ */
- #if defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P)
- if (g_tdl_cntx.CurrHiliteOption == TODO_FROM_FMGR || g_tdl_cntx.CurrHiliteOption == TODO_FROM_NETWORK)
- {
- ChangeRightSoftkey(STR_GLOBAL_DONE, 0);
- SetRightSoftkeyFunction(EntryTDLSaveConfirm, KEY_EVENT_UP);
- }
- #endif /* defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P) */
- }
- /*****************************************************************************
- * FUNCTION
- * EntryTDLEditTask
- * DESCRIPTION
- * Entry edit task screen of To Do List.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryTDLEditTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- U8 inline_total;
- #ifdef __MMI_ADVANCED_TODO__
- U16 ToDoList_View_icon_list[MAX_INLINE_ITEM_TODO_LIST];
- #else /* __MMI_ADVANCED_TODO__ */
- U16 ToDoList_View_icon_list[MAX_INLINE_ITEM_TODO_LIST] =
- {
- IMG_TODO_LIST_DATE, IMG_TODO_LIST_TIME, IMG_TODO_LIST_NOTE,
- 0, IMG_TODO_LIST_ALARM, 0, IMG_TODO_LIST_REPEAT, 0, 0
- };
- #endif /* __MMI_ADVANCED_TODO__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __SYNCML_SUPPORT__
- /* popup "please wait" when syncML is executing */
- if (mmi_syncml_is_tdl_sync_now())
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_SYNC_PLEASE_WAIT),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- return;
- }
- #endif
- EntryNewScreen(SCR_TDL_TASK_EDIT, ExitTDLEditTask, NULL, NULL);
- InitializeCategory57Screen();
- guiBuffer = GetCurrGuiBuffer(SCR_TDL_TASK_EDIT);
- inputBuffer = GetCurrNInputBuffer(SCR_TDL_TASK_EDIT, &inputBufferSize);
- SetParentHandler(0);
- inline_total = TDLFillInlineStruct();
- #ifdef __MMI_ADVANCED_TODO__
- memset(&ToDoList_View_icon_list, 0, sizeof(U16) * MAX_INLINE_ITEM_TODO_LIST);
- mmi_tdl_set_inline_icon(ToDoList_View_icon_list, inline_total);
- #endif /* __MMI_ADVANCED_TODO__ */
- RegisterHighlightHandler(HighlightTDLEditInlineItem);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, MAX_INLINE_ITEM_TODO_LIST, inputBuffer);
- }
- if (TDLIsTaskChanged() && GetInlineDoneFlag(guiBuffer) == 0)
- {
- SetInlineDoneFlag(guiBuffer);
- }
- ShowCategory57Screen(
- STR_TODO_LIST_LSK_EDIT,
- GetRootTitleIcon(ORGANIZER_TODOLIST_MENU),
- STR_TODO_LIST_LSK_EDIT,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- inline_total,
- ToDoList_View_icon_list,
- wgui_inline_items,
- g_tdl_cntx.SelectedItemInView,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(EntryTDLSaveConfirm, GoBackHistory);
- #if defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P)
- if (g_tdl_cntx.CurrHiliteOption == TODO_FROM_FMGR)
- {
- ChangeRightSoftkey(STR_GLOBAL_DONE, IMG_GLOBAL_BACK);
- SetRightSoftkeyFunction(EntryTDLSaveConfirm, KEY_EVENT_UP);
- }
- #endif /* defined(__MMI_VCALENDAR__) && defined(MMI_ON_HARDWARE_P) */
- }
- /*****************************************************************************
- * FUNCTION
- * ExitTDLEditTask
- * DESCRIPTION
- * Exit function of edit task screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitTDLEditTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history ScrDA; /* Variable to hold the history data */
- S16 nHistory = 0;
- U16 size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- ScrDA.scrnID = SCR_TDL_TASK_EDIT;
- ScrDA.entryFuncPtr = EntryTDLEditTask;
- pfnUnicodeStrcpy((S8*) ScrDA.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(ScrDA.guiBuffer);
- size = (U16) GetCategory57DataSize();
- GetCategory57Data((U8*) ScrDA.inputBuffer);
- AddNHistory(ScrDA, size);
- }
- /*****************************************************************************
- * FUNCTION
- * TDLGotoListOrOptionScreen
- * DESCRIPTION
- * Go back to task list or option screen when giving up save.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TDLGotoListOrOptionScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_tdl_cntx.TotalListedTask == 0)
- {
- GoBackToHistory(SCR_TDL_TASK_LIST);
- }
- else
- {
- GoBackToHistory(SCR_TDL_OPTION_LIST);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_tdl_is_valid_fields
- * DESCRIPTION
- * Retrieve user input from inline editor screen and save to global context.
- * PARAMETERS
- * tdlItem [?]
- * RETURNS
- * void
- *****************************************************************************/
- U16 mmi_tdl_is_valid_fields(ToDoListNode *tdlItem)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- TIME_EQUALITY equality;
- MMI_TDL_ERROR_ENUM errorCode = MMI_TDL_SUCCESS;
- MYTIME currTime;
- #ifdef __MMI_ADVANCED_TODO__
- MYTIME incTime, alarmTime;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GetDateTime(&currTime);
- #ifdef __MMI_ADVANCED_TODO__
- memset(&incTime, 0, sizeof(MYTIME));
- memcpy(&alarmTime, tdlItem, sizeof(MYTIME));
- mmi_tdl_compute_reminder_time(tdlItem, &incTime);
- #ifdef MMI_ON_WIN32
- DecrementTime(alarmTime, incTime, &alarmTime);
- #else
- applib_dt_decrease_time(
- (applib_time_struct*) & alarmTime,
- (applib_time_struct*) & incTime,
- (applib_time_struct*) & alarmTime);
- #endif
- equality = CompareTime(alarmTime, currTime, NULL);
- #else /* __MMI_ADVANCED_TODO__ */
- equality = CompareTime(tdlItem->StartTime, currTime, NULL);
- #endif /* __MMI_ADVANCED_TODO__ */
- /* Check note */
- if (pfnUnicodeStrlen((S8*) tdlItem->Note) == 0)
- {
- return MMI_TDL_INVALID_NOTES;
- }
- /* Check alarm */
- if (tdlItem->Alarm >= TODO_LIST_ALARM_TOTAL)
- {
- return MMI_TDL_INVALID_ALARM;
- }
- /* disable alarm state if already expired */
- if (g_tdl_freq_set[tdlItem->Repeat] == ALM_FREQ_ONCE && equality != TIME_GREATER) /* already expired */
- {
- if (tdlItem->Alarm >= TODO_LIST_ALARM_ON)
- {
- errorCode = MMI_TDL_EXPIRED_ALARM;
- }
- }
- /* Check repeat */
- if (tdlItem->Repeat >= TODO_FREQ_NUM)
- {
- return MMI_TDL_REPEAT_OUT_OF_BOUNDARY;
- }
- #ifdef __MMI_ADVANCED_TODO__
- /* if task duration is more than one day, repeat should set as "once" */
- if (tdlItem->Type == TDL_TASK_REMINDER &&
- (tdlItem->StartTime.nYear != tdlItem->EndTime.nYear ||tdlItem->StartTime.nMonth!= tdlItem->EndTime.nMonth || tdlItem->StartTime.nSec != tdlItem->EndTime.nSec) &&
- g_tdl_freq_set[tdlItem->Repeat] != ALM_FREQ_ONCE)
- {
- return MMI_TDL_INVALID_REPEAT;
- }
- #endif
- /* Check Days */
- if (g_tdl_freq_set[tdlItem->Repeat] == ALM_FREQ_DAYS && tdlItem->Days == 0)
- {
- tdlItem->Repeat = mmi_alm_get_freq_order(TODO_FREQ_NUM, g_tdl_freq_set, ALM_FREQ_ONCE);
- }
- return errorCode;
- }
- /*****************************************************************************
- * FUNCTION
- * TDLSaveTask
- * DESCRIPTION
- * Retrieve user input from inline editor screen and save to NVRAM.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void TDLSaveTask(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i, j;
- U8 OldStatus;
- U16 doneStr = STR_GLOBAL_DONE;
- U16 errorCode;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- i = g_tdl_cntx.CurrTaskIndex;
- /* note */
- if (pfnUnicodeStrlen(g_tdl_cntx.NoteBuff) == 0)