/*!\brief Adds a item at the end of a previously created menu, extended version * * \param navItem All data for the menu item to be created * \return TRUE if the item is generated successfully, otherwise FALSE. *****************************************************************************/ MSF_BOOL meaAddNavMenuItemNew(const MeaNavMenuItem *navItem) { ASSERT(meaNavMenu.listIndex <= MEA_MAX_CONTEXT_LIST_ITEMS); if ((NULL != navItem->visibilityCallBack) && (FALSE == (navItem->visibilityCallBack)(navItem->entryId))) { return TRUE; } /* if */ #ifdef WAP_SUPPORT if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(meaNavMenu.menuHandle, meaNavMenu.listIndex, MEA_GET_STR_ID(navItem->strId), 0, meaGetListNumImage(meaNavMenu.listIndex), 0, TRUE)) #else if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(meaNavMenu.menuHandle, meaNavMenu.listIndex, MEA_GET_STR_ID(navItem->strId), 0, 0, 0, TRUE)) #endif /*WAP_SUPPORT*/ { return FALSE; } #ifdef WAP_SUPPORT if (navItem->strId != MEA_STR_ID_SEND_OPTIONS) //Only Send Option can use right arrow key { HDIa_widgetExtChoiceSetElemFlag(meaNavMenu.menuHandle, meaNavMenu.listIndex, WIDGET_EXT_CHOICE_ELEM_NO_RIGHT_ARROW); } #endif /* WAP_SUPPORT */ meaNavMenu.type[meaNavMenu.listIndex] = MEA_NAV_MENU_TYPE_NEW; meaNavMenu.item.listItemsNew[meaNavMenu.listIndex] = *navItem; meaNavMenu.listIndex++; return TRUE; }
/*! * \brief Handles the viewing of a link detected inside a text object * * \param linkIn The particular link * \param fsm The fsm to call when viewing is done * \param sig The signal to send when viewing is done * \return TRUE upon success *****************************************************************************/ static MSF_BOOL viewLink(void *linkIn, MeaStateMachine fsm, int sig) { MtrLinkEntry *link = (MtrLinkEntry *)linkIn; if ((NULL == link) || (NULL == link->link)) { return FALSE; } /* if */ switch (link->scheme) { case MTR_SCHEME_HTTP: case MTR_SCHEME_HTTPS: case MTR_SCHEME_WWW: startBra(link->link); return TRUE; case MTR_SCHEME_PHONE: meaSrhMakeCall(fsm, sig, link->link); return TRUE; case MTR_SCHEME_NONE: case MTR_SCHEME_MAIL: default: (void)meaShowDialog(MEA_GET_STR_ID(MEA_STR_ID_UNHANDLED_LINK), MEA_DIALOG_ALERT); return FALSE; } /* switch */ } /* viewLink */
/*!\brief Adds a item at the end of a previously created menu. * * \param itemStrHandle The string that are displayed to the user. * \param contextValue A value that will be returned when meaGetNavMenuItem is * called. * \return TRUE if the item is generated successfully, otherwise FALSE. *****************************************************************************/ MSF_BOOL meaAddNavMenuItem(MsfStringHandle itemStrHandle, int contextValue) { ASSERT(meaNavMenu.listIndex <= MEA_MAX_CONTEXT_LIST_ITEMS); #ifdef WAP_SUPPORT if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(meaNavMenu.menuHandle, meaNavMenu.listIndex, itemStrHandle, 0, meaGetListNumImage(meaNavMenu.listIndex), 0, TRUE)) #else if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(meaNavMenu.menuHandle, meaNavMenu.listIndex, itemStrHandle, 0, 0, 0, TRUE)) #endif /*WAP_SUPPORT*/ { return FALSE; } #ifdef WAP_SUPPORT if(itemStrHandle == MEA_GET_STR_ID(MEA_STR_ID_SEND) ) { HDIa_widgetExtChoiceSetElemFlag(meaNavMenu.menuHandle, meaNavMenu.listIndex, WIDGET_EXT_CHOICE_ELEM_NO_RIGHT_ARROW); } #endif /* WAP_SUPPORT */ meaNavMenu.type[meaNavMenu.listIndex] = MEA_NAV_MENU_TYPE_ORIGINAL; meaNavMenu.item.listItems[meaNavMenu.listIndex] = contextValue; meaNavMenu.listIndex++; return TRUE; }
/*! * \brief Creates the context sensitive menu for the message handler. * * \param folder The folder that i currently active. * \param activeMsgId Message ID of the active message * \param msgType The type of the active message. See #MmsFileType. * \param forwardLock TRUE if the current message has a forward lock, * otherwise FALSE. * \return TRUE if the operation was successful, otherwise FALSE. *****************************************************************************/ static int createMenuItems(MeaFolder folder, MmsMsgId activeMsgId, MmsFileType msgType, MSF_BOOL forwardLock, MSF_BOOL isJSR) { /* Download */ if ((0 < activeMsgId) && ((msgType == MMS_SUFFIX_NOTIFICATION) || (msgType == MMS_SUFFIX_IMMEDIATE)) && (!isJSR)) { if (!meaAddPropNavMenuItem(MEA_GET_STR_ID(MEA_STR_ID_DOWNLOAD), MEA_MV_DOWNLOAD))//MEA_SIG_MV_ACTIVATE return FALSE; } /* Delete only if a message is selected */ if ((0 < activeMsgId) && (MEA_FOLDER_TEMPLATE != folder)) { if (!meaAddPropNavMenuItem(MEA_GET_STR_ID(MEA_STR_ID_DELETE), MEA_MV_PROP_DELETE)) { return FALSE; } if (!meaAddPropNavMenuItem(MEA_GET_STR_ID(MEA_STR_ID_DELETE_ALL), MEA_MV_PROP_DELETE_ALL)) { return FALSE; } } /* MOVE TO ARCHIVE */ #ifdef __UNIFIED_MESSAGE_ARCHIVE_SUPPORT__ if(( folder == MMS_SENT || folder == MMS_INBOX ) && msgType == MMS_SUFFIX_MSG) { if (!meaAddPropNavMenuItem(MEA_GET_STR_ID(MEA_STR_ID_MOVE_TO_ARCHIVE), MEA_MV_PROP_MOVE_TO_ARCHIVE)) { return FALSE; } } #endif /*__UNIFIED_MESSAGE_ARCHIVE_SUPPORT__*/ /* Use Details */ if ((0 < activeMsgId) && (MEA_FOLDER_TEMPLATE != folder) && (!isJSR)) { if (!meaAddPropNavMenuItem(MEA_GET_STR_ID(MEA_STR_ID_USE_DETAILS), MEA_MV_PROP_USE_DETAILS)) { return FALSE; } } return TRUE; }
/*! * \brief Initiates MEA in new mode with content insertion. *****************************************************************************/ void MEAc_startWithContentInserted(char* contentSource) { msf_content_data_t contentData; int size; const char * strMimeType; char * strContentSource = NULL; MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MEA_ENV_6D82A4C998BF548C524317FF17E024C1, "MEAc_startWithContentInserted()\n")); #ifdef __USB_IN_NORMAL_MODE__ if (mmi_usb_is_in_mass_storage_mode() && is_mms_storage_exported_to_pc()) { mmi_usb_app_unavailable_popup(0); return; } #endif /* __USB_IN_NORMAL_MODE__ */ /* convert UCS2 to UTF8 */ size = widget_ucs2_to_utf8_length_in_bytes((kal_uint8*) contentSource) + 1; strContentSource = MSF_MEM_ALLOC(MSF_MODID_MSM, size); widget_ucs2_to_utf8_string((kal_uint8*)strContentSource,size,(kal_uint8*)contentSource); contentData.contentSource = msf_cmmn_strcat(MSF_MODID_MSM, HDI_EXTERNAL_PATH, strContentSource); strMimeType = meaFileName2MimeType(contentData.contentSource); if (strMimeType == NULL) { #ifdef JPG_ENCODE if(meaIsResizedFile(strContentSource)) { MSF_FILE_REMOVE(strContentSource); } #endif HDIa_widgetExtShowPopup(MSF_MODID_MSM, MEA_GET_STR_ID(MSF_STR_ID_DLG_MIME_ACTION_NONE), MsfAlert, 0); MSF_MEM_FREE(MSF_MODID_MSM, strContentSource); HDIa_widgetExtCloseTransitionAnimation(); return; } contentData.routingIdentifier = MSF_MEM_ALLOC(MSF_MODID_MSM, strlen(strMimeType)+1); strcpy(contentData.routingIdentifier, strMimeType); contentData.contentUrl = NULL; contentData.routingFormat = MSF_ROUTING_TYPE_MIME; contentData.contentParameters = NULL; contentData.contentData = NULL; contentData.contentDataLength=0; contentData.contentHeaders=NULL; contentData.contentDRMData=NULL; contentData.contentDRMDataExists=0; contentData.auxTypeIdentifier = NULL; MSF_CONTENT_SEND_DRM_EXT(MSF_MODID_MSM, MSF_MODID_MEA, "-mode new -i", &contentData,0,0); MSF_MEM_FREE(MSF_MODID_MSM, strContentSource); MSF_MEM_FREE(MSF_MODID_MSM, contentData.routingIdentifier); MSF_MEM_FREE(MSF_MODID_MSM, contentData.contentUrl); if (contentData.contentSource) MSF_MEM_FREE(MSF_MODID_MSM, contentData.contentSource); }
/*!\brief Displayes a previously created menu. * \return TRUE if the menu could be displayed. otherwise FALSE. *****************************************************************************/ MSF_BOOL meaShowPropNavMenu(void) { if (0 == meaPropNavMenu.menuHandle) { return FALSE; } /* Title */ (void)meaSetTitle(meaPropNavMenu.menuHandle, MEA_GET_STR_ID(MEA_STR_ID_OPTIONS), 0); return meaDisplayWindow(meaPropNavMenu.menuHandle, meaGetPosLeftTop()); }
/*! * \brief Initiates the data-structures for the dialog handling. *****************************************************************************/ void meaInitDia(void) { /* Create a panic dialog, if anything went totally wrong */ meaPanicDialog = MSF_WIDGET_DIALOG_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_PANIC), MsfError, MEA_DIALOG_DEFAULT_TIME_OUT, 0, 0); terminating = FALSE; memset(&meaConfirmDialog, 0, sizeof(MeaConfirmDialog)); memset(meaDialogQueue, 0, sizeof(meaDialogQueue)); memset(&meaDialog, 0, sizeof(MeaDialog)); }
/*!\brief Displayes a previously created menu. * * \return TRUE if the menu could be displayed. otherwise FALSE. * *****************************************************************************/ MSF_BOOL meaShowNavMenu() { if (0 == meaNavMenu.menuHandle) { return FALSE; } #ifdef WAP_SUPPORT /* Title */ (void)meaSetTitle(meaNavMenu.menuHandle, MEA_GET_STR_ID(MEA_STR_ID_OPTIONS), 0); #endif /*WAP_SUPPORT*/ return meaDisplayWindow(meaNavMenu.menuHandle, meaGetPosLeftTop()); }
/*!\brief Creates the data-structures for a context sensitive menu. * * \param titleStrHandle The title of the menu, if 0 no title is displayed. * \param signalHandler The navigation callback function *****************************************************************************/ MSF_BOOL meaCreateNavMenu(MsfStringHandle titleStrHandle, MeaNavCallBack signalHandler) { MsfActionHandle actionHandle; if (0 != meaNavMenu.menuHandle) { MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIMENU_B308D4280296A2DC7B04F7DE3E738342, "(%s) (%d) instance is busy!\n", __FILE__, __LINE__)); return FALSE; } memset(&meaNavMenu, 0, sizeof(MeaNavMenu)); /* Set destination signal converter */ meaNavMenu.signalHandler = signalHandler; /* Create the menu */ actionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_OK), MsfSelect, 0, MSF_ACTION_PROPERTY_ENABLED); if (0 == (meaNavMenu.menuHandle = MSF_WIDGET_MENU_APP_CREATE(MSF_MODID_MEA, actionHandle, NULL, MSF_CHOICE_ELEMENT_STRING_1, 0, 0))) { return FALSE; } /* Actions */ /* We couldn't register the action until we had a window handle. * Now we have it so rock'n'roll. */ if (!meaRegisterAction(meaNavMenu.menuHandle, actionHandle, handleOkAction, 0, 0)) { (void)MSF_WIDGET_RELEASE(actionHandle); return FALSE; } if (!meaCreateAction(meaNavMenu.menuHandle, MsfBack, handleBackAction, 0, 0, MEA_STR_ID_BACK)) { return FALSE; } /* Add title only if titleStrId is valid */ if (0 != titleStrHandle) { (void)meaSetTitle(meaNavMenu.menuHandle, titleStrHandle, 0); } return TRUE; }
/*! * \brief Signal handler for the multipart mixed message viewer * \param sig The received signal *****************************************************************************/ static void meaMmvMain(MeaSignal *sig) { switch ((MeaMmvSignalId) sig->type) { case MEA_SIG_MMV_ACTIVATE: if( mmvInstance != NULL ) { break; } meaMmvCreateInstance(&mmvInstance,(MeaMessage*)sig->p_param); /* activate MOB and let it do the browsing of attachments */ #ifdef WAP_SUPPORT //Change string to View meaMobActivate(mmvInstance->moList, MEA_MOB_SOP_NO_OP, MEA_STR_ID_VIEW, MEA_MMV_FSM, MEA_SIG_MMV_MOB_OP); #else meaMobActivate(mmvInstance->moList, MEA_MOB_SOP_NO_OP, MEA_STR_ID_VIEW_ATTACHMENTS, MEA_MMV_FSM, MEA_SIG_MMV_MOB_OP); #endif /* WAP_SUPPORT */ break; case MEA_SIG_MMV_DEACTIVATE: /* Clean-up the mmv instance */ if (mmvInstance) { meaMmvDeleteInstance(&mmvInstance); #ifdef WAP_SUPPORT (void)MEA_SIGNAL_SENDTO(MEA_MV_FSM, MEA_SIG_MV_PLAY_DONE); #endif /* WAP_SUPPORT */ } else { /* No MMV instance, delete MV directly.*/ (void)MEA_SIGNAL_SENDTO(MEA_MV_FSM, MEA_SIG_MV_DEACTIVATE); } break; case MEA_SIG_MMV_MOB_OP: /* Handle key press from MOB */ if (MEA_MOB_DEACTIVATED == (MeaMobOperation)sig->u_param1) { /* User selected Back, or MOB was deactivated */ (void)MEA_SIGNAL_SENDTO(MEA_MMV_FSM, MEA_SIG_MMV_DEACTIVATE); } else { handleMobOp(mmvInstance, (MeaMobOperation)sig->u_param1, sig->i_param, sig->p_param); } break; case MEA_SIG_MMV_MAKE_CALL_RSP: /* sig->u_param1 has a TRUE/FALSE result */ /* deliberately ignored since srh handles error dialogs for us */ break; case MEA_SIG_MMV_NAV_DEACTIVATE: /* Displayed menu was deactivated */ meaUiMmvDeleteMenu(); break; case MEA_SIG_MMV_NAV_SAVE: /* Save operation selected from menu */ saveMo(mmvInstance); break; case MEA_SIG_MMV_SAVE_DONE: /* Save operation finished */ MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAMMV_25089AF8905EFF9704992FDBC00AC3E6, "%s(%d): Save object done\n", __FILE__, __LINE__)); meaUiMmvDeleteMenu(); break; case MEA_SIG_MMV_CRH_DONE: /* Content router handler finished */ if (sig->u_param1 != MEA_CRH_VIEW_ATTACH_OK) { (void)meaShowDialog(MEA_GET_STR_ID(MEA_STR_ID_ATTACH_ERROR), MEA_DIALOG_ALERT); } meaUiMmvDeleteMenu(); break; case MEA_SIG_MMV_HANDLE_ACTION_RSP: /* Content router handler finished */ if (sig->u_param1 != MEA_CRH_VIEW_ATTACH_OK) { (void)meaShowDialog(MEA_GET_STR_ID(MEA_STR_ID_ATTACH_ERROR), MEA_DIALOG_ALERT); } meaUiMmvDeleteMenu(); break; default: MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAMMV_5D088F8A8F427BC1516107E77A681AE4, "%s(%d): mmvSignalHandler erroneous signal received(%d)\n", __FILE__, __LINE__, sig->type)); break; } meaSignalDelete(sig); }
/*! * \brief Save the media object * * \param instance The current instance. *****************************************************************************/ static void saveMo(const MeaMmvInstance *instance) { MeaMoDataItem *mo = instance->currentMo; #ifdef MMS_SLIM_MEM MSF_INT32 actId; msf_pck_result_t result; char *vFileName = NULL; const char *mime = NULL; int fileHandle = 0; meaUiMmvDeleteMenu(); vFileName = MEA_ALLOC(WIDGET_RAWFILE_NAMELEN); ASSERT(vFileName != NULL); fileHandle = MSF_FILE_OPEN( MSF_MODID_SMA, mo->file->path, MSF_FILE_SET_RDONLY, 0); if(fileHandle < 0) { MEA_FREE(vFileName); fileHandle = 0; meaShowDialog(MEA_GET_STR_ID(SMA_STR_ID_FAILED_TO_SAVE),MEA_DIALOG_ERROR); return; } if(HDIa_fileGenVirtualFileName(fileHandle, vFileName, WIDGET_RAWFILE_NAMELEN, mo->file->pos, mo->file->size) != HDI_FILE_OK) { MEA_FREE(vFileName); MSF_FILE_CLOSE(fileHandle); fileHandle = 0; meaShowDialog(MEA_GET_STR_ID(SMA_STR_ID_FAILED_TO_SAVE),MEA_DIALOG_ERROR); return; } if((mime = meaFileName2MimeType(mo->name)) == NULL) { mime = MEA_UNKNOWN_MIME_STR; } meaActHandle = (msf_pck_handle_t*)msf_act_init(MSF_MODID_MEA); actId = msf_act_object_action_drm (meaActHandle, 0, mime, MsfResourceFile, NULL, mo->size, vFileName, NULL, mo->name, 0, //for drm meaGetScreenHandle(), NULL, NULL, 0); msf_act_get_result (meaActHandle, actId, &result); msf_act_result_free (meaActHandle, &result); meaActTerminate(); MEA_FREE(vFileName); MSF_FILE_CLOSE(fileHandle); #else (void)meaCreateSaveAs(MEA_MMV_FSM, MEA_SIG_MMV_SAVE_DONE, meaMediaType2Mime(mo->content.type) , mo->name, (char*)mo->data, (long)mo->size); #endif /* MMS_SLIM_MEM */ }
/*! * \brief Displays a dialog that requires End User actions to disappear. * * \param textStrId The text to be displayed or 0 if the str param is used * instead. * \param str The text string to displayed if textStrId is 0 * \param fsm The FSM to respond the result to. * \param signal The response signal. * \param id A optional id that is sent back in the response as u_param2. * \return TRUE if successful, otherwise FALSE. *****************************************************************************/ MSF_BOOL meaShowDialogWithConfirm(MsfDialogType dlgType, MSF_UINT32 lskStrId, MSF_UINT32 rskStrId, MSF_UINT32 textStrId, MeaStateMachine fsm, int signal, unsigned int id) { if (0 != meaConfirmDialog.dialogHandle) { meaDeleteDialog(meaConfirmDialog.dialogHandle); MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIDIA_B308D4280296A2DC7B04F7DE3E738342, "(%s) (%d) instance is busy!\n", __FILE__, __LINE__)); return FALSE; } meaConfirmDialog.fsm = fsm; meaConfirmDialog.signal = signal; meaConfirmDialog.id = id; /* Create string handle */ if (0 == textStrId) { return FALSE; } /* Create dialog */ if (0 == (meaConfirmDialog.dialogHandle = MSF_WIDGET_DIALOG_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(textStrId), dlgType, 0, MSF_WINDOW_PROPERTY_NOTIFY, 0))) { return FALSE; } /* Create LSK action */ if(0 == lskStrId) { meaConfirmDialog.okActionHandle = 0; } else { meaConfirmDialog.okActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(lskStrId), MsfOk, 0, MSF_ACTION_PROPERTY_ENABLED); } if (meaConfirmDialog.okActionHandle > 0 && 0 > MSF_WIDGET_ADD_ACTION(meaConfirmDialog.dialogHandle, meaConfirmDialog.okActionHandle)) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } /* Create RSK action */ if(0 == rskStrId) { meaConfirmDialog.cancelActionHandle = 0; } else { meaConfirmDialog.cancelActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(rskStrId), MsfCancel, 0, MSF_ACTION_PROPERTY_ENABLED); } if (meaConfirmDialog.cancelActionHandle> 0 && 0 > MSF_WIDGET_ADD_ACTION(meaConfirmDialog.dialogHandle, meaConfirmDialog.cancelActionHandle)) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); if(meaConfirmDialog.okActionHandle != 0) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.okActionHandle); } memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } /* Display the dialog */ if (0 <= MSF_WIDGET_SCREEN_ADD_WINDOW(meaGetScreenHandle(), meaConfirmDialog.dialogHandle, meaGetPosLeftTop(), meaGetScreenHandle(), 0)) { (void)MSF_WIDGET_SET_IN_FOCUS(meaGetScreenHandle(), TRUE); (void)MSF_WIDGET_SET_IN_FOCUS(meaConfirmDialog.dialogHandle, TRUE); } else { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); if(meaConfirmDialog.okActionHandle != 0) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.okActionHandle); } if(meaConfirmDialog.cancelActionHandle != 0) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.cancelActionHandle); } memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } return TRUE; }
/*! * \brief Displays a dialog that requires End User actions to disappear. * * \param textStrId The text to be displayed or 0 if the str param is used * instead. * \param str The text string to displayed if textStrId is 0 * \param fsm The FSM to respond the result to. * \param signal The response signal. * \param id A optional id that is sent back in the response as u_param2. * \return TRUE if successful, otherwise FALSE. *****************************************************************************/ MSF_BOOL meaShowConfirmDialog(MSF_UINT32 textStrId, const char *str, MeaStateMachine fsm, int signal, unsigned int id) { MsfStringHandle strHandle; if (0 != meaConfirmDialog.dialogHandle) { #ifdef WAP_SUPPORT meaDeleteDialog(meaConfirmDialog.dialogHandle); #else MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIDIA_B308D4280296A2DC7B04F7DE3E738342, "(%s) (%d) instance is busy!\n", __FILE__, __LINE__)); return FALSE; #endif /* WAP_SUPPORT */ } meaConfirmDialog.fsm = fsm; meaConfirmDialog.signal = signal; meaConfirmDialog.id = id; /* Create string handle */ /*lint -e{539} */ if (0 == textStrId) { if (0 == (strHandle = MSF_WIDGET_STRING_CREATE(MSF_MODID_MEA, str, MsfUtf8, (int)strlen(str) + 1, 0))) { return FALSE; } } else { strHandle = MEA_GET_STR_ID(textStrId); } /* Create dialog */ if (0 == (meaConfirmDialog.dialogHandle = MSF_WIDGET_DIALOG_CREATE( MSF_MODID_MEA, strHandle, MsfConfirmation, 0, MSF_WINDOW_PROPERTY_NOTIFY, 0))) { if (0 == textStrId) { (void)MSF_WIDGET_RELEASE(strHandle); } return FALSE; } if (0 == textStrId) { (void)MSF_WIDGET_RELEASE(strHandle); } /* Create actions */ #ifdef WAP_SUPPORT if (textStrId==MEA_STR_ID_NEW_MMS_MSG #ifdef __MMS_DUAL_SIM_SUPPORT__ || textStrId == WIDGET_STR_ID_RECEIVED_MMS_MSG_SIM_1 || textStrId == WIDGET_STR_ID_RECEIVED_MMS_MSG_SIM_2 #endif /*__MMS_DUAL_SIM_SUPPORT__*/ ) meaConfirmDialog.okActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_LSK_READ), MsfOk, 0, MSF_ACTION_PROPERTY_ENABLED); else meaConfirmDialog.okActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_LSK_YES), MsfOk, 0, MSF_ACTION_PROPERTY_ENABLED); #else meaConfirmDialog.okActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_OK), MsfOk, 0, MSF_ACTION_PROPERTY_ENABLED); #endif /* WAP_SUPPORT */ if (0 > MSF_WIDGET_ADD_ACTION(meaConfirmDialog.dialogHandle, meaConfirmDialog.okActionHandle)) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } #ifdef WAP_SUPPORT if (textStrId==MEA_STR_ID_NEW_MMS_MSG #ifdef __MMS_DUAL_SIM_SUPPORT__ || textStrId == WIDGET_STR_ID_RECEIVED_MMS_MSG_SIM_1 || textStrId == WIDGET_STR_ID_RECEIVED_MMS_MSG_SIM_2 #endif /*__MMS_DUAL_SIM_SUPPORT__*/ ) meaConfirmDialog.cancelActionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_BACK), MsfCancel, 0, MSF_ACTION_PROPERTY_ENABLED); else meaConfirmDialog.cancelActionHandle = MSF_WIDGET_ACTION_CREATE( MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_RSK_NO), MsfCancel, 0, MSF_ACTION_PROPERTY_ENABLED); #else meaConfirmDialog.cancelActionHandle = MSF_WIDGET_ACTION_CREATE( MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_CANCEL), MsfCancel, 0, MSF_ACTION_PROPERTY_ENABLED); #endif /* WAP_SUPPORT */ if (0 > MSF_WIDGET_ADD_ACTION(meaConfirmDialog.dialogHandle, meaConfirmDialog.cancelActionHandle)) { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); (void)MSF_WIDGET_RELEASE(meaConfirmDialog.okActionHandle); memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } /* Display the dialog */ if (0 <= MSF_WIDGET_SCREEN_ADD_WINDOW(meaGetScreenHandle(), meaConfirmDialog.dialogHandle, meaGetPosLeftTop(), meaGetScreenHandle(), 0)) { (void)MSF_WIDGET_SET_IN_FOCUS(meaGetScreenHandle(), TRUE); (void)MSF_WIDGET_SET_IN_FOCUS(meaConfirmDialog.dialogHandle, TRUE); } else { (void)MSF_WIDGET_RELEASE(meaConfirmDialog.dialogHandle); (void)MSF_WIDGET_RELEASE(meaConfirmDialog.okActionHandle); (void)MSF_WIDGET_RELEASE(meaConfirmDialog.cancelActionHandle); memset(&meaConfirmDialog, 0 , sizeof(MeaConfirmDialog)); return FALSE; } return TRUE; }
/*! * \brief Creates a input form. * * \param item The type of input form to create. * \param titleStrHandle The title of the form. * \return TRUE of successful, otherwise FALSE: *****************************************************************************/ MSF_BOOL meaCreateInputForm(const MeaInputItem *item, MSF_UINT32 titleStrHandle) { int i; MsfStringHandle strHandle; MeaInputForm *inst; MsfActionHandle actionHandle; const MsfSize maxSize = {MEA_GADGET_DEF_HEIGHT, MEA_GADGET_DEF_WIDTH}; MsfSize newSize = {0, 0}; actionHandle = 0; if (NULL == (inst = createInstance(item))) { MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIFORM_46E7974CE7354600D97E60808E9536EF, "(%s) (%d) Input form instance is busy!\n", __FILE__, __LINE__)); return FALSE; } /* Do not copy the list of elements */ inst->item.items = NULL; /* Create gadget */ switch(item->type) { case MEA_SINGLE_LINE_INPUT: /* Create string handle */ if (NULL != item->text) { if (0 == (strHandle = MSF_WIDGET_STRING_CREATE(MSF_MODID_MEA, item->text, MsfUtf8, strlen(item->text) + 1, 0))) { return FALSE; } } else { if (0 == (strHandle = MSF_WIDGET_STRING_CREATE(MSF_MODID_MEA, "", MsfUtf8, 1, 0))) { return FALSE; } } if (0 == (inst->winHandle = MSF_WIDGET_FORM_CREATE( MSF_MODID_MEA, NULL, 0, 0))) { (void)MSF_WIDGET_RELEASE(strHandle); return FALSE; } if (0 == (inst->gadgetHandle = MSF_WIDGET_TEXT_INPUT_CREATE(MSF_MODID_MEA, meaGetEmptyStringHandle(), strHandle, item->textType, (int)item->maxTextSize, TRUE, NULL, MSF_GADGET_PROPERTY_FOCUS, 0))) { (void)MSF_WIDGET_RELEASE(strHandle); (void)MSF_WIDGET_RELEASE(inst->winHandle); inst->winHandle = 0; } /* Calculate optimal size of gadget */ meaCalculateStringGadgetSize(inst->winHandle, inst->gadgetHandle, strHandle, (MsfPosition*)&meaInputPos, (MsfSize*)&maxSize, &newSize, FALSE); (void)MSF_WIDGET_SET_SIZE(inst->gadgetHandle, &newSize); (void)MSF_WIDGET_RELEASE(strHandle); if (0 > MSF_WIDGET_WINDOW_ADD_GADGET(inst->winHandle, inst->gadgetHandle, NULL, (MsfAlignment *)&meaInputPos)) { (void)MSF_WIDGET_RELEASE(inst->winHandle); inst->winHandle = 0; (void)MSF_WIDGET_RELEASE(inst->gadgetHandle); inst->gadgetHandle = 0; return FALSE; } break; case MEA_TEXT_INPUT: /* Create string handle */ if (NULL != item->text) { if (0 == (strHandle = MSF_WIDGET_STRING_CREATE(MSF_MODID_MEA, item->text, MsfUtf8, strlen(item->text) + 1, 0))) { return FALSE; } } else { if (0 == (strHandle = MSF_WIDGET_STRING_CREATE(MSF_MODID_MEA, "", MsfUtf8, 1, 0))) { return FALSE; } } /* Create editor */ if (0 == (inst->winHandle = MSF_WIDGET_EDITOR_CREATE( MSF_MODID_MEA, meaGetEmptyStringHandle(), strHandle, item->textType, (int)item->maxTextSize, (MEA_TEXT_INPUT == item->type), NULL, 0, 0))) { (void)MSF_WIDGET_RELEASE(strHandle); return FALSE; } (void)MSF_WIDGET_RELEASE(strHandle); break; case MEA_RADIO_BUTTON_INPUT: /* Create radio button list */ if (0 == (inst->winHandle = MSF_WIDGET_MENU_CREATE( MSF_MODID_MEA, MsfExclusiveChoice, NULL, 0, NULL, MSF_CHOICE_ELEMENT_STRING_1 | MSF_CHOICE_ELEMENT_ICON, 0, 0))) { return FALSE; } /* Add items to the list */ for(i = 0; 0 != item->items[i]; i++) { if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(inst->winHandle, i, item->items[i], 0, 0, 0, TRUE)) { (void)MSF_WIDGET_RELEASE(inst->winHandle); return FALSE; } } /* Set selected index */ if ((inst->item.selectedItem < i) && (i >= 0)) { (void)MSF_WIDGET_CHOICE_SET_ELEM_STATE(inst->winHandle, inst->item.selectedItem, MSF_CHOICE_ELEMENT_SELECTED); } else { MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIFORM_7C3400E063A6C6DC06716EB479BBE41B, "(%s) (%d) erroneous selected index!\n", __FILE__, __LINE__)); } break; case MEA_SELECT_INPUT: actionHandle = MSF_WIDGET_ACTION_CREATE(MSF_MODID_MEA, MEA_GET_STR_ID(MEA_STR_ID_OK), MsfSelect, 0, MSF_ACTION_PROPERTY_ENABLED); if (0 == (inst->winHandle = MSF_WIDGET_MENU_CREATE( MSF_MODID_MEA, MsfImplicitChoice, NULL, actionHandle, NULL, MSF_CHOICE_ELEMENT_STRING_1, 0, 0))) { return FALSE; } /* Add items to the list */ for(i = 0; 0 != item->items[i]; i++) { #ifdef WAP_SUPPORT if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(inst->winHandle, i, item->items[i], 0, meaGetListNumImage(i), 0, TRUE)) #else if (0 > MSF_WIDGET_CHOICE_SET_ELEMENT(inst->winHandle, i, item->items[i], 0, 0, 0, TRUE)) #endif /* WAP_SUPPORT */ { (void)MSF_WIDGET_RELEASE(inst->winHandle); return FALSE; } } /* Set selected index */ if ((inst->item.selectedItem < i) && (i >= 0)) { (void)MSF_WIDGET_CHOICE_SET_ELEM_STATE(inst->winHandle, inst->item.selectedItem, MSF_CHOICE_ELEMENT_SELECTED); } else { MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MAUIFORM_7C3400E063A6C6DC06716EB479BBE41B, "(%s) (%d) erroneous selected index!\n", __FILE__, __LINE__)); } break; } /* Actions */ if (MEA_SELECT_INPUT == item->type) { if (!meaRegisterAction(inst->winHandle, actionHandle, meaHandleOkFormAction, 0, 0)) { (void)MSF_WIDGET_RELEASE(actionHandle); return FALSE; } /* Back action */ if (0 == meaCreateAction(inst->winHandle, MsfBack, meaHandleBackFormAction, 0, 0, MEA_STR_ID_BACK)) { return FALSE; } } else { if (0 == meaCreateAction(inst->winHandle, MsfOk, meaHandleOkFormAction, 0, 0, MEA_STR_ID_OK)) { return FALSE; } /* Cancel action */ if (0 == meaCreateAction(inst->winHandle, MsfCancel, meaHandleBackFormAction, 0, 0, MEA_STR_ID_CANCEL)) { return FALSE; } } /* Set title*/ if (!meaSetTitle(inst->winHandle, titleStrHandle, 0)) { return FALSE; } #ifdef WAP_SUPPORT //MSF_WIDGET_WINDOW_SET_PROPERTIES(inst->winHandle, (int) MSF_WINDOW_PROPERTY_EXT_DISABLE_RIGHT_ARROW | MSF_WINDOW_PROPERTY_TITLE); #endif /* WAP_SUPPORT */ /* Display form */ return meaDisplayWindow(inst->winHandle, meaGetPosLeftTop()); }
/***************************************************************************** * FUNCTION * wap_bgsr_msg_hdlr * DESCRIPTION * Message Handler for primitives from BGSR * PARAMETERS * ilm_ptr [in] * RETURNS * void *****************************************************************************/ void wap_bgsr_msg_hdlr(ilm_struct *ilm_ptr) { switch(ilm_ptr->msg_id) { case MSG_ID_MMS_BGSR_CANCEL_SEND_RSP: case MSG_ID_MMS_BGSR_CANCEL_DOWNLOAD_RSP: case MSG_ID_MMS_BGSR_CANCEL_ALL_INBOX_RSP: meaDeleteMvStatusView(); #ifdef __UNIFIED_MSG_SUPPORT__ /* for notification prop/Dr/Rr screen (option menu is from these screen)*/ (void)MEA_SIGNAL_SENDTO(MEA_MV_FSM, MEA_SIG_MV_DEACTIVATE); #endif /* Bring down the navigation menu */ (void)MEA_SIGNAL_SENDTO(MEA_MH_FSM, MEA_SIG_MH_NAV_DEACTIVATE); (void)MEA_SIGNAL_SENDTO_I(MEA_MH_FSM, MEA_SIG_MH_UPDATE_FOLDER, MEA_FOLDER_NONE); break; case MSG_ID_MMS_BGSR_SEND_RSP: meaDeleteMvStatusView(); #ifdef __UNIFIED_MSG_SUPPORT__ /* for notification prop/Dr/Rr screen (option menu is from these screen)*/ (void)MEA_SIGNAL_SENDTO_U(MEA_MV_FSM, MEA_SIG_MV_DEACTIVATE, mmi_mms_bgsr_send_msg_id); #endif /* Bring down the navigation menu */ (void)MEA_SIGNAL_SENDTO(MEA_MH_FSM, MEA_SIG_MH_NAV_DEACTIVATE); (void)MEA_SIGNAL_SENDTO_IUU(MEA_MH_FSM, MEA_SIG_MH_UPDATE_FOLDER, MEA_FOLDER_NONE, mmi_mms_bgsr_send_msg_id, mmi_mms_bgsr_result); break; case MSG_ID_MMS_BGSR_DOWNLOAD_RSP: #ifdef MMS_SUPPORT mmcIsRecvMMSForJava(mmi_mms_bgsr_download_msg_id); #endif #ifdef MMS_FILE_PROTECT_SUPPORT if (genChkSumFile(mmi_mms_bgsr_download_msg_id)==MMS_RESULT_INSUFFICIENT_PERSISTENT_STORAGE) { meaShowDialog(MEA_GET_STR_ID(MEA_STR_ID_NO_PERSISTENT_STORAGE), MEA_DIALOG_ERROR); fldrMgrDeleteMessage(mmi_mms_bgsr_download_msg_id); } #endif /* MMS_FILE_PROTECT_SUPPORT */ meaDeleteMvStatusView(); #ifdef __UNIFIED_MSG_SUPPORT__ /* for notification prop/Dr/Rr screen (option menu is from these screen)*/ (void)MEA_SIGNAL_SENDTO_U(MEA_MV_FSM, MEA_SIG_MV_DEACTIVATE, mmi_mms_bgsr_download_msg_id); #endif /* Bring down the navigation menu */ (void)MEA_SIGNAL_SENDTO(MEA_MH_FSM, MEA_SIG_MH_NAV_DEACTIVATE); (void)MEA_SIGNAL_SENDTO_IUU(MEA_MH_FSM, MEA_SIG_MH_UPDATE_FOLDER, MEA_FOLDER_NONE, mmi_mms_bgsr_download_msg_id, mmi_mms_bgsr_result); break; case MSG_ID_MMS_BGSR_MOVE_TO_FOLDER_RSP: if(mmi_mms_bgsr_result == MMI_MMS_BGSR_RESULT_OK) { (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_BGSR_MOVE_TO_DRAFT_RSP, 0, mmi_mms_bgsr_op_msg_id); } else { (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_BGSR_MOVE_TO_DRAFT_RSP, 1, mmi_mms_bgsr_op_msg_id); } break; case MSG_ID_MMS_BGSR_NAV_ACTIVATE_BGSR_RSP: { (void)MEA_SIGNAL_SENDTO(MEA_MH_FSM, MEA_SIG_MH_NAV_ACTIVATE_BGSR_RSP); break; } case MSG_ID_MMS_BGSR_DELETE_MSG_RSP: if(mmi_mms_bgsr_result == MMI_MMS_BGSR_RESULT_OK || mmi_mms_bgsr_result == MMI_MMS_BGSR_RESULT_FAIL_FILE_NOT_FOUND ) { (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_DELETE_MSG, 0, mmi_mms_bgsr_op_msg_id); } else { (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_DELETE_MSG, 1, mmi_mms_bgsr_op_msg_id); } break; case MSG_ID_MMS_BGSR_DELETE_ALL_INBOX_RSP: #ifdef __UNIFIED_MSG_SUPPORT__ (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_UM_DELETE_ALL_MSG_REQ, 0, MEA_FOLDER_INBOX); #else (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_DELETE_ALL_MSG, 0, MEA_FOLDER_INBOX); #endif break; case MSG_ID_MMS_BGSR_DELETE_ALL_OUTBOX_RSP: #ifdef __UNIFIED_MSG_SUPPORT__ (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_UM_DELETE_ALL_MSG_REQ, 0, MEA_FOLDER_OUTBOX); #else (void)MEA_SIGNAL_SENDTO_UU(MEA_MH_FSM, MEA_SIG_MH_DELETE_ALL_MSG, 0, MEA_FOLDER_OUTBOX); #endif break; default: break; } }
/*! * \brief Initiates MEA in new mode with text or content insertion, with subject and addr. *****************************************************************************/ void MEAc_startWithGeneralInserted(char *subject, char *text, MSF_BOOL isTruncated, char *addr, char *contentSource) { msf_content_data_t contentData; int size; char *str = NULL; char *tmp_str = NULL; char *cmd = NULL; MSF_LOG_MSG_NOARG((MSF_LOG_DETAIL_MEDIUM, MSF_MODID_MEA, MEA_ENV_4A93CC25579B8BB435EBA7080B622F30, "MEAc_startWithTextInserted()\n")); #ifdef __USB_IN_NORMAL_MODE__ if (mmi_usb_is_in_mass_storage_mode() && is_mms_storage_exported_to_pc()) { mmi_usb_app_unavailable_popup(0); return; } #endif /* __USB_IN_NORMAL_MODE__ */ memset(&contentData, 0x00, sizeof(msf_content_data_t)); contentData.routingIdentifier = msf_cmmn_strdup(MSF_MODID_MSM, "text/plain"); contentData.routingFormat = MSF_ROUTING_TYPE_MIME; /* process file path */ if(contentSource != NULL && contentSource[0] != 0) { const char * strMimeType; char * strContentSource = NULL; MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, MEA_ENV_6D82A4C998BF548C524317FF17E024C1, "MEAc_startWithContentInserted()\n")); /* convert UCS2 to UTF8 */ size = widget_ucs2_to_utf8_length_in_bytes((kal_uint8*) contentSource) + 1; strContentSource = MSF_MEM_ALLOC(MSF_MODID_MSM, size); widget_ucs2_to_utf8_string((kal_uint8*)strContentSource,size,(kal_uint8*)contentSource); contentData.contentSource = msf_cmmn_strcat(MSF_MODID_MSM, HDI_EXTERNAL_PATH, strContentSource); strMimeType = meaFileName2MimeType(contentData.contentSource); if (strMimeType == NULL) { #ifdef JPG_ENCODE if(meaIsResizedFile(strContentSource)) { MSF_FILE_REMOVE(strContentSource); } #endif HDIa_widgetExtShowPopup(MSF_MODID_MSM, MEA_GET_STR_ID(MSF_STR_ID_DLG_MIME_ACTION_NONE), MsfAlert, 0); MSF_MEM_FREE(MSF_MODID_MSM, strContentSource); HDIa_widgetExtCloseTransitionAnimation(); return; } contentData.routingIdentifier = MSF_MEM_ALLOC(MSF_MODID_MSM, strlen(strMimeType)+1); strcpy(contentData.routingIdentifier, strMimeType); contentData.contentUrl = NULL; contentData.routingFormat = MSF_ROUTING_TYPE_MIME; contentData.contentParameters = NULL; contentData.contentData = NULL; contentData.contentDataLength=0; contentData.contentHeaders=NULL; contentData.contentDRMData=NULL; contentData.contentDRMDataExists=0; contentData.auxTypeIdentifier = NULL; } /* Text */ if(text) { size = widget_ucs2_to_utf8_length_in_bytes((kal_uint8*)text); if(size > 0) { contentData.contentData = MSF_MEM_ALLOC(MSF_MODID_MSM, size + 1); widget_ucs2_to_utf8_string((kal_uint8*)contentData.contentData, size + 1, (kal_uint8*)text); contentData.contentDataLength = size + 1; } } if(text || contentSource) { cmd = msf_cmmn_strdup(MSF_MODID_MSM, "-mode new -i"); } else { cmd = msf_cmmn_strdup(MSF_MODID_MSM, "-mode new"); } /* Subject */ if(subject) { size = widget_ucs2_to_utf8_length_in_bytes((kal_uint8*)subject); if(size > 0) { str = MSF_MEM_ALLOC(MSF_MODID_MSM, size + 1); widget_ucs2_to_utf8_string((kal_uint8*)str, size + 1,(kal_uint8*)subject); MSF_MEM_FREE(MSF_MODID_MSM, cmd); cmd = msf_cmmn_str3cat(MSF_MODID_MSM, cmd ," -subject ", str); } } if(isTruncated) { contentData.contentDataLength++; } /* addr */ if(addr) { size = widget_ucs2_to_utf8_length_in_bytes((kal_uint8*)addr); if(size > 0) { //str = msf_cmmn_strdup(MSF_MODID_MSM, addr); str = MSF_MEM_ALLOC(MSF_MODID_MSM, size + 1); widget_ucs2_to_utf8_string((kal_uint8*)str, size + 1,(kal_uint8*)addr); tmp_str = msf_cmmn_strdup(MSF_MODID_MSM, cmd); MSF_MEM_FREE(MSF_MODID_MSM, cmd); cmd = msf_cmmn_str3cat(MSF_MODID_MSM, tmp_str, " -to ", str); } } MSF_CONTENT_SEND_DRM_EXT(MSF_MODID_MSM, MSF_MODID_MEA, cmd, &contentData, 0, 0); MSF_MEM_FREE(MSF_MODID_MSM, contentData.routingIdentifier); MSF_MEM_FREE(MSF_MODID_MSM, contentData.contentData); MSF_MEM_FREE(MSF_MODID_MSM, str); MSF_MEM_FREE(MSF_MODID_MSM, cmd); MSF_MEM_FREE(MSF_MODID_MSM, tmp_str); }