JMMSComposeUtils.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:174k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2002
  8. *
  9. *****************************************************************************/
  10. /*****************************************************************************
  11.  *
  12.  * Filename:
  13.  * ---------
  14.  * mms_compose.C
  15.  *
  16.  * Project:
  17.  * --------
  18.  *   MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *   
  23.  *
  24.  * Author:
  25.  * -------
  26.  * -------
  27.  *
  28.  *============================================================================
  29.  *             HISTORY
  30.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  31.  *------------------------------------------------------------------------------
  32.  * removed!
  33.  * removed!
  34.  * removed!
  35.  *
  36.  * removed!
  37.  * removed!
  38.  * removed!
  39.  *
  40.  * removed!
  41.  * removed!
  42.  * removed!
  43.  *
  44.  * removed!
  45.  * removed!
  46.  * removed!
  47.  *
  48.  * removed!
  49.  * removed!
  50.  * removed!
  51.  *
  52.  * removed!
  53.  * removed!
  54.  * removed!
  55.  *
  56.  * removed!
  57.  * removed!
  58.  * removed!
  59.  *
  60.  * removed!
  61.  * removed!
  62.  * removed!
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * removed!
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * removed!
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * removed!
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * removed!
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * removed!
  83.  *
  84.  * removed!
  85.  * removed!
  86.  * removed!
  87.  *
  88.  * removed!
  89.  * removed!
  90.  * removed!
  91.  *
  92.  * removed!
  93.  * removed!
  94.  * removed!
  95.  *
  96.  * removed!
  97.  * removed!
  98.  * removed!
  99.  *
  100.  * removed!
  101.  * removed!
  102.  * removed!
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * removed!
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * removed!
  111.  *
  112.  * removed!
  113.  * removed!
  114.  * removed!
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * removed!
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * removed!
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * removed!
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * removed!
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * removed!
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * removed!
  139.  *
  140.  * removed!
  141.  * removed!
  142.  * removed!
  143.  *
  144.  * removed!
  145.  * removed!
  146.  * removed!
  147.  *
  148.  * removed!
  149.  * removed!
  150.  * removed!
  151.  *
  152.  * removed!
  153.  * removed!
  154.  * removed!
  155.  *
  156.  * removed!
  157.  * removed!
  158.  * removed!
  159.  *
  160.  * removed!
  161.  * removed!
  162.  * removed!
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * removed!
  167.  *
  168.  * removed!
  169.  * removed!
  170.  * removed!
  171.  *
  172.  * removed!
  173.  * removed!
  174.  * removed!
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * removed!
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * removed!
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * removed!
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * removed!
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * removed!
  195.  * removed!
  196.  *
  197.  * removed!
  198.  * removed!
  199.  * removed!
  200.  *
  201.  * removed!
  202.  * removed!
  203.  * removed!
  204.  *
  205.  * removed!
  206.  * removed!
  207.  * removed!
  208.  *
  209.  * removed!
  210.  * removed!
  211.  * removed!
  212.  *
  213.  * removed!
  214.  * removed!
  215.  * removed!
  216.  *
  217.  * removed!
  218.  * removed!
  219.  * removed!
  220.  *
  221.  * removed!
  222.  * removed!
  223.  * removed!
  224.  *
  225.  * removed!
  226.  * removed!
  227.  * removed!
  228.  *
  229.  * removed!
  230.  * removed!
  231.  * removed!
  232.  *
  233.  * removed!
  234.  * removed!
  235.  * removed!
  236.  *
  237.  * removed!
  238.  * removed!
  239.  * removed!
  240.  *
  241.  * removed!
  242.  * removed!
  243.  * removed!
  244.  *
  245.  * removed!
  246.  * removed!
  247.  * removed!
  248.  *
  249.  * removed!
  250.  * removed!
  251.  * removed!
  252.  *
  253.  * removed!
  254.  * removed!
  255.  * removed!
  256.  *
  257.  * removed!
  258.  * removed!
  259.  * removed!
  260.  *
  261.  *------------------------------------------------------------------------------
  262.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  263.  *============================================================================
  264.  ****************************************************************************/
  265. #include "MMI_features.h"
  266. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  267. /*  Include: MMI header file */
  268. #include "stdC.h"
  269. #include "L4Dr1.h"
  270. #include "PixtelDataTypes.h"
  271. #include "JMMSConfig.h"
  272. #include "JMMSCompose.h"
  273. #include "JMMSResEnum.h"
  274. #include "JMMSWriteMMS.h"
  275. #include "JMMSExdcl.h"
  276. #include "Globaldefs.h"
  277. #include "GlobalMenuItems.h"
  278. #include "GlobalConstants.h"
  279. #include "EventsGprot.h"
  280. #include "HistoryGprot.h"
  281. #include "CommonScreens.h"
  282. #include "wgui_categories.h"
  283. #include "SettingProfile.h"
  284. // #include "Wap.h"
  285. #include "MessagesResourceData.h"
  286. #include "FileSystemDef.h"
  287. #include "FileManagerDef.h"
  288. #include "FileSystemGProt.h"
  289. #include "fs_type.h"
  290. #include "fs_func.h"
  291. #include "fs_errcode.h"
  292. #include "FileMgr.h"
  293. #include "jdd_memapi.h"
  294. /* jataayu files */
  295. #include "ddl.h"
  296. #include "jcal.h"
  297. #include "JMMSCoreAPI.h"
  298. #include "ddlbase.h"
  299. #include "JMMSExdcl.h"
  300. #include "jcutils.h"
  301. #include "ddlutils.h"
  302. #include "jdi_MMSErr.h"
  303. #include "jcerror.h"
  304. #include "miscutils.h"
  305. #include "JMMSMessageSettingsUtils.h"
  306. // #include "jdi_miscutils.h"
  307. #include "JMMSGprot.h"
  308. #include "jdd_MessagingConfig.h"
  309. #include "JMMSView.h"
  310. #include "NVRAMType.h"
  311. #include "NVRAMProt.h"
  312. #include "NVRAMEnum.h"
  313. #include "Fs_errcode.h"
  314. #include "JMMSInbox.h"
  315. #include "JMMSProtocols.h"
  316. #include "PhoneBookGprot.h"
  317. #include "messagingdatatypes.h"
  318. #include "prvmessagingdatatypes.h"
  319. #include "app_mine.h"
  320. #include "jdd_fileapi.h"
  321. #include "custom_wap_config.h"
  322. #ifdef __DRM_SUPPORT__
  323. #include "JMMSDRMHandler.h"
  324. #endif
  325. #include "PixtelDataTypes.h"  /* dependent headers for AudioPlayerProt.h" */
  326. #include "mdi_datatype.h"     /* dependent headers for AudioPlayerProt.h" */
  327. #if defined(__MMI_AUDIO_PLAYER__)
  328. #include "AudioPlayerProt.h"
  329. #endif
  330. #ifdef __MMI_VIDEO_PLAYER__
  331. #include "mdi_video.h"
  332. #include "jdd_videoapi.h"
  333. #endif /* __MMI_VIDEO_PLAYER__ */
  334. #include "SATDefs.h"
  335. #include "DebugInitDef.h"
  336. #ifdef __DRM_SUPPORT__
  337. #include "DRM_gprot.h"
  338. #endif 
  339. #include "wapadp.h"  // compiler warning removal
  340. /*  Include: PS header file */
  341. /* ... Add More PS header */
  342. /***************************************************************************** 
  343. * Define
  344. *****************************************************************************/
  345. #define STRING_TEXT "Text"
  346. #define STRING_IMAGE "Image"
  347. #define STRING_AUDIO "Audio"
  348. #define STRING_ATTACHMENT "Attachment"
  349. /***************************************************************************** 
  350. * Typedef 
  351. *****************************************************************************/
  352. /***************************************************************************** 
  353. * Local static Variable
  354. *****************************************************************************/
  355. /***************************************************************************** 
  356. * Local Function
  357. *****************************************************************************/
  358. /***************************************************************************** 
  359. * Global Variable
  360. *****************************************************************************/
  361. /* HIMANSHU 05122006 START */
  362. #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
  363. enum
  364. {
  365.     RESIZE_ANIMATION_DISABLE_OFF,
  366.     RESIZE_ANIMATION_DISABLE_ON
  367. };
  368. U16 resize_animation_disable_status;
  369. #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */ 
  370. /* HIMANSHU 05122006 END */
  371. /***************************************************************************** 
  372. * Global Function
  373. *****************************************************************************/
  374. extern JC_INT32 GetColorValue(JC_INT8 *pColorString);
  375. extern MMI_BOOL is_add_media_as_drm;
  376. extern kal_wchar *mime_get_extension(kal_wchar *file_path);        // compiler warning removal
  377. extern mdi_result mdi_audio_get_duration(void *file_name, U32 *time_p);  // compiler warning removal
  378. extern void kal_get_time(kal_uint32 *ticks_ptr);
  379. /*****************************************************************************
  380.  * FUNCTION
  381.  *  mmi_jmms_compose_fill_default_values_slide_settings
  382.  * DESCRIPTION
  383.  *  Initialization function of MMS compose.
  384.  * PARAMETERS
  385.  *  void
  386.  *  a(?)        [IN/OUT]        Nil(?)
  387.  *  b(?)        [IN]            Nil(?)
  388.  * RETURNS
  389.  *  void
  390.  *****************************************************************************/
  391. void mmi_jmms_compose_fill_default_values_slide_settings(void)
  392. {
  393.     /*----------------------------------------------------------------*/
  394.     /* Local Variables                                                */
  395.     /*----------------------------------------------------------------*/
  396.     /*----------------------------------------------------------------*/
  397.     /* Code Body                                                      */
  398.     /*----------------------------------------------------------------*/
  399.     g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].txt_dur_max_set = 1;
  400.     g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].img_dur_max_set = 1;
  401.     g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].audio_dur_max_set = 1;
  402.     g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].video_dur_max_set = 1;
  403.     g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic = 0;
  404.     g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold = 0;
  405.     g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size = MEDIUM_FONT;
  406.     g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time = 0;
  407.     g_jmms_context->compose_context->curr_slide_info.slide_prop.text_color = g_jmms_color_RGB_list[COLOR_BLACK];
  408.     g_jmms_context->compose_context->curr_slide_info.img_info.img_x = 0;
  409.     g_jmms_context->compose_context->curr_slide_info.img_info.img_y = 0;
  410. }
  411. /*****************************************************************************
  412.  * FUNCTION
  413.  *  mmi_jmms_compose_handle_error
  414.  * DESCRIPTION
  415.  *  error handling fn.
  416.  * PARAMETERS
  417.  *  ret_code        [IN]        
  418.  *  is_page         [IN]        
  419.  *  a(?)            [IN/OUT]        Nil(?)
  420.  *  b(?)            [IN]            Nil(?)
  421.  * RETURNS
  422.  *  void
  423.  *****************************************************************************/
  424. JMMS_COMP_ERRCODE mmi_jmms_compose_handle_error(JC_RETCODE ret_code, U8 is_page)
  425. {
  426.     /*----------------------------------------------------------------*/
  427.     /* Local Variables                                                */
  428.     /*----------------------------------------------------------------*/
  429.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_FAIL;
  430.     /*----------------------------------------------------------------*/
  431.     /* Code Body                                                      */
  432.     /*----------------------------------------------------------------*/
  433.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_compose_handle_error"));
  434.     if( (ret_code == JC_ERR_MSG_MMS_AUDIO_EXISTS) || (ret_code == JC_ERR_MSG_MMS_IMAGE_EXISTS ) ||
  435.         (ret_code == JC_ERR_MSG_MMS_VIDEO_EXISTS) || (ret_code == JC_ERR_MSG_MMS_MEDIA_TYPE_EXISTS))
  436.     {
  437.         U8 total_pages = 0; 
  438.         mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &total_pages);
  439.         if( total_pages == mmi_jmms_compose_settings_max_no_pages())
  440.         {
  441.            is_page = 1;
  442.            ret_code = JC_ERR_MSG_MAX_REACHED; 
  443.         }
  444.     }
  445.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "mmi_jmms_compose_handle_error = %d", ret_code));
  446.     switch (ret_code)
  447.     {
  448.         case JC_OK:
  449.             if (g_jmms_context->is_add_media_warning == 1 && !g_jmms_context->disable_warning_popup)
  450.             {
  451.                 DisplayPopup(
  452.                     (PU8) GetString(STR_ID_JMMS_WARNING_MODE_MEDIA),
  453.                     IMG_GLOBAL_WARNING,
  454.                     1,
  455.                     JMMS_POPUP_TIME,
  456.                     WARNING_TONE);
  457.                 err_code = JMMS_COMP_POPUP_OK;
  458.             }
  459.             else
  460.             {
  461.                 err_code = JMMS_COMP_OK;
  462.             }
  463.             break;
  464.         case JC_ERR_MSG_INVALID_HANDLE:
  465.             DisplayPopup(
  466.                 (PU8) GetString(STR_ID_JMMS_INVALID_MESSAGE_HANDLE),
  467.                 IMG_GLOBAL_ERROR,
  468.                 1,
  469.                 JMMS_POPUP_TIME,
  470.                 ERROR_TONE);
  471.             break;
  472.         case JC_ERR_MSG_INVALID_PAGE_INDEX:
  473.             DisplayPopup(
  474.                 (PU8) GetString(STR_ID_JMMS_INVALID_PAGE_INDEX),
  475.                 IMG_GLOBAL_ERROR,
  476.                 1,
  477.                 JMMS_POPUP_TIME,
  478.                 ERROR_TONE);
  479.             break;
  480.         case JC_ERR_MSG_INVALID_MEDIA_INDEX:
  481.             DisplayPopup(
  482.                 (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_ID),
  483.                 IMG_GLOBAL_ERROR,
  484.                 1,
  485.                 JMMS_POPUP_TIME,
  486.                 ERROR_TONE);
  487.             break;
  488.         case JC_ERR_MSG_MEDIA_RESTRICTED:
  489.             DisplayPopup(
  490.                 (PU8) GetString(STR_ID_JMMS_RESTRICTED_MODE_MEDIA),
  491.                 IMG_GLOBAL_ERROR,
  492.                 1,
  493.                 JMMS_POPUP_TIME,
  494.                 ERROR_TONE);
  495. err_code = JMMS_COMP_FAIL;
  496.             break;
  497.         case JC_ERR_MSG_MEDIA_WARNING:
  498. if (!g_jmms_context->disable_warning_popup)
  499. {
  500. DisplayPopup(
  501. (PU8) GetString(STR_ID_JMMS_WARNING_MODE_MEDIA),
  502. IMG_GLOBAL_WARNING,
  503. 1,
  504. JMMS_POPUP_TIME,
  505. WARNING_TONE);
  506. err_code = JMMS_COMP_POPUP_OK;
  507. }
  508. else
  509. {
  510. err_code = JMMS_COMP_OK;
  511. }
  512.             break;
  513.         case JC_ERR_MSG_MAX_REACHED:
  514.             if (is_page == 1)
  515.             {
  516.                 DisplayPopup(
  517.                     (PU8) GetString(STR_ID_JMMS_EDIT_CONTENT_MAX_SLIDE_REACHED),
  518.                     IMG_GLOBAL_WARNING,
  519.                     1,
  520.                     JMMS_POPUP_TIME,
  521.                     WARNING_TONE);
  522.             }
  523.             else
  524.             {
  525.                 DisplayPopup(
  526.                     (PU8) GetString(STR_ID_JMMS_MAX_MSG_REACHED),
  527.                     IMG_GLOBAL_WARNING,
  528.                     1,
  529.                     JMMS_POPUP_TIME,
  530.                     WARNING_TONE);
  531.             }
  532.             break;
  533.         case JC_ERR_UNSUPPORTED:
  534.             DisplayPopup(
  535.                 (PU8) GetString(STR_GLOBAL_UNSUPPORTED_FORMAT),
  536.                 IMG_GLOBAL_ERROR,
  537.                 1,
  538.                 JMMS_POPUP_TIME,
  539.                 ERROR_TONE);
  540.             break;
  541.         case JC_ERR_MSG_MMS_UNSUPPORTED_TYPE:
  542.             DisplayPopup(
  543.                 (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_TYPE),
  544.                 IMG_GLOBAL_ERROR,
  545.                 1,
  546.                 JMMS_POPUP_TIME,
  547.                 ERROR_TONE);
  548.             break;
  549.         case JC_ERR_MSG_MMS_AUDIO_EXISTS:
  550.             if (g_jmms_context->is_add_media_warning != 1)
  551.             {
  552.                 DisplayPopup(
  553.                     (PU8) GetString(STR_ID_JMMS_AUDIO_EXISTS_NEW_SLIDE),
  554.                     IMG_GLOBAL_WARNING,
  555.                     1,
  556.                     JMMS_POPUP_TIME,
  557.                     WARNING_TONE);
  558.             }
  559.             err_code = JMMS_COMP_NEW_SLIDE;
  560.             break;
  561.         case JC_ERR_MSG_MMS_IMAGE_EXISTS:
  562.             if (g_jmms_context->is_add_media_warning != 1)
  563.             {
  564.                 DisplayPopup(
  565.                     (PU8) GetString(STR_ID_JMMS_IMAGE_EXISTS_NEW_SLIDE),
  566.                     IMG_GLOBAL_WARNING,
  567.                     1,
  568.                     JMMS_POPUP_TIME,
  569.                     WARNING_TONE);
  570.             }
  571.             err_code = JMMS_COMP_NEW_SLIDE;
  572.             break;
  573.         case JC_ERR_MSG_MMS_VIDEO_EXISTS:
  574.             if (g_jmms_context->is_add_media_warning != 1)
  575.             {
  576.                 DisplayPopup(
  577.                     (PU8) GetString(STR_ID_JMMS_VIDEO_EXISTS_NEW_SLIDE),
  578.                     IMG_GLOBAL_WARNING,
  579.                     1,
  580.                     JMMS_POPUP_TIME,
  581.                     WARNING_TONE);
  582.             }
  583.             err_code = JMMS_COMP_NEW_SLIDE;
  584.             break;
  585.         case JC_ERR_MSG_MMS_MEDIA_TYPE_EXISTS:
  586.             if (g_jmms_context->is_add_media_warning != 1)
  587.             {
  588.                 DisplayPopup(
  589.                     (PU8) GetString(STR_ID_JMMS_SAME_MEDIA_EXISTS_NEW_SLIDE),
  590.                     IMG_GLOBAL_WARNING,
  591.                     1,
  592.                     JMMS_POPUP_TIME,
  593.                     WARNING_TONE);
  594.             }
  595.             err_code = JMMS_COMP_NEW_SLIDE;
  596.             break;
  597.         case JC_ERR_MSG_INVALID_MEDIA_INFO:
  598.             DisplayPopup(
  599.                 (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_INFO),
  600.                 IMG_GLOBAL_ERROR,
  601.                 1,
  602.                 JMMS_POPUP_TIME,
  603.                 ERROR_TONE);
  604.             break;
  605.         case JC_ERR_MSG_MMS_CONTENT_CLASS:
  606.             err_code = JMMS_CONTENT_CLASS;
  607.             break;
  608.             /*
  609.              * merge     case JC_ERR_MSG_MULTIPLE_REFERENCE: 
  610.              * err_code=JMMS_COMP_OK;
  611.              * break;
  612.              */
  613. case JC_ERR_FILE_SYS_INIT:
  614.         case JC_ERR_MEMORY_ALLOCATION:
  615.             DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  616.             err_code = JMMS_COMP_OUT_MEMORY;
  617.             break;
  618.         case JC_ERR_NULL_POINTER:
  619.             DisplayPopup(
  620.                 (PU8) GetString(STR_ID_JMMS_INVALID_POINTER),
  621.                 IMG_GLOBAL_ERROR,
  622.                 1,
  623.                 JMMS_POPUP_TIME,
  624.                 ERROR_TONE);
  625.             break;
  626.         default:
  627.             /* DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE); */
  628.         {
  629.             U8 error_str[20];
  630.             S8 temp[10] = {0, };
  631.             memset(error_str, 0x00, 20);
  632.             sprintf((S8*) temp, "%d", ret_code);
  633.             AnsiiToUnicodeString((PS8) (error_str), (PS8) temp);
  634.             DisplayPopup((PU8) (error_str), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  635.             break;
  636.         }
  637.     }
  638.     if (g_jmms_context->is_add_media_warning == 1)
  639.     {
  640.         g_jmms_context->is_add_media_warning = 0;
  641.     }
  642.     return err_code;
  643. }
  644. /*****************************************************************************
  645.  * FUNCTION
  646.  *  mmi_jmms_compose_new_mms
  647.  * DESCRIPTION
  648.  *  function of writing a new MMS
  649.  * PARAMETERS
  650.  *  void
  651.  *  a(?)        [IN/OUT]        Nil(?)
  652.  *  b(?)        [IN]            Nil(?)
  653.  * RETURNS
  654.  *  void
  655.  *****************************************************************************/
  656. JMMS_COMP_ERRCODE mmi_jmms_compose_new_mms(void)
  657. {
  658.     /*----------------------------------------------------------------*/
  659.     /* Local Variables                                                */
  660.     /*----------------------------------------------------------------*/
  661.     /* Deepali: use setting API's */
  662.     JC_RETCODE ret_code = JC_OK;
  663.     JMMS_COMP_ERRCODE err_code;
  664.     U8 config_arg = JMMS_CONFIG_PREVIEW;
  665.     /*----------------------------------------------------------------*/
  666.     /* Code Body                                                      */
  667.     /*----------------------------------------------------------------*/
  668.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_compose_new_mms"));
  669.     if (g_jmms_context->msg_handle != NULL)
  670.     {
  671.         ret_code = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  672.     }
  673.     if (ret_code == JC_OK)
  674.     {
  675.         g_jmms_context->msg_handle = NULL;
  676.         ret_code = mmi_jmms_jdi_msg_init(&(g_jmms_context->msg_handle), (void*)config_arg);
  677.     }
  678.     if (ret_code == JC_ERR_MEMORY_ALLOCATION)
  679.     {
  680.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Fail to create msg handle"));
  681.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  682.         goto ERROR_HANDLE;
  683.     }
  684.     if (ret_code == JC_OK)
  685.     {
  686.         ret_code = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
  687.     }
  688.     if (ret_code == JC_OK)
  689.     {
  690.         ret_code = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
  691.     }
  692.     if (ret_code == JC_OK)
  693.     {
  694.         ret_code = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
  695.     }
  696.     if (ret_code == JC_OK)
  697.     {
  698.         ret_code = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
  699.     }
  700.     if (ret_code == JC_OK)
  701.     {
  702.         ret_code = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
  703.     }
  704.     if (ret_code == JC_OK)
  705.     {
  706.         ret_code = mmi_jmms_jdi_msg_register_callback(
  707.                     g_jmms_context->msg_handle,
  708.                     E_CB_ERROR_IND,
  709.                     (void*)mmi_jmms_error_ind_cb);
  710.     }
  711.   ERROR_HANDLE:
  712.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "Fail to create msg error= %d", ret_code));
  713.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  714.     return err_code;
  715. }
  716. /*****************************************************************************
  717.  * FUNCTION
  718.  *  mmi_jmms_error_ind_cb
  719.  * DESCRIPTION
  720.  *  
  721.  * PARAMETERS
  722.  *  hMsg                [IN]        
  723.  *  pCallbackArg        [?]         [?]
  724.  *  pCBStruct           [?]         [?]
  725.  *  error               [IN]        
  726.  * RETURNS
  727.  *  
  728.  *****************************************************************************/
  729. JC_RETCODE mmi_jmms_error_ind_cb(MSG_HANDLE hMsg, void *pCallbackArg, void *pCBStruct, ErrorCode error)
  730. {
  731.     /*----------------------------------------------------------------*/
  732.     /* Local Variables                                                */
  733.     /*----------------------------------------------------------------*/
  734.     JC_RETCODE ret_code = JC_OK;
  735.     /*----------------------------------------------------------------*/
  736.     /* Code Body                                                      */
  737.     /*----------------------------------------------------------------*/
  738.     /*DIlip 30 aug 2006 commented to handel Is media already exist error indicator call back*/
  739. /*   g_jmms_context->is_add_media_warning = 0;*/
  740.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "mmi_jmms_error_ind_cb %d", error));
  741.     switch (error)
  742.     {
  743.         case E_WARNING_CREATION_MODE:
  744.             g_jmms_context->is_add_media_warning = 1;
  745.             break;
  746.         case E_WARNING_DRM_FORWARD_RESTRICTED:
  747.             ret_code = JC_ERR_MSG_DRM_FORWARD_RESTRICTED;
  748.             break;
  749.     }
  750.     return ret_code;
  751. }
  752. /*****************************************************************************
  753.  * FUNCTION
  754.  *  mmi_jmms_compose_add_media
  755.  * DESCRIPTION
  756.  *  fn to add media.
  757.  * PARAMETERS
  758.  *  path_p              [?]         [?]
  759.  *  type                [IN]        
  760.  *  is_attachment       [IN]        
  761.  *  page_index          [IN]        
  762.  *  a(?)                [IN/OUT]        Nil(?)
  763.  *  b(?)                [IN]            Nil(?)
  764.  * RETURNS
  765.  *  void
  766.  *****************************************************************************/
  767. JMMS_COMP_ERRCODE mmi_jmms_compose_add_media(void *path_p, U8 type, U8 is_attachment, U8 page_index)
  768. {
  769.     /*----------------------------------------------------------------*/
  770.     /* Local Variables                                                */
  771.     /*----------------------------------------------------------------*/
  772.     MEDIA_INFO *media_info_p;
  773.     S8 *file_name_p;
  774.     U32 file_size = 0;
  775.     /* FS_HANDLE  file_handle; */
  776.     JC_RETCODE ret_code = JC_OK;
  777.     JMMS_COMP_ERRCODE err_code;
  778.     U32 media_id;
  779.     JDD_FILE file_handle;
  780.     /*----------------------------------------------------------------*/
  781.     /* Code Body                                                      */
  782.     /*----------------------------------------------------------------*/
  783.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_media"));
  784.     media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
  785.     if (media_info_p == NULL)
  786.     {
  787.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  788.         goto ERROR_HANDLE;
  789.     }
  790.     if (g_jmms_context->jmms_fs_handle == NULL)
  791.     {
  792.         if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
  793.         {
  794.             ret_code = JC_ERR_FILE_SYS_INIT;
  795.             goto ERROR_HANDLE;
  796.         }
  797.     }
  798.     file_name_p = mmi_fmgr_extract_file_name((S8*) path_p);
  799.     file_handle = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (U16*) path_p, E_OPEN_READ_MODE);
  800.     if (file_handle == NULL)
  801.     {
  802.         ret_code = JC_ERR_FILE_OPEN;
  803.         goto ERROR_HANDLE;
  804.     }
  805.     jdd_FSGetSize(file_handle, &file_size);
  806.     jdd_FSClose(file_handle);
  807.     media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
  808.     if (media_info_p->pMimeInfo == NULL)
  809.     {
  810.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  811.         goto ERROR_HANDLE;
  812.     }
  813.     media_info_p->eMediaType = type;
  814.     if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
  815.     {
  816.         U8 size;
  817.         size = strlen(STRING_IMAGE);
  818.         media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
  819.         if (media_info_p->PresentationInfo.pRegionName == NULL)
  820.         {
  821.             ret_code = JC_ERR_MEMORY_ALLOCATION;
  822.             goto ERROR_HANDLE;
  823.         }
  824.         AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_IMAGE) );
  825.     }
  826.     media_info_p->pMimeInfo->ContentData.bIsStream = E_TRUE;
  827.     media_info_p->pMimeInfo->ContentData.eCopyMemory = E_FALSE;
  828.     media_info_p->pMimeInfo->ContentData.pBuffer = NULL;
  829.     media_info_p->pMimeInfo->ContentData.uiCurSize = 0;
  830.     media_info_p->pMimeInfo->ContentData.uiTotalSize = file_size;
  831.     media_info_p->pMimeInfo->ContentData.cbReadCallback = mmi_jmms_read_callback;
  832.     media_info_p->pMimeInfo->ContentData.cbWriteCallback = NULL;
  833.     media_info_p->pMimeInfo->ContentData.uiStartOffset = 0;
  834.     media_info_p->pMimeInfo->ContentData.pFileName =
  835.         (JC_CHAR*) jdd_MemAlloc((jc_tcslen((JC_CHAR*) path_p) + 1), sizeof(JC_CHAR));
  836.     if (media_info_p->pMimeInfo->ContentData.pFileName == NULL)
  837.     {
  838.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  839.         goto ERROR_HANDLE;
  840.     }
  841.     jc_tcscpy((UI_character_type*) media_info_p->pMimeInfo->ContentData.pFileName, (UI_character_type*) path_p);
  842.     media_info_p->pMimeInfo->ContentData.pStream = media_info_p->pMimeInfo->ContentData.pFileName;
  843.     media_info_p->pMimeInfo->MimeHeaders.bIsAttachment = is_attachment;
  844.     if ((GetUCS2Flag((S8*) file_name_p) == FALSE )&& (IsExtendedCharPresent((S8*) file_name_p)== FALSE))
  845.     {
  846.         media_info_p->pMimeInfo->MimeHeaders.pObjectName =
  847.             (JC_CHAR*) jdd_MemAlloc((jc_tcslen((JC_CHAR*) file_name_p) + 1), sizeof(JC_CHAR));
  848.         if (media_info_p->pMimeInfo->MimeHeaders.pObjectName == NULL)
  849.         {
  850.             ret_code = JC_ERR_MEMORY_ALLOCATION;
  851.             goto ERROR_HANDLE;
  852.         }
  853.         jc_tcscpy((JC_CHAR*) media_info_p->pMimeInfo->MimeHeaders.pObjectName, (JC_CHAR*) file_name_p);
  854.     }
  855.     else
  856.     {
  857.         ret_code = mmi_jmms_convert_chinese_english_filename(
  858.                     (JC_CHAR **) & (media_info_p->pMimeInfo->MimeHeaders.pObjectName),
  859.                     (JC_CHAR*) file_name_p);
  860.         if (ret_code != JC_OK)
  861.         {
  862.             goto ERROR_HANDLE;
  863.         }
  864.     }
  865. #ifdef __DRM_SUPPORT__
  866.     if(jMMS_is_sep_delivery_content(path_p))/* && (mmi_jmms_compose_settings_creation_mode() == E_CREATION_MODE_RESTRICTED))*/
  867.     {
  868.         media_info_p->pMimeInfo->MimeHeaders.pContentType = jdi_UtilsStrdup("application/vnd.oma.drm.content");
  869.     }
  870.     else
  871.     {
  872. #endif /* __DRM_SUPPORT__ */ 
  873.         media_info_p->pMimeInfo->MimeHeaders.pContentType =
  874.         (JC_INT8*) mmi_mms_get_mms_content_type_file((UI_character_type*) file_name_p);
  875. #ifdef __DRM_SUPPORT__
  876.     }
  877. #endif
  878.     if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
  879.     {
  880.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  881.         goto ERROR_HANDLE;
  882.     }
  883.     /* add media */
  884.     ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
  885.     if(ret_code != JC_OK)
  886.     {
  887.         goto ERROR_HANDLE;
  888.     }
  889. #ifdef __DRM_SUPPORT__
  890.     if(is_add_media_as_drm)
  891.     {
  892.         ret_code = jdi_MsgSetMediaDRMType (g_jmms_context->msg_handle, page_index, 
  893. media_id, E_DRM_FWD_LOCK, 
  894. media_info_p->pMimeInfo->MimeHeaders.bIsAttachment);
  895.         mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle,
  896.                                     E_CB_DRM_COMPOSE,
  897.                                     (void*)jMMS_drm_compose_handler);
  898.         is_add_media_as_drm = MMI_FALSE;
  899.     }
  900.     else
  901.     {
  902.         ret_code = jdi_MsgSetMediaDRMType (g_jmms_context->msg_handle, page_index, 
  903. media_id, E_DRM_NONE, 
  904. media_info_p->pMimeInfo->MimeHeaders.bIsAttachment);
  905.     }
  906. #endif
  907.   ERROR_HANDLE:
  908.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  909.     switch (err_code)
  910.     {
  911.         case JMMS_COMP_OK:
  912.         case JMMS_COMP_POPUP_OK:
  913.         {
  914.             if (is_attachment == E_FALSE)
  915.             {
  916.                 U32 start_time = 0;
  917.   U32 duration = 0, audio_duration = 0;
  918.                 U32 max = 999;
  919.             #ifdef __MMI_VIDEO_PLAYER__
  920.                 U64 video_duration = 0;
  921.             #endif 
  922.                 switch (type)
  923.                 {
  924.                     case E_MEDIA_IMAGE:
  925.                     {
  926.                         g_jmms_context->compose_context->curr_slide_info.image_ID = media_id;
  927.                         g_jmms_context->compose_context->curr_slide_info.img_info.pFileName =
  928.                             (U8*) media_info_p->pMimeInfo->ContentData.pFileName;
  929.                         break;
  930.                     }
  931.                     case E_MEDIA_AUDIO:
  932.                         g_jmms_context->compose_context->curr_slide_info.audio_ID = media_id;
  933. mdi_audio_get_duration((S8*) path_p, &audio_duration);
  934. duration = audio_duration / 1000;
  935. duration = (duration >= max)? max : ((audio_duration % 1000) > 0)?(duration + 1) : duration;
  936. err_code = mmi_jmms_set_media_time(
  937. start_time,
  938. duration,
  939. g_jmms_context->compose_context->curr_slide_info.audio_ID,
  940. g_jmms_context->compose_context->curr_page_index);
  941.                         break;
  942.                     case E_MEDIA_VIDEO:
  943.                         g_jmms_context->compose_context->curr_slide_info.video_ID = media_id;
  944.                         g_jmms_context->compose_context->curr_slide_info.img_info.pFileName =
  945.                             (U8*) media_info_p->pMimeInfo->ContentData.pFileName;
  946. #ifdef __MMI_VIDEO_PLAYER__
  947. video_duration = mmi_jdd_videoapp_get_video_file_duration_info((S8*) path_p);
  948. duration = (U32)( video_duration / 1000);
  949. duration = (duration >= max)? max : ((video_duration % 1000) > 0)?(duration + 1) : duration;
  950. err_code = mmi_jmms_set_media_time(
  951. start_time,
  952. duration,
  953. g_jmms_context->compose_context->curr_slide_info.video_ID,
  954. g_jmms_context->compose_context->curr_page_index);
  955. #endif
  956.                         break;
  957.                 }
  958.             }
  959.             else
  960.             {
  961.                 g_jmms_context->num_attachments++;
  962.             }
  963.         }
  964.             break;
  965.         case JMMS_COMP_FAIL:
  966.         case JMMS_COMP_OUT_MEMORY:  /* deallocate memory for new slide and out of mmeory case. */
  967.         {
  968.             if (media_info_p != NULL)
  969.             {
  970.                 if (media_info_p->pMimeInfo != NULL)
  971.                 {
  972.                     if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
  973.                     {
  974.                         jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
  975.                     }
  976.                     if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
  977.                     {
  978.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
  979.                     }
  980.                     if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
  981.                     {
  982.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
  983.                     }
  984.                     jdd_MemFree(media_info_p->pMimeInfo);
  985.                 }
  986.                 if (media_info_p->PresentationInfo.pRegionName != NULL)
  987.                 {
  988.                     jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
  989.                 }
  990.                 jdd_MemFree(media_info_p);
  991.                 media_info_p = NULL;
  992.             }
  993.         }
  994.             err_code = JMMS_COMP_FAIL;
  995.             break;
  996.         case JMMS_COMP_NEW_SLIDE:
  997.         {
  998.             JMMS_COMP_ERRCODE temp_err_code;
  999.             if (media_info_p != NULL)
  1000.             {
  1001.                 if (media_info_p->pMimeInfo != NULL)
  1002.                 {
  1003.                     if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
  1004.                     {
  1005.                         jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
  1006.                     }
  1007.                     if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
  1008.                     {
  1009.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
  1010.                     }
  1011.                     if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
  1012.                     {
  1013.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
  1014.                     }
  1015.                     jdd_MemFree(media_info_p->pMimeInfo);
  1016.                 }
  1017.                 if (media_info_p->PresentationInfo.pRegionName != NULL)
  1018.                 {
  1019.                     jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
  1020.                 }
  1021.                 jdd_MemFree(media_info_p);
  1022.                 media_info_p = NULL;
  1023.             }
  1024.             temp_err_code = mmi_jmms_compose_insert_slide();
  1025.             if (temp_err_code == JMMS_COMP_OK)
  1026.             {
  1027.                 HistoryReplace(SCR_ID_JMMS_EDIT_CONTENT, SCR_ID_JMMS_EDIT_CONTENT, mmi_jmms_entry_edit_content_screen); /* to delete guibuffer details as entering new slide. */
  1028.                 temp_err_code = mmi_jmms_compose_add_media(path_p, type, is_attachment, (U8) (page_index + 1));
  1029.             }
  1030.             if (temp_err_code != JMMS_COMP_OK)
  1031.             {
  1032.                 err_code = temp_err_code;
  1033.             }
  1034.             else
  1035.             {
  1036.                 err_code = JMMS_COMP_POPUP_OK;
  1037.             }
  1038.         }
  1039.             break;
  1040.     }
  1041.     mmi_jmms_set_region_list();
  1042.     if (g_jmms_context->jmms_fs_handle != NULL)
  1043.     {
  1044.         jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
  1045.         g_jmms_context->jmms_fs_handle = NULL;
  1046.     }
  1047.     if (media_info_p != NULL)
  1048.     {
  1049.         jdd_MemFree(media_info_p);
  1050.         media_info_p = NULL;
  1051.     }
  1052.     return err_code;
  1053. }
  1054. /*****************************************************************************
  1055.  * FUNCTION
  1056.  *  mmi_jmms_compose_add_media_template
  1057.  * DESCRIPTION
  1058.  *  fn to add media.
  1059.  * PARAMETERS
  1060.  *  buffer              [?]         [?]
  1061.  *  content_type        [?]         [?]
  1062.  *  size                [IN]        
  1063.  *  type                [IN]        
  1064.  *  is_attachment       [IN]        
  1065.  *  page_index          [IN]        
  1066.  *  a(?)                [IN/OUT]        Nil(?)
  1067.  *  b(?)                [IN]            Nil(?)
  1068.  * RETURNS
  1069.  *  void
  1070.  *****************************************************************************/
  1071. JMMS_COMP_ERRCODE mmi_jmms_compose_add_media_template(
  1072.                     U8 *buffer,
  1073.                     U8 *content_type,
  1074.                     U32 size,
  1075.                     U8 type,
  1076.                     U8 is_attachment,
  1077.                     U8 page_index)
  1078. {
  1079.     /*----------------------------------------------------------------*/
  1080.     /* Local Variables                                                */
  1081.     /*----------------------------------------------------------------*/
  1082.     MEDIA_INFO *media_info_p;
  1083.     JC_RETCODE ret_code = JC_OK;
  1084.     JMMS_COMP_ERRCODE err_code;
  1085.     U32 media_id;
  1086.     U8 *media_buffer_p = NULL;
  1087.     U8 region_size = 0;
  1088.     U8 object_name_size = 0;
  1089.     /*----------------------------------------------------------------*/
  1090.     /* Code Body                                                      */
  1091.     /*----------------------------------------------------------------*/
  1092.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_media_template"));
  1093.     media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
  1094.     if (media_info_p == NULL)
  1095.     {
  1096.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1097.         goto ERROR_HANDLE;
  1098.     }
  1099.     media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
  1100.     if (media_info_p->pMimeInfo == NULL)
  1101.     {
  1102.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1103.         goto ERROR_HANDLE;
  1104.     }
  1105.     media_info_p->eMediaType = type;
  1106.     if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
  1107.     {
  1108.         region_size = strlen(STRING_IMAGE);
  1109.         media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), region_size + 1);
  1110.         if (media_info_p->PresentationInfo.pRegionName == NULL)
  1111.         {
  1112.             ret_code = JC_ERR_MEMORY_ALLOCATION;
  1113.             goto ERROR_HANDLE;
  1114.         }
  1115.         AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_IMAGE));
  1116.     }
  1117.     media_info_p->pMimeInfo->ContentData.bIsStream = E_FALSE;
  1118.     media_info_p->pMimeInfo->ContentData.eCopyMemory = E_FALSE;
  1119.     media_buffer_p = (U8*) jdd_MemAlloc(size, sizeof(U8));
  1120.     if (media_buffer_p == NULL)
  1121.     {
  1122.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1123.         goto ERROR_HANDLE;
  1124.     }
  1125.     memcpy(media_buffer_p, buffer, size);
  1126.     media_info_p->pMimeInfo->ContentData.pBuffer = media_buffer_p;
  1127.     media_info_p->pMimeInfo->ContentData.uiCurSize = size;
  1128.     media_info_p->pMimeInfo->ContentData.uiTotalSize = size;
  1129.     media_info_p->pMimeInfo->ContentData.cbReadCallback = NULL;
  1130.     media_info_p->pMimeInfo->ContentData.cbWriteCallback = NULL;
  1131.     media_info_p->pMimeInfo->ContentData.uiStartOffset = 0;
  1132.     media_info_p->pMimeInfo->ContentData.pFileName = NULL;
  1133.     media_info_p->pMimeInfo->MimeHeaders.bIsAttachment = is_attachment;
  1134.     if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
  1135.     {
  1136.         object_name_size = strlen(STRING_IMAGE);
  1137.     }
  1138.     else if (is_attachment == E_FALSE)
  1139.     {
  1140.         object_name_size = strlen(STRING_AUDIO);
  1141.     }
  1142.     else
  1143.     {
  1144.         object_name_size = strlen(STRING_ATTACHMENT);
  1145.     }
  1146.     media_info_p->pMimeInfo->MimeHeaders.pObjectName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), object_name_size + 1);
  1147.     if (media_info_p->pMimeInfo->MimeHeaders.pObjectName == NULL)
  1148.     {
  1149.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1150.         goto ERROR_HANDLE;
  1151.     }
  1152.     if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
  1153.     {
  1154.         AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_IMAGE));
  1155.     }
  1156.     else if (is_attachment == E_FALSE)
  1157.     {
  1158.         AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_AUDIO));
  1159.     }
  1160.     else
  1161.     {
  1162.         AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_ATTACHMENT));
  1163.     }
  1164.     media_info_p->pMimeInfo->MimeHeaders.pContentType =
  1165.         (JC_INT8*) jdd_MemAlloc(sizeof(JC_INT8), strlen((S8*) content_type) + 1);
  1166.     if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
  1167.     {
  1168.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1169.         goto ERROR_HANDLE;
  1170.     }
  1171.     strcpy((S8*) media_info_p->pMimeInfo->MimeHeaders.pContentType, (S8*) content_type);
  1172.     /* add media */
  1173.     ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
  1174.   ERROR_HANDLE:
  1175.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1176.     switch (err_code)
  1177.     {
  1178.         case JMMS_COMP_FAIL:
  1179.         case JMMS_COMP_OUT_MEMORY:  /* deallocate memory for new slide and out of mmeory case. */
  1180.         {
  1181.             if (media_info_p != NULL)
  1182.             {
  1183.                 if (media_info_p->pMimeInfo != NULL)
  1184.                 {
  1185.                     if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
  1186.                     {
  1187.                         jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
  1188.                     }
  1189.                     if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
  1190.                     {
  1191.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
  1192.                     }
  1193.                     if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
  1194.                     {
  1195.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
  1196.                     }
  1197.                     jdd_MemFree(media_info_p->pMimeInfo);
  1198.                 }
  1199.                 if (media_info_p->PresentationInfo.pRegionName != NULL)
  1200.                 {
  1201.                     jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
  1202.                 }
  1203.                 jdd_MemFree(media_info_p);
  1204.                 media_info_p = NULL;
  1205.             }
  1206.         }
  1207.             err_code = JMMS_COMP_FAIL;
  1208.             break;
  1209.     }
  1210.     mmi_jmms_set_region_list();
  1211.     if (media_info_p != NULL)
  1212.     {
  1213.         jdd_MemFree(media_info_p);
  1214.         media_info_p = NULL;
  1215.     }
  1216.     return err_code;
  1217. }
  1218. /*****************************************************************************
  1219.  * FUNCTION
  1220.  *  mmi_jmms_compose_add_text
  1221.  * DESCRIPTION
  1222.  *  fn to add text.
  1223.  * PARAMETERS
  1224.  *  page_index      [IN]        
  1225.  *  text_font       [IN]        
  1226.  *  txt_color       [IN]        
  1227.  *  a(?)            [IN/OUT]        Nil(?)
  1228.  *  b(?)            [IN]            Nil(?)
  1229.  * RETURNS
  1230.  *  void
  1231.  *****************************************************************************/
  1232. /* U8 media_buffer_p[3000]; */
  1233. JMMS_COMP_ERRCODE mmi_jmms_compose_add_text(U8 page_index, UI_font_type text_font, U32 txt_color, S32 update_text_id)
  1234. {
  1235.     /*----------------------------------------------------------------*/
  1236.     /* Local Variables                                                */
  1237.     /*----------------------------------------------------------------*/
  1238.     MEDIA_INFO *media_info_p;
  1239.     JC_RETCODE ret_code = JC_OK;
  1240.     JMMS_COMP_ERRCODE err_code;
  1241.     U32 media_id;
  1242.     U32 buffer_size;
  1243.     U8 size;
  1244.     U8 *media_buffer_p = NULL;
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_text"));
  1249.     media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
  1250.     if (media_info_p == NULL)
  1251.     {
  1252.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1253.         goto ERROR_HANDLE;
  1254.     }
  1255.     media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
  1256.     if (media_info_p->pMimeInfo == NULL)
  1257.     {
  1258.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1259.         goto ERROR_HANDLE;
  1260.     }
  1261.     media_info_p->eMediaType = E_MEDIA_TEXT;
  1262.     media_info_p->PresentationInfo.pTextAttributes =
  1263.         (TEXT_ATTRIBUTES*) jdd_MemAlloc(sizeof(TEXT_ATTRIBUTES), sizeof(U8));
  1264.     if (media_info_p->PresentationInfo.pTextAttributes == NULL)
  1265.     {
  1266.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1267.         goto ERROR_HANDLE;
  1268.     }
  1269.     if (text_font->bold == 1)
  1270.     {
  1271.         media_info_p->PresentationInfo.pTextAttributes->bIsBold = E_TRUE;
  1272.     }
  1273.     if (text_font->italic == 1)
  1274.     {
  1275.         media_info_p->PresentationInfo.pTextAttributes->bIsItalic = E_TRUE;
  1276.     }
  1277.     media_info_p->PresentationInfo.pTextAttributes->pFontColor =
  1278.         (JC_INT8*) jdd_MemAlloc((strlen("#rrggbb") + 1), sizeof(JC_INT8));
  1279.     if (media_info_p->PresentationInfo.pTextAttributes->pFontColor == NULL)
  1280.     {
  1281.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1282.         goto ERROR_HANDLE;
  1283.     }
  1284.     mmi_jmms_convert_u32To_hash_col_string(txt_color, media_info_p->PresentationInfo.pTextAttributes->pFontColor);
  1285.     switch (text_font->size)
  1286.     {
  1287.         case SMALL_FONT:
  1288.             media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_SMALL;
  1289.             break;
  1290.         case LARGE_FONT:
  1291.             media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_LARGE;
  1292.             break;
  1293.         case MEDIUM_FONT:
  1294.             media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_NORMAL;
  1295.             break;
  1296.     }
  1297.     media_info_p->pMimeInfo->MimeHeaders.pContentType =
  1298.         (JC_INT8*) jdd_MemAlloc(jc_strlen("text/plain") + 1, sizeof(JC_INT8));
  1299.     if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
  1300.     {
  1301.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1302.         goto ERROR_HANDLE;
  1303.     }
  1304.     jc_strcpy(media_info_p->pMimeInfo->MimeHeaders.pContentType, "text/plain");
  1305.     size = strlen(STRING_TEXT);
  1306.     media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
  1307.     if (media_info_p->PresentationInfo.pRegionName == NULL)
  1308.     {
  1309.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1310.         goto ERROR_HANDLE;
  1311.     }
  1312.     AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_TEXT));
  1313.     buffer_size = jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) *
  1314.         sizeof(JC_CHAR);
  1315.     media_info_p->pMimeInfo->ContentData.uiTotalSize = buffer_size;
  1316.     media_info_p->pMimeInfo->ContentData.uiCurSize = buffer_size;
  1317.     media_buffer_p = (U8*) jdd_MemAlloc(buffer_size + 1, sizeof(U16));
  1318.     if (media_buffer_p == NULL)
  1319.     {
  1320.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1321.         goto ERROR_HANDLE;
  1322.     }
  1323.     jc_tcscpy(
  1324.         (UI_character_type*) media_buffer_p,
  1325.         (UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer);
  1326.     media_info_p->pMimeInfo->ContentData.pBuffer = media_buffer_p;
  1327.     ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
  1328.   ERROR_HANDLE:
  1329.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1330.     switch (err_code)
  1331.     {
  1332.         case JMMS_COMP_OK:
  1333.         case JMMS_COMP_POPUP_OK:
  1334. if(update_text_id)
  1335. g_jmms_context->compose_context->curr_slide_info.text_ID = media_id;
  1336.             break;
  1337.         case JMMS_COMP_FAIL:
  1338.         case JMMS_COMP_OUT_MEMORY:  /* deallocate memory for new slide and out of mmeory case. */
  1339.         {
  1340.             if (media_info_p != NULL)
  1341.             {
  1342.                 if (media_info_p->pMimeInfo != NULL)
  1343.                 {
  1344.                     if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
  1345.                     {
  1346.                         jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
  1347.                     }
  1348.                     jdd_MemFree(media_info_p->pMimeInfo);
  1349.                 }
  1350.                 if (media_info_p->PresentationInfo.pRegionName != NULL)
  1351.                 {
  1352.                     jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
  1353.                 }
  1354.                 if (media_info_p->PresentationInfo.pTextAttributes != NULL)
  1355.                 {
  1356.                     jdd_MemFree(media_info_p->PresentationInfo.pTextAttributes);
  1357.                 }
  1358.                 jdd_MemFree(media_info_p);
  1359.                 media_info_p = NULL;
  1360.             }
  1361.             if (media_buffer_p != NULL)
  1362.             {
  1363.                 jdd_MemFree(media_buffer_p);
  1364.             }
  1365.         }
  1366.             err_code = JMMS_COMP_FAIL;
  1367.             break;
  1368.     }
  1369.     mmi_jmms_set_region_list();
  1370.     if (media_info_p != NULL)
  1371.     {
  1372.         jdd_MemFree(media_info_p);
  1373.         media_info_p = NULL;
  1374.     }
  1375.     return err_code;
  1376. }
  1377. /*****************************************************************************
  1378.  * FUNCTION
  1379.  *  mmi_jmms_compose_update_text
  1380.  * DESCRIPTION
  1381.  *  fn to update text media.
  1382.  * PARAMETERS
  1383.  *  page_index      [IN]        
  1384.  *  media_id        [IN]        
  1385.  *  a(?)            [IN/OUT]        Nil(?)
  1386.  *  b(?)            [IN]            Nil(?)
  1387.  * RETURNS
  1388.  *  void
  1389.  *****************************************************************************/
  1390. /* U8 media_buffer_p[3000]; */
  1391. JMMS_COMP_ERRCODE mmi_jmms_compose_update_text(U8 page_index, U32 media_id)
  1392. {
  1393.     /*----------------------------------------------------------------*/
  1394.     /* Local Variables                                                */
  1395.     /*----------------------------------------------------------------*/
  1396.     JC_UINT8 *media_buffer_p;
  1397.     U32 buffer_size;
  1398.     JC_RETCODE ret_code = JC_OK;
  1399.     JMMS_COMP_ERRCODE err_code;
  1400.     /*----------------------------------------------------------------*/
  1401.     /* Code Body                                                      */
  1402.     /*----------------------------------------------------------------*/
  1403.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_update_text"));
  1404.     buffer_size = jc_tcslen((JC_CHAR*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) * sizeof(JC_CHAR);
  1405.     media_buffer_p = (U8*) jdd_MemAlloc(buffer_size + 1, sizeof(JC_CHAR));
  1406.     if (media_buffer_p == NULL)
  1407.     {
  1408.         ret_code = JC_ERR_MEMORY_ALLOCATION;
  1409.         goto ERROR_HANDLE;
  1410.     }
  1411.     jc_tcscpy(
  1412.         (JC_CHAR*) media_buffer_p,
  1413.         (JC_CHAR*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer);
  1414.     ret_code = mmi_jmms_jdi_update_inline_text(
  1415.                 g_jmms_context->msg_handle,
  1416.                 (JC_UINT8*) media_buffer_p,
  1417.                 buffer_size,
  1418.                 page_index,
  1419.                 media_id);
  1420.   ERROR_HANDLE:
  1421.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1422.     switch (err_code)
  1423.     {
  1424.         case JMMS_COMP_FAIL:
  1425.         case JMMS_COMP_OUT_MEMORY:  /* deallocate memory for new slide and out of mmeory case. */
  1426.             if (media_buffer_p != NULL)
  1427.             {
  1428.                 jdd_MemFree(media_buffer_p);
  1429.             }
  1430.             err_code = JMMS_COMP_FAIL;
  1431.             break;
  1432.     }
  1433.     return err_code;
  1434. }
  1435. /*****************************************************************************
  1436.  * FUNCTION
  1437.  *  mmi_mms_get_mms_content_type_file
  1438.  * DESCRIPTION
  1439.  *  returns the content type of media file.
  1440.  * PARAMETERS
  1441.  *  file_name_p     [?]     [?]
  1442.  *  a(?)            [IN/OUT]        Nil(?)
  1443.  *  b(?)            [IN]            Nil(?)
  1444.  * RETURNS
  1445.  *  void
  1446.  *****************************************************************************/
  1447. U8 *mmi_mms_get_mms_content_type_file(JC_CHAR *file_name_p)
  1448. {
  1449.     /*----------------------------------------------------------------*/
  1450.     /* Local Variables                                                */
  1451.     /*----------------------------------------------------------------*/
  1452.     U8 *content_type_p = NULL;
  1453.     JC_CHAR *tmp_file_name = NULL;
  1454.     applib_mime_type_struct *mime_info = NULL;
  1455.     /*----------------------------------------------------------------*/
  1456.     /* Code Body                                                      */
  1457.     /*----------------------------------------------------------------*/
  1458.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_mms_get_mms_content_type_file"));
  1459.     if (file_name_p)
  1460.     {
  1461.         U32 iIndex = 0;
  1462.         tmp_file_name = jdi_UtilsTcsDup(file_name_p);
  1463.         tmp_file_name = jdi_UtilsTcsUpperToLower((JC_CHAR*) tmp_file_name);
  1464.         iIndex = jdi_UtilsLastIndexOfTchar('.', tmp_file_name, jc_tcslen(tmp_file_name) - 1);
  1465.         if (iIndex > 0 && jc_tcslen(tmp_file_name) != (U32) iIndex)
  1466.         {
  1467.             U16 uhCounter = 0;
  1468.             iIndex++;
  1469.             while (*(g_content_type_list[uhCounter][0]) != 0)
  1470.             {
  1471.                 if (jdi_UtilsTcsStrCmp(tmp_file_name + iIndex, g_content_type_list[uhCounter][1]) == 0)
  1472.                 {
  1473.                     content_type_p = (U8*) jdi_UtilsStrdup(g_content_type_list[uhCounter][0]);
  1474.                     break;
  1475.                 }
  1476.                 uhCounter++;
  1477.             }
  1478.         }
  1479.     }
  1480.     if (tmp_file_name)
  1481.     {
  1482.         jdd_MemFree(tmp_file_name);
  1483.     }
  1484.     if (content_type_p == NULL)
  1485.     {
  1486.          if(mime_get_extension(file_name_p) != NULL)
  1487.          {
  1488.              mime_info = mime_get_file_type(file_name_p);
  1489.          }
  1490.         if (mime_info == NULL)
  1491.         {
  1492.             content_type_p = (U8*) jdi_UtilsStrdup("application/octet-stream");
  1493.         }
  1494.         else
  1495.         {
  1496.             content_type_p = (U8*) jdi_UtilsStrdup(mime_info->mime_string);
  1497.         }
  1498.     }
  1499.     return content_type_p;
  1500. }
  1501. /*****************************************************************************
  1502.  * FUNCTION
  1503.  *  mmi_jmms_is_mime_found_in_g_content_type_list
  1504.  * DESCRIPTION
  1505.  *  returns the content type of media file.
  1506.  * PARAMETERS
  1507.  *  pszContentType     [IN]
  1508.  * RETURNS
  1509.  *  JC_BOOLEAN
  1510.  *****************************************************************************/
  1511. JC_BOOLEAN mmi_jmms_is_mime_found_in_g_content_type_list(JC_INT8 *pszContentType)
  1512. {
  1513.     /*----------------------------------------------------------------*/
  1514.     /* Local Variables                                                */
  1515.     /*----------------------------------------------------------------*/
  1516.     S32 uhCounter = 0;
  1517.     /*----------------------------------------------------------------*/
  1518.     /* Code Body                                                      */
  1519.     /*----------------------------------------------------------------*/
  1520.     while (*(g_content_type_list[uhCounter][0]) != 0)
  1521.     {
  1522.         if (strcmp(pszContentType, (PS8)(g_content_type_list[uhCounter][0])) == 0)
  1523.         {
  1524.             return E_TRUE;
  1525.         }
  1526.         uhCounter++;
  1527.     }
  1528.     return E_FALSE;
  1529. }
  1530. /*****************************************************************************
  1531.  * FUNCTION
  1532.  *  mmi_jmms_compose_delete_media
  1533.  * DESCRIPTION
  1534.  *  fn to delete media.
  1535.  * PARAMETERS
  1536.  *  media_id            [IN]        
  1537.  *  page_index          [IN]        
  1538.  *  is_attachment       [IN]        
  1539.  *  a(?)                [IN/OUT]        Nil(?)
  1540.  *  b(?)                [IN]            Nil(?)
  1541.  * RETURNS
  1542.  *  void
  1543.  *****************************************************************************/
  1544. /* U8 media_buffer_p[3000]; */
  1545. JMMS_COMP_ERRCODE mmi_jmms_compose_delete_media(U32 media_id, U8 page_index, U8 is_attachment)
  1546. {
  1547.     /*----------------------------------------------------------------*/
  1548.     /* Local Variables                                                */
  1549.     /*----------------------------------------------------------------*/
  1550.     JC_RETCODE ret_code = JC_OK;
  1551.     JMMS_COMP_ERRCODE err_code;
  1552.     /*----------------------------------------------------------------*/
  1553.     /* Code Body                                                      */
  1554.     /*----------------------------------------------------------------*/
  1555.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_delete_media"));
  1556.     ret_code = mmi_jmms_jdi_delete_media(g_jmms_context->msg_handle, page_index, media_id, is_attachment);
  1557.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1558.     return err_code;
  1559. }
  1560. /*****************************************************************************
  1561.  * FUNCTION
  1562.  *  mmi_jmms_compose_delete_page
  1563.  * DESCRIPTION
  1564.  *  fn to delete media.
  1565.  * PARAMETERS
  1566.  *  page_index      [IN]        
  1567.  *  a(?)            [IN/OUT]        Nil(?)
  1568.  *  b(?)            [IN]            Nil(?)
  1569.  * RETURNS
  1570.  *  void
  1571.  *****************************************************************************/
  1572. /* U8 media_buffer_p[3000]; */
  1573. JMMS_COMP_ERRCODE mmi_jmms_compose_delete_page(U8 page_index)
  1574. {
  1575.     /*----------------------------------------------------------------*/
  1576.     /* Local Variables                                                */
  1577.     /*----------------------------------------------------------------*/
  1578.     JC_RETCODE ret_code = JC_OK;
  1579.     JMMS_COMP_ERRCODE err_code;
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Code Body                                                      */
  1582.     /*----------------------------------------------------------------*/
  1583.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_delete_page"));
  1584.     ret_code = mmi_jmms_jdi_delete_page(g_jmms_context->msg_handle, page_index);
  1585.     err_code = mmi_jmms_compose_handle_error(ret_code, 1);
  1586.     return err_code;
  1587. }
  1588. /*****************************************************************************
  1589.  * FUNCTION
  1590.  *  mmi_jmms_compose_get_media_list
  1591.  * DESCRIPTION
  1592.  *  fn to delete media.
  1593.  * PARAMETERS
  1594.  *  page_index          [IN]        
  1595.  *  media_info_p        [IN]        
  1596.  *  media_count         [?]         [?]
  1597.  *  is_attachment       [IN]        
  1598.  *  a(?)                [IN/OUT]        Nil(?)
  1599.  *  b(?)                [IN]            Nil(?)
  1600.  * RETURNS
  1601.  *  void
  1602.  *****************************************************************************/
  1603. /* U8 media_buffer_p[3000]; */
  1604. JMMS_COMP_ERRCODE mmi_jmms_compose_get_media_list(
  1605.                     U8 page_index,
  1606.                     MEDIA_INFO **media_info_p,
  1607.                     U8 *media_count,
  1608.                     U8 is_attachment)
  1609. {
  1610.     /*----------------------------------------------------------------*/
  1611.     /* Local Variables                                                */
  1612.     /*----------------------------------------------------------------*/
  1613.     JC_RETCODE ret_code = JC_OK;
  1614.     JMMS_COMP_ERRCODE err_code;
  1615.     /*----------------------------------------------------------------*/
  1616.     /* Code Body                                                      */
  1617.     /*----------------------------------------------------------------*/
  1618.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_get_media_list"));
  1619.     ret_code = mmi_jmms_jdi_get_media_list(g_jmms_context->msg_handle, page_index, media_info_p, media_count, is_attachment);
  1620.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1621.     if (*media_count == 0)
  1622.     {
  1623.         err_code = JMMS_COMP_FAIL;
  1624.     }
  1625.     return err_code;
  1626. }
  1627. /*****************************************************************************
  1628.  * FUNCTION
  1629.  *  mmi_jmms_compose_insert_slide
  1630.  * DESCRIPTION
  1631.  *  This fn inserts a slide.
  1632.  * PARAMETERS
  1633.  *  void
  1634.  *  a(?)        [IN/OUT]        Nil(?)
  1635.  *  b(?)        [IN]            Nil(?)
  1636.  * RETURNS
  1637.  *  void
  1638.  *****************************************************************************/
  1639. JMMS_COMP_ERRCODE mmi_jmms_compose_insert_slide(void)
  1640. {
  1641.     /*----------------------------------------------------------------*/
  1642.     /* Local Variables                                                */
  1643.     /*----------------------------------------------------------------*/
  1644.     JC_RETCODE ret_code = JC_OK;
  1645.     JMMS_COMP_ERRCODE err_code;
  1646.     U8 max_page = 0, count = 0;
  1647.     U32 slide_time = 0;
  1648.     /*----------------------------------------------------------------*/
  1649.     /* Code Body                                                      */
  1650.     /*----------------------------------------------------------------*/
  1651.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_insert_slide"));
  1652. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
  1653. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
  1654. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
  1655.     max_page = (U8) mmi_jmms_compose_settings_max_no_pages();
  1656.     if (max_page > g_jmms_context->compose_context->curr_page_index)
  1657.     {
  1658.         ret_code = mmi_jmms_jdi_add_page(
  1659.                     g_jmms_context->msg_handle,
  1660.                     (U8) (g_jmms_context->compose_context->curr_page_index + 1));
  1661.     }
  1662.     else
  1663.     {
  1664.         ret_code = JC_ERR_MSG_MAX_REACHED;
  1665.     }
  1666.     err_code = mmi_jmms_compose_handle_error(ret_code, 1);
  1667.     switch (err_code)
  1668.     {
  1669.         case JMMS_COMP_OK:
  1670.         {
  1671.             g_jmms_context->compose_context->curr_page_index++;
  1672.             /* shuffling of compose_context->duration handling array  */
  1673.             for(count = MAX_POSSIBLE_SLIDES - 1; count >= g_jmms_context->compose_context->curr_page_index ; count-- )
  1674.             {
  1675.                 g_jmms_context->compose_context->duration[count].txt_dur_max_set = g_jmms_context->compose_context->duration[count - 1].txt_dur_max_set;
  1676.                 g_jmms_context->compose_context->duration[count].img_dur_max_set = g_jmms_context->compose_context->duration[count - 1].img_dur_max_set;
  1677.                 g_jmms_context->compose_context->duration[count].audio_dur_max_set = g_jmms_context->compose_context->duration[count - 1].audio_dur_max_set;
  1678.                 g_jmms_context->compose_context->duration[count].video_dur_max_set = g_jmms_context->compose_context->duration[count - 1].video_dur_max_set;
  1679.             }
  1680.             mmi_jmms_compose_fill_default_values_slide_settings();
  1681.             slide_time = mmi_jmms_compose_settings_default_slide_time();
  1682.             err_code = mmi_jmms_save_page_time(slide_time);
  1683.             if (err_code == JMMS_COMP_OK)
  1684.             {
  1685.                 g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time = slide_time;
  1686.             }
  1687.             memset(
  1688.                 g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
  1689.                 0,
  1690.                 (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
  1691.             g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
  1692.             g_jmms_context->compose_context->curr_slide_info.image_ID = 0;
  1693.             g_jmms_context->compose_context->curr_slide_info.audio_ID = 0;
  1694.             g_jmms_context->compose_context->curr_slide_info.video_ID = 0;
  1695.             /* shuffling of is_image_first handling array  */
  1696.             for(count = MAX_POSSIBLE_SLIDES - 1; count >= g_jmms_context->compose_context->curr_page_index ; count-- )
  1697.             {
  1698.                g_jmms_context->compose_context->is_image_first[ count ] = g_jmms_context->compose_context->is_image_first[ count - 1 ]; 
  1699.             }
  1700.             g_jmms_context->compose_context->is_image_first[ g_jmms_context->compose_context->curr_page_index - 1 ] = 0;
  1701.         }
  1702.             break;
  1703.     }
  1704. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
  1705. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
  1706. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
  1707.     return err_code;
  1708. }
  1709. /*****************************************************************************
  1710.  * FUNCTION
  1711.  *  mmi_jmms_exit_curr_slide
  1712.  * DESCRIPTION
  1713.  *  This fn inserts a slide.
  1714.  * PARAMETERS
  1715.  *  void
  1716.  *  a(?)        [IN/OUT]        Nil(?)
  1717.  *  b(?)        [IN]            Nil(?)
  1718.  * RETURNS
  1719.  *  JMMS_COMP_ERRCODE
  1720.  *****************************************************************************/
  1721. JMMS_COMP_ERRCODE mmi_jmms_exit_curr_slide(void)
  1722. {
  1723.     /*----------------------------------------------------------------*/
  1724.     /* Local Variables                                                */
  1725.     /*----------------------------------------------------------------*/
  1726.     JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1727.     /*----------------------------------------------------------------*/
  1728.     /* Code Body                                                      */
  1729.     /*----------------------------------------------------------------*/
  1730.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_exit_curr_slide"));
  1731.     if (g_jmms_context->compose_context->exit_conpose_screen == 0 &&
  1732.         g_jmms_context->compose_context->curr_page_index > 0)
  1733.     {
  1734.         /* Deepali: If while adding or deleting the text media some poup comes then this is done to prevent re-entry in infinite loop for this fn. */
  1735.         g_jmms_context->compose_context->exit_conpose_screen = 1;
  1736.         if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) != 0)
  1737.             && g_jmms_context->compose_context->curr_slide_info.text_ID == 0)
  1738.         {
  1739.             err_code = mmi_jmms_compose_add_text(
  1740.                         g_jmms_context->compose_context->curr_page_index,
  1741.                         &(g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font),
  1742.                         g_jmms_context->compose_context->curr_slide_info.slide_prop.text_color,1);
  1743.         }
  1744.         else if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer)
  1745.                   != 0) && g_jmms_context->compose_context->curr_slide_info.text_ID != 0)
  1746.         {
  1747.             err_code = mmi_jmms_compose_update_text(
  1748.                         g_jmms_context->compose_context->curr_page_index,
  1749.                         g_jmms_context->compose_context->curr_slide_info.text_ID);
  1750.         }
  1751.         else if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer)
  1752.                   == 0) && g_jmms_context->compose_context->curr_slide_info.text_ID != 0)
  1753.         {
  1754.             err_code = mmi_jmms_compose_delete_media(
  1755.                         g_jmms_context->compose_context->curr_slide_info.text_ID,
  1756.                         g_jmms_context->compose_context->curr_page_index,
  1757.                         E_FALSE);
  1758.             if (err_code == JMMS_COMP_OK || err_code == JMMS_COMP_POPUP_OK)
  1759.             {
  1760.                 g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
  1761.                 mmi_jmms_set_region_list();
  1762.             }
  1763.         }
  1764.         g_jmms_context->compose_context->exit_conpose_screen = 0;
  1765.     }
  1766.     return err_code;
  1767. }
  1768. /*****************************************************************************
  1769.  * FUNCTION
  1770.  *  mmi_jmms_extract_slide_media_info
  1771.  * DESCRIPTION
  1772.  *  extract curretn slide media info..
  1773.  * PARAMETERS
  1774.  *  page_index      [IN]        
  1775.  *  a(?)            [IN/OUT]        Nil(?)
  1776.  *  b(?)            [IN]            Nil(?)
  1777.  * RETURNS
  1778.  *  void
  1779.  *****************************************************************************/
  1780. JMMS_COMP_ERRCODE mmi_jmms_extract_slide_media_info(U8 page_index)
  1781. {
  1782.     /*----------------------------------------------------------------*/
  1783.     /* Local Variables                                                */
  1784.     /*----------------------------------------------------------------*/
  1785.     MEDIA_INFO *media_info_p;
  1786.     U8 media_count, is_image_first = 0;
  1787.     JC_RETCODE ret_code;
  1788.     JMMS_COMP_ERRCODE err_code;
  1789.     U8 count = 0;
  1790.     jmms_context_slide_node_struct *slide_info;
  1791.     JC_UINT32 slide_time;
  1792.     /*----------------------------------------------------------------*/
  1793.     /* Code Body                                                      */
  1794.     /*----------------------------------------------------------------*/
  1795.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_extract_slide_media_info"));
  1796. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
  1797. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
  1798. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
  1799.     ret_code = mmi_jmms_jdi_get_media_list(g_jmms_context->msg_handle, page_index, &media_info_p, &media_count, E_FALSE);
  1800.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1801.     if (err_code == JMMS_COMP_OK)
  1802.     {
  1803.         memset(
  1804.             g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
  1805.             0,
  1806.             (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
  1807.         g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
  1808.         g_jmms_context->compose_context->curr_slide_info.image_ID = 0;
  1809.         g_jmms_context->compose_context->curr_slide_info.audio_ID = 0;
  1810.         g_jmms_context->compose_context->curr_slide_info.video_ID = 0;
  1811.         slide_info = &(g_jmms_context->compose_context->curr_slide_info);
  1812.         mmi_jmms_jdi_get_page_timer(g_jmms_context->msg_handle, page_index, &slide_time);
  1813.         slide_info->slide_prop.slide_time = slide_time / 1000;
  1814. slide_info->slide_prop.text_font.italic = 0;
  1815. slide_info->slide_prop.text_font.bold = 0;
  1816. slide_info->slide_prop.text_font.size = MEDIUM_FONT;
  1817. slide_info->slide_prop.text_color = g_jmms_color_RGB_list[COLOR_BLACK];
  1818.         mmi_jmms_get_region_list(page_index, &is_image_first);
  1819.         for (count = 0; count < media_count; count++)
  1820.         {
  1821.             switch (media_info_p->eMediaType)
  1822.             {
  1823.                 case E_MEDIA_TEXT:
  1824.                     slide_info->text_ID = media_info_p->uiMediaID;
  1825. /* sandeep start to fix MAUI_00227858 */
  1826. if(jc_tcslen((UI_character_type*)media_info_p->pMimeInfo->ContentData.pBuffer) < JMMS_COMPOSE_TEXT_LENGTH)
  1827. {
  1828.                     jc_tcscpy(
  1829.                         (UI_character_type*) slide_info->edit_content_buffer,
  1830.                         (UI_character_type*) media_info_p->pMimeInfo->ContentData.pBuffer);
  1831. }
  1832. else
  1833. {
  1834. jc_tcsncpy(
  1835. (UI_character_type*) slide_info->edit_content_buffer,
  1836. (UI_character_type*) media_info_p->pMimeInfo->ContentData.pBuffer,
  1837. JMMS_COMPOSE_TEXT_LENGTH);
  1838. }
  1839. /* sandeep end to fix MAUI_00227858 */
  1840.                     if (media_info_p->PresentationInfo.pTextAttributes != NULL)
  1841.                     {
  1842.                         slide_info->slide_prop.text_font.bold = media_info_p->PresentationInfo.pTextAttributes->bIsBold;
  1843.                         slide_info->slide_prop.text_font.italic =
  1844.                             media_info_p->PresentationInfo.pTextAttributes->bIsItalic;
  1845.                         switch (media_info_p->PresentationInfo.pTextAttributes->uiFontSize)
  1846.                         {
  1847.                             case MMS_SIZE_SMALL:
  1848.                                 slide_info->slide_prop.text_font.size = SMALL_FONT;
  1849.                                 break;
  1850.                             case MMS_SIZE_NORMAL:
  1851.                                 slide_info->slide_prop.text_font.size = MEDIUM_FONT;
  1852.                                 break;
  1853.                             case MMS_SIZE_LARGE:
  1854.                                 slide_info->slide_prop.text_font.size = LARGE_FONT;
  1855.                                 break;
  1856.                         }
  1857.                         mmi_jmms_convert_hash_col_string_toU32((PS8) media_info_p->PresentationInfo.pTextAttributes->pFontColor, &slide_info->slide_prop.text_color, 16);       /* deepali: put correct values. */
  1858.                     }
  1859.                     break;
  1860.                 case E_MEDIA_IMAGE:
  1861.                     slide_info->image_ID = media_info_p->uiMediaID;
  1862.                     g_jmms_context->compose_context->is_image_first[page_index - 1] = is_image_first;
  1863.                     if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
  1864.                     {
  1865.                         slide_info->img_info.pFileName =
  1866.                             (PU8) media_info_p->pMimeInfo->ContentData.pFileName;
  1867.                     }
  1868.                     break;
  1869.                 case E_MEDIA_AUDIO:
  1870.                     slide_info->audio_ID = media_info_p->uiMediaID;
  1871.                     break;
  1872.                 case E_MEDIA_VIDEO:
  1873.                     slide_info->video_ID = media_info_p->uiMediaID;
  1874.                     g_jmms_context->compose_context->is_image_first[page_index - 1] = is_image_first;
  1875.                     if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
  1876.                     {
  1877.                         slide_info->img_info.pFileName =
  1878.                             (PU8) media_info_p->pMimeInfo->ContentData.pFileName;
  1879.                     }
  1880.                     break;
  1881.             }
  1882.             media_info_p = media_info_p->pNext;
  1883.         };
  1884.     }
  1885. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
  1886. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
  1887. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
  1888.     return err_code;
  1889. }
  1890. /*****************************************************************************
  1891.  * FUNCTION
  1892.  *  mmi_jmms_save_page_time
  1893.  * DESCRIPTION
  1894.  *  set page time in message handle.
  1895.  * PARAMETERS
  1896.  *  slide_time      [IN]        
  1897.  * RETURNS
  1898.  *  void
  1899.  *****************************************************************************/
  1900. JMMS_COMP_ERRCODE mmi_jmms_save_page_time(U32 slide_time)
  1901. {
  1902.     /*----------------------------------------------------------------*/
  1903.     /* Local Variables                                                */
  1904.     /*----------------------------------------------------------------*/
  1905.     JC_RETCODE ret_code;
  1906.     JMMS_COMP_ERRCODE err_code;
  1907.     /*----------------------------------------------------------------*/
  1908.     /* Code Body                                                      */
  1909.     /*----------------------------------------------------------------*/
  1910.     ret_code = mmi_jmms_jdi_set_page_timer(
  1911.                 g_jmms_context->msg_handle,
  1912.                 g_jmms_context->compose_context->curr_page_index,
  1913.                 slide_time * 1000);
  1914.     err_code = mmi_jmms_compose_handle_error(ret_code, 1);
  1915.     return err_code;
  1916. }
  1917. /*****************************************************************************
  1918.  * FUNCTION
  1919.  *  mmi_jmms_set_text_attributes
  1920.  * DESCRIPTION
  1921.  *  set text attributes
  1922.  * PARAMETERS
  1923.  *  media_id            [IN]        
  1924.  *  page_index          [IN]        
  1925.  *  curr_slide_prop     [?]         [?]
  1926.  * RETURNS
  1927.  *  void
  1928.  *****************************************************************************/
  1929. JMMS_COMP_ERRCODE mmi_jmms_set_text_attributes(U32 media_id, U8 page_index, slide_prop_struct *curr_slide_prop)
  1930. {
  1931.     /*----------------------------------------------------------------*/
  1932.     /* Local Variables                                                */
  1933.     /*----------------------------------------------------------------*/
  1934.     JC_RETCODE ret_code;
  1935.     JMMS_COMP_ERRCODE err_code;
  1936.     MEDIA_PRESENTATION_INFO media_presentation_p;
  1937.     /*----------------------------------------------------------------*/
  1938.     /* Code Body                                                      */
  1939.     /*----------------------------------------------------------------*/
  1940.     mmi_jmms_jdi_get_presentation_info(g_jmms_context->msg_handle, page_index, media_id, &media_presentation_p);
  1941.     if (media_presentation_p.pTextAttributes == NULL)
  1942.     {
  1943.         media_presentation_p.pTextAttributes = (TEXT_ATTRIBUTES*) jdd_MemAlloc(sizeof(TEXT_ATTRIBUTES), sizeof(U8));
  1944.         if (media_presentation_p.pTextAttributes == NULL)
  1945.         {
  1946.             ret_code = JC_ERR_MEMORY_ALLOCATION;
  1947.             goto ERROR_HANDLE;
  1948.         }
  1949.     }
  1950.     if (curr_slide_prop->text_font.bold == 1)
  1951.     {
  1952.         media_presentation_p.pTextAttributes->bIsBold = E_TRUE;
  1953.     }
  1954.     else
  1955.     {
  1956.         media_presentation_p.pTextAttributes->bIsBold = E_FALSE;
  1957.     }
  1958.     if (curr_slide_prop->text_font.italic == 1)
  1959.     {
  1960.         media_presentation_p.pTextAttributes->bIsItalic = E_TRUE;
  1961.     }
  1962.     else
  1963.     {
  1964.         media_presentation_p.pTextAttributes->bIsItalic = E_FALSE;
  1965.     }
  1966.     if (media_presentation_p.pTextAttributes->pFontColor == NULL)
  1967.     {
  1968.         media_presentation_p.pTextAttributes->pFontColor =
  1969.             (JC_INT8*) jdd_MemAlloc((strlen("#rrggbb") + 1), sizeof(JC_INT8));
  1970.         if (media_presentation_p.pTextAttributes->pFontColor == NULL)
  1971.         {
  1972.             ret_code = JC_ERR_MEMORY_ALLOCATION;
  1973.             goto ERROR_HANDLE;
  1974.         }
  1975.     }
  1976.     mmi_jmms_convert_u32To_hash_col_string(
  1977.         curr_slide_prop->text_color,
  1978.         media_presentation_p.pTextAttributes->pFontColor);
  1979.     switch (curr_slide_prop->text_font.size)
  1980.     {
  1981.         case SMALL_FONT:
  1982.             media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_SMALL;
  1983.             break;
  1984.         case LARGE_FONT:
  1985.             media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_LARGE;
  1986.             break;
  1987.         case MEDIUM_FONT:
  1988.             media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_NORMAL;
  1989.             break;
  1990.     }
  1991.     ret_code = mmi_jmms_jdi_set_media_presentation_info(
  1992.                 g_jmms_context->msg_handle,
  1993.                 page_index,
  1994.                 media_id,
  1995.                 &media_presentation_p);
  1996.   ERROR_HANDLE:
  1997.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  1998.     return err_code;
  1999. }
  2000. /*****************************************************************************
  2001.  * FUNCTION
  2002.  *  mmi_jmms_set_media_time
  2003.  * DESCRIPTION
  2004.  *  set media time in message handle.
  2005.  * PARAMETERS
  2006.  *  start_time      [IN]        
  2007.  *  duration        [IN]        
  2008.  *  media_id        [IN]        
  2009.  *  page_index      [IN]        
  2010.  * RETURNS
  2011.  *  void
  2012.  *****************************************************************************/
  2013. JMMS_COMP_ERRCODE mmi_jmms_set_media_time(U32 start_time, U32 duration, U32 media_id, U8 page_index)
  2014. {
  2015.     /*----------------------------------------------------------------*/
  2016.     /* Local Variables                                                */
  2017.     /*----------------------------------------------------------------*/
  2018.     JC_RETCODE ret_code;
  2019.     JMMS_COMP_ERRCODE err_code;
  2020.     MEDIA_TIMER media_timer_p;
  2021.     /*----------------------------------------------------------------*/
  2022.     /* Code Body                                                      */
  2023.     /*----------------------------------------------------------------*/
  2024.     media_timer_p.uiBegin = start_time * 1000;
  2025.     media_timer_p.uiDuration = duration * 1000;
  2026.     ret_code = mmi_jmms_jdi_set_media_timer(g_jmms_context->msg_handle, page_index, media_id, media_timer_p);
  2027.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  2028.     return err_code;
  2029. }
  2030. /*****************************************************************************
  2031.  * FUNCTION
  2032.  *  mmi_jmms_get_media_time
  2033.  * DESCRIPTION
  2034.  *  get media time in message handle.
  2035.  * PARAMETERS
  2036.  *  start_time      [?]         [?]
  2037.  *  duration        [?]         [?]
  2038.  *  media_id        [IN]        
  2039.  *  page_index      [IN]        
  2040.  * RETURNS
  2041.  *  void
  2042.  *****************************************************************************/
  2043. JMMS_COMP_ERRCODE mmi_jmms_get_media_time(U32 *start_time, U32 *duration, U32 media_id, U8 page_index)
  2044. {
  2045.     /*----------------------------------------------------------------*/
  2046.     /* Local Variables                                                */
  2047.     /*----------------------------------------------------------------*/
  2048.     JC_RETCODE ret_code;
  2049.     JMMS_COMP_ERRCODE err_code;
  2050.     MEDIA_TIMER media_timer_p;
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Code Body                                                      */
  2053.     /*----------------------------------------------------------------*/
  2054.     ret_code = mmi_jmms_jdi_get_media_timer(g_jmms_context->msg_handle, page_index, media_id, &media_timer_p);
  2055.     err_code = mmi_jmms_compose_handle_error(ret_code, 0);
  2056.     if (err_code == JMMS_COMP_OK)
  2057.     {
  2058.         *start_time = media_timer_p.uiBegin / 1000;
  2059.         *duration = media_timer_p.uiDuration / 1000;
  2060.     }
  2061.     return err_code;
  2062. }
  2063. /*****************************************************************************
  2064.  * FUNCTION
  2065.  *  mmi_jmms_convert_u32To_hash_col_string
  2066.  * DESCRIPTION
  2067.  *  Converts U32 value to Hash color string
  2068.  * PARAMETERS
  2069.  *  ip_color        [IN]        
  2070.  *  op_colstr       [IN]        
  2071.  * RETURNS
  2072.  *  void
  2073.  *****************************************************************************/
  2074. void mmi_jmms_convert_u32To_hash_col_string(U32 ip_color, PS8 op_colstr)
  2075. {
  2076.     /*----------------------------------------------------------------*/
  2077.     /* Local Variables                                                */
  2078.     /*----------------------------------------------------------------*/
  2079.     JC_INT8 temp_color_str[10];
  2080.     JC_INT8 color_list[3];
  2081.     /*----------------------------------------------------------------*/
  2082.     /* Code Body                                                      */
  2083.     /*----------------------------------------------------------------*/
  2084.     color_list[0] = (U8) ((0xFF000000 & ip_color) >> 24);
  2085.     color_list[1] = (U8) ((0x00FF0000 & ip_color) >> 16);
  2086.     color_list[2] = (U8) ((0x0000FF00 & ip_color) >> 8);
  2087.     strcpy(op_colstr, "#");
  2088.     memset(temp_color_str, 0, 10);
  2089.     sprintf(temp_color_str, "%X", color_list[0]);
  2090.     if (strlen(temp_color_str) < 2)
  2091.     {
  2092.         sprintf(temp_color_str, "0%X", color_list[0]);
  2093.     }
  2094.     strncat(op_colstr, temp_color_str, 2);
  2095.     memset(temp_color_str, 0, 10);
  2096.     sprintf(temp_color_str, "%X", color_list[1]);
  2097.     if (strlen(temp_color_str) < 2)
  2098.     {
  2099.         sprintf(temp_color_str, "0%X", color_list[1]);
  2100.     }
  2101.     strncat(op_colstr, temp_color_str, 2);
  2102.     memset(temp_color_str, 0, 10);
  2103.     sprintf(temp_color_str, "%X", color_list[2]);
  2104.     if (strlen(temp_color_str) < 2)
  2105.     {
  2106.         sprintf(temp_color_str, "0%X", color_list[2]);
  2107.     }
  2108.     strncat(op_colstr, temp_color_str, 2);
  2109. }
  2110. /*****************************************************************************
  2111.  * FUNCTION
  2112.  *  mmi_jmms_convert_hash_col_string_toU32
  2113.  * DESCRIPTION
  2114.  *  Converts Hash color string to U32 value
  2115.  * PARAMETERS
  2116.  *  ip_colstr       [IN]        
  2117.  *  op_color        [?]         [?]
  2118.  *  base            [IN]        
  2119.  * RETURNS
  2120.  *  void
  2121.  *****************************************************************************/
  2122. void mmi_jmms_convert_hash_col_string_toU32(PS8 ip_colstr, U32 *op_color, U8 base)
  2123. {
  2124.     /*----------------------------------------------------------------*/
  2125.     /* Local Variables                                                */
  2126.     /*----------------------------------------------------------------*/
  2127.     JC_INT8 tempStr[10];
  2128.     JC_INT32 color_list[3];
  2129.     /*----------------------------------------------------------------*/
  2130.     /* Code Body                                                      */
  2131.     /*----------------------------------------------------------------*/
  2132.     memset(tempStr, 0, 10);
  2133.     jc_strncpy(tempStr, (ip_colstr + 1), 2);
  2134.     color_list[0] = (U8) jc_strtol(tempStr, NULL, base);
  2135.     memset(tempStr, 0, 10);
  2136.     jc_strncpy(tempStr, (ip_colstr + 3), 2);
  2137.     color_list[1] = (U8) jc_strtol(tempStr, NULL, base);
  2138.     memset(tempStr, 0, 10);
  2139.     jc_strncpy(tempStr, (ip_colstr + 5), 2);
  2140.     color_list[2] = (U8) jc_strtol(tempStr, NULL, base);
  2141.     *op_color = 0;
  2142.     *op_color |= 0x00000064;
  2143.     *op_color |= (((U32) color_list[0]) << 24);
  2144.     *op_color |= (((U32) color_list[1]) << 16);
  2145.     *op_color |= (((U32) color_list[2]) << 8);
  2146. }
  2147. /*****************************************************************************
  2148.  * FUNCTION
  2149.  *  mmi_jmms_set_bg_color
  2150.  * DESCRIPTION