mmi_imps_ui.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:497k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_manage_group
- * DESCRIPTION
- * Highlight handler of Manage Group option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_manage_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_group, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_group, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #ifdef IMPS_FOR_OMA_ONLY
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_subscribe
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_subscribe(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_group_struct *group = &imps_p->group_info.group_list[imps_p->group_info.curr_item];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- mmi_imps_ps_subs_group_pa_req(group->group_id);
- }
- #endif /* IMPS_FOR_OMA_ONLY */
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group
- * DESCRIPTION
- * Entry Manage Group option. Display list of groups.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i;
- S32 no_items;
- mmi_imps_group_info_struct *group_info = &imps_p->group_info;
- mmi_imps_group_struct *group;
- /*----------------------------------------------------------------*/
- /* 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_GROUP, NULL, mmi_imps_entry_group, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_GROUP);
- SetParentHandler(0);
- RegisterHighlightHandler(mmi_imps_hilite_group);
- if (group_info->no_group)
- {
- for (i = 0, no_items = 0; i < (S32) group_info->no_group; i++)
- {
- group = &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);
- no_items++;
- subMenuDataPtrs[i] = subMenuData[i];
- }
- }
- else
- {
- pfnUnicodeStrcpy((S8*) subMenuData[0], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
- no_items = 1;
- i = 0; /* i is reused for checking if the group is empty */
- hintDataPtrs[0] = NULL;
- subMenuDataPtrs[0] = subMenuData[0];
- }
- ShowCategory53Screen(
- STR_ID_IMPS_MANAGE_GROUPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (S32) no_items,
- (U8 **) subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- (U8 **) hintDataPtrs,
- 0,
- 0,
- guiBuffer);
- /* group is empty */
- if (i == 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_ADD, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_group_create, KEY_EVENT_UP);
- }
- else
- {
- SetLeftSoftkeyFunction(mmi_imps_entry_group_opt, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_group_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #ifdef IMPS_FOR_OMA_ONLY
- SetKeyHandler(mmi_imps_group_subscribe, KEY_SEND, KEY_EVENT_DOWN);
- #endif
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_group
- * DESCRIPTION
- * Highlight handler of group items
- * PARAMETERS
- * index [IN] Index of current highlighting item.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->group_info.curr_item = (U8) index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group_opt
- * DESCRIPTION
- * Display option screen of Group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[5]; /* Activate and Edit */
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_GROUP_OPT, NULL, mmi_imps_entry_group_opt, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_GROUP_OPT);
- SetParentHandler(MENU_ID_IMPS_GROUP_OPT);
- numItems = GetNumOfChild(MENU_ID_IMPS_GROUP_OPT);
- GetSequenceStringIds(MENU_ID_IMPS_GROUP_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_group_create
- * DESCRIPTION
- * Highlight handler of Group -> Create
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group_create(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_group_create, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_group_create, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_group_edit
- * DESCRIPTION
- * Highlight handler of Group -> Edit
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->group_info.is_created = FALSE;
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_group_edit, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_group_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_group_create
- * DESCRIPTION
- * Pre-Entry function of Group -> Create. Load data before entry editing screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_group_create(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->group_info.is_created = TRUE;
- mmi_imps_pre_entry_group_edit();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_group_edit
- * DESCRIPTION
- * Pre-Entry function of Group -> Edit. Load data before entry editing screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_group_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_group_info_struct *grp_info = &imps_p->group_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (grp_info->no_group == IMPS_MAX_NO_GROUP && grp_info->is_created)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CONT_LIST_FULL);
- return;
- }
- if (grp_info->inline_edit_group == NULL)
- {
- grp_info->inline_edit_group = OslMalloc(sizeof(mmi_imps_group_info_struct));
- }
- if (grp_info->is_created) /* create groupd */
- {
- memset(grp_info->inline_edit_group, 0, sizeof(mmi_imps_group_info_struct));
- }
- else /* load saved data to group */
- {
- mmi_imps_group_inline_struct *grp_edit = grp_info->inline_edit_group;
- mmi_imps_group_struct *curr_grp = &imps_p->group_info.group_list[imps_p->group_info.curr_item];
- pfnUnicodeStrcpy((S8*) grp_edit->group_name, (S8*) curr_grp->group_name);
- grp_edit->open_status = (S32) curr_grp->open_status;
- grp_edit->open_mood = (S32) curr_grp->open_mood;
- grp_edit->open_pic = (S32) curr_grp->open_pic;
- grp_edit->open_text = (S32) curr_grp->open_text;
- grp_edit->open_status = (S32) curr_grp->open_status;
- }
- /* load data of current selected group */
- mmi_imps_entry_group_edit();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group_edit
- * DESCRIPTION
- * Entry function for creating or editing a group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_GROUP_EDIT, mmi_imps_exit_group_edit, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_group_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_GROUP_EDIT);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_GROUP_EDIT, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_GROUP_EDIT, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_MANAGE_GROUPS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_GROUP_EDIT,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_group_save, mmi_imps_group_free_mem_n_back);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_GROUP_EDIT, (HistoryDelCBPtr) mmi_imps_group_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_scr_del_callback
- * DESCRIPTION
- * Function to free memory when inline editor screen is deleted.
- * PARAMETERS
- * param [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_imps_group_scr_del_callback(void *param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_group_free_mem();
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_group_edit
- * DESCRIPTION
- * Exit function for creating or editing a group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_group_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_GROUP_EDIT, mmi_imps_entry_group_edit);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_free_mem
- * DESCRIPTION
- * Free inline editor memory for group management
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_free_mem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->group_info.inline_edit_group
- && imps_p->gen_info.curr_action != MSG_ID_MMI_IMPS_ADD_CONTACT_LIST_REQ
- && imps_p->gen_info.curr_action != MSG_ID_MMI_IMPS_EDIT_CONTACT_LIST_REQ)
- {
- OslMfree(imps_p->group_info.inline_edit_group);
- imps_p->group_info.inline_edit_group = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_free_mem_n_back
- * DESCRIPTION
- * Free inline editor memory for group management and back to previous screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_free_mem_n_back(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_group_free_mem();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_fill_inline_struct
- * DESCRIPTION
- * Fill inline editor structure of a group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_group_inline_struct *inline_edit_group = imps_p->group_info.inline_edit_group;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- inline_edit_group->open_hide_list[0] = (U8*) GetString(STR_ID_IMPS_SHOW);
- inline_edit_group->open_hide_list[1] = (U8*) GetString(STR_ID_IMPS_HIDE);
- /* Name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_NAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) inline_edit_group->group_name,
- 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);
- /* Availability */
- 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], 2, inline_edit_group->open_hide_list, &inline_edit_group->open_status);
- /* My Profile */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_MY_PROFILE));
- SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[5], 2, inline_edit_group->open_hide_list, &inline_edit_group->open_text);
- /* Mood */
- SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_MOOD));
- SetInlineItemActivation(&wgui_inline_items[7], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[7], 2, inline_edit_group->open_hide_list, &inline_edit_group->open_mood);
- /* My Picture */
- SetInlineItemActivation(&wgui_inline_items[8], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[8], (U8*) GetString(STR_ID_IMPS_MY_PICTURE));
- SetInlineItemActivation(&wgui_inline_items[9], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[9], 2, inline_edit_group->open_hide_list, &inline_edit_group->open_pic);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_save
- * DESCRIPTION
- * Display confirmation screen for saving group information
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_save(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_GLOBAL_SAVE, mmi_imps_group_save_yes, mmi_imps_util_go_back_2_hist);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_save_yes
- * DESCRIPTION
- * Confirm to save group information
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_save_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_group_inline_struct *grp_edit = imps_p->group_info.inline_edit_group;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((S8*) grp_edit->group_name) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_NAME);
- return;
- }
- else if (imps_p->group_info.is_created)
- {
- if (mmi_imps_util_is_group_name_valid((S8*) grp_edit->group_name) == FALSE)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_INVALID_GROUP_NAME);
- return;
- }
- }
- /* display progressing screen for group */
- mmi_imps_display_progressing();
- #ifdef IMPS_TEST_CODE
- /* write group data to FS */
- mmi_imps_util_write_group();
- mmi_imps_util_disp_popup_done();
- DeleteUptoScrID(SCR_ID_IMPS_GROUP);
- #else /* IMPS_TEST_CODE */
- /* send request to update group information */
- if (imps_p->group_info.is_created == FALSE)
- {
- mmi_imps_ps_edit_contact_list_req();
- }
- else
- {
- mmi_imps_ps_add_contact_list_req();
- }
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_edit_done
- * DESCRIPTION
- * Callback function when finish groud edit/create
- * PARAMETERS
- * result [IN]
- * RETURNS
- * result IN error code(?)
- *****************************************************************************/
- void mmi_imps_group_edit_done(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == IMPS_OK)
- {
- /* update context */
- mmi_imps_group_inline_struct *grp_edit = imps_p->group_info.inline_edit_group;
- mmi_imps_group_struct *curr_grp;
- /* fill data to group list */
- if (imps_p->group_info.is_created) /* create groupd */
- {
- imps_p->group_info.curr_item = imps_p->group_info.no_group;
- imps_p->group_info.no_group++;
- }
- curr_grp = &imps_p->group_info.group_list[imps_p->group_info.curr_item];
- pfnUnicodeStrcpy((S8*) curr_grp->group_name, (S8*) grp_edit->group_name);
- curr_grp->open_status = (U8) grp_edit->open_status;
- curr_grp->open_mood = (U8) grp_edit->open_mood;
- curr_grp->open_pic = (U8) grp_edit->open_pic;
- curr_grp->open_text = (U8) grp_edit->open_text;
- /* generate group id */
- if (imps_p->group_info.is_created) /* create groupd */
- {
- S8 *buff = OslMalloc(IMPS_MAX_ID_LEN);
- /* generate group id */
- UnicodeToAnsii((S8*) buff, (S8*) grp_edit->group_name);
- sprintf((S8*) curr_grp->group_id, "%s/%s", imps_p->act_prof.username, buff);
- OslMfree(buff);
- curr_grp->no_users = 0;
- }
- 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
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_GROUP); /* delete screen between group list and progressing screen */
- }
- /* free dynamic alloacted buffer */
- mmi_imps_group_free_mem();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_group_del
- * DESCRIPTION
- * Highlight handler of Group -> Delete
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group_del(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_group_del, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group_del
- * DESCRIPTION
- * Display confirmation screen for deleting a group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group_del(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users > 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_GROUP_NOT_EMPTY);
- return;
- }
- mmi_imps_entry_confirm(STR_GLOBAL_DELETE, mmi_imps_group_del_yes, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_del_yes
- * DESCRIPTION
- * Proceed deleting group process
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_del_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- #ifdef IMPS_TEST_CODE
- mmi_imps_group_del_done(0);
- #else
- mmi_imps_ps_del_contact_list_req();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_del_done
- * DESCRIPTION
- * Callback function after deleting complete
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_del_done(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == 0 /* IMPS_OK */ )
- {
- S32 i = (S32) imps_p->group_info.curr_item;
- /* delete entry from RAM */
- if (i == (IMPS_MAX_NO_GROUP - 1)) /* last item */
- {
- memset(&imps_p->group_info.group_list[i], 0, sizeof(mmi_imps_group_struct));
- }
- else
- {
- memcpy(
- &imps_p->group_info.group_list[i],
- &imps_p->group_info.group_list[i + 1],
- sizeof(mmi_imps_group_struct) * (IMPS_MAX_NO_GROUP - i - 1));
- }
- imps_p->group_info.no_group--;
- mmi_imps_util_write_group();
- /* delete entry from file */
- 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
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_GROUP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_group_list_member
- * DESCRIPTION
- * Highlight handler of Group -> List Member
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group_list_member(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_group_list_member, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_group_list_member, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_group_list_member
- * DESCRIPTION
- * Pre-Entry function of Group -> List Member. Construct list to display
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_group_list_member(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- S32 no_cont = (S32) imps_p->cont_info.no_cont;
- S32 count = 0;
- U8 *group_id = &imps_p->group_info.group_list[imps_p->group_info.curr_item].group_id[0];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0, j = 0; i < no_cont; i++)
- {
- mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[i];
- if (mmi_imps_util_is_id_same((S8*) cont->group_id, (S8*) group_id))
- {
- mmi_imps_util_ansi_2_ucs2_menu((S8*) cont->id, (S8*) subMenuData[j], MAX_SUBMENU_CHARACTERS);
- subMenuDataPtrs[j] = subMenuData[j];
- mmi_imps_util_generate_name_hint((S8*) cont->nick_name, j, MAX_SUBMENU_CHARACTERS);
- count++;
- j++;
- }
- }
- imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users = (U8) j;
- mmi_imps_entry_group_list_member();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group_list_member
- * DESCRIPTION
- * Entry function of Group -> List Member
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group_list_member(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users == 0)
- {
- mmi_imps_util_disp_empty_popup();
- }
- else
- {
- U8 *guiBuffer;
- EntryNewScreen(SCR_ID_IMPS_LIST_GROUP_MEMBER, NULL, mmi_imps_entry_group_list_member, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_LIST_GROUP_MEMBER);
- SetParentHandler(0);
- ShowCategory53Screen(
- STR_ID_IMPS_LIST_MEMBER,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (S32) imps_p->group_info.group_list[imps_p->group_info.curr_item].no_users,
- (U8 **) subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- (U8 **) hintDataPtrs,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- }
- #define BLOCK_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_block_grant
- * DESCRIPTION
- * Highlight handler of Glock/Grant option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_block_grant(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_block_grant, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_block_grant
- * DESCRIPTION
- * Entry funtion of Glock/Grant option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_block_grant(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!imps_p->gen_info.auto_update_done)
- {
- mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
- return;
- }
- mmi_imps_display_progressing();
- #ifdef IMPS_TEST_CODE
- mmi_imps_block_grant_done(0);
- #else /* IMPS_TEST_CODE */
- if (imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].comm_state & IMPS_CONT_BLOCK)
- {
- mmi_imps_ps_block_entity_req(IMPS_GRANT);
- }
- else
- {
- mmi_imps_ps_block_entity_req(IMPS_BLOCK);
- }
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_block_grant_done
- * DESCRIPTION
- * Callback function when finish blocking/granting a contact
- * PARAMETERS
- * result [IN]
- * S32(?) [IN] Result of request
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_block_grant_done(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == 0 /* IMPS_OK */ )
- {
- if (imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].comm_state & IMPS_CONT_BLOCK) /* currently blocked */
- {
- imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].comm_state &= ~(IMPS_CONT_BLOCK);
- }
- else
- {
- imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].comm_state |= IMPS_CONT_BLOCK;
- }
- 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
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- }
- }
- #define ROOM_IMPS
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_reset_cntx
- * DESCRIPTION
- * Reset global context of a chat room
- * PARAMETERS
- * room [IN] Address of the conext buffer of a room
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_reset_cntx(mmi_imps_room_struct *room)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- mmi_imps_chat_session_struct *chat_session;
- mmi_imps_invite_session_struct *invite_session;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* reset chat sessions */
- for (i = 0; i < IMPS_MAX_CHAT_MSG_COUNT; i++)
- {
- chat_session = &imps_p->chat_info.chat_session[i];
- if (chat_session->session_id > 0)
- {
- if (mmi_imps_util_is_id_same((S8*) room->room_id, (S8*) chat_session->room_id)) /* session of current closed chat room */
- {
- chat_session->session_id = 0;
- chat_session->input_buff[0] = 0;
- chat_session->room_id[0] = 0;
- }
- }
- }
- /* reset invite sessions */
- for (i = 0; i < IMPS_MAX_INVITEE_SESSION; i++)
- {
- invite_session = &imps_p->invite_info.invite_session[i];
- if (invite_session->session_id > 0)
- {
- if (mmi_imps_util_is_id_same((S8*) room->room_id, (S8*) invite_session->room_id)) /* session of current closed chat room */
- {
- invite_session->session_id = 0;
- invite_session->cont_id[0] = 0;
- invite_session->room_id[0] = 0;
- }
- }
- }
- memset(room, 0, sizeof(mmi_imps_room_struct));
- room->tab_index = 0xff;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_new_room_string
- * DESCRIPTION
- * Append starting
- * PARAMETERS
- * chat_buff [IN/OUT] Buffer to store starting text.
- * room [IN] String of room index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_new_room_string(S8 *chat_buff, S8 *room)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_color_buffer_writer_struct writer;
- BOOL result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- chat_buff[0] = 0;
- chat_buff[1] = 0;
- wgui_color_buffer_create_writer(&writer, (U8*) chat_buff, IMPS_MAX_CHAT_BUFF * ENCODING_LENGTH);
- wgui_color_buffer_write_char(&writer, GUI_INPUT_COLOR_46);
- wgui_color_buffer_write_string(&writer, (U8*) GetString(STR_ID_IMPS_NEW_ROOM_CREATED), MMI_FALSE, &result);
- wgui_color_buffer_write_string(&writer, (U8*) L" [", MMI_FALSE, &result);
- wgui_color_buffer_write_string(&writer, (U8*) room, MMI_FALSE, &result);
- wgui_color_buffer_write_string(&writer, (U8*) L"]nn", MMI_FALSE, &result);
- wgui_color_buffer_write_char(&writer, GUI_INPUT_MARKER_RESET_ALL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_chat_room
- * DESCRIPTION
- * Highlight handler of Chat Rooms option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_chat_room(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_room, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_room, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room
- * DESCRIPTION
- * Entry chat room list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- S32 i, j;
- S32 count = (S32) imps_p->room_info.no_rooms;
- U16 img_list[IMPS_MAX_NO_ROOM];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_CHAT_ROOM, NULL, mmi_imps_entry_room, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CHAT_ROOM);
- SetParentHandler(0);
- RegisterHighlightHandler(mmi_imps_hilite_room);
- if (count == 0)
- {
- pfnUnicodeStrcpy((S8*) subMenuData[0], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
- img_list[0] = IMG_GLOBAL_L1;
- count = 1;
- subMenuDataPtrs[0] = subMenuData[0];
- }
- else
- {
- for (i = 0, j = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- mmi_imps_room_struct *room = &imps_p->room_info.room_list[i];
- if (room->is_used)
- {
- memset(subMenuData[j], 0, MAX_SUB_MENU_SIZE);
- mmi_imps_util_copy_with_dot((S8*) room->room_name, (S8*) subMenuDataPtrs[j], MAX_SUBMENU_CHARACTERS);
- subMenuDataPtrs[j] = subMenuData[j];
- if (room->type == IMPS_ROOM_TYPE_SINGLE)
- {
- img_list[j] = IMG_ID_IMPS_TALK_MENU;
- }
- else
- {
- img_list[j] = IMG_ID_IMPS_CHATROOM_MENU;
- }
- j++;
- }
- }
- }
- ShowCategory84Screen(
- STR_ID_IMPS_CHAT_ROOMS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- count,
- (U8 **) subMenuDataPtrs,
- (U16*) img_list,
- 0,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_imps_entry_room_opt, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_entry_room_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room
- * DESCRIPTION
- * Entry chat room list
- * PARAMETERS
- * index [IN] Index of current highlighting chat room
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->room_info.curr_item = (U8) index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room_opt
- * DESCRIPTION
- * Entry option screen for chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[5];
- U8 *guiBuffer;
- U16 menu_id;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->room_info.no_rooms == 0)
- {
- menu_id = MENU_ID_IMPS_ROOM_OPT2;
- }
- else
- {
- menu_id = MENU_ID_IMPS_ROOM_OPT;
- }
- EntryNewScreen(SCR_ID_IMPS_CHAT_ROOM_OPT, NULL, mmi_imps_entry_room_opt, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CHAT_ROOM_OPT);
- SetParentHandler(menu_id);
- numItems = GetNumOfChild(menu_id);
- GetSequenceStringIds(menu_id, 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_room_open
- * DESCRIPTION
- * Highlight handler of Chat Room -> Create
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_open(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_room_open, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_room_open, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_room_open
- * DESCRIPTION
- * Pre-Entry function for Create Room option. Reset all buffers.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_room_open(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_imps_util_get_empty_room_slot() == IMPS_MAX_NO_ROOM) /* all chat rooms are occupied */
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CHAT_ROOM_FULL);
- return;
- }
- if (imps_p->room_info.inline_open_room == NULL)
- {
- imps_p->room_info.inline_open_room = OslMalloc(sizeof(mmi_imps_room_inline_struct));
- }
- imps_p->room_info.inline_open_room->room_name[0] = 0;
- imps_p->room_info.inline_open_room->topic[0] = 0;
- imps_p->room_info.inline_open_room->welcome[0] = 0;
- imps_p->room_info.inline_open_room->sname[0] = 0;
- mmi_imps_entry_room_open();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room_open
- * DESCRIPTION
- * Inline editor screen for create/edit a chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room_open(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_CHAT_ROOM_OPEN, mmi_imps_exit_room_open, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_room_create_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CHAT_ROOM_OPEN);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_CHAT_ROOM_OPEN, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_EDIT_ROOM, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_CHAT_ROOMS,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_EDIT_ROOM,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_room_create_done, GoBackHistory);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_CHAT_ROOM_OPEN, (HistoryDelCBPtr) mmi_imps_room_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_room_open
- * DESCRIPTION
- * Exit function of Inline editor screen for create/edit a chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_room_open(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_CHAT_ROOM_OPEN, mmi_imps_entry_room_open);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_scr_del_callback
- * DESCRIPTION
- * Function to free memory when inline editor screen is deleted.
- * PARAMETERS
- * param [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_imps_room_scr_del_callback(void *param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_free_room_mem();
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_free_room_mem
- * DESCRIPTION
- * Free memory for editing room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_free_room_mem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->room_info.inline_open_room && imps_p->gen_info.curr_action != MSG_ID_MMI_IMPS_CREATE_GROUP_REQ)
- {
- OslMfree(imps_p->room_info.inline_open_room);
- imps_p->room_info.inline_open_room = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_create_fill_inline_struct
- * DESCRIPTION
- * Fill inline editor structure for Edit/Create Room screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_create_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_room_inline_struct *inline_open_room = imps_p->room_info.inline_open_room;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_CHAT_ROOM_NAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_CHAT_ROOM_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) inline_open_room->room_name,
- 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);
- /* 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*) inline_open_room->sname,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[3], mmi_imps_hilite_prof_full_edit);
- /* Topic */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_TOPIC));
- SetInlineItemActivation(&wgui_inline_items[5], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[5],
- STR_ID_IMPS_TOPIC,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) inline_open_room->topic,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[5], mmi_imps_hilite_prof_full_edit);
- /* Welcome Text */
- SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_WELCOME_TEXT));
- SetInlineItemActivation(&wgui_inline_items[7], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[7],
- STR_ID_IMPS_WELCOME_TEXT,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) inline_open_room->welcome,
- IMPS_MAX_NOTE_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[7], mmi_imps_hilite_prof_full_edit);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_create_done
- * DESCRIPTION
- * Done key handler of Room -> Edit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_create_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_GLOBAL_OPEN, mmi_imps_room_create_yes, mmi_imps_util_go_back_2_hist);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_create_yes
- * DESCRIPTION
- * Confirm to create/edit a chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_create_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((S8*) imps_p->room_info.inline_open_room->room_name) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_NAME);
- return;
- }
- else if (pfnUnicodeStrlen((S8*) imps_p->room_info.inline_open_room->sname) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_DISP_NAME);
- return;
- }
- else if (mmi_imps_util_is_group_name_valid((S8*) imps_p->room_info.inline_open_room->room_name) == FALSE)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_INVALID_GROUP_NAME);
- return;
- }
- mmi_imps_display_progressing();
- #ifdef IMPS_TEST_CODE
- mmi_imps_room_create_finish(0);
- #else /* IMPS_TEST_CODE */
- /* send request to PS */
- mmi_imps_ps_create_group_req();
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_create_finish
- * DESCRIPTION
- * Finish creating/editing a chat room
- * PARAMETERS
- * result [IN] Result of the operation
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_create_finish(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == 0 /* IMPS_OK */ )
- {
- /* finding empty chat room */
- S32 i;
- mmi_imps_room_struct *room = NULL;
- mmi_imps_room_inline_struct *inline_open_room = imps_p->room_info.inline_open_room;
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- room = &imps_p->room_info.room_list[i];
- if (room->is_used == FALSE)
- {
- break;
- }
- }
- /* shall always find an empty chat room */
- MMI_ASSERT(i < IMPS_MAX_NO_ROOM);
- memset(room, 0, sizeof(mmi_imps_room_struct));
- /* update group list */
- strcpy((S8*) room->room_id, (S8*) inline_open_room->room_id);
- pfnUnicodeStrcpy((S8*) room->room_name, (S8*) inline_open_room->room_name);
- if (pfnUnicodeStrlen((S8*) inline_open_room->topic))
- {
- pfnUnicodeStrcpy((S8*) room->room_topic, (S8*) inline_open_room->topic);
- }
- if (pfnUnicodeStrlen((S8*) inline_open_room->welcome))
- {
- pfnUnicodeStrcpy((S8*) room->welcome, (S8*) inline_open_room->welcome);
- }
- if (pfnUnicodeStrlen((S8*) inline_open_room->sname))
- {
- pfnUnicodeStrcpy((S8*) room->sname, (S8*) inline_open_room->sname);
- }
- room->is_used = TRUE;
- room->type = IMPS_ROOM_TYPE_GROUP_CREATE;
- imps_p->chat_info.curr_room = (U8) i;
- imps_p->room_info.no_rooms++;
- /* room members */
- strcpy((S8*) room->member[0].id, (S8*) imps_p->act_prof.username);
- pfnUnicodeStrcpy((S8*) room->member[0].sname, (S8*) inline_open_room->sname);
- room->no_member = 1;
- /* update display buffer */
- mmi_imps_new_room_string((S8*) room->chat_buff, (S8*) room->room_name);
- /* update list of chat rooms */
- room->tab_index = imps_p->gen_info.curr_tab = imps_p->gen_info.no_tab;
- imps_p->gen_info.no_tab++;
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- mmi_imps_entry_chat();
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- DeleteScreenIfPresent(SCR_ID_IMPS_CONT);
- }
- else
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- HistoryReplace(SCR_ID_IMPS_CONT, SCR_ID_IMPS_CHAT, mmi_imps_entry_chat);
- }
- }
- }
- 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
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CHAT_ROOM);
- }
- }
- /* free allocated memory */
- mmi_imps_free_room_mem();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room_search
- * DESCRIPTION
- * Highlight handler of Chat Room -> Search
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_room_pre_entry_search, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_room_pre_entry_search, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_pre_entry_search
- * DESCRIPTION
- * Pre-entry inline editor screen for searching chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_pre_entry_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_imps_util_get_empty_room_slot() == IMPS_MAX_NO_ROOM) /* all chat rooms are occupied */
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CHAT_ROOM_FULL);
- return;
- }
- if (imps_p->search_data == NULL)
- {
- imps_p->search_data = (mmi_imps_search_struct*) OslMalloc(sizeof(mmi_imps_search_struct));
- }
- mmi_imps_entry_room_search();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room_search
- * DESCRIPTION
- * Entry inline editor screen for searching chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_CHAT_ROOM_SEARCH, mmi_imps_exit_room_search, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_room_search_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CHAT_ROOM_SEARCH);
- if (guiBuffer == NULL) /* first time entry */
- {
- imps_p->search_data->room_name[0] = 0;
- imps_p->search_data->room_topic[0] = 0;
- imps_p->search_data->room_owner[0] = 0;
- imps_p->search_data->room_joined_user[0] = 0;
- }
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_CHAT_ROOM_SEARCH, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_SEARCH_ROOM, inputBuffer);
- }
- ShowCategory57Screen(
- STR_GLOBAL_SEARCH,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_SEARCH_ROOM,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_entryt_room_search_opt, GoBackHistory);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_CHAT_ROOM_SEARCH, (HistoryDelCBPtr) mmi_imps_search_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_room_search
- * DESCRIPTION
- * Entry inline editor screen for searching chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_room_search(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_CHAT_ROOM_SEARCH, mmi_imps_entry_room_search);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_search_fill_inline_struct
- * DESCRIPTION
- * Fill inline editor structure for searching chat room screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_search_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_CHAT_ROOM_NAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_CHAT_ROOM_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->room_name,
- 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);
- /* Topic */
- SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_TOPIC));
- SetInlineItemActivation(&wgui_inline_items[3], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[3],
- STR_ID_IMPS_TOPIC,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->room_topic,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[3], mmi_imps_hilite_prof_full_edit);
- /* Owner */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_OWNER));
- SetInlineItemActivation(&wgui_inline_items[5], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[5],
- STR_ID_IMPS_OWNER,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->room_owner,
- IMPS_MAX_ID_LEN,
- INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[5], mmi_imps_hilite_prof_full_edit);
- /* Joined User */
- SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_JOINED_USER));
- SetInlineItemActivation(&wgui_inline_items[7], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[7],
- STR_ID_IMPS_JOINED_USER,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) imps_p->search_data->room_joined_user,
- IMPS_MAX_ID_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_room_search_opt
- * DESCRIPTION
- * "Done" key handler in Chat Room Search screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entryt_room_search_opt(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 numItems;
- U16 nStrItemList[2];
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_SEARCH_OPT, NULL, mmi_imps_entryt_room_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_room_search_done);
- SetHiliteHandler(MENU_ID_IMPS_SEARCH_OPT_QUIT, mmi_imps_hilite_room_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_room_search_done
- * DESCRIPTION
- * Highlight handler of Chat Room Search -> Done option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_search_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_room_search_start, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room_search_quit
- * DESCRIPTION
- * Highlight handler of Chat Room Search -> Quit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_search_quit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_room_search_quit, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_search_start
- * DESCRIPTION
- * Start searching chat rooms
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_search_start(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((S8*) imps_p->search_data->room_name) == 0 &&
- pfnUnicodeStrlen((S8*) imps_p->search_data->room_topic) == 0 &&
- pfnUnicodeStrlen((S8*) imps_p->search_data->room_owner) == 0 &&
- pfnUnicodeStrlen((S8*) imps_p->search_data->room_joined_user) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_EMPTY_INPUT);
- return;
- }
- imps_p->search_result.search_cause = IMPS_SEARCH_ROOM;
- /* rest previous searched data */
- imps_p->search_result.count = 0;
- 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);
- #ifdef IMPS_TEST_CODE
- mmi_imps_entry_search_result();
- DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
- #else /* IMPS_TEST_CODE */
- mmi_imps_ps_search_req(IMPS_SEARCH_ROOM);
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room_close
- * DESCRIPTION
- * Highlight handler of Room List -> Close option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_close(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_room_close, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room_close
- * DESCRIPTION
- * Display confirmation screen for the user to decide close chat room of not.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room_close(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_GLOBAL_CLOSE, mmi_imps_room_close, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_close
- * DESCRIPTION
- * Handler of Room List -> Close option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_close(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- mmi_imps_room_struct *room;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* find out the location of chat room in the list */
- for (i = 0, j = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- if (imps_p->room_info.room_list[i].is_used)
- {
- if (j == (S32) imps_p->room_info.curr_item)
- {
- break;
- }
- else
- {
- j++;
- }
- }
- }
- room = &imps_p->room_info.room_list[i];
- imps_p->chat_info.curr_room = i;
- #ifndef IMPS_TEST_CODE
- /* if it's a group, shall send request to protocol */
- if (room->type == IMPS_ROOM_TYPE_GROUP_CREATE)
- {
- /* send delete group request */
- mmi_imps_display_progressing();
- mmi_imps_ps_del_group_req(room->room_id);
- }
- else if (room->type == IMPS_ROOM_TYPE_GROUP_JOIN)
- {
- /* send leave group request */
- mmi_imps_display_progressing();
- mmi_imps_ps_leave_group_req(room->room_id);
- }
- else
- {
- /*
- * single talk, close room directly,
- * for other chat rooms, because always reported as success,
- * we always clear context for all cases.
- */
- mmi_imps_room_close_finished(room);
- mmi_imps_util_disp_popup_done();
- DeleteUptoScrID(SCR_ID_IMPS_CHAT_ROOM);
- }
- #else /* IMPS_TEST_CODE */
- mmi_imps_room_close_finished(room);
- mmi_imps_util_disp_popup_done();
- DeleteUptoScrID(SCR_ID_IMPS_CHAT_ROOM);
- DeleteScreenIfPresent(SCR_ID_IMPS_CHAT_ROOM);
- #endif /* IMPS_TEST_CODE */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room_join
- * DESCRIPTION
- * Highlight handler of Room List -> Join option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_pre_entry_room_direct_join, KEY_EVENT_UP);
- SetKeyHandler(mmi_imps_pre_entry_room_direct_join, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_room_direct_join
- * DESCRIPTION
- * Pre-Entry function of Room->Join option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_room_direct_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_imps_util_get_empty_room_slot() == IMPS_MAX_NO_ROOM) /* all chat rooms are occupied */
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CHAT_ROOM_FULL);
- return;
- }
- if (imps_p->room_info.inline_join == NULL)
- {
- imps_p->room_info.inline_join = OslMalloc(sizeof(mmi_imps_join_inline_struct));
- }
- /* reset buffer */
- imps_p->room_info.inline_join->disclose_id = 0;
- imps_p->room_info.inline_join->sname[0] = 0;
- imps_p->room_info.inline_join->room_id[0] = 0;
- mmi_imps_entry_room_direct_join();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_room_direct_join
- * DESCRIPTION
- * Entry function of Room->Join option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_room_direct_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_ROOM_JOIN_DIRECT, mmi_imps_eixt_room_direct_join, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_room_join_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ROOM_JOIN_DIRECT);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_ROOM_JOIN_DIRECT, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_ROOM_JOIN_DIRECT, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_JOIN,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_DONE,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_ROOM_JOIN_DIRECT,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_room_direct_join_confirm, GoBackHistory);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_ROOM_JOIN_DIRECT, (HistoryDelCBPtr) mmi_imps_join_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_eixt_room_direct_join
- * DESCRIPTION
- * Exit function of Room->Join option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_eixt_room_direct_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_ROOM_JOIN_DIRECT, mmi_imps_entry_room_direct_join);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_join_fill_inline_struct
- * DESCRIPTION
- * Fill inline struct of Room->Join screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_join_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_join_inline_struct *join_room = imps_p->room_info.inline_join;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- join_room->yes_no_list[0] = (U8*) GetString(STR_GLOBAL_YES);
- join_room->yes_no_list[1] = (U8*) GetString(STR_GLOBAL_NO);
- /* Room Name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_ROOM_ID));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_CHAT_ROOM_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) join_room->room_id,
- 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*) join_room->sname,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[3], mmi_imps_hilite_prof_full_edit);
- /* Disclose ID */
- SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_DISCLOSE_ID));
- SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[5], 2, join_room->yes_no_list, &join_room->disclose_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_direct_join_confirm
- * DESCRIPTION
- * Display confirmation screen for joining a chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_direct_join_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_ID_IMPS_JOIN, mmi_imps_room_direct_join_yes, mmi_imps_util_go_back_2_hist);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_direct_join_yes
- * DESCRIPTION
- * Proceed joining chat room
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_direct_join_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *id = OslMalloc(IMPS_MAX_ID_LEN * ENCODING_LENGTH);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if the room is already joined */
- UnicodeToAnsii(id, (S8*) imps_p->room_info.inline_join->room_id);
- if (mmi_imps_util_is_room_joined(id))
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_ROOM_ALREADY_JOINED);
- }
- else if (pfnUnicodeStrlen((S8*) imps_p->room_info.inline_join->sname) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_DISP_NAME);
- }
- else
- {
- mmi_imps_display_progressing();
- imps_p->room_info.join_cause = IMPS_JOIN_DIRECT;
- mmi_imps_ps_join_group_req(id);
- }
- OslMfree(id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_room_jump_to
- * DESCRIPTION
- * Highlight handler of Room List -> Jump To option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_room_jump_to(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_room_jump_to, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_jump_to
- * DESCRIPTION
- * Handler of Room List -> Jump To option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_jump_to(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- mmi_imps_room_struct *room;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0, j = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- if (imps_p->room_info.room_list[i].is_used)
- {
- if (j == (S32) imps_p->room_info.curr_item)
- {
- break;
- }
- else
- {
- j++;
- }
- }
- }
- /* if it's a group, shall send request to protocol */
- room = &imps_p->room_info.room_list[i];
- imps_p->chat_info.curr_room = (U8) i;
- imps_p->gen_info.curr_tab = room->tab_index;
- mmi_imps_entry_chat();
- DeleteUptoScrID(SCR_ID_IMPS_CONT);
- DeleteScreenIfPresent(SCR_ID_IMPS_CONT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_pre_entry_join
- * DESCRIPTION
- * Pre-Entry inline editor screen for joining a chat room.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_pre_entry_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- S32 j;
- mmi_imps_room_struct *room;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if it's dupicated joined */
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- {
- room = &imps_p->room_info.room_list[i];
- if (room->is_used)
- {
- if (mmi_imps_util_is_id_same
- ((S8*) imps_p->search_result.entity[imps_p->search_result.curr_item].id, (S8*) room->room_id))
- {
- /* scan all members in the chat room */
- for (j = 0; j < IMPS_MAX_ENTITY_NUMBER; j++)
- {
- if (mmi_imps_util_is_id_same((S8*) imps_p->cont_info.cont_list[0].id, (S8*) room->member[j].id))
- {
- /* found match */
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_ROOM_ALREADY_JOINED);
- return;
- }
- }
- }
- }
- }
- if (mmi_imps_util_get_empty_room_slot() == IMPS_MAX_NO_ROOM) /* all chat rooms are occupied */
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_CHAT_ROOM_FULL);
- return;
- }
- if (imps_p->room_info.inline_join == NULL)
- {
- imps_p->room_info.inline_join = OslMalloc(sizeof(mmi_imps_join_inline_struct));
- }
- /* reset buffer */
- imps_p->room_info.inline_join->disclose_id = 0;
- imps_p->room_info.inline_join->sname[0] = 0;
- mmi_imps_entry_join();
- /* DeleteScreenIfPresent(SCR_ID_IMPS_CHAT_ROOM_JOIN); */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_join
- * DESCRIPTION
- * Entry inline editor screen for joining a chat room.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_CHAT_ROOM_JOIN, mmi_imps_exit_join, NULL, NULL);
- InitializeCategory57Screen();
- mmi_imps_join_fill_inline_struct();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CHAT_ROOM_JOIN);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_CHAT_ROOM_JOIN, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, IMPS_INLINE_JOIN_ROOM, inputBuffer);
- }
- ShowCategory57Screen(
- STR_ID_IMPS_JOIN,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_EDIT,
- IMG_GLOBAL_BACK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- IMPS_INLINE_JOIN_ROOM,
- (U16*) g_imps_inline_icons,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(mmi_imps_join_room, mmi_imps_join_free_mem_n_back);
- SetDelScrnIDCallbackHandler(SCR_ID_IMPS_CHAT_ROOM_JOIN, (HistoryDelCBPtr) mmi_imps_join_scr_del_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_exit_join
- * DESCRIPTION
- * Exit function for Join Room screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_exit_join(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GenericExitInlineScreen(SCR_ID_IMPS_CHAT_ROOM_JOIN, mmi_imps_entry_join);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_fill_inline_struct
- * DESCRIPTION
- * Fill inline structure of Join Chat room screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_fill_inline_struct(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_join_inline_struct *join_room = imps_p->room_info.inline_join;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- join_room->yes_no_list[0] = (U8*) GetString(STR_GLOBAL_YES);
- join_room->yes_no_list[1] = (U8*) GetString(STR_GLOBAL_NO);
- /* Display Name */
- SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_DISPLAY_NAME));
- SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &wgui_inline_items[1],
- STR_ID_IMPS_DISPLAY_NAME,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- (U8*) join_room->sname,
- IMPS_MAX_NAME_LEN,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
- SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_imps_hilite_prof_full_edit);
- /* Disclose ID */
- SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_DISCLOSE_ID));
- SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(&wgui_inline_items[3], 2, join_room->yes_no_list, &join_room->disclose_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_free_mem_n_back
- * DESCRIPTION
- * Free inline editor memory and go back to previous screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_free_mem_n_back(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_join_free_mem();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_scr_del_callback
- * DESCRIPTION
- * Callback function when join chat room screen is deleted.
- * PARAMETERS
- * param [IN] Parameter from framework
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_imps_join_scr_del_callback(void *param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imps_p->gen_info.curr_action == 0) /* nothing happens now */
- {
- mmi_imps_join_free_mem();
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_room
- * DESCRIPTION
- * Display confirmation screen to determine join chat room or not
- * PARAMETERS
- * void
- * param(?) [IN] Parameter from framework
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_room(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_entry_confirm(STR_ID_IMPS_JOIN, mmi_imps_join_room_yes, mmi_imps_util_go_back_2_hist);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_room_yes
- * DESCRIPTION
- * Preceed join a chat room
- * PARAMETERS
- * void
- * param(?) [IN] Parameter from framework
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_room_yes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_imps_join_inline_struct *join_room = imps_p->room_info.inline_join;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((S8*) join_room->sname) == 0)
- {
- mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_DISP_NAME);
- return;
- }
- mmi_imps_display_progressing();
- /* check if it's join from invitation screen of a voluntarily join */
- if (IsScreenPresent(SCR_ID_IMPS_INVITATION_IND))
- {
- mmi_imps_invite_accept();
- imps_p->room_info.join_cause = IMPS_JOIN_FROM_INVITE;
- }
- else
- {
- #ifdef IMPS_TEST_CODE
- #else /* IMPS_TEST_CODE */
- imps_p->room_info.join_cause = IMPS_JOIN_FROM_SEARCH;
- mmi_imps_ps_join_group_req((S8*) imps_p->search_result.entity[imps_p->search_result.curr_item].id);
- #endif /* IMPS_TEST_CODE */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_room_finished
- * DESCRIPTION
- * Preceed join a chat room
- * PARAMETERS
- * msg [?]
- * param(?) [IN] Parameter from framework
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_room_finished(void *msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j;
- mmi_imps_join_group_rsp_struct *rsp = (mmi_imps_join_group_rsp_struct*) msg;
- mmi_imps_room_struct *room;
- S32 no_member;
- imps_entity_struct *entity;
- mmi_imps_entity_struct *member;
- mmi_imps_join_inline_struct *inline_join = imps_p->room_info.inline_join;
- U8 join_cause = imps_p->room_info.join_cause;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (rsp->result == IMPS_OK)
- {
- /* find empty chat room */
- for (i = 0; i < IMPS_MAX_NO_ROOM; i++)
- if (imps_p->room_info.room_list[i].is_used == FALSE)
- {
- break;
- }
- /* copy data to chat room context */
- imps_p->chat_info.curr_room = (U8) i;
- imps_p->room_info.no_rooms++;
- room = &imps_p->room_info.room_list[i];
- memset(room, 0, sizeof(mmi_imps_room_struct));
- room->is_used = TRUE;
- room->type = IMPS_ROOM_TYPE_GROUP_JOIN;
- room->no_member = rsp->joined_users_list.entity_count;
- if (join_cause == IMPS_JOIN_FROM_SEARCH) /* entry from search result */
- {
- strcpy((S8*) room->room_id, (S8*) imps_p->search_result.entity[imps_p->search_result.curr_item].id);
- }
- else if (join_cause == IMPS_JOIN_DIRECT) /* direct join */
- {
- UnicodeToAnsii((S8*) room->room_id, (S8*) inline_join->room_id);
- }
- else /* invitation result */
- {
- strcpy(
- (S8*) room->room_id,
- (S8*) imps_p->invite_info.invite_pending_list[imps_p->invite_info.curr_pend_invite].node->group_id);
- }
- memset(room->room_name, 0, sizeof(room->room_name));
- AnsiiNToUnicodeString((S8*) room->room_name, (S8*) room->room_id, (IMPS_MAX_NAME_LEN - 1));
- /* update display buffer */
- mmi_imps_new_room_string((S8*) room->chat_buff, (S8*) room->room_name);
- /* welcome text */
- if (pfnUnicodeStrlen((S8*) rsp->welcome_text))
- {
- pfnUnicodeStrcpy((S8*) room->welcome, (S8*) rsp->welcome_text);
- pfnUnicodeStrcat((S8*) room->chat_buff, (S8*) GetString(STR_ID_IMPS_WELCOME_TEXT));
- pfnUnicodeStrcat((S8*) room->chat_buff, (S8*) L":n");
- pfnUnicodeStrcat((S8*) room->chat_buff, (S8*) rsp->welcome_text);
- pfnUnicodeStrcat((S8*) room->chat_buff, (S8*) L"nn");
- }
- /* update tab */
- room->tab_index = imps_p->gen_info.curr_tab = imps_p->gen_info.no_tab;
- imps_p->gen_info.no_tab++;
- no_member = (S32) room->no_member;
- /* put my self in the first member */
- pfnUnicodeStrcpy((S8*) room->member[0].sname, (S8*) inline_join->sname);
- strcpy((S8*) room->member[0].id, (S8*) imps_p->cont_info.cont_list[0].id);
- /* set room's display name as user's name */
- pfnUnicodeStrcpy((S8*) room->sname, (S8*) inline_join->sname);
- for (i = 0, j = 1; i < no_member; i++)
- {
- entity = &rsp->joined_users_list.entity[i];
- member = &room->member[j];
- if (pfnUnicodeStrcmp((S8*) room->member[0].sname, (S8*) entity->sname) == 0) /* myself found */
- {
- continue;
- }
- if (entity->entity_type == IMPS_ENTITY_TYPE_SCREEN_NAME) /* screen name only */
- {
- member->id[0] = 0; /* no id */
- }
- else
- {
- strcpy((S8*) member->id, (S8*) entity->id);
- }
- pfnUnicodeStrcpy((S8*) member->sname, (S8*) entity->sname);
- j++;
- }
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
- {
- mmi_imps_entry_chat();
- if(IsScreenPresent(SCR_ID_IMPS_CONT))
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- DeleteScreenIfPresent(SCR_ID_IMPS_CONT);
- }
- else /* CHAT screen */
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CHAT);
- DeleteScreenIfPresent(SCR_ID_IMPS_CHAT);
- }
- }
- else
- {
- if(IsScreenPresent(SCR_ID_IMPS_CONT))
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- HistoryReplace(SCR_ID_IMPS_CONT, SCR_ID_IMPS_CHAT, mmi_imps_entry_chat);
- }
- else if(IsScreenPresent(SCR_ID_IMPS_CHAT))/* chat screen present */
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CHAT);
- }
- else
- {
- /* other application, do nothing */
- }
- }
- }
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(rsp->result));
- if (imps_p->gen_info.is_reentry)
- {
- mmi_imps_re_entry_app();
- }
- else
- {
- /* check if it's join from invitation screen of a voluntarily join */
- if (IsScreenPresent(SCR_ID_IMPS_INVITATION_IND))
- {
- if(IsScreenPresent(SCR_ID_IMPS_CONT))
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
- }
- else /* (IsScreenPresent(SCR_ID_IMPS_CHAT)) */
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CHAT);
- }
- }
- else if (IsScreenPresent(SCR_ID_IMPS_SEARCH_RESULT)) /* join from search result */
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_SEARCH_RESULT);
- }
- else /* direct join */
- {
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CHAT_ROOM_OPT);
- }
- }
- }
- /* free memory */
- mmi_imps_join_free_mem();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_join_free_mem
- * DESCRIPTION
- * Free inline editor memory for Join Chat Room screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_join_free_mem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* currently request for join */
- if (imps_p->room_info.inline_join && imps_p->gen_info.curr_action != MSG_ID_MMI_IMPS_JOIN_GROUP_REQ)
- {
- OslMfree(imps_p->room_info.inline_join);
- imps_p->room_info.inline_join = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_room_search_quit
- * DESCRIPTION
- * Quit Chat Room search procedure
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_room_search_quit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBackToHistory(SCR_ID_IMPS_CHAT_ROOM_OPT);
- }
- #ifdef IMPS_FOR_OMA_ONLY
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_subscribe
- * DESCRIPTION
- * Highlight handler of Subscribe Presence menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_subscribe(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_subscribe, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_unsubscribe
- * DESCRIPTION
- * Highlight handler of Unsubscribe Presence menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_unsubscribe(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_unsubscribe, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_subscribe
- * DESCRIPTION
- * Entry function for Subscribe Presence menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_subscribe(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- mmi_imps_ps_subs_pa_req((S8*) imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_unsubscribe
- * DESCRIPTION
- * Entry function for Unsubscribe Presence menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_unsubscribe(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- mmi_imps_ps_unsubs_pa_req((S8*) imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_subscribe_pa_finished
- * DESCRIPTION
- * Handler when subscribe pa finished
- * PARAMETERS
- * result [IN] Error code of sbuscribing
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_subscribe_pa_finished(S32 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- imps_p->gen_info.curr_action = 0;
- if (result == IMPS_OK)
- {
- mmi_imps_util_disp_popup_done();
- }
- else
- {
- mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(mmi_imps_util_get_err_str(result)));
- }
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_hilite_group_broadcast
- * DESCRIPTION
- * Highlight handler of Group Broadcast menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_hilite_group_broadcast(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_imps_entry_group_broadcast, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_entry_group_broadcast
- * DESCRIPTION
- * Entry function of Group Broadcast menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_entry_group_broadcast(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_IMPS_GROUP_BROADCAST, NULL, mmi_imps_entry_group_broadcast, NULL);
- SetParentHandler(0);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_INVITE_NOTE);
- if (guiBuffer == NULL) /* first time entry, reset input buffer */
- {
- imps_p->path_buff[0] = 0;
- }
- ShowCategory5Screen(
- STR_ID_IMPS_BROADCAST,
- GetRootTitleIcon(MENU_ID_IMPS_MAIN),
- STR_GLOBAL_SEND,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
- (U8*) imps_p->path_buff, /* reuse path buffer */
- IMPS_MAX_NOTE_LEN,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_imps_group_broadcast_done, KEY_EVENT_UP);
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_broadcast_done
- * DESCRIPTION
- * Proceed broadcasting
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_broadcast_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_display_progressing();
- mmi_imps_ps_broadcast_msg_req(imps_p->group_info.curr_item, (S8*) imps_p->path_buff);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_imps_group_broadcast_finished
- * DESCRIPTION
- * Broadcast finished
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_imps_group_broadcast_finished(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_imps_util_disp_popup_done();
- mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_GROUP);
- }
- #endif /* IMPS_FOR_OMA_ONLY */
- #endif /* __MMI_IMPS__ */ /* #ifdef __MMI_IMPS__ */
- #endif /* _MMI_IMPS_UI_C */