mmi_imps_ui.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:497k
源码类别:
MTK
开发平台:
C/C++
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_ABOUT_ME_INLINE, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_ABOUT_ME, inputBuffer);
- }
- if (imps_p->about_info->is_pic_changed && GetInlineDoneFlag(guiBuffer) == 0)
- {
- SetInlineDoneFlag(guiBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_ABOUT_ME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_ABOUT_ME,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_about_me_save, mmi_imps_about_free_mem_and_back);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_ABOUT_ME_INLINE, (HistoryDelCBPtr) mmi_imps_about_me_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_free_mem_and_back
- * DESCRIPTION
- * Free memory and go back history
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_free_mem_and_back(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_free_about_me_buff();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_del_callback
- * DESCRIPTION
- * Callback function when About Me inline editor screen is deleted.
- * PARAMETERS
- * param [IN] Parameter from framework
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_imps_about_me_del_callback(void *param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (param != (void*)MMI_TRUE)
- {
- mmi_imps_free_about_me_buff();
- }
- else if(imps_p->gen_info.curr_action == 0)
- {
- /* if it's not saving about me, free the buffer */
- mmi_imps_free_about_me_buff();
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_free_about_me_buff
- * DESCRIPTION
- * Free memory of about me screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_free_about_me_buff(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* about me buffer is not empty and currently is not updating */
- if (imps_p->about_info != NULL && imps_p->gen_info.curr_action != MSG_ID_MMI_IMPS_UPDATE_PA_REQ)
- {
- OslMfree(imps_p->about_info);
- imps_p->about_info = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_about_me
- * DESCRIPTION
- * Exit function for About Me inline editor.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_about_me(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_ABOUT_ME_INLINE, mmi_imps_entry_about_me);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_fill_inline_struct
- * DESCRIPTION
- * Fill inline editor structure of About Me screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* status */
- imps_p->about_info->status_list[0] = (U8*) GetString(STR_ID_IMPS_ONLINE);
- imps_p->about_info->status_list[1] = (U8*) GetString(STR_ID_IMPS_AWAY);
- imps_p->about_info->status_list[2] = (U8*) GetString(STR_ID_IMPS_OFFLINE);
- /* mood */
- for (i = 0; i < IMPS_NUM_MOOD; i++)
- {
- imps_p->about_info->mood_list[i] = (U8*) GetString((U16) (STR_ID_IMPS_HAPPY + i));
- }
- /* file */
- imps_p->about_info->file_sel_list[0] = (U8*) GetString(STR_GLOBAL_NONE);
- if (pfnUnicodeStrlen((S8*) imps_p->about_info->pic_name) == 0)
- {
- imps_p->about_info->file_sel_list[1] = (U8*) GetString(STR_ID_IMPS_SEL_FROM_FILE);
- }
- else
- {
- imps_p->about_info->file_sel_list[1] = (U8*) imps_p->about_info->pic_name;
- }
- /* My Profile */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_MY_PROFILE));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_MY_PROFILE,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->about_info->my_prof,
- IMPS_MAX_PA_STATUS_TEXT_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_imps_hilite_prof_full_edit);
- /* Status */
- SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_STATUS));
- SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[3], 3, imps_p->about_info->status_list, &imps_p->about_info->status);
- /* Mood */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_MOOD));
- SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[5], 11, imps_p->about_info->mood_list, &imps_p->about_info->mood);
- /* My Picture */
- SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_MY_PICTURE));
- SetInlineItemActivation(&wgui_inline_items[7], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[7], 2, imps_p->about_info->file_sel_list, &imps_p->about_info->is_pic);
- RegisterInlineSelectHighlightHandler(&wgui_inline_items[7], mmi_imps_hilite_about_me_inline_sel);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_me_inline_sel
- * DESCRIPTION
- * Highlight handler of My Picture in About Me menu
- * PARAMETERS
- * index [IN] Index of inline seletion item
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_me_inline_sel(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(0, 0);
- if (index != 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, 0);
- SetCategory57LeftSoftkeyFunction(mmi_imps_entry_about_me_sel_file);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_me_sel_file
- * DESCRIPTION
- * Entry About Me -> Select From File screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_me_sel_file(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[3]; /* only 3 options */
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ABOUT_ME_SEL_FILE, NULL, mmi_imps_entry_about_me_sel_file, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- SetParentHandler(MENU_ID_IMPS_ABOUT_ME_FILE_OPT);
- numItems = GetNumOfChild(MENU_ID_IMPS_ABOUT_ME_FILE_OPT);
- GetSequenceStringIds(MENU_ID_IMPS_ABOUT_ME_FILE_OPT, nStrItemList);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- if (pfnUnicodeStrlen((S8*) imps_p->about_info->file_buff) == 0) /* no file selected */
- {
- numItems = 1;
- }
- ShowCategory52Screen(
- STR_ID_IMPS_SEL_FILE,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_pic_sel
- * DESCRIPTION
- * Highlight handler of About Me -> Select From File -> Select File
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_pic_sel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_about_pic_sel, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_about_pic_sel, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_pic_view
- * DESCRIPTION
- * Highlight handler of About Me -> Select From File -> View
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_pic_view(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_about_pic_view, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_about_pic_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_pic_del
- * DESCRIPTION
- * Highlight handler of About Me -> Select From File -> Delete
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_pic_del(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_about_pic_del, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_pic_sel
- * DESCRIPTION
- * Entry function of About Me -> Select From File -> Delete
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_pic_sel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FMGR_FILTER filter;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- FMGR_FILTER_INIT(&filter);
- FMGR_FILTER_SET(&filter, FMGR_TYPE_BMP);
- FMGR_FILTER_SET(&filter, FMGR_TYPE_JPG);
- #if defined(GDI_USING_PNG)
- FMGR_FILTER_SET(&filter, FMGR_TYPE_PNG);
- #endif
- FMGR_FILTER_SET(&filter, FMGR_TYPE_GIF);
- FMGR_FILTER_SET(&filter, FMGR_TYPE_WBMP);
- FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
- mmi_fmgr_select_path_and_enter(APP_IMPS, FMGR_SELECT_FILE, filter, (S8*) L"root", mmi_imps_about_sel_pic_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_sel_pic_callback
- * DESCRIPTION
- * Callback function for selected image from File Manager
- * PARAMETERS
- * filePath [IN] File path+name from File Manager
- * is_short [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_sel_pic_callback(void *filePath, int is_short)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (filePath == NULL)
- {
- GoBackToHistory(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- }
- else
- {
- S32 fileLen;
- S32 f_result;
- mmi_imps_about_me_struct *about_info;
- if ((f_result = mmi_imps_util_get_file_size(filePath, &fileLen)) == FS_NO_ERROR)
- {
- if (fileLen > IMPS_MAX_PIC_SIZE)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_SIZE_TOO_LARGE);
- DeleteUptoScrID(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- return;
- }
- }
- else
- {
- mmi_imps_util_disp_err_popup(GetFileSystemErrorString(f_result));
- DeleteUptoScrID(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- return;
- }
- /* store file in buffer */
- about_info = imps_p->about_info;
- if(is_short)
- {
- mmi_chset_mixed_text_to_ucs2_str((kal_uint8*)about_info->pic_name, (FMGR_MAX_FILE_LEN + 1)*2, (kal_uint8 *)mmi_fmgr_extract_file_name((S8*) filePath), PhnsetGetDefEncodingType());
- pfnUnicodeStrcpy((S8*) about_info->file_buff, (S8*) filePath);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) about_info->file_buff, (S8*) filePath);
- pfnUnicodeStrcpy((S8*) about_info->pic_name, (S8*) mmi_fmgr_extract_file_name((S8*) filePath));
- }
- /* change RSK of signature secreen to Done */
- about_info->is_pic_changed = TRUE;
- about_info->is_pic = (S32) TRUE;
- GoBackToHistory(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_pic_view
- * DESCRIPTION
- * Entry function of About Me -> Select From File -> Delete
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_pic_view(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ABOUT_ME_VIEW_PIC, NULL, mmi_imps_entry_about_pic_view, NULL);
- ShowCategory222Screen(
- STR_GLOBAL_VIEW,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- GDI_COLOR_WHITE,
- NULL,
- (S8*) imps_p->about_info->file_buff,
- FALSE,
- NULL);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_pic_del
- * DESCRIPTION
- * Entry function of About Me -> Select From File -> Delete
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_pic_del(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->about_info->is_pic = FALSE;
- imps_p->about_info->is_pic_changed = TRUE;
- imps_p->about_info->file_buff[0] = 0;
- imps_p->about_info->file_buff[1] = 0;
- imps_p->about_info->pic_name[0] = 0;
- imps_p->about_info->pic_name[1] = 0;
- mmi_imps_util_disp_popup_done();
- DeleteUptoScrID(SCR_ID_IMPS_ABOUT_ME_SEL_FILE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_save
- * DESCRIPTION
- * LSK handler for About Me editor screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_save(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_GLOBAL_SAVE, mmi_imps_about_me_save_yes, mmi_imps_about_me_save_no);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_save_no
- * DESCRIPTION
- * Give up saving About Me
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_save_no(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DeleteUptoScrID(SCR_ID_IMPS_CONT_OPT);
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_save_yes
- * DESCRIPTION
- * Proceed saving About Me
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_save_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_about_me_struct *about_info = imps_p->about_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- /* check picture state */
- if (about_info->is_pic && pfnUnicodeStrlen((S8*) about_info->file_buff) > 0)
- {
- about_info->is_pic = TRUE;
- if (pfnUnicodeStrcmp((S8*) about_info->my_pic, (S8*) about_info->file_buff))
- {
- if (pfnUnicodeStrlen((S8*) about_info->my_pic)) /* remove previous file if exists */
- {
- FS_Delete((U16*) about_info->my_pic);
- }
- mmi_imps_util_get_img_path((S8*) about_info->my_pic);
- pfnUnicodeStrcat((S8*) about_info->my_pic, (S8*) IMPS_ABOUT_PIC_PREFIX);
- pfnUnicodeStrcat(
- (S8*) about_info->my_pic,
- (S8*) mmi_fmgr_extract_ext_file_name((S8*) about_info->file_buff));
- FS_Delete((U16*) about_info->my_pic);
- /* special case for file copy, if the user press END key before copy finished, the state will become mismatch,
- that cause us to free about_info buffer when screen is deleted */
- imps_p->gen_info.curr_action = MSG_ID_MMI_IMPS_UPDATE_PA_REQ;
- mmi_fmgr_send_copy_req(
- FMGR_ACTION_COPY,
- (U8*) about_info->file_buff,
- (U8*) about_info->my_pic,
- mmi_imps_about_save_pic_callback);
- return;
- }
- about_info->is_pic_changed = FALSE;
- }
- else
- {
- if (pfnUnicodeStrlen((S8*) about_info->my_pic)) /* remove previous file if exists */
- {
- FS_Delete((U16*) about_info->my_pic);
- about_info->my_pic[0] = 0;
- }
- about_info->is_pic = FALSE;
- about_info->is_pic_changed = TRUE;
- }
- mmi_imps_about_me_write_to_nvram();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_save_pic_callback
- * DESCRIPTION
- * Callback function for copying picture of About Me
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_save_pic_callback(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_fmt_copy_rsp_strcut *msgPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgPtr = (mmi_fmt_copy_rsp_strcut*) info;
- if (msgPtr->result >= 0)
- {
- mmi_imps_about_me_write_to_nvram();
- }
- else
- {
- imps_p->gen_info.curr_action = 0;
- mmi_imps_util_disp_err_popup(GetFileSystemErrorString(msgPtr->result));
- DeleteUptoScrID(SCR_ID_IMPS_ABOUT_ME_INLINE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_write_to_nvram
- * DESCRIPTION
- * Write About Me info to NVRAM and send request to protocol
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_write_to_nvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_nvram_struct *nvram_buff = (mmi_imps_nvram_struct*) OslMalloc(sizeof(mmi_imps_nvram_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* read data from NVRAM to sync */
- mmi_imps_util_read_nvram((void*)nvram_buff);
- /* picture */
- if (imps_p->about_info->is_pic_changed)
- {
- nvram_buff->about_me.is_pic = (U8) imps_p->about_info->is_pic;
- if (imps_p->about_info->is_pic) /* extract file extension */
- {
- pfnUnicodeStrcpy(
- (S8*) nvram_buff->about_me.pic_name,
- (S8*) imps_p->about_info->pic_name/*mmi_fmgr_extract_file_name((S8*) imps_p->about_info->file_buff)*/);
- }
- }
- /* status */
- nvram_buff->about_me.status = (U8) imps_p->about_info->status;
- nvram_buff->about_me.mood = (U8) imps_p->about_info->mood;
- /* my profile */
- pfnUnicodeStrcpy((S8*) nvram_buff->about_me.my_prof, (S8*) imps_p->about_info->my_prof);
- mmi_imps_util_write_nvram((void*)nvram_buff);
- OslMfree(nvram_buff);
- /* send request to protocol */
- #ifdef IMPS_TEST_CODE
- mmi_imps_about_me_save_done(0);
- #else
- mmi_imps_ps_update_pa_req();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_me_save_done
- * DESCRIPTION
- * Callback function when update presence response comes.
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_me_save_done(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == 0)
- {
- mmi_imps_util_disp_popup_done();
- /* update contact list of myself */
- imps_p->cont_info.cont_list[0].availability = (U8) imps_p->about_info->status;
- }
- else
- {
- /* display popup with error message */
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(result));
- }
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- /* free about me buffer */
- mmi_imps_free_about_me_buff();
- }
- else
- {
- if (result == 0)
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- }
- else
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ABOUT_ME_INLINE);
- }
- }
- }
- #define _ABOUT_FRIEND_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_friend
- * DESCRIPTION
- * Highlight handler of Contact List -> About
- * Me (Friends)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_friend(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_about_friend, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_about_friend, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_friend
- * DESCRIPTION
- * Entry function of Contact List -> About Me (Friends)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_friend(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i;
- S8 *img = NULL;
- U8 tmp_availability = IMPS_PA_USER_NOT_AVAILABLE;
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!imps_p->gen_info.auto_update_done)
- {
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
- return;
- }
- i = (S32) imps_p->cont_info.curr_cont;
- /* different contact, reset data */
- if (mmi_imps_util_is_id_same((S8*) imps_p->friend_info.id, (S8*) cont->id) == FALSE)
- {
- imps_p->friend_info.file_name[0] = 0;
- strcpy((S8*) imps_p->friend_info.id, (S8*) cont->id);
- }
- else
- {
- if (pfnUnicodeStrlen((S8*) imps_p->friend_info.file_name))
- {
- mmi_imps_util_get_img_path((S8*) imps_p->path_buff);
- pfnUnicodeStrcat((S8*) imps_p->path_buff, (S8*) imps_p->friend_info.file_name);
- img = (S8*) imps_p->path_buff;
- }
- }
- /* set to un-available when status unknown */
- if (cont->availability != IMPS_PA_USER_UNKNOWN)
- {
- tmp_availability = cont->availability;
- }
- if (pfnUnicodeStrlen((S8*) cont->nick_name) == 0)
- {
- S8 *id_buff = OslMalloc(IMPS_MAX_ID_LEN * ENCODING_LENGTH);
- AnsiiToUnicodeString((S8*) id_buff, (S8*) cont->id);
- mmi_imps_util_copy_with_dot((S8*) id_buff, (S8*) cont->nick_name, IMPS_MAX_NAME_LEN);
- OslMfree(id_buff);
- }
- EntryNewScreen(SCR_ID_IMPS_ABOUT_FRIEND, NULL, mmi_imps_entry_about_friend, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ABOUT_FRIEND);
- if (imps_p->cont_info.clear_gui_buff)
- {
- guiBuffer = NULL;
- }
- ShowCategory420Screen(
- STR_ID_IMPS_VIEW_CONT_DETAIL,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- cont->nick_name,
- img,
- IMG_ID_IMPS_ABOUT_DEFAULT,
- STR_ID_IMPS_MOOD,
- (UI_string_type) GetString((U16) (cont->mood + STR_ID_IMPS_HAPPY)),
- (PU8) GetImage((U16) (cont->mood + IMG_ID_IMPS_HAPPY)),
- STR_ID_IMPS_STATUS,
- (UI_string_type) GetString((U16) (tmp_availability + STR_ID_IMPS_ONLINE)),
- (PU8) GetImage((U16) (tmp_availability + IMG_ID_IMPS_ABOUT_ONLINE)),
- (U8*) cont->prof_text,
- (S32) pfnUnicodeStrlen((S8*) cont->prof_text),
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_imps_entry_about_friend_opt, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_about_friend_opt
- * DESCRIPTION
- * Entry optino screen of Friend's Detail
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_about_friend_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[2];
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ABOUT_FRIEND_OPT, NULL, mmi_imps_entry_about_friend_opt, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ABOUT_FRIEND_OPT);
- SetParentHandler(MENU_ID_IMPS_ABOUT_FRIEND_OPT);
- numItems = GetNumOfChild(MENU_ID_IMPS_ABOUT_FRIEND_OPT);
- GetSequenceStringIds(MENU_ID_IMPS_ABOUT_FRIEND_OPT, nStrItemList);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_friend_edit
- * DESCRIPTION
- * Highlight handler of Friend's Detail -> Option -> Edit
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_friend_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_about_friend_edit, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_about_friend_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_about_friend_refresh
- * DESCRIPTION
- * Highlight handler of Friend's Detail -> Option -> Refresh
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_about_friend_refresh(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_about_friend_refersh, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_about_friend_edit
- * DESCRIPTION
- * Pre-Entry fnuction of Friend's Detail -> Option -> Edit
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_about_friend_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pfnUnicodeStrcpy((S8*) imps_p->file_buff, (S8*) cont->nick_name);
- /* re-use input name screen */
- mmi_imps_entry_cont_input_name();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_friend_edit_done
- * DESCRIPTION
- * Proceed editing friend's name
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_friend_edit_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pfnUnicodeStrcpy((S8*) cont->nick_name, (S8*) imps_p->file_buff);
- /* should save after response back */
- /* mmi_imps_util_write_cont(); */
- mmi_imps_display_progressing();
- mmi_imps_edit_cont_req((U8*) cont->group_id, (U8*) cont->id, (S8*) cont->nick_name);
- /* force to redraw contact list */
- imps_p->cont_info.clear_gui_buff = TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_friend_edit_finish
- * DESCRIPTION
- * Result of Edit
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_friend_edit_finish(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 active_scr = GetActiveScreenId();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- * partial success, subscribe error (server not support)
- * regard it as success
- */
- if (result == IMPS_OK || result == IMPS_ERROR_SUBSCRIPTION_NOT_SUPPORT)
- {
- mmi_imps_util_write_cont();
- mmi_imps_util_disp_popup_done();
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(result));
- }
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (active_scr == SCR_ID_IMPS_PROGRESS)
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ABOUT_FRIEND);
- }
- }
- /* force to redraw contact list */
- imps_p->cont_info.clear_gui_buff = TRUE;
- imps_p->gen_info.is_reentry = FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_friend_refersh
- * DESCRIPTION
- * Refresh status of friend
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_friend_refersh(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_pre_entry_progressing(
- STR_ID_IMPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- 0,
- (U8*) GetString(STR_ID_IMPS_PROGRESSING),
- NULL,
- IMG_GLOBAL_PROGRESS,
- NULL,
- mmi_imps_about_friend_abort,
- mmi_imps_about_friend_abort);
- #ifdef IMPS_TEST_CODE
- SetKeyHandler(mmi_imps_about_friend_refresh_finish, KEY_SEND, KEY_EVENT_DOWN);
- #else
- mmi_imps_ps_get_single_pa_req((U8*) imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].id);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_friend_abort
- * DESCRIPTION
- * About refresh
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_friend_abort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_abort();
- #ifdef IMPS_TEST_CODE
- SetKeyHandler(mmi_imps_about_friend_refresh_finish, KEY_SEND, KEY_EVENT_DOWN);
- #else
- mmi_imps_abort_get_pa_req();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_about_friend_refresh_finish
- * DESCRIPTION
- * Finish refreshing status of friend
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_about_friend_refresh_finish( /* S32 result */ void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- GoBackToHistory(SCR_ID_IMPS_ABOUT_FRIEND);
- }
- else
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ABOUT_FRIEND);
- }
- /* force to redraw contact list */
- imps_p->cont_info.clear_gui_buff = TRUE;
- }
- #define SORT_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_sort_save
- * DESCRIPTION
- * Save sorting type to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_sort_save(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_nvram_struct *nvram_buff = (mmi_imps_nvram_struct*) OslMalloc(sizeof(mmi_imps_nvram_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* read data from NVRAM */
- mmi_imps_util_read_nvram((void*)nvram_buff);
- nvram_buff->sort_type = (U8) imps_p->cont_info.sort_type;
- mmi_imps_util_write_nvram((void*)nvram_buff);
- OslMfree(nvram_buff);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_sort
- * DESCRIPTION
- * Highlight handler of Contact List -> Sort option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_sort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_sort, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_sort, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_sort
- * DESCRIPTION
- * Entry function of Contact List -> Sort option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_sort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[3]; /* only Login and Profile Setting */
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!imps_p->gen_info.auto_update_done)
- {
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
- return;
- }
- EntryNewScreen(SCR_ID_IMPS_SORT, NULL, mmi_imps_entry_sort, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_SORT);
- SetParentHandler(MENU_ID_IMPS_CONT_SORT);
- numItems = GetNumOfChild(MENU_ID_IMPS_CONT_SORT);
- GetSequenceStringIds(MENU_ID_IMPS_CONT_SORT, nStrItemList);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_ID_IMPS_SORT_LIST,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_sort_by_name
- * DESCRIPTION
- * Highlight handler of Contact List -> Sort -> By Name option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_sort_by_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_sort_by_name, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_sort_by_name
- * DESCRIPTION
- * Handler of Contact List -> Sort -> By Name option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_sort_by_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->cont_info.sort_type = IMPS_SORT_BY_NAME;
- mmi_imps_sort_save();
- imps_p->cont_info.clear_gui_buff = TRUE;
- GoBackToHistory(SCR_ID_IMPS_CONT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_sort_by_status
- * DESCRIPTION
- * Highlight handler of Contact List -> Sort -> By Status option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_sort_by_status(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_sort_by_status, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_sort_by_status
- * DESCRIPTION
- * Handler of Contact List -> Sort -> By Status option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_sort_by_status(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->cont_info.sort_type = IMPS_SORT_BY_STATUS;
- mmi_imps_sort_save();
- imps_p->cont_info.clear_gui_buff = TRUE;
- GoBackToHistory(SCR_ID_IMPS_CONT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_sort_by_group
- * DESCRIPTION
- * Highlight handler of Contact List -> Sort -> By Group option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_sort_by_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_sort_by_group, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_sort_by_group
- * DESCRIPTION
- * Handler of Contact List -> Sort -> By Group option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_sort_by_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->cont_info.sort_type = IMPS_SORT_BY_GROUP;
- mmi_imps_sort_save();
- imps_p->cont_info.clear_gui_buff = TRUE;
- GoBackToHistory(SCR_ID_IMPS_CONT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_sort_list
- * DESCRIPTION
- * Sort contact list according to selecting criterion
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_sort_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (imps_p->cont_info.sort_type)
- {
- case IMPS_SORT_BY_STATUS:
- mmi_imps_sort_by_status();
- break;
- case IMPS_SORT_BY_GROUP:
- mmi_imps_sort_by_group();
- break;
- default: /* case IMPS_SORT_BY_NAME: */
- mmi_imps_sort_by_name();
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_sort_by_name
- * DESCRIPTION
- * Sort list by name
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_sort_by_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- S32 count = (S32) imps_p->cont_info.no_cont;
- mmi_imps_cont_struct *cont_buff = (mmi_imps_cont_struct*) OslMalloc(sizeof(mmi_imps_cont_struct));
- S8 *str1, *str2;
- S8 *str_buff1 = OslMalloc(IMPS_MAX_ID_LEN * ENCODING_LENGTH);
- S8 *str_buff2 = OslMalloc(IMPS_MAX_ID_LEN * ENCODING_LENGTH);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 1; i < count; i++)
- {
- for (j = 1; j < count; j++)
- {
- if (i >= j)
- {
- continue;
- }
- /* compare alais first */
- if (strlen((S8*) imps_p->cont_info.cont_list[i].nick_name))
- {
- str1 = (S8*) imps_p->cont_info.cont_list[i].nick_name;
- }
- else
- {
- AnsiiToUnicodeString(str_buff1, (S8*) imps_p->cont_info.cont_list[i].id);
- str1 = str_buff1;
- }
- /* compare alais first */
- if (strlen((S8*) imps_p->cont_info.cont_list[j].nick_name))
- {
- str2 = (S8*) imps_p->cont_info.cont_list[j].nick_name;
- }
- else
- {
- AnsiiToUnicodeString(str_buff2, (S8*) imps_p->cont_info.cont_list[j].id);
- str2 = str_buff2;
- }
- if ((pfnUnicodeStrcmp((S8*) str1, (S8*) str2) > 0))
- {
- memcpy(cont_buff, &imps_p->cont_info.cont_list[j], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[j], &imps_p->cont_info.cont_list[i], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[i], cont_buff, sizeof(mmi_imps_cont_struct));
- }
- }
- }
- OslMfree(cont_buff);
- OslMfree(str_buff1);
- OslMfree(str_buff2);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_sort_by_status
- * DESCRIPTION
- * Sort list by status
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_sort_by_status(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- S32 count = (S32) imps_p->cont_info.no_cont;
- mmi_imps_cont_struct *cont_buff = (mmi_imps_cont_struct*) OslMalloc(sizeof(mmi_imps_cont_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 1; i < count; i++)
- {
- for (j = 1; j < count; j++)
- {
- if ((imps_p->cont_info.cont_list[i].availability > imps_p->cont_info.cont_list[j].availability) && i < j)
- {
- memcpy(cont_buff, &imps_p->cont_info.cont_list[j], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[j], &imps_p->cont_info.cont_list[i], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[i], cont_buff, sizeof(mmi_imps_cont_struct));
- }
- }
- }
- OslMfree(cont_buff);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_sort_by_group
- * DESCRIPTION
- * Sort list by group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_sort_by_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- S32 count = (S32) imps_p->cont_info.no_cont;
- mmi_imps_cont_struct *cont_buff = (mmi_imps_cont_struct*) OslMalloc(sizeof(mmi_imps_cont_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 1; i < count; i++)
- {
- for (j = 1; j < count; j++)
- {
- if (strcmp((S8*) imps_p->cont_info.cont_list[i].group_id, (S8*) imps_p->cont_info.cont_list[j].group_id) >
- 0 && i < j)
- {
- memcpy(cont_buff, &imps_p->cont_info.cont_list[j], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[j], &imps_p->cont_info.cont_list[i], sizeof(mmi_imps_cont_struct));
- memcpy(&imps_p->cont_info.cont_list[i], cont_buff, sizeof(mmi_imps_cont_struct));
- }
- }
- }
- OslMfree(cont_buff);
- }
- #define ADD_CONTACT
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_add_cont
- * DESCRIPTION
- * Highlight handler of Contact List -> Add Contact option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_add_cont(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_add_cont, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_add_cont, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_add_cont
- * DESCRIPTION
- * Display available option for Add Contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_add_cont(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[3];
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!imps_p->gen_info.auto_update_done)
- {
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
- return;
- }
- else if (imps_p->cont_info.no_cont == IMPS_MAX_NO_CONT)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CONT_FULL);
- return;
- }
- else if (imps_p->group_info.no_group == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_NO_GROUP);
- return;
- }
- EntryNewScreen(SCR_ID_IMPS_ADD_CONT, NULL, mmi_imps_entry_add_cont, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ADD_CONT);
- SetParentHandler(MENU_ID_IMPS_CONT_ADD);
- numItems = GetNumOfChild(MENU_ID_IMPS_CONT_ADD);
- GetSequenceStringIds(MENU_ID_IMPS_CONT_ADD, nStrItemList);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_direct_search
- * DESCRIPTION
- * Highlight handler of direct search option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_direct_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_cont_search, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_cont_search, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_search_from_phb
- * DESCRIPTION
- * Highlight handler of Contact List -> Add Contact -> Search From Phonebook option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_search_from_phb(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_search_from_phb, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_search_from_phb, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_search_from_phb
- * DESCRIPTION
- * Entry function for Contact List -> Add Contact -> Search From Phonebook option
- * PARAMETERS
- * void
- * entity(?)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_search_from_phb(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_generic_enter_list(mmi_imps_search_phb_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_cont_search
- * DESCRIPTION
- * Pre-Entry function of inline editor screen for Search Contact.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_cont_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->search_data == NULL)
- {
- imps_p->search_data = (mmi_imps_search_struct*) OslMalloc(sizeof(mmi_imps_search_struct));
- }
- imps_p->search_data->username[0] = 0;
- imps_p->search_data->phone[0] = 0;
- imps_p->search_data->alias[0] = 0;
- imps_p->search_data->email[0] = 0;
- mmi_imps_entry_cont_search();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_phb_callback
- * DESCRIPTION
- * Callback function for phone book search
- * PARAMETERS
- * entity [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_phb_callback(MMI_PHB_VCARD_STRUCT *entity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (entity != NULL)
- {
- mmi_imps_search_struct *search_data;
- if (imps_p->search_data == NULL)
- {
- imps_p->search_data = (mmi_imps_search_struct*) OslMalloc(sizeof(mmi_imps_search_struct));
- imps_p->search_data->username[0] = 0;
- imps_p->search_data->phone[0] = 0;
- imps_p->search_data->alias[0] = 0;
- imps_p->search_data->email[0] = 0;
- }
- search_data = imps_p->search_data;
- if (strlen((S8*) entity->emailAddress))
- {
- AnsiiToUnicodeString((S8*) search_data->email, (S8*) entity->emailAddress);
- }
- if (strlen((S8*) entity->number))
- {
- AnsiiToUnicodeString((S8*) search_data->phone, (S8*) entity->number);
- }
- if (pfnUnicodeStrlen((S8*) entity->name))
- {
- pfnUnicodeStrcpy((S8*) search_data->alias, (S8*) entity->name);
- }
- mmi_imps_entry_cont_search();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_is_search_cont_changed
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- BOOL mmi_imps_is_search_cont_changed(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((S8*) imps_p->search_data->username) ||
- pfnUnicodeStrlen((S8*) imps_p->search_data->phone) ||
- pfnUnicodeStrlen((S8*) imps_p->search_data->alias) || pfnUnicodeStrlen((S8*) imps_p->search_data->email))
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_cont_search_item
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_cont_search_item(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index != 2) /* phone number */
- {
- if (mmi_imps_is_search_cont_changed())
- {
- ChangeRightSoftkey(STR_GLOBAL_DONE, 0);
- SetRightSoftkeyFunction(mmi_imps_entryt_search_opt, KEY_EVENT_UP);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_cont_search
- * DESCRIPTION
- * Entry inline editor screen for Search Contact.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_cont_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_CONT_SEARCH, mmi_imps_exit_cont_search, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_search_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CONT_SEARCH);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_CONT_SEARCH, &inputBufferSize);
- RegisterHighlightHandler(mmi_imps_hilite_cont_search_item);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_SEARCH_CONT, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_SEARCH_CONTACT,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_SEARCH_CONT,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_entryt_search_opt, mmi_imps_search_free_mem_n_back);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_CONT_SEARCH, (HistoryDelCBPtr) mmi_imps_search_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_cont_search
- * DESCRIPTION
- * Exit function for Search Contact screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_cont_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_CONT_SEARCH, mmi_imps_entry_cont_search);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_free_mem_n_back
- * DESCRIPTION
- * Free memory use in Search screen and go back to previous screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_free_mem_n_back(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_free_search_mem();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_free_search_mem
- * DESCRIPTION
- * Free memory of search screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_free_search_mem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->search_data != NULL)
- {
- OslMfree(imps_p->search_data);
- imps_p->search_data = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_scr_del_callback
- * DESCRIPTION
- * Function to free memory when inline editor screen is deleted.
- * PARAMETERS
- * param [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_imps_search_scr_del_callback(void *param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_free_search_mem();
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_fill_inline_struct
- * DESCRIPTION
- * Fill inline editor structure of Contact Search screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* User name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_USERNAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_USERNAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->username,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_imps_hilite_prof_full_edit);
- /* Phone Number */
- SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_PHONE_NO));
- SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemTextEdit(
- &wgui_inline_items[3],
- (U8*) imps_p->search_data->phone,
- IMPS_MAX_USER_MOBILE_PHONE_LEN,
- INPUT_TYPE_PHONE_NUMBER | INPUT_TYPE_PLUS_CHARACTER_HANDLING);
- EnableInlineItemBoundary(&wgui_inline_items[3]);
- DisableInlineItemHighlight(&wgui_inline_items[3]);
- /* Alias */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_ALIAS));
- SetInlineItemActivation(&wgui_inline_items[5], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[5],
- STR_ID_IMPS_ALIAS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->alias,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[5], mmi_imps_hilite_prof_full_edit);
- /* Email Address */
- SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_EMAIL));
- SetInlineItemActivation(&wgui_inline_items[7], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[7],
- STR_ID_IMPS_EMAIL,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->email,
- IMPS_MAX_USER_EMAIL_ADDRESS_LEN,
- INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[7], mmi_imps_hilite_prof_full_edit);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entryt_search_opt
- * DESCRIPTION
- * "Done" key handler in Search screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entryt_search_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[3];
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_SEARCH_OPT, NULL, mmi_imps_entryt_search_opt, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_SEARCH_OPT);
- SetParentHandler(MENU_ID_IMPS_SEARCH_OPT);
- numItems = GetNumOfChild(MENU_ID_IMPS_SEARCH_OPT);
- GetSequenceStringIds(MENU_ID_IMPS_SEARCH_OPT, nStrItemList);
- SetHiliteHandler(MENU_ID_IMPS_SEARCH_OPT_SEARCH, mmi_imps_hilite_search_done);
- SetHiliteHandler(MENU_ID_IMPS_SEARCH_OPT_QUIT, mmi_imps_hilite_search_quit);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_search_done
- * DESCRIPTION
- * Highlight handler of Search -> Done option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_search_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_search_start, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_start
- * DESCRIPTION
- * Start searching contact procedure
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_start(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if all the fileds are empty */
- if (pfnUnicodeStrlen((S8*) imps_p->search_data->username) == 0
- && pfnUnicodeStrlen((S8*) imps_p->search_data->phone) == 0
- && pfnUnicodeStrlen((S8*) imps_p->search_data->alias) == 0
- && pfnUnicodeStrlen((S8*) imps_p->search_data->email) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_EMPTY_INPUT);
- return;
- }
- mmi_imps_pre_entry_progressing(
- STR_ID_IMPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- 0,
- (U8*) GetString(STR_GLOBAL_SEARCH),
- NULL,
- IMG_GLOBAL_PROGRESS,
- NULL,
- mmi_imps_search_abort,
- mmi_imps_search_abort);
- /* send request to search */
- imps_p->search_result.search_cause = IMPS_SEARCH_CONT;
- /* rest previous searched data */
- imps_p->search_result.count = 0;
- #ifdef IMPS_TEST_CODE
- strcpy((S8*) imps_p->search_result.entity[0].id, (S8*) "TEST 1");
- AnsiiToUnicodeString((S8*) imps_p->search_result.entity[0].sname, (S8*) "TEST 1");
- strcpy((S8*) imps_p->search_result.entity[1].id, (S8*) "TEST 2");
- AnsiiToUnicodeString((S8*) imps_p->search_result.entity[1].sname, (S8*) "TEST 2");
- strcpy((S8*) imps_p->search_result.entity[2].id, (S8*) "TEST 3");
- AnsiiToUnicodeString((S8*) imps_p->search_result.entity[2].sname, (S8*) "TEST 3");
- imps_p->search_result.count = 3;
- SetKeyHandler(mmi_imps_test_search_complete, KEY_SEND, KEY_EVENT_DOWN);
- #else /* IMPS_TEST_CODE */
- mmi_imps_ps_search_req(IMPS_SEARCH_CONT);
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_search_quit
- * DESCRIPTION
- * Highlight handler of Search -> Quit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_search_quit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_search_quit, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_quit
- * DESCRIPTION
- * Quit search procedure
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_quit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBackToHistory(SCR_ID_IMPS_ADD_CONT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_search_abort
- * DESCRIPTION
- * Abort searching process
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_search_abort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_abort();
- #ifdef IMPS_TEST_CODE
- SetKeyHandler(mmi_imps_abort_search_finish, KEY_SEND, KEY_EVENT_DOWN);
- #else
- mmi_imps_ps_abort_search_req();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_abort_search_finish
- * DESCRIPTION
- * Finish aborting search process.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_abort_search_finish(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (imps_p->search_result.count) /* some result already came back */
- {
- mmi_imps_entry_search_result();
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ADD_CONT);
- }
- else
- {
- U16 end_menu;
- if (imps_p->search_result.search_cause == IMPS_SEARCH_WATCHER)
- {
- end_menu = SCR_ID_IMPS_CONT_OPT;
- }
- else
- {
- end_menu = SCR_ID_IMPS_SEARCH_OPT;
- }
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- GoBackToHistory(end_menu);
- }
- else
- {
- mmi_imps_util_del_scr_after_progress(end_menu);
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_search_result
- * DESCRIPTION
- * Display list of search result
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_search_result(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i;
- S32 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- count = (S32) imps_p->search_result.count;
- if (count == 0)
- {
- mmi_imps_util_disp_empty_popup();
- return;
- }
- for (i = 0; i < count; i++)
- {
- mmi_imps_util_ansi_2_ucs2_menu(
- (S8*) imps_p->search_result.entity[i].id,
- (S8*) subMenuData[i],
- MAX_SUBMENU_CHARACTERS);
- mmi_imps_util_generate_name_hint((S8*) imps_p->search_result.entity[i].sname, i, MAX_SUBMENU_CHARACTERS);
- subMenuDataPtrs[i] = subMenuData[i];
- }
- EntryNewScreen(SCR_ID_IMPS_SEARCH_RESULT, NULL, mmi_imps_entry_search_result, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_SEARCH_RESULT);
- SetParentHandler(0);
- RegisterHighlightHandler(mmi_imps_hilite_search_result);
- ShowCategory53Screen(
- STR_ID_IMPS_SEARCH_RESULT,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_ADD,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- count,
- (U8 **) subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- (U8 **) hintDataPtrs,
- 0,
- 0,
- guiBuffer);
- if (imps_p->search_result.search_cause == IMPS_SEARCH_ROOM)
- {
- ChangeLeftSoftkey(STR_ID_IMPS_JOIN, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_join, KEY_EVENT_UP);
- }
- else /* search chat room */
- {
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_sel_group, KEY_EVENT_UP);
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_search_result
- * DESCRIPTION
- * Highlight handler of result list. Store index of current selecting item.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_search_result(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->search_result.curr_item = (U8) index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_sel_group
- * DESCRIPTION
- * Pre-Entry function for selecting group when adding new contacts
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_sel_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_imps_util_is_cont_exist((S8*) imps_p->search_result.entity[imps_p->search_result.curr_item].id))
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_CONTACT_EXIST);
- return;
- }
- /* display list of groups */
- mmi_imps_entry_sel_group();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_sel_group
- * DESCRIPTION
- * List of group for the user to select
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_sel_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i;
- mmi_imps_group_struct *group;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_SELECT_GROUP, NULL, mmi_imps_entry_sel_group, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_SELECT_GROUP);
- SetParentHandler(0);
- RegisterHighlightHandler(mmi_imps_hilite_sel_group);
- for (i = 0; i < (S32) imps_p->group_info.no_group; i++)
- {
- group = &imps_p->group_info.group_list[i];
- /* if group name is not empty */
- if (pfnUnicodeStrlen((S8*) group->group_name))
- {
- mmi_imps_util_copy_with_dot((S8*) group->group_name, (S8*) subMenuData[i], MAX_SUBMENU_CHARACTERS);
- }
- else
- {
- mmi_imps_util_ansi_2_ucs2_menu((S8*) group->group_id, (S8*) subMenuData[i], MAX_SUBMENU_CHARACTERS);
- }
- mmi_imps_util_generate_name_hint((S8*) NULL, i, MAX_SUBMENU_CHARACTERS);
- subMenuDataPtrs[i] = subMenuData[i];
- }
- ShowCategory53Screen(
- STR_ID_IMPS_SELECT_GROUP,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (S32) imps_p->group_info.no_group,
- (U8 **) subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- (U8 **) hintDataPtrs,
- 0,
- 0,
- guiBuffer);
- /* entry from search contact or watcher list */
- if (IsScreenPresent(SCR_ID_IMPS_SEARCH_RESULT) || IsScreenPresent(SCR_ID_IMPS_WATCHER_LIST))
- {
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_input_name, KEY_EVENT_UP);
- }
- else
- {
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_add_direct, KEY_EVENT_UP);
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_sel_group
- * DESCRIPTION
- * Highlight handler of group list for selecting item.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_sel_group(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->group_info.curr_item = (U8) index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_input_name
- * DESCRIPTION
- * Pre-entry function of input name screen when adding contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_input_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if group full */
- if (imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users == IMPS_MAX_ENTITY_NUMBER)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CONT_LIST_FULL);
- }
- else
- {
- mmi_imps_entity_struct *sel_entity = &imps_p->search_result.entity[imps_p->search_result.curr_item];
- /* alias */
- if (pfnUnicodeStrlen((S8*) sel_entity->sname))
- {
- pfnUnicodeStrcpy((S8*) imps_p->file_buff, (S8*) sel_entity->sname);
- }
- else
- {
- imps_p->file_buff[0] = 0;
- }
- mmi_imps_entry_cont_input_name();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_cont_input_name
- * DESCRIPTION
- * Input display name of contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_cont_input_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ADD_CONT_INPUT_NAME, NULL, mmi_imps_entry_cont_input_name, NULL);
- SetParentHandler(0);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ADD_CONT_INPUT_NAME);
- /* reuse file_buff */
- ShowCategory5Screen(
- STR_ID_IMPS_DISPLAY_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
- (U8*) imps_p->file_buff,
- IMPS_MAX_NAME_LEN,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_imps_entry_add_cont_input_name_opt, KEY_EVENT_UP);
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_add_cont_input_name_opt
- * DESCRIPTION
- * Option screen for input name option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_add_cont_input_name_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[2];
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ADD_CONT_INPUT_NAME_OPT, NULL, mmi_imps_entry_add_cont_input_name_opt, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ADD_CONT_INPUT_NAME_OPT);
- SetParentHandler(MENU_ID_IMPS_CONT_ADD_NAME_OPT);
- numItems = GetNumOfChild(MENU_ID_IMPS_CONT_ADD_NAME_OPT);
- GetSequenceStringIds(MENU_ID_IMPS_CONT_ADD_NAME_OPT, nStrItemList);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_input_name_opt_done
- * DESCRIPTION
- * Start adding contact list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_input_name_opt_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (IsScreenPresent(SCR_ID_IMPS_ABOUT_FRIEND)) /* about friend */
- {
- SetLeftSoftkeyFunction(mmi_imps_about_friend_edit_done, KEY_EVENT_UP);
- }
- else /* add contact list */
- {
- SetLeftSoftkeyFunction(mmi_imps_add_cont_done, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_add_cont_done
- * DESCRIPTION
- * Start adding contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_add_cont_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* display progressing screen */
- mmi_imps_display_progressing();
- imps_p->cont_info.add_type = IMPS_ADD_CONT_SEARCH;
- #ifdef IMPS_TEST_CODE
- mmi_imps_add_cont_finished(0);
- #else /* IMPS_TEST_CODE */
- mmi_imps_add_cont_req(
- imps_p->group_info.group_list[imps_p->group_info.curr_item].group_id,
- imps_p->search_result.entity[imps_p->search_result.curr_item].id,
- (S8*) imps_p->file_buff);
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_add_cont_finished
- * DESCRIPTION
- * Callback function when finishing adding a contact
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_add_cont_finished(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- * partial success, subscribe error (server not support)
- * regard it as success
- */
- if (result == 0 || result == IMPS_ERROR_SUBSCRIPTION_NOT_SUPPORT) /* IMPS_OK */
- {
- /* add contact to local-saved file */
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[imps_p->cont_info.no_cont];
- mmi_imps_entity_struct *sel_entity;
- memset(cont, 0, sizeof(mmi_imps_cont_struct));
- /* contact id */
- if (imps_p->cont_info.add_type == IMPS_ADD_CONT_SEARCH)
- {
- sel_entity = &imps_p->search_result.entity[imps_p->search_result.curr_item];
- strcpy((S8*) cont->id, (S8*) sel_entity->id);
- }
- else
- {
- UnicodeToAnsii((S8*) cont->id, (S8*) imps_p->path_buff);
- }
- if (pfnUnicodeStrlen((S8*) imps_p->file_buff))
- {
- pfnUnicodeStrcpy((S8*) cont->nick_name, (S8*) imps_p->file_buff);
- }
- /* status */
- cont->availability = IMPS_PA_USER_NOT_AVAILABLE;
- strcpy((S8*) cont->group_id, (S8*) imps_p->group_info.group_list[imps_p->group_info.curr_item].group_id);
- imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users++;
- MMI_ASSERT(imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users <= IMPS_MAX_ENTITY_NUMBER);
- imps_p->cont_info.no_cont++;
- mmi_imps_util_write_cont();
- /* clear gui buffer when re-entry contact list */
- imps_p->cont_info.clear_gui_buff = TRUE;
- mmi_imps_util_write_group();
- mmi_imps_util_disp_popup_done();
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(result));
- }
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (imps_p->cont_info.no_cont == IMPS_MAX_NO_CONT)
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT);
- }
- else
- {
- if (imps_p->cont_info.add_type == IMPS_ADD_CONT_SEARCH)
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_SEARCH_RESULT);
- }
- else
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_ADD_CONT);
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_add_direct
- * DESCRIPTION
- * Highlight handler of Add Contact -> Add Directly option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_add_direct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_sel_group, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_sel_group, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_add_direct
- * DESCRIPTION
- * Pre-Entry function for Add Contact -> Add Directly option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_add_direct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if group full */
- if (imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users == IMPS_MAX_ENTITY_NUMBER)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CONT_LIST_FULL);
- return;
- }
- imps_p->file_buff[0] = 0; /* reuse path and file buffer */
- pfnUnicodeStrcpy((S8*) imps_p->path_buff, g_imps_wv);
- mmi_imps_entry_add_direct();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_add_direct
- * DESCRIPTION
- * Entry Add Directly option --> input name and nick name screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_add_direct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ADD_CONT_DIRECT, mmi_imps_exit_add_direct, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_add_direct_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ADD_CONT_DIRECT);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_ADD_CONT_DIRECT, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_ADD_DIRECT, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_ADD_DIRECTLY,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_ADD_DIRECT,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_add_direct_save, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_add_direct
- * DESCRIPTION
- * Exit function for Add Directly option --> input name and nick name screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_add_direct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_ADD_CONT_DIRECT, mmi_imps_entry_add_direct);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_add_direct_fill_inline_struct
- * DESCRIPTION
- * Fill inline structure for Direct Add contact screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_add_direct_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* User name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_USERNAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_USERNAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->path_buff,
- IMPS_MAX_ID_LEN,
- INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_imps_hilite_prof_full_edit);
- /* Display Name */
- SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_DISPLAY_NAME));
- SetInlineItemActivation(&wgui_inline_items[3], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[3],
- STR_ID_IMPS_DISPLAY_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->file_buff,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[3], mmi_imps_hilite_prof_full_edit);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_add_direct_save
- * DESCRIPTION
- * Confirmation screen for adding contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_add_direct_save(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_GLOBAL_ADD, mmi_imps_add_direct_save_yes, mmi_imps_util_go_back_2_hist);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_add_direct_save_yes
- * DESCRIPTION
- * Confirm to add contact
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_add_direct_save_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *id = OslMalloc(IMPS_MAX_ID_LEN * ENCODING_LENGTH);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UnicodeToAnsii((S8*) id, (S8*) imps_p->path_buff);
- if (mmi_imps_util_is_cont_exist(id))
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_CONTACT_EXIST);
- }
- else
- {
- /* display progressing screen */
- mmi_imps_display_progressing();
- imps_p->cont_info.add_type = IMPS_ADD_CONT_DIRECT;
- #ifdef IMPS_TEST_CODE
- mmi_imps_add_cont_done(0);
- #else /* IMPS_TEST_CODE */
- mmi_imps_add_cont_req(
- imps_p->group_info.group_list[imps_p->group_info.curr_item].group_id,
- (U8*) id,
- (S8*) imps_p->file_buff);
- #endif /* IMPS_TEST_CODE */
- }
- OslMfree(id);
- }
- #define COMMON_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_display_progressing
- * DESCRIPTION
- * Common function to display "Progressing" screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_display_progressing(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_pre_entry_progressing(
- STR_ID_IMPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_ID_IMPS_PROGRESSING),
- NULL,
- IMG_GLOBAL_PROGRESS,
- NULL,
- NULL,
- NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_progressing
- * DESCRIPTION
- * Pre-entry function for progressing screen
- * PARAMETERS
- * strCaption [IN]
- * imgCaption [IN]
- * strLsk [IN]
- * imgLsk [IN]
- * strRsk [IN]
- * imgRsk [IN]
- * strBody1 [?]
- * strBody2 [?]
- * imgBody [IN]
- * lskFuncPtr [IN]
- * rskFuncPtr [IN]
- * endFuncPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_progressing(
- U16 strCaption,
- U16 imgCaption,
- U16 strLsk,
- U16 imgLsk,
- U16 strRsk,
- U16 imgRsk,
- U8 *strBody1,
- U8 *strBody2,
- U16 imgBody,
- FuncPtr lskFuncPtr,
- FuncPtr rskFuncPtr,
- FuncPtr endFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_progress_scr_struct *progress_info = &imps_p->progress_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- progress_info->strCaption = strCaption;
- progress_info->imgCaption = imgCaption;
- progress_info->strLsk = strLsk;
- progress_info->imgLsk = imgLsk;
- progress_info->strRsk = strRsk;
- progress_info->imgRsk = imgRsk;
- progress_info->strBody1 = strBody1;
- progress_info->strBody2 = strBody2;
- progress_info->imgBody = imgBody;
- progress_info->lskFuncPtr = lskFuncPtr;
- progress_info->rskFuncPtr = rskFuncPtr;
- progress_info->endFuncPtr = endFuncPtr;
- mmi_imps_entry_progressing();
- /* prevent the progressing screen being entered twice */
- DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_progressing
- * DESCRIPTION
- * Common entry function for all progressing screens.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_progressing(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- mmi_imps_progress_scr_struct *progress_info = &imps_p->progress_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_PROGRESS, NULL, mmi_imps_entry_progressing, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROGRESS);
- ShowCategory154Screen(
- progress_info->strCaption,
- progress_info->imgCaption,
- progress_info->strLsk,
- progress_info->imgLsk,
- progress_info->strRsk,
- progress_info->imgRsk,
- (U8*) progress_info->strBody1,
- (U8*) progress_info->strBody2,
- progress_info->imgBody,
- guiBuffer);
- SetLeftSoftkeyFunction(progress_info->lskFuncPtr, KEY_EVENT_UP);
- SetRightSoftkeyFunction(progress_info->rskFuncPtr, KEY_EVENT_UP);
- if (progress_info->endFuncPtr)
- {
- SetKeyHandler(progress_info->endFuncPtr, KEY_END, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_abort
- * DESCRIPTION
- * Common function to send abort request to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_abort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_pre_entry_progressing(
- STR_ID_IMPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_GLOBAL_ABORTING),
- NULL,
- IMG_GLOBAL_PROGRESS,
- NULL,
- NULL,
- NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_confirm
- * DESCRIPTION
- * Common function to display confirmation screem
- * PARAMETERS
- * msg [IN] String index of message to be displayed in confirmation screen
- * lskFuncPtr [IN] LSK handler of the confirmation screen
- * rskFuncPtr [IN] RSK handler of the confirmation screen
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_confirm(U16 msg, FuncPtr lskFuncPtr, FuncPtr rskFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,