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

MTK

开发平台:

C/C++

  1.     U8 minid = 0;
  2.     U8 maxid = 0;
  3. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  4.     /*----------------------------------------------------------------*/
  5.     /* Code Body                                                      */
  6.     /*----------------------------------------------------------------*/
  7.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] GetEmsObjectListDetails -------*n"));
  8.     switch (currEmsObjectDisplayListState)
  9.     {
  10.         case EMS_OBJECT_PICTURE_STATE:
  11.             currMaxEmsObjectList = EmsPictureNum();
  12.             *lskStrID = STR_GLOBAL_VIEW;
  13.             for (index = 0; index < currMaxEmsObjectList; index++)
  14.             {
  15.                 strItemListPtr[index] = (PU8) GetString((U16) ManufacturerPictureStrIDs[index]);
  16.                 imgItemListPtr[index] = GetEmsObjectDataInsertStatus(index);
  17.                 popUpList[index] = GetEmsObjectDataSizeHint(index);
  18.             }
  19.             break;
  20.         case EMS_OBJECT_PREDEFINED_ANIMATION_STATE:
  21.             currMaxEmsObjectList = MAX_EMS_PREDEFINED_ANIMATION;
  22.             *lskStrID = STR_GLOBAL_VIEW;
  23.             for (index = 0; index < currMaxEmsObjectList; index++)
  24.             {
  25.                 strItemListPtr[index] = (PU8) GetString((U16) PredefinedAnimationStrIDs[index]);
  26.                 imgItemListPtr[index] = EMS_CAN_INSERT_OBJECT_ID;
  27.                 popUpList[index] = NULL;
  28.             }
  29.             break;
  30.         #if defined(__MMI_IMELODY_SUPPORT__)
  31.         case EMS_OBJECT_MELODY_STATE:
  32.             EnableDisableAudioPlayback();
  33.         #ifdef MMI_ON_HARDWARE_P
  34.             custom_get_fixed_ems_imelody_range(&minid, &maxid);
  35.             currMaxEmsObjectList = (maxid - minid + 1);
  36.         #else /* MMI_ON_HARDWARE_P */ 
  37.             currMaxEmsObjectList = EmsMelodyNum();
  38.         #endif /* MMI_ON_HARDWARE_P */ 
  39.             *lskStrID = STR_GLOBAL_OK;
  40.             for (index = 0; index < currMaxEmsObjectList; index++)
  41.             {
  42.                 strItemListPtr[index] = (PU8) GetString((U16) ManufacturerMelodiesStrIDs[index]);
  43.                 imgItemListPtr[index] = GetEmsObjectDataInsertStatus(index);
  44.                 popUpList[index] = GetEmsObjectDataSizeHint(index);
  45.             }
  46.             break;
  47.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  48.         case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  49.             currMaxEmsObjectList = MAX_EMS_PREDEFINED_SOUND;
  50.             *lskStrID = STR_GLOBAL_OK;
  51.             for (index = 0; index < currMaxEmsObjectList; index++)
  52.             {
  53.                 strItemListPtr[index] = (PU8) GetString((U16) PredefinedSoundStrIDs[index]);
  54.                 imgItemListPtr[index] = EMS_CAN_INSERT_OBJECT_ID;
  55.                 popUpList[index] = NULL;
  56.             }
  57.             break;
  58.         default:
  59.             currMaxEmsObjectList = 0;
  60.             break;
  61.     }
  62. }
  63. /*****************************************************************************
  64.  * FUNCTION
  65.  *  EntryEMSObjectList
  66.  * DESCRIPTION
  67.  *  Entry object list screen
  68.  * PARAMETERS
  69.  *  void
  70.  * RETURNS
  71.  *  void
  72.  *****************************************************************************/
  73. extern void ShowCategoryEMSScreen(
  74.                 U16 title,
  75.                 U16 title_icon,
  76.                 U16 left_softkey,
  77.                 U16 left_softkey_icon,
  78.                 U16 right_softkey,
  79.                 U16 right_softkey_icon,
  80.                 S32 num_of_symbols,
  81.                 MMI_ID_TYPE *symbols,
  82.                 MMI_ID_TYPE *descriptions,
  83.                 S32 highlighted_item,
  84.                 U8 *history_buffer);
  85. extern U16 EMS_predefined_images[];
  86. extern U16 EMS_predefined_animations[];
  87. static void RegisterLskAndRightArrowHandler(void);
  88. static void RegisterEndKeyForPreviewEmsObjectScrnHandler(void);
  89. static U16 GetLskStringID(void);
  90. static U16 GetLskImageID(void);
  91. void EntryEMSObjectList(void)
  92. {
  93.     /*----------------------------------------------------------------*/
  94.     /* Local Variables                                                */
  95.     /*----------------------------------------------------------------*/
  96.     U16 lskStrID = 0;
  97.     U8 *guiBuffer = NULL;
  98.     U8 *strItemList[MAX_EMS_OBJECT_LIST_DISPLAY
  99.                     /* MTK Joy added for customization, 1014 */
  100. #if defined(__MMI_IMELODY_SUPPORT__)
  101.                     + MAXIMUM_DOWNLOAD_AUDIO + MAXIMUM_COMPOSED_RINGTONE
  102. #endif 
  103.                     /* MTK end */
  104.         ];
  105.     U16 imgItemList[MAX_EMS_OBJECT_LIST_DISPLAY
  106.                     /* MTK Joy added for customization, 1014 */
  107. #if defined(__MMI_IMELODY_SUPPORT__)
  108.                     + MAXIMUM_DOWNLOAD_AUDIO + MAXIMUM_COMPOSED_RINGTONE
  109. #endif 
  110.                     /* MTK end */
  111.         ];
  112.     U8 *popUpList[MAX_EMS_OBJECT_LIST_DISPLAY
  113.                   /* MTK Joy added for customization, 1014 */
  114. #if defined(__MMI_IMELODY_SUPPORT__)
  115.                   + MAXIMUM_DOWNLOAD_AUDIO + MAXIMUM_COMPOSED_RINGTONE
  116. #endif 
  117.                   /* MTK end */
  118.         ];
  119. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  120.     U16 driveName;
  121.     S8 temp[4];
  122.     UI_character_type dir_ems_root[4];
  123.     S8 emsObjectFileNameBuf[(MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN + 1) * ENCODING_LENGTH] = {0, 0};
  124.     FMGR_FILTER filter;
  125.     /*----------------------------------------------------------------*/
  126.     /* Code Body                                                      */
  127.     /*----------------------------------------------------------------*/
  128.     driveName = MMI_PUBLIC_DRV;
  129.     sprintf(temp, "%c:\", (S8) driveName);
  130.     AnsiiToUnicodeString((S8*) dir_ems_root, temp);
  131.     pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  132. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  133.     switch (currEmsObjectDisplayListState)
  134.     {
  135.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  136.         case EMS_OBJECT_MY_PICTURE_STATE:
  137.             /* [Bear] 2004/6/23 - begin */
  138.             FMGR_FILTER_INIT(&filter);
  139.             FMGR_FILTER_SET(&filter, FMGR_TYPE_EMS);
  140.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  141.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  142.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
  143.             mmi_fmgr_select_path_and_enter(
  144.                 APP_MESSAGES,
  145.                 FMGR_SELECT_FILE,
  146.                 filter,
  147.                 (PS8) emsObjectFileNameBuf,
  148.                 (PsExtFuncPtr) mmi_ems_preview_object_from_fm);
  149.             /* [Bear] 2004/6/23 - end */
  150.             break;
  151.         case EMS_OBJECT_MY_ANIMATION_STATE:
  152.             /* [Bear] 2004/6/23 - begin */
  153.             FMGR_FILTER_INIT(&filter);
  154.             FMGR_FILTER_SET(&filter, FMGR_TYPE_ANM);
  155.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  156.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  157.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
  158.             mmi_fmgr_select_path_and_enter(
  159.                 APP_MESSAGES,
  160.                 FMGR_SELECT_FILE,
  161.                 filter,
  162.                 (PS8) emsObjectFileNameBuf,
  163.                 (PsExtFuncPtr) mmi_ems_preview_object_from_fm);
  164.             /* [Bear] 2004/6/23 - end */
  165.             break;
  166.     #if defined(__MMI_IMELODY_SUPPORT__)
  167.         case EMS_OBJECT_MY_MELODY_STATE:
  168.             /* [Bear] 2004/6/23 - begin */
  169.             FMGR_FILTER_INIT(&filter);
  170.             FMGR_FILTER_SET(&filter, FMGR_TYPE_IMY);
  171.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  172.             FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  173.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_AUDIO);
  174.             mmi_fmgr_select_path_and_enter(
  175.                 APP_MESSAGES,
  176.                 FMGR_SELECT_FILE,
  177.                 filter,
  178.                 (PS8) emsObjectFileNameBuf,
  179.                 (PsExtFuncPtr) mmi_ems_preview_object_from_fm);
  180.             break;
  181.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  182.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  183.         case EMS_OBJECT_MY_PICTURE_STATE:
  184.         case EMS_OBJECT_MY_ANIMATION_STATE:
  185.     #if defined(__MMI_IMELODY_SUPPORT__)
  186.         case EMS_OBJECT_MY_MELODY_STATE:
  187.     #endif 
  188.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  189.         case EMS_OBJECT_PICTURE_STATE:
  190.         case EMS_OBJECT_MELODY_STATE:
  191.         case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  192.     #if !defined(__MMI_MAINLCD_176X220__) && !defined(__MMI_MAINLCD_240X320__)
  193.         case EMS_OBJECT_PREDEFINED_ANIMATION_STATE:
  194.     #endif 
  195.             GetEmsObjectDisplayListDetails(&lskStrID, strItemList, imgItemList, popUpList);
  196.             if (currMaxEmsObjectList > 0)
  197.             {
  198.             #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  199.             #if !defined(__MMI_MAINLCD_176X220__) && !defined(__MMI_MAINLCD_240X320__)
  200.                 if (currEmsObjectDisplayListState == EMS_OBJECT_PICTURE_STATE ||
  201.                     currEmsObjectDisplayListState == EMS_OBJECT_PREDEFINED_ANIMATION_STATE)
  202.             #else /* !defined(__MMI_MAINLCD_176X220__) && !defined(__MMI_MAINLCD_240X320__) */ 
  203.                 if (currEmsObjectDisplayListState == EMS_OBJECT_PICTURE_STATE)
  204.             #endif /* !defined(__MMI_MAINLCD_176X220__) && !defined(__MMI_MAINLCD_240X320__) */ 
  205.                 {
  206.                     enable_resized_small_screen();  /* small screen is only applicable to picture and animation */
  207.                 }
  208.                 else
  209.                 {
  210.                     disable_resized_small_screen(); /* small screen is not applicable to sound and melody */
  211.                 }
  212.                 if (whether_no_small_screen())
  213.                 {
  214.                     EntryNewScreen(SCR_ID_MSG_EMS_PREVIEW_OBJECT, mmi_msg_exit_generic, EntryEMSObjectList, NULL);
  215.                     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  216.                     RegisterCategory144ObjectLoader(CallBackLoadUserDefinedObjectDataBuffPtr);
  217.                     SetMessagesCurrScrnID(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  218.                     ShowImageSelectorScreen(
  219.                         GetString(STR_GLOBAL_SELECT),
  220.                         IMG_SMS_ENTRY_SCRN_CAPTION,
  221.                         GetLskStringID(),
  222.                         GetLskImageID(),
  223.                         STR_GLOBAL_BACK,
  224.                         IMG_GLOBAL_BACK,
  225.                         currEmsObjectDisplayListState,
  226.                         currMaxEmsObjectList,
  227.                         NULL,
  228.                         preDefinedObjectIds,
  229.                         userDefinedObjectDataPtrs,
  230.                         (PS32) & currObjectListHiliteIndex,
  231.                         guiBuffer);
  232.                     RegisterLskAndRightArrowHandler();
  233.                     RegisterEndKeyForPreviewEmsObjectScrnHandler();
  234.                     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  235.                 }
  236.                 else
  237.                 {
  238.                     restore_small_screen();
  239.             #endif /* UI_SMALL_IMAGE_SELECTOR_SCREEN */ 
  240.                     EntryNewScreen(SCR_ID_MSG_EMS_OBJECT_LIST, ExitEMSObjectList, EntryEMSObjectList, NULL);
  241.                     RegisterHighlightHandler(GetEmsObjectHiliteIndex);
  242.                     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_OBJECT_LIST);
  243.                     if (guiBuffer != NULL)
  244.                     {
  245.                         change_list_menu_category_history(
  246.                             guiBuffer,
  247.                             currObjectListHiliteIndex,
  248.                             currMaxEmsObjectList,
  249.                             0);
  250.                     }
  251.                     else
  252.                     {
  253.                         currObjectListHiliteIndex = 0;
  254.                     }
  255.                     SetMessagesCurrScrnID(SCR_ID_MSG_EMS_OBJECT_LIST);
  256.                     ShowCategory53Screen(
  257.                         STR_EMS_OBJECT_LIST,
  258.                         IMG_SMS_ENTRY_SCRN_CAPTION,
  259.                         lskStrID,
  260.                         IMG_GLOBAL_OK,
  261.                         STR_GLOBAL_BACK,
  262.                         IMG_GLOBAL_BACK,
  263.                         currMaxEmsObjectList,
  264.                         (U8 **) strItemList,
  265.                         imgItemList,
  266.                         (U8 **) popUpList,
  267.                         0,
  268.                         currObjectListHiliteIndex,
  269.                         guiBuffer);
  270.                     SetLeftSoftkeyFunction(EntryScrPreviewEmsObject, KEY_EVENT_UP);
  271.                     SetKeyHandler(EntryScrPreviewEmsObject, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  272.                     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  273.                     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  274.                 #ifdef UI_SMALL_IMAGE_SELECTOR_SCREEN
  275.                 }
  276.                 #endif 
  277.             }
  278.             else
  279.             {
  280.                 DisplayPopup(
  281.                     (PU8) GetString(STR_GLOBAL_EMPTY),
  282.                     IMG_GLOBAL_EMPTY,
  283.                     1,
  284.                     MESSAGES_POPUP_TIME_OUT,
  285.                     (U8) EMPTY_LIST_TONE);
  286.             }
  287.             break;
  288.         #if defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)        /* 041205 Calvin modified */
  289.         case EMS_OBJECT_PREDEFINED_ANIMATION_STATE:
  290.         {
  291.             MMI_ID_TYPE *imglist = (currEmsObjectDisplayListState == EMS_OBJECT_PICTURE_STATE) ?
  292.                 EMS_predefined_images : EMS_predefined_animations;
  293.             MMI_ID_TYPE *strlist = (currEmsObjectDisplayListState == EMS_OBJECT_PICTURE_STATE) ?
  294.                 ManufacturerPictureStrIDs : PredefinedAnimationStrIDs;
  295.             S32 objectcount = (currEmsObjectDisplayListState == EMS_OBJECT_PICTURE_STATE) ?
  296.                 EmsPictureNum() : MAX_EMS_PREDEFINED_ANIMATION;
  297.             EntryNewScreen(SCR_ID_MSG_EMS_OBJECT_LIST, mmi_msg_exit_generic, EntryEMSObjectList, NULL);
  298.             guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_OBJECT_LIST);
  299.             if (guiBuffer == NULL)
  300.             {
  301.                 currObjectListHiliteIndex = 0;
  302.             }
  303.             SetMessagesCurrScrnID(SCR_ID_MSG_EMS_OBJECT_LIST);
  304.             RegisterHighlightHandler(GetEmsObjectHiliteIndex);
  305.             ShowCategoryEMSScreen(
  306.                 STR_EMS_OBJECT_LIST,
  307.                 IMG_SMS_ENTRY_SCRN_CAPTION,
  308.                 STR_GLOBAL_OK,
  309.                 IMG_GLOBAL_OK,
  310.                 STR_GLOBAL_BACK,
  311.                 IMG_GLOBAL_BACK,
  312.                 objectcount,
  313.                 imglist,
  314.                 strlist,
  315.                 currObjectListHiliteIndex,
  316.                 guiBuffer);
  317.             SetLeftSoftkeyFunction(PreviewEmsObjectIsDone, KEY_EVENT_UP);
  318.             SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  319.         }
  320.             break;
  321.         #endif /* defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__) */ 
  322.     }
  323. }
  324. /*****************************************************************************
  325.  * FUNCTION
  326.  *  ExitEMSObjectList
  327.  * DESCRIPTION
  328.  *  Exit object list screen
  329.  * PARAMETERS
  330.  *  void
  331.  * RETURNS
  332.  *  void
  333.  *****************************************************************************/
  334. void ExitEMSObjectList(void)
  335. {
  336.     /*----------------------------------------------------------------*/
  337.     /* Local Variables                                                */
  338.     /*----------------------------------------------------------------*/
  339.     /*----------------------------------------------------------------*/
  340.     /* Code Body                                                      */
  341.     /*----------------------------------------------------------------*/
  342.     /* history currHistory; */
  343.     currObjectListHiliteIndex = GetHighlightedItem();
  344.     StopEmsObjectIMelodyAndSoundIfAny();
  345.     /* currHistory.scrnID = SCR_ID_MSG_EMS_OBJECT_LIST; */
  346.     g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_EMS_OBJECT_LIST;
  347.     //currHistory.entryFuncPtr = EntryEMSObjectList;
  348.     //memset (currHistory.inputBuffer, 0, ENCODING_LENGTH);
  349.     //GetCategoryHistory (currHistory.guiBuffer);
  350.     //AddHistory (currHistory);
  351. }
  352. /*****************************************************************************
  353.  * FUNCTION
  354.  *  RegisterLskAndRightArrowHandler
  355.  * DESCRIPTION
  356.  *  Register LSK handler
  357.  * PARAMETERS
  358.  *  void
  359.  * RETURNS
  360.  *  void
  361.  *****************************************************************************/
  362. static void RegisterLskAndRightArrowHandler(void)
  363. {
  364.     /*----------------------------------------------------------------*/
  365.     /* Local Variables                                                */
  366.     /*----------------------------------------------------------------*/
  367.     /*----------------------------------------------------------------*/
  368.     /* Code Body                                                      */
  369.     /*----------------------------------------------------------------*/
  370.     SetLeftSoftkeyFunction(PreviewEmsObjectIsDone, KEY_EVENT_UP);
  371. }
  372. /*****************************************************************************
  373.  * FUNCTION
  374.  *  RegisterEndKeyForPreviewEmsObjectScrnHandler
  375.  * DESCRIPTION
  376.  *  Register End key handler
  377.  * PARAMETERS
  378.  *  void
  379.  * RETURNS
  380.  *  void
  381.  *****************************************************************************/
  382. static void RegisterEndKeyForPreviewEmsObjectScrnHandler(void)
  383. {
  384.     /*----------------------------------------------------------------*/
  385.     /* Local Variables                                                */
  386.     /*----------------------------------------------------------------*/
  387.     /*----------------------------------------------------------------*/
  388.     /* Code Body                                                      */
  389.     /*----------------------------------------------------------------*/
  390. }
  391. /*****************************************************************************
  392.  * FUNCTION
  393.  *  GetLskStringID
  394.  * DESCRIPTION
  395.  *  Get LSK string
  396.  * PARAMETERS
  397.  *  void
  398.  * RETURNS
  399.  *  LSK string
  400.  *****************************************************************************/
  401. static U16 GetLskStringID(void)
  402. {
  403.     /*----------------------------------------------------------------*/
  404.     /* Local Variables                                                */
  405.     /*----------------------------------------------------------------*/
  406.     /*----------------------------------------------------------------*/
  407.     /* Code Body                                                      */
  408.     /*----------------------------------------------------------------*/
  409.     return STR_GLOBAL_OK;
  410. }
  411. /*****************************************************************************
  412.  * FUNCTION
  413.  *  GetLskImageID
  414.  * DESCRIPTION
  415.  *  Get LSK image
  416.  * PARAMETERS
  417.  *  void
  418.  * RETURNS
  419.  *  LSK image
  420.  *****************************************************************************/
  421. static U16 GetLskImageID(void)
  422. {
  423.     /*----------------------------------------------------------------*/
  424.     /* Local Variables                                                */
  425.     /*----------------------------------------------------------------*/
  426.     /*----------------------------------------------------------------*/
  427.     /* Code Body                                                      */
  428.     /*----------------------------------------------------------------*/
  429.     return IMG_GLOBAL_OK;
  430. }
  431. /*****************************************************************************
  432.  * FUNCTION
  433.  *  EntryScrPreviewEmsObject
  434.  * DESCRIPTION
  435.  *  Entry preview object screen
  436.  * PARAMETERS
  437.  *  void
  438.  * RETURNS
  439.  *  void
  440.  *****************************************************************************/
  441. void EntryScrPreviewEmsObject(void)
  442. {
  443.     /*----------------------------------------------------------------*/
  444.     /* Local Variables                                                */
  445.     /*----------------------------------------------------------------*/
  446.     U32 objectType = 0;
  447.     U8 *guiBuffer = NULL;
  448.     U8 isPictureOrAnimation = FALSE;
  449.     /*----------------------------------------------------------------*/
  450.     /* Code Body                                                      */
  451.     /*----------------------------------------------------------------*/
  452.     switch (currEmsObjectDisplayListState)
  453.     {
  454.         case EMS_OBJECT_PICTURE_STATE:
  455.             objectType = EMS_PREDEFINED_PICTURE;
  456.             isPictureOrAnimation = TRUE;
  457.             break;
  458.         case EMS_OBJECT_MY_PICTURE_STATE:
  459.             objectType = EMS_USERDEFINED_PICTURE;
  460.             isPictureOrAnimation = TRUE;
  461.             break;
  462.         case EMS_OBJECT_PREDEFINED_ANIMATION_STATE:
  463.             objectType = EMS_PREDEFINED_ANIMATION;
  464.             isPictureOrAnimation = TRUE;
  465.             break;
  466.         case EMS_OBJECT_MY_ANIMATION_STATE:
  467.             objectType = EMS_USERDEFINED_ANIMATION;
  468.             isPictureOrAnimation = TRUE;
  469.             break;
  470.     #if defined(__MMI_IMELODY_SUPPORT__)
  471.         case EMS_OBJECT_MELODY_STATE:
  472.             objectType = EMS_PREDEFINED_MELODY | CATEGORY144_DISABLE_PREVIEW;
  473.             isPictureOrAnimation = FALSE;
  474.             break;
  475.         case EMS_OBJECT_MY_MELODY_STATE:
  476.             objectType = EMS_USERDEFINED_MELODY | CATEGORY144_DISABLE_PREVIEW;
  477.             isPictureOrAnimation = FALSE;
  478.             break;
  479.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  480.         case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  481.             objectType = EMS_PREDEFINED_SOUND | CATEGORY144_DISABLE_PREVIEW;
  482.             isPictureOrAnimation = FALSE;
  483.             break;
  484.     }
  485.     if (isPictureOrAnimation == TRUE)
  486.     {
  487.         EntryNewScreen(SCR_ID_MSG_EMS_PREVIEW_OBJECT, mmi_msg_exit_generic, EntryScrPreviewEmsObject, NULL);
  488.         guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  489.         if (currEmsObjectDisplayListState == EMS_OBJECT_PREDEFINED_ANIMATION_STATE)
  490.         {
  491.             emsObjectNameWhenPreview = (U8*) GetString(PredefinedAnimationStrIDs[currObjectListHiliteIndex]);
  492.             RegisterHighlightHandler(ChangeEmsObjectTitleWithIndex);
  493.         }
  494.         else
  495.         {
  496.             RegisterCategory144ObjectLoader(CallBackLoadUserDefinedObjectDataBuffPtr);
  497.         }
  498.         SetMessagesCurrScrnID(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  499.         ShowCategory144Screen(
  500.             emsObjectNameWhenPreview,
  501.             IMG_SMS_ENTRY_SCRN_CAPTION,
  502.             GetLskStringID(),
  503.             GetLskImageID(),
  504.             STR_GLOBAL_BACK,
  505.             IMG_GLOBAL_BACK,
  506.             objectType,
  507.             currMaxEmsObjectList,
  508.             NULL,
  509.             preDefinedObjectIds,
  510.             FALSE,
  511.             userDefinedObjectDataPtrs,
  512.             (PS32) & currObjectListHiliteIndex,
  513.             guiBuffer);
  514.         RegisterLskAndRightArrowHandler();
  515.         RegisterEndKeyForPreviewEmsObjectScrnHandler();
  516.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  517.     }
  518.     else
  519.     {
  520.         ExitCategoryFunction();
  521.         RegisterCategory144ObjectLoader(CallBackLoadUserDefinedObjectDataBuffPtr);
  522.         ShowCategory144Screen(
  523.             (PU8) GetString(STR_PREVIEW_EMS_OBJECT),
  524.             IMG_SMS_ENTRY_SCRN_CAPTION,
  525.             STR_GLOBAL_OK,
  526.             IMG_GLOBAL_OK,
  527.             STR_GLOBAL_BACK,
  528.             IMG_GLOBAL_BACK,
  529.             objectType,
  530.             currMaxEmsObjectList,
  531.             NULL,
  532.             preDefinedObjectIds,
  533.             FALSE,
  534.             userDefinedObjectDataPtrs,
  535.             (PS32) & currObjectListHiliteIndex,
  536.             guiBuffer);
  537.         PreviewEmsObjectIsDone();
  538.     }
  539. }
  540. /*****************************************************************************
  541.  * FUNCTION
  542.  *  ChangeEmsObjectTitleWithIndex
  543.  * DESCRIPTION
  544.  *  This function is just for template.
  545.  * PARAMETERS
  546.  *  index       [IN]        Object index
  547.  * RETURNS
  548.  *  void
  549.  *****************************************************************************/
  550. void ChangeEmsObjectTitleWithIndex(S32 index)
  551. {
  552.     /*----------------------------------------------------------------*/
  553.     /* Local Variables                                                */
  554.     /*----------------------------------------------------------------*/
  555.     /*----------------------------------------------------------------*/
  556.     /* Code Body                                                      */
  557.     /*----------------------------------------------------------------*/
  558.     emsObjectNameWhenPreview = (U8*) GetString(PredefinedAnimationStrIDs[index]);
  559.     ChangeTitleString(emsObjectNameWhenPreview);
  560.     draw_title();
  561. }
  562. /*****************************************************************************
  563.  * FUNCTION
  564.  *  GetEmsObjectHiliteIndex
  565.  * DESCRIPTION
  566.  *  Get object highlight index
  567.  * PARAMETERS
  568.  *  index       [IN]        
  569.  * RETURNS
  570.  *  void
  571.  *****************************************************************************/
  572. void GetEmsObjectHiliteIndex(S32 index)
  573. {
  574.     /*----------------------------------------------------------------*/
  575.     /* Local Variables                                                */
  576.     /*----------------------------------------------------------------*/
  577.     /*----------------------------------------------------------------*/
  578.     /* Code Body                                                      */
  579.     /*----------------------------------------------------------------*/
  580.     currObjectListHiliteIndex = index;
  581.     switch (currEmsObjectDisplayListState)
  582.     {
  583.     #if defined(__MMI_IMELODY_SUPPORT__)
  584.         case EMS_OBJECT_MELODY_STATE:
  585.             StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  586.             EMSObjectStopPlayBack();
  587.             if (ReadDownloadObjectDataFromFileSystem(index))
  588.             {
  589.                 StartTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID, MESSAGES_ONE_SEC_TIME_OUT, PlayEmsManufacturerIMelody);
  590.             }
  591.             break;
  592.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  593.         case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  594.             StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  595.             EMSObjectStopPlayBack();
  596.             StartTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID, MESSAGES_ONE_SEC_TIME_OUT, PlayEmsManufacturerSound);
  597.             break;
  598.     }
  599. }
  600. /* MTK Joy added for customization, 1014 */
  601. #if defined(__MMI_IMELODY_SUPPORT__)
  602. /*****************************************************************************
  603.  * FUNCTION
  604.  *  PlayEmsManufacturerIMelody
  605.  * DESCRIPTION
  606.  *  Play manufacturer melody
  607.  * PARAMETERS
  608.  *  void
  609.  * RETURNS
  610.  *  void
  611.  *****************************************************************************/
  612. void PlayEmsManufacturerIMelody(void)
  613. {
  614.     /*----------------------------------------------------------------*/
  615.     /* Local Variables                                                */
  616.     /*----------------------------------------------------------------*/
  617.     /*----------------------------------------------------------------*/
  618.     /* Code Body                                                      */
  619.     /*----------------------------------------------------------------*/
  620.     StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  621.     EMSObjectStopPlayBack();
  622.     if (!IsSilentModeActivated())
  623. #ifdef __MMI_SILENT_MEETING_PROFILE__
  624.         if (!IsMeetingModeActivated())
  625. #endif 
  626.             EMSObjectPlayback(EMS_PREDEFINED_MELODY, userDefinedObjectDataBuff, -1);
  627. }
  628. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  629. /* MTK end */
  630. /*****************************************************************************
  631.  * FUNCTION
  632.  *  PlayEmsManufacturerSound
  633.  * DESCRIPTION
  634.  *  Play manufacturer sound
  635.  * PARAMETERS
  636.  *  void
  637.  * RETURNS
  638.  *  void
  639.  *****************************************************************************/
  640. void PlayEmsManufacturerSound(void)
  641. {
  642.     /*----------------------------------------------------------------*/
  643.     /* Local Variables                                                */
  644.     /*----------------------------------------------------------------*/
  645.     /*----------------------------------------------------------------*/
  646.     /* Code Body                                                      */
  647.     /*----------------------------------------------------------------*/
  648.     StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  649.     EMSObjectStopPlayBack();
  650.     if (!IsSilentModeActivated())
  651. #ifdef __MMI_SILENT_MEETING_PROFILE__
  652.         if (!IsMeetingModeActivated())
  653. #endif 
  654.             EMSObjectPlayback(EMS_PREDEFINED_SOUND, NULL, currObjectListHiliteIndex);
  655. }
  656. /*****************************************************************************
  657.  * FUNCTION
  658.  *  StopEmsObjectIMelodyAndSoundIfAny
  659.  * DESCRIPTION
  660.  *  Stop melody/sound
  661.  * PARAMETERS
  662.  *  void
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. void StopEmsObjectIMelodyAndSoundIfAny(void)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     /*----------------------------------------------------------------*/
  672.     /* Code Body                                                      */
  673.     /*----------------------------------------------------------------*/
  674.     switch (currEmsObjectDisplayListState)
  675.     {
  676.     #if defined(__MMI_IMELODY_SUPPORT__)
  677.         case EMS_OBJECT_MELODY_STATE:
  678.             StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  679.             EMSObjectStopPlayBack();
  680.             break;
  681.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  682.         case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  683.             StopTimer(MESSAGES_EMS_OBJECT_PLAY_TIMER_ID);
  684.             EMSObjectStopPlayBack();
  685.             break;
  686.     }
  687. }
  688. /*****************************************************************************
  689.  * FUNCTION
  690.  *  PreviewEmsObjectIsDone
  691.  * DESCRIPTION
  692.  *  After preview, add object to message body
  693.  * PARAMETERS
  694.  *  void
  695.  * RETURNS
  696.  *  void
  697.  *****************************************************************************/
  698. void PreviewEmsObjectIsDone(void)
  699. {
  700.     /*----------------------------------------------------------------*/
  701.     /* Local Variables                                                */
  702.     /*----------------------------------------------------------------*/
  703.     EMSTATUS emsObjectStatus;
  704.     /*----------------------------------------------------------------*/
  705.     /* Code Body                                                      */
  706.     /*----------------------------------------------------------------*/
  707.     if ((currEmsObjectDisplayListState != EMS_OBJECT_PREDEFINED_ANIMATION_STATE) &&
  708.         (currEmsObjectDisplayListState != EMS_OBJECT_PREDEFINED_SOUND_STATE) &&
  709.         (!listOfIsAllowedData[currObjectListHiliteIndex]))
  710.     {
  711.         DisplayPopup(
  712.             (PU8) GetString(STR_EMS_OBJECT_SIZE_NOT_ALLOWED_ID),
  713.             IMG_GLOBAL_UNFINISHED,
  714.             1,
  715.             MESSAGES_POPUP_TIME_OUT,
  716.             (U8) ERROR_TONE);
  717.     }
  718.     else
  719.     {
  720.         switch (currEmsObjectDisplayListState)
  721.         {
  722.             case EMS_OBJECT_PICTURE_STATE:
  723.                 emsObjectStatus = EMS_inputbox_insert_predefined_picture(currObjectListHiliteIndex);
  724.                 break;
  725.             case EMS_OBJECT_MY_PICTURE_STATE:
  726.                 emsObjectStatus = EMS_inputbox_insert_userdefined_picture(userDefinedObjectDataBuff);
  727.                 break;
  728.             case EMS_OBJECT_PREDEFINED_ANIMATION_STATE:
  729.                 emsObjectStatus = EMS_inputbox_insert_predefined_animation(currObjectListHiliteIndex);
  730.                 break;
  731.             case EMS_OBJECT_MY_ANIMATION_STATE:
  732.                 emsObjectStatus = EMS_inputbox_insert_userdefined_animation(userDefinedObjectDataBuff);
  733.                 break;
  734.         #if defined(__MMI_IMELODY_SUPPORT__)
  735.             case EMS_OBJECT_MELODY_STATE:
  736.                 emsObjectStatus = EMS_inputbox_insert_predefined_melody(currObjectListHiliteIndex);
  737.                 break;
  738.             case EMS_OBJECT_MY_MELODY_STATE:
  739.                 emsObjectStatus = EMS_inputbox_insert_userdefined_melody(userDefinedObjectDataBuff);
  740.                 break;
  741.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  742.             case EMS_OBJECT_PREDEFINED_SOUND_STATE:
  743.                 emsObjectStatus = EMS_inputbox_insert_predefined_sound(currObjectListHiliteIndex);
  744.                 break;
  745.             default:
  746.                 emsObjectStatus = EMS_inputbox_insert_predefined_picture(currObjectListHiliteIndex);
  747.                 break;
  748.         }
  749.         GoBackToHistory(SCR_ID_MSG_WRITE);
  750.         ErrorHandlingWhileInsertingObject(emsObjectStatus); /* check whetehr it is inserted or not. */
  751.     }
  752. }
  753. /*****************************************************************************
  754.  * FUNCTION
  755.  *  EntryScrInsertObjectMenu
  756.  * DESCRIPTION
  757.  *  Entry insert object screen
  758.  * PARAMETERS
  759.  *  void
  760.  * RETURNS
  761.  *  void
  762.  *****************************************************************************/
  763. void EntryScrInsertObjectMenu(void)
  764. {
  765.     /*----------------------------------------------------------------*/
  766.     /* Local Variables                                                */
  767.     /*----------------------------------------------------------------*/
  768.     U16 numItems = 0;
  769.     PU8 guiBuffer = NULL;
  770.     U16 nStrItemList[MAX_SUB_MENUS];
  771.     /*----------------------------------------------------------------*/
  772.     /* Code Body                                                      */
  773.     /*----------------------------------------------------------------*/
  774.     EntryNewScreen(SCR_ID_MSG_EMS_INSERT_OBJECT, mmi_msg_exit_generic, EntryScrInsertObjectMenu, NULL);
  775.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_INSERT_OBJECT);
  776.     SetParentHandler(EMS_ED_OPT_INS_OBJ);
  777.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  778.     numItems = GetNumOfChild(EMS_ED_OPT_INS_OBJ);
  779.     GetSequenceStringIds(EMS_ED_OPT_INS_OBJ, nStrItemList);
  780.     SetMessagesCurrScrnID(SCR_ID_MSG_EMS_INSERT_OBJECT);
  781.     ShowCategory52Screen(
  782.         STR_OPT_INS_OBJECT_MENUENTRY,
  783.         IMG_SMS_ENTRY_SCRN_CAPTION,
  784.         STR_GLOBAL_OK,
  785.         IMG_GLOBAL_OK,
  786.         STR_GLOBAL_BACK,
  787.         IMG_GLOBAL_BACK,
  788.         numItems,
  789.         nStrItemList,
  790.         (U16*) gIndexIconsImageList,
  791.         NULL,
  792.         0,
  793.         0,
  794.         guiBuffer);
  795. }
  796. /*****************************************************************************
  797.  * FUNCTION
  798.  *  HighlightEditOptionInsertObject
  799.  * DESCRIPTION
  800.  *  Highlight insert object handler
  801.  * PARAMETERS
  802.  *  void
  803.  * RETURNS
  804.  *  void
  805.  *****************************************************************************/
  806. void HighlightEditOptionInsertObject(void)
  807. {
  808.     /*----------------------------------------------------------------*/
  809.     /* Local Variables                                                */
  810.     /*----------------------------------------------------------------*/
  811.     /*----------------------------------------------------------------*/
  812.     /* Code Body                                                      */
  813.     /*----------------------------------------------------------------*/
  814.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  815.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  816.     SetLeftSoftkeyFunction(EntryScrInsertObjectMenu, KEY_EVENT_UP);
  817.     SetKeyHandler(EntryScrInsertObjectMenu, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  818.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  819.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  820. }
  821. /*****************************************************************************
  822.  * FUNCTION
  823.  *  HighlightInsObjPicture
  824.  * DESCRIPTION
  825.  *  Highlight insert picture handler
  826.  * PARAMETERS
  827.  *  void
  828.  * RETURNS
  829.  *  void
  830.  *****************************************************************************/
  831. void HighlightInsObjPicture(void)
  832. {
  833.     /*----------------------------------------------------------------*/
  834.     /* Local Variables                                                */
  835.     /*----------------------------------------------------------------*/
  836.     /*----------------------------------------------------------------*/
  837.     /* Code Body                                                      */
  838.     /*----------------------------------------------------------------*/
  839.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  840.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  841.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  842.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  843.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  844.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  845.     currEmsObjectDisplayListState = EMS_OBJECT_PICTURE_STATE;
  846.     currObjectListHiliteIndex = 0;
  847. }
  848. /*****************************************************************************
  849.  * FUNCTION
  850.  *  HighlightInsObjMyPicture
  851.  * DESCRIPTION
  852.  *  Highlight insert my picture handler
  853.  * PARAMETERS
  854.  *  void
  855.  * RETURNS
  856.  *  void
  857.  *****************************************************************************/
  858. void HighlightInsObjMyPicture(void)
  859. {
  860.     /*----------------------------------------------------------------*/
  861.     /* Local Variables                                                */
  862.     /*----------------------------------------------------------------*/
  863.     /*----------------------------------------------------------------*/
  864.     /* Code Body                                                      */
  865.     /*----------------------------------------------------------------*/
  866.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  867.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  868.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  869.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  870.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  871.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  872.     currEmsObjectDisplayListState = EMS_OBJECT_MY_PICTURE_STATE;
  873. }
  874. /*****************************************************************************
  875.  * FUNCTION
  876.  *  HighlightInsObjPredefinedAnimation
  877.  * DESCRIPTION
  878.  *  Highlight insert predefined animation handler
  879.  * PARAMETERS
  880.  *  void
  881.  * RETURNS
  882.  *  void
  883.  *****************************************************************************/
  884. void HighlightInsObjPredefinedAnimation(void)
  885. {
  886.     /*----------------------------------------------------------------*/
  887.     /* Local Variables                                                */
  888.     /*----------------------------------------------------------------*/
  889.     /*----------------------------------------------------------------*/
  890.     /* Code Body                                                      */
  891.     /*----------------------------------------------------------------*/
  892.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  893.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  894.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  895.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  896.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  897.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  898.     currEmsObjectDisplayListState = EMS_OBJECT_PREDEFINED_ANIMATION_STATE;
  899.     currMaxEmsObjectList = MAX_EMS_PREDEFINED_ANIMATION;
  900. }
  901. /*****************************************************************************
  902.  * FUNCTION
  903.  *  HighlightInsObjMyAnimation
  904.  * DESCRIPTION
  905.  *  Highlight insert my animation handler
  906.  * PARAMETERS
  907.  *  void
  908.  * RETURNS
  909.  *  void
  910.  *****************************************************************************/
  911. void HighlightInsObjMyAnimation(void)
  912. {
  913.     /*----------------------------------------------------------------*/
  914.     /* Local Variables                                                */
  915.     /*----------------------------------------------------------------*/
  916.     /*----------------------------------------------------------------*/
  917.     /* Code Body                                                      */
  918.     /*----------------------------------------------------------------*/
  919.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  920.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  921.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  922.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  923.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  924.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  925.     currEmsObjectDisplayListState = EMS_OBJECT_MY_ANIMATION_STATE;
  926. }
  927. /*****************************************************************************
  928.  * FUNCTION
  929.  *  HighlightInsObjMelody
  930.  * DESCRIPTION
  931.  *  Highlight insert melody handler
  932.  * PARAMETERS
  933.  *  void
  934.  * RETURNS
  935.  *  void
  936.  *****************************************************************************/
  937. /* MTK Joy added for customization, 1014 */
  938. #if defined(__MMI_IMELODY_SUPPORT__)
  939. void HighlightInsObjMelody(void)
  940. {
  941.     /*----------------------------------------------------------------*/
  942.     /* Local Variables                                                */
  943.     /*----------------------------------------------------------------*/
  944.     /*----------------------------------------------------------------*/
  945.     /* Code Body                                                      */
  946.     /*----------------------------------------------------------------*/
  947.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  948.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  949.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  950.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  951. #ifdef MMI_ON_WIN32
  952.     SetLeftSoftkeyFunction(PopupNoSupport, KEY_EVENT_UP);
  953.     SetKeyHandler(PopupNoSupport, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  954. #endif /* MMI_ON_WIN32 */ 
  955.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  956.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  957.     currEmsObjectDisplayListState = EMS_OBJECT_MELODY_STATE;
  958. }
  959. /*****************************************************************************
  960.  * FUNCTION
  961.  *  HighlightInsObjMyMelody
  962.  * DESCRIPTION
  963.  *  Highlight insert my melody handler
  964.  * PARAMETERS
  965.  *  void
  966.  * RETURNS
  967.  *  void
  968.  *****************************************************************************/
  969. void HighlightInsObjMyMelody(void)
  970. {
  971.     /*----------------------------------------------------------------*/
  972.     /* Local Variables                                                */
  973.     /*----------------------------------------------------------------*/
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  978.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  979.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  980.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  981. #ifdef MMI_ON_WIN32
  982.     SetLeftSoftkeyFunction(PopupNoSupport, KEY_EVENT_UP);
  983.     SetKeyHandler(PopupNoSupport, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  984. #endif /* MMI_ON_WIN32 */ 
  985.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  986.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  987.     currEmsObjectDisplayListState = EMS_OBJECT_MY_MELODY_STATE;
  988. }
  989. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  990. /* MTK end */
  991. /*****************************************************************************
  992.  * FUNCTION
  993.  *  HighlightInsObjPredefinedSound
  994.  * DESCRIPTION
  995.  *  Highlight insert predefined sound handler
  996.  * PARAMETERS
  997.  *  void
  998.  * RETURNS
  999.  *  void
  1000.  *****************************************************************************/
  1001. void HighlightInsObjPredefinedSound(void)
  1002. {
  1003.     /*----------------------------------------------------------------*/
  1004.     /* Local Variables                                                */
  1005.     /*----------------------------------------------------------------*/
  1006.     /*----------------------------------------------------------------*/
  1007.     /* Code Body                                                      */
  1008.     /*----------------------------------------------------------------*/
  1009.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  1010.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  1011.     SetLeftSoftkeyFunction(EntryEMSObjectList, KEY_EVENT_UP);
  1012.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1013.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1014.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1015.     currEmsObjectDisplayListState = EMS_OBJECT_PREDEFINED_SOUND_STATE;
  1016. }
  1017. #if (defined(__MMI_FILE_MANAGER__))
  1018. /*****************************************************************************
  1019.  * FUNCTION
  1020.  *  mmi_ems_add_object_from_fm
  1021.  * DESCRIPTION
  1022.  *  Add object from file manager
  1023.  * PARAMETERS
  1024.  *  void
  1025.  * RETURNS
  1026.  *  void
  1027.  *****************************************************************************/
  1028. void mmi_ems_add_object_from_fm(void)
  1029. {
  1030.     /*----------------------------------------------------------------*/
  1031.     /* Local Variables                                                */
  1032.     /*----------------------------------------------------------------*/
  1033.     EMSTATUS emsObjectStatus;
  1034.     /*----------------------------------------------------------------*/
  1035.     /* Code Body                                                      */
  1036.     /*----------------------------------------------------------------*/
  1037.     userDefinedObjectDataSize = GetEmsObjectDataSize();
  1038.     if (IsAllowed == TRUE)
  1039.     {
  1040.         switch (currEmsObjectDisplayListState)
  1041.         {
  1042.             case EMS_OBJECT_MY_PICTURE_STATE:
  1043.                 emsObjectStatus = EMS_inputbox_insert_userdefined_picture(userDefinedObjectDataBuff);
  1044.                 break;
  1045.             case EMS_OBJECT_MY_ANIMATION_STATE:
  1046.                 emsObjectStatus = EMS_inputbox_insert_userdefined_animation(userDefinedObjectDataBuff);
  1047.                 break;
  1048.         #if defined(__MMI_IMELODY_SUPPORT__)
  1049.             case EMS_OBJECT_MY_MELODY_STATE:
  1050.                 emsObjectStatus = EMS_inputbox_insert_userdefined_melody(userDefinedObjectDataBuff);
  1051.                 break;
  1052.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1053.             default:
  1054.                 emsObjectStatus = EMS_inputbox_insert_userdefined_picture(userDefinedObjectDataBuff);
  1055.                 break;
  1056.         }
  1057.         GoBackToHistory(SCR_ID_MSG_WRITE);
  1058.         ErrorHandlingWhileInsertingObject(emsObjectStatus);
  1059.     }
  1060.     else
  1061.     {
  1062.         DisplayPopup(
  1063.             (PU8) GetString(STR_EMS_OBJECT_SIZE_NOT_ALLOWED_ID),
  1064.             IMG_GLOBAL_UNFINISHED,
  1065.             1,
  1066.             MESSAGES_POPUP_TIME_OUT,
  1067.             (U8) ERROR_TONE);
  1068.     }
  1069. }
  1070. /*****************************************************************************
  1071.  * FUNCTION
  1072.  *  mmi_ems_go_back_from_preview_object
  1073.  * DESCRIPTION
  1074.  *  clear screen for file manager preview
  1075.  * PARAMETERS
  1076.  *  void
  1077.  * RETURNS
  1078.  *  void
  1079.  *****************************************************************************/
  1080. void mmi_ems_go_back_from_preview_object(void)
  1081. {
  1082.     /*----------------------------------------------------------------*/
  1083.     /* Local Variables                                                */
  1084.     /*----------------------------------------------------------------*/
  1085.     /*----------------------------------------------------------------*/
  1086.     /* Code Body                                                      */
  1087.     /*----------------------------------------------------------------*/
  1088.     GoBackToHistory(SCR_ID_MSG_EMS_INSERT_OBJECT);
  1089. }
  1090. /*****************************************************************************
  1091.  * FUNCTION
  1092.  *  mmi_ems_entry_preview_object_from_fm
  1093.  * DESCRIPTION
  1094.  *  Entry preview object screen from file manager
  1095.  * PARAMETERS
  1096.  *  void
  1097.  * RETURNS
  1098.  *  void
  1099.  *****************************************************************************/
  1100. void mmi_ems_entry_preview_object_from_fm(void)
  1101. {
  1102.     /*----------------------------------------------------------------*/
  1103.     /* Local Variables                                                */
  1104.     /*----------------------------------------------------------------*/
  1105.     U32 objectType = 0;
  1106.     U8 *guiBuffer = NULL;
  1107.     /*----------------------------------------------------------------*/
  1108.     /* Code Body                                                      */
  1109.     /*----------------------------------------------------------------*/
  1110.     EntryNewScreen(SCR_ID_MSG_EMS_PREVIEW_OBJECT, mmi_msg_exit_generic, mmi_ems_entry_preview_object_from_fm, NULL);
  1111.     switch (currEmsObjectDisplayListState)
  1112.     {
  1113.         case EMS_OBJECT_MY_PICTURE_STATE:
  1114.             objectType = EMS_USERDEFINED_PICTURE;
  1115.             break;
  1116.         case EMS_OBJECT_MY_ANIMATION_STATE:
  1117.             objectType = EMS_USERDEFINED_ANIMATION;
  1118.             break;
  1119.     #if defined(__MMI_IMELODY_SUPPORT__)
  1120.         case EMS_OBJECT_MY_MELODY_STATE:
  1121.             objectType = EMS_USERDEFINED_MELODY;
  1122.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1123.             break;
  1124.     }
  1125.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  1126.     SetMessagesCurrScrnID(SCR_ID_MSG_EMS_PREVIEW_OBJECT);
  1127.     emsObjectNameWhenPreview = (U8*) GetString(STR_PREVIEW_EMS_OBJECT);
  1128.     currObjectListHiliteIndex = 0;
  1129.     userDefinedObjectDataPtrs[0] = userDefinedObjectDataBuff;
  1130.     ShowCategory144Screen(
  1131.         emsObjectNameWhenPreview,
  1132.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1133.         STR_GLOBAL_OK,
  1134.         IMG_GLOBAL_OK,
  1135.         STR_GLOBAL_BACK,
  1136.         IMG_GLOBAL_BACK,
  1137.         objectType,
  1138.         1,
  1139.         NULL,
  1140.         preDefinedObjectIds,
  1141.         FALSE,
  1142.         userDefinedObjectDataPtrs,
  1143.         (PS32) & currObjectListHiliteIndex,
  1144.         guiBuffer);
  1145.     SetLeftSoftkeyFunction(mmi_ems_add_object_from_fm, KEY_EVENT_UP);
  1146.     SetRightSoftkeyFunction(mmi_ems_go_back_from_preview_object, KEY_EVENT_UP);
  1147. }
  1148. /*****************************************************************************
  1149.  * FUNCTION
  1150.  *  mmi_ems_preview_object_from_fm
  1151.  * DESCRIPTION
  1152.  *  Preview object from file manager
  1153.  * PARAMETERS
  1154.  *  filePath        [IN]        
  1155.  *  is_short        [IN]        
  1156.  * RETURNS
  1157.  *  void
  1158.  *****************************************************************************/
  1159. void mmi_ems_preview_object_from_fm(PU16 filePath, S32 is_short)
  1160. {
  1161.     /*----------------------------------------------------------------*/
  1162.     /* Local Variables                                                */
  1163.     /*----------------------------------------------------------------*/
  1164.     EMSTATUS emsObjectStatus;
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     if (filePath == NULL)
  1169.     {
  1170.         GoBackToHistory(SCR_ID_MSG_EMS_INSERT_OBJECT);
  1171.         return;
  1172.     }
  1173.     emsObjectStatus = mmi_ems_fm_open_file((S8*) filePath, currEmsObjectDisplayListState);
  1174.     if (emsObjectStatus != EMS_OK)
  1175.     {
  1176.         ErrorHandlingWhileInsertingObject(emsObjectStatus);
  1177.         DeleteUptoScrID(SCR_ID_MSG_EMS_INSERT_OBJECT);
  1178.         return;
  1179.     }
  1180.     else
  1181.     {
  1182.         mmi_ems_entry_preview_object_from_fm();
  1183.     }
  1184. }
  1185. /*****************************************************************************
  1186.  * FUNCTION
  1187.  *  mmi_ems_fm_open_file
  1188.  * DESCRIPTION
  1189.  *  Open file
  1190.  * PARAMETERS
  1191.  *  emsObjectFileNameBuf        [IN]        File name
  1192.  *  emsObjectType               [IN]        Object type
  1193.  * RETURNS
  1194.  *  TRUE: open success, FALSE: open fail
  1195.  *****************************************************************************/
  1196. EMSTATUS mmi_ems_fm_open_file(S8 *emsObjectFileNameBuf, EMS_OBJECT_DISPLAY_STATE emsObjectType)
  1197. {
  1198.     /*----------------------------------------------------------------*/
  1199.     /* Local Variables                                                */
  1200.     /*----------------------------------------------------------------*/
  1201.     S32 errorCode = 0;
  1202.     FILE_HANDLE emsObjectFilePtr = 0;
  1203.     /*----------------------------------------------------------------*/
  1204.     /* Code Body                                                      */
  1205.     /*----------------------------------------------------------------*/
  1206.     MemsetUserDefinedObjectDataBuff();
  1207.     emsObjectFilePtr = pfopen(emsObjectFileNameBuf, PFS_READ);
  1208.     if (!pfOpenError(emsObjectFilePtr))
  1209.     {
  1210.         userDefinedObjectDataSize = GetFSFileSize(emsObjectFilePtr);
  1211.         switch (emsObjectType)
  1212.         {
  1213.         #if defined(__MMI_IMELODY_SUPPORT__)    /* Pending work here ...abt hint for over sized.. */
  1214.             case EMS_OBJECT_MY_MELODY_STATE:
  1215.                 if (userDefinedObjectDataSize > MAX_EMS_OBJECT_INSERT_SIZE /* 128 bytes */ )
  1216.                 {
  1217.                     pfclose(emsObjectFilePtr);
  1218.                     return EMS_EMS_DATA_EXCEEDED;
  1219.                 }
  1220.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1221.             default:
  1222.                 if (userDefinedObjectDataSize > MAX_CURR_EMS_OBJECT_DATA_BUFF /* bytes */ )
  1223.                 {
  1224.                     pfclose(emsObjectFilePtr);
  1225.                     return EMS_EMS_DATA_EXCEEDED;
  1226.                 }
  1227.         }
  1228.         pfread(userDefinedObjectDataBuff, 1, userDefinedObjectDataSize, emsObjectFilePtr, &errorCode);
  1229.         pfclose(emsObjectFilePtr);
  1230.         if (pfError(errorCode))
  1231.         {
  1232.             return EMS_UNSPECIFIED_ERROR;
  1233.         }
  1234.         switch (emsObjectType)
  1235.         {
  1236.         #if defined(__MMI_IMELODY_SUPPORT__)
  1237.             case EMS_OBJECT_MY_MELODY_STATE:
  1238.             {
  1239.                 U8 userDefinedObjectDataBuffTemp[MAX_CURR_EMS_OBJECT_DATA_BUFF];
  1240.                 EMS_userdefined_melody_attach_header(
  1241.                     userDefinedObjectDataBuff,
  1242.                     userDefinedObjectDataBuffTemp,
  1243.                     &userDefinedObjectDataSize);
  1244.                 memcpy(userDefinedObjectDataBuff, userDefinedObjectDataBuffTemp, userDefinedObjectDataSize);
  1245.             }
  1246.                 break;
  1247.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1248.         }
  1249.         return EMS_OK;
  1250.     }
  1251.     return EMS_UNSPECIFIED_ERROR;
  1252. }
  1253. /*****************************************************************************
  1254.  * FUNCTION
  1255.  *  mmi_ems_fm_send_by_ems
  1256.  * DESCRIPTION
  1257.  *  Send by EMS from file manager
  1258.  * PARAMETERS
  1259.  *  emsObjectFileNameBuf        [IN]        File name
  1260.  *  emsObjectType               [IN]        Object type
  1261.  * RETURNS
  1262.  *  void
  1263.  *****************************************************************************/
  1264. void mmi_ems_fm_send_by_ems(S8 *emsObjectFileNameBuf, EMS_OBJECT_DISPLAY_STATE emsObjectType)
  1265. {
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Local Variables                                                */
  1268.     /*----------------------------------------------------------------*/
  1269.     EMSTATUS emsObjectStatus;
  1270.     /*----------------------------------------------------------------*/
  1271.     /* Code Body                                                      */
  1272.     /*----------------------------------------------------------------*/
  1273.     currEmsObjectDisplayListState = emsObjectType;
  1274.     g_msg_cntx.number_from_phb = 0;
  1275.     /* disallow re-entering SMS application when there is a pending SMS job running in the background */
  1276.     if (mmi_frm_sms_check_action_pending())
  1277.     {
  1278.         DisplayPopup(
  1279.             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  1280.             IMG_GLOBAL_UNFINISHED,
  1281.             1,
  1282.             MESSAGES_POPUP_TIME_OUT,
  1283.             (U8) ERROR_TONE);
  1284.         return;
  1285.     }
  1286.     emsObjectStatus = mmi_ems_fm_open_file(emsObjectFileNameBuf, emsObjectType);
  1287.     if (emsObjectStatus != EMS_OK)
  1288.     {
  1289.         ErrorHandlingWhileInsertingObject(emsObjectStatus);
  1290.         return;
  1291.     }
  1292.     GetEmsObjectDataSize();
  1293.     if (!IsAllowed)
  1294.     {
  1295.         DisplayPopup(
  1296.             (PU8) GetString(STR_EMS_OBJECT_SIZE_NOT_ALLOWED_ID),
  1297.             IMG_GLOBAL_UNFINISHED,
  1298.             1,
  1299.             MESSAGES_POPUP_TIME_OUT,
  1300.             (U8) ERROR_TONE);
  1301.         return;
  1302.     }
  1303.     else
  1304.     {
  1305.         EMSTATUS emsObjectStatus = EMS_UNSPECIFIED_ERROR;
  1306.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  1307.         gui_lock_double_buffer();
  1308.     #endif 
  1309.         GetEMSDataForEdit(0, 1);    /* Force init */
  1310.         g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;
  1311.         mmi_msg_entry_write_msg();
  1312.         switch (emsObjectType)
  1313.         {
  1314.             case EMS_OBJECT_MY_PICTURE_STATE:
  1315.                 emsObjectStatus = EMS_inputbox_insert_userdefined_picture(userDefinedObjectDataBuff);
  1316.                 break;
  1317.             case EMS_OBJECT_MY_ANIMATION_STATE:
  1318.                 emsObjectStatus = EMS_inputbox_insert_userdefined_animation(userDefinedObjectDataBuff);
  1319.                 break;
  1320.         #if defined(__MMI_IMELODY_SUPPORT__)
  1321.             case EMS_OBJECT_MY_MELODY_STATE:
  1322.                 emsObjectStatus = EMS_inputbox_insert_userdefined_melody(userDefinedObjectDataBuff);
  1323.                 break;
  1324.         #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1325.         }
  1326.         handle_category28_input();
  1327.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  1328.         gui_unlock_double_buffer();
  1329.     #endif 
  1330.     #ifdef __MMI_T9__
  1331.         switch (MMI_current_input_type & INPUT_TYPE_MASK)
  1332.         {
  1333.             case INPUT_TYPE_TR_BOPOMO:
  1334.             case INPUT_TYPE_SM_PINYIN:
  1335.             case INPUT_TYPE_TR_STROKE:
  1336.             case INPUT_TYPE_SM_STROKE:
  1337.             case INPUT_TYPE_SMART_UPPERCASE_ABC:
  1338.             case INPUT_TYPE_SMART_LOWERCASE_ABC:
  1339.             case INPUT_TYPE_TR_MULTITAP_BOPOMO:
  1340.             case INPUT_TYPE_SM_MULTITAP_PINYIN:
  1341.                 /* PMT dara added for t9 thai */
  1342.         #if defined(__MMI_T9_THAI__)
  1343.             case INPUT_TYPE_SMART_THAI:
  1344.         #endif 
  1345.                 /* PMT NO_AR_SL_DU START 20050909 */
  1346.         #if defined(__MMI_T9_ARABIC__)
  1347.             case INPUT_TYPE_SMART_ARABIC:
  1348.         #endif 
  1349.                 /* PMT VIKAS GUPTA START 20051129 */
  1350.         #if defined(__MMI_T9_HINDI__)
  1351.             case INPUT_TYPE_SMART_HINDI:
  1352.         #endif 
  1353.                 //PMT VIKAS GUPTA END 20051129
  1354.                 //PMT NO_AR_SL_DU END 20050909
  1355.                 //MTK Terry for Spanish French German Italian
  1356.         #if defined(__MMI_T9_SPANISH__)
  1357.             case INPUT_TYPE_SMART_UPPERCASE_SPANISH:
  1358.             case INPUT_TYPE_SMART_LOWERCASE_SPANISH:
  1359.         #endif /* defined(__MMI_T9_SPANISH__) */ 
  1360.                 /* PMT VIKASG START 20050729 */
  1361.         #if defined(__MMI_T9_DANISH__)  /* Vikas */
  1362.             case INPUT_TYPE_SMART_UPPERCASE_DANISH:
  1363.             case INPUT_TYPE_SMART_LOWERCASE_DANISH:
  1364.         #endif /* defined(__MMI_T9_DANISH__) */ 
  1365.                 //PMT VIKASG END 20050729
  1366.                 //PMT CZ_PO_TU START 20050812   
  1367.         #if defined(__MMI_T9_POLISH__)  /* Vikas */
  1368.             case INPUT_TYPE_SMART_UPPERCASE_POLISH:
  1369.             case INPUT_TYPE_SMART_LOWERCASE_POLISH:
  1370.         #endif /* defined(__MMI_T9_POLISH__) */ 
  1371.                 /* PMT CZ_PO_TU END 20050812 */
  1372.         #if defined(__MMI_T9_FRENCH__)
  1373.             case INPUT_TYPE_SMART_UPPERCASE_FRENCH:
  1374.             case INPUT_TYPE_SMART_LOWERCASE_FRENCH:
  1375.         #endif /* defined(__MMI_T9_FRENCH__) */ 
  1376.         #if defined(__MMI_T9_GERMAN__)
  1377.             case INPUT_TYPE_SMART_UPPERCASE_GERMAN:
  1378.             case INPUT_TYPE_SMART_LOWERCASE_GERMAN:
  1379.         #endif /* defined(__MMI_T9_GERMAN__) */ 
  1380.         #if defined(__MMI_T9_ITALIAN__)
  1381.             case INPUT_TYPE_SMART_UPPERCASE_ITALIAN:
  1382.             case INPUT_TYPE_SMART_LOWERCASE_ITALIAN:
  1383.         #endif /* defined(__MMI_T9_ITALIAN__) */ 
  1384.                 /* PMT BHASKAR START 20052907 */
  1385.         #if defined(__MMI_T9_VIETNAMESE__)
  1386.             case INPUT_TYPE_SMART_UPPERCASE_VIETNAMESE:
  1387.             case INPUT_TYPE_SMART_LOWERCASE_VIETNAMESE:
  1388.         #endif /* defined(__MMI_T9_VIETNAMESE__) */ 
  1389.                 /* PMT BHASKAR END 20052907 */
  1390.                 /* PMT Gurdev Start 20050729 */
  1391.         #if defined(__MMI_T9_INDONESIAN__)
  1392.             case INPUT_TYPE_SMART_UPPERCASE_INDONESIAN:
  1393.             case INPUT_TYPE_SMART_LOWERCASE_INDONESIAN:
  1394.         #endif /* defined(__MMI_T9_INDONESIAN__) */ 
  1395.                 //PMT Gurdev End 20050729
  1396.                 //PMT CZ_PO_TU START 20050812   
  1397.         #if defined(__MMI_T9_CZECH__)
  1398.             case INPUT_TYPE_SMART_UPPERCASE_CZECH:
  1399.             case INPUT_TYPE_SMART_LOWERCASE_CZECH:
  1400.         #endif /* defined(__MMI_T9_CZECH__) */ 
  1401.                 //PMT CZ_PO_TU END 20050812     
  1402.                 //PMT CZ_PO_TU START 20050812    
  1403.         #if defined(__MMI_T9_TURKISH__)
  1404.             case INPUT_TYPE_SMART_UPPERCASE_TURKISH:
  1405.             case INPUT_TYPE_SMART_LOWERCASE_TURKISH:
  1406.         #endif /* defined(__MMI_T9_TURKISH__) */ 
  1407.                 /* PMT CZ_PO_TU END 20050812 */
  1408.                 /* START PMT VANDANA 20051506 */
  1409.         #if defined(__MMI_T9_RUSSIAN__)
  1410.             case INPUT_TYPE_SMART_UPPERCASE_RUSSIAN:
  1411.             case INPUT_TYPE_SMART_LOWERCASE_RUSSIAN:
  1412.         #endif /* defined(__MMI_T9_RUSSIAN__) */ 
  1413.                 //END PMT
  1414.                 //MTK end
  1415.                 /* PMT BULGARIAN START 20051201 */
  1416.         #if defined(__MMI_T9_BULGARIAN__)
  1417.             case INPUT_TYPE_SMART_UPPERCASE_BULGARIAN:
  1418.             case INPUT_TYPE_SMART_LOWERCASE_BULGARIAN:
  1419.         #endif /* defined(__MMI_T9_BULGARIAN__) */ 
  1420.                 //PMT BULGARIAN END 20051201
  1421.                 //PMT SHARIQ START 20050729
  1422.         #if defined(__MMI_T9_PORTUGUESE__)
  1423.             case INPUT_TYPE_SMART_UPPERCASE_PORTUGUESE:
  1424.             case INPUT_TYPE_SMART_LOWERCASE_PORTUGUESE:
  1425.         #endif /* defined(__MMI_T9_PORTUGUESE__) */ 
  1426.                 /* PMT SHARIQ END 20050729 */
  1427.                 /* PMT START HU_FI 20050825 */
  1428.         #if defined(__MMI_T9_FINNISH__)
  1429.             case INPUT_TYPE_SMART_UPPERCASE_FINNISH:
  1430.             case INPUT_TYPE_SMART_LOWERCASE_FINNISH:
  1431.         #endif /* defined(__MMI_T9_FINNISH__) */ 
  1432.         #if defined(__MMI_T9_HUNGARIAN__)
  1433.             case INPUT_TYPE_SMART_UPPERCASE_HUNGARIAN:
  1434.             case INPUT_TYPE_SMART_LOWERCASE_HUNGARIAN:
  1435.         #endif /* defined(__MMI_T9_HUNGARIAN__) */ 
  1436.                 //PMT END HU_FI 20050825
  1437.                 //PMT NO_AR_SL_DU START 20050909
  1438.                 //Norwegian start
  1439.         #if defined(__MMI_T9_NORWEGIAN__)
  1440.             case INPUT_TYPE_SMART_UPPERCASE_NORWEGIAN:
  1441.             case INPUT_TYPE_SMART_LOWERCASE_NORWEGIAN:
  1442.         #endif /* defined(__MMI_T9_NORWEGIAN__) */ 
  1443.                 //Norwegian end
  1444.                 //START DUTCH_T9 20051021
  1445.         #if defined(__MMI_T9_DUTCH__)
  1446.             case INPUT_TYPE_SMART_UPPERCASE_DUTCH:
  1447.             case INPUT_TYPE_SMART_LOWERCASE_DUTCH:
  1448.         #endif /* defined(__MMI_T9_DUTCH__) */ 
  1449.                 //END DUTCH_T9 20051021
  1450.                 //PMT NO_AR_SL_DU END 20050909
  1451.                 //PMT LANGUAGE START 20051221
  1452.         #if defined(__MMI_T9_SLOVENIAN__)
  1453.             case INPUT_TYPE_SMART_UPPERCASE_SLOVENIAN:
  1454.             case INPUT_TYPE_SMART_LOWERCASE_SLOVENIAN:
  1455.         #endif /* defined(__MMI_T9_SLOVENIAN__) */ 
  1456.         #if defined(__MMI_T9_SWEDISH__)
  1457.             case INPUT_TYPE_SMART_UPPERCASE_SWEDISH:
  1458.             case INPUT_TYPE_SMART_LOWERCASE_SWEDISH:
  1459.         #endif /* defined(__MMI_T9_SWEDISH__) */ 
  1460.                 /* PMT SLO_SWE END 20051213 */
  1461.         #if defined(__MMI_T9_GREEK__)
  1462.             case INPUT_TYPE_SMART_UPPERCASE_GREEK:
  1463.             case INPUT_TYPE_SMART_LOWERCASE_GREEK:
  1464.         #endif /* defined(__MMI_T9_GREEK__) */ 
  1465.         #if defined(__MMI_T9_HEBREW__)
  1466.             case INPUT_TYPE_SMART_HEBREW:
  1467.         #endif /* defined(__MMI_T9_HEBREW__) */ 
  1468.                 //PMT LANGUAGE END 20051221
  1469.                 //PMT START LANGUAGE 20060104
  1470.         #if defined(__MMI_T9_CROATIAN__)
  1471.             case INPUT_TYPE_SMART_UPPERCASE_CROATIAN:
  1472.             case INPUT_TYPE_SMART_LOWERCASE_CROATIAN:
  1473.         #endif /* defined(__MMI_T9_CROATIAN__) */ 
  1474.         #if defined(__MMI_T9_MALAY__)
  1475.             case INPUT_TYPE_SMART_UPPERCASE_MALAY:
  1476.             case INPUT_TYPE_SMART_LOWERCASE_MALAY:
  1477.         #endif /* defined(__MMI_T9_MALAY__) */ 
  1478.         #if defined(__MMI_T9_SLOVAK__)
  1479.             case INPUT_TYPE_SMART_UPPERCASE_SLOVAK:
  1480.             case INPUT_TYPE_SMART_LOWERCASE_SLOVAK:
  1481.         #endif /* defined(__MMI_T9_SLOVAK__) */ 
  1482.         #if defined(__MMI_T9_ROMANIAN__)
  1483.             case INPUT_TYPE_SMART_UPPERCASE_ROMANIAN:
  1484.             case INPUT_TYPE_SMART_LOWERCASE_ROMANIAN:
  1485.         #endif /* defined(__MMI_T9_ROMANIAN__) */ 
  1486.                 /* PMT END LANGUAGE 20060104 */
  1487.                 T9SynT9WithInputBox();
  1488.                 break;
  1489.         }
  1490.     #endif /* __MMI_T9__ */ 
  1491.         dm_redraw_category_screen();
  1492.         ErrorHandlingWhileInsertingObject(emsObjectStatus); /* check whetehr it is inserted or not. */
  1493.     }
  1494. }
  1495. /* MTk end */
  1496. #endif /* (defined(__MMI_FILE_MANAGER__)) */ 
  1497. /*****************************************************************************
  1498.  * FUNCTION
  1499.  *  EntryScrSaveObjectList
  1500.  * DESCRIPTION
  1501.  *  Entry save object list screen
  1502.  * PARAMETERS
  1503.  *  void
  1504.  * RETURNS
  1505.  *  void
  1506.  *****************************************************************************/
  1507. void EntryScrSaveObjectList(void)
  1508. {
  1509.     /*----------------------------------------------------------------*/
  1510.     /* Local Variables                                                */
  1511.     /*----------------------------------------------------------------*/
  1512.     U8 *guiBuffer = NULL;
  1513.     EMSData *pEms;
  1514.     /*----------------------------------------------------------------*/
  1515.     /* Code Body                                                      */
  1516.     /*----------------------------------------------------------------*/
  1517.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_SAVE_OBJECT_LIST);
  1518.     if (guiBuffer == NULL)
  1519.     {
  1520.         currObjectIndex = 0;
  1521.     }
  1522.     CreateCategory143ObjectList(GetEMSDataForView(&pEms, 0), &previewObjectListPtr);
  1523.     if (previewObjectListPtr != NULL)
  1524.     {
  1525.         EntryNewScreen(SCR_ID_MSG_SAVE_OBJECT_LIST, ExitScrSaveObjectList, NULL, NULL);
  1526.         EnableDisableAudioPlayback();
  1527.         ShowCategory143Screen(
  1528.             STR_EMS_OBJECT_LIST,
  1529.             IMG_SMS_ENTRY_SCRN_CAPTION,
  1530.             STR_GLOBAL_OK,
  1531.             IMG_GLOBAL_OK,
  1532.             STR_GLOBAL_BACK,
  1533.             IMG_GLOBAL_BACK,
  1534.             previewObjectListPtr,
  1535.             &nObjectLists,
  1536.             &currObjectIndex,
  1537.             guiBuffer);
  1538.         SetLeftSoftkeyFunction(PreEntryScrSaveObjectName, KEY_EVENT_UP);
  1539.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1540.         SetKeyHandler(PreEntryScrSaveObjectName, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1541.     }
  1542.     else
  1543.     {
  1544.         DisplayPopup(
  1545.             (PU8) GetString(STR_GLOBAL_EMPTY),
  1546.             IMG_GLOBAL_EMPTY,
  1547.             1,
  1548.             MESSAGES_POPUP_TIME_OUT,
  1549.             (U8) EMPTY_LIST_TONE);
  1550.     }
  1551. }
  1552. /*****************************************************************************
  1553.  * FUNCTION
  1554.  *  ExitScrSaveObjectList
  1555.  * DESCRIPTION
  1556.  *  Exit save object list screen
  1557.  * PARAMETERS
  1558.  *  void
  1559.  * RETURNS
  1560.  *  void
  1561.  *****************************************************************************/
  1562. void ExitScrSaveObjectList(void)
  1563. {
  1564.     /*----------------------------------------------------------------*/
  1565.     /* Local Variables                                                */
  1566.     /*----------------------------------------------------------------*/
  1567.     history currHistory;
  1568.     S16 ucs2InputBuffer = 0;
  1569.     /*----------------------------------------------------------------*/
  1570.     /* Code Body                                                      */
  1571.     /*----------------------------------------------------------------*/
  1572.     FreeCategory143ObjectList(&previewObjectListPtr);
  1573.     currHistory.scrnID = SCR_ID_MSG_SAVE_OBJECT_LIST;
  1574.     g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_SAVE_OBJECT_LIST;
  1575.     currHistory.entryFuncPtr = EntryScrSaveObjectList;
  1576.     pfnUnicodeStrcpy((S8*) currHistory.inputBuffer, (S8*) & ucs2InputBuffer);
  1577.     GetCategoryHistory(currHistory.guiBuffer);
  1578.     AddHistory(currHistory);
  1579. }
  1580. /*****************************************************************************
  1581.  * FUNCTION
  1582.  *  PreEntryScrSaveObjectName
  1583.  * DESCRIPTION
  1584.  *  Before entry save object name, get object type and size
  1585.  * PARAMETERS
  1586.  *  void
  1587.  * RETURNS
  1588.  *  void
  1589.  *****************************************************************************/
  1590. void PreEntryScrSaveObjectName(void)
  1591. {
  1592.     /*----------------------------------------------------------------*/
  1593.     /* Local Variables                                                */
  1594.     /*----------------------------------------------------------------*/
  1595.     /*----------------------------------------------------------------*/
  1596.     /* Code Body                                                      */
  1597.     /*----------------------------------------------------------------*/
  1598.     FreeUserEmsObjectNameInputBuff();
  1599.     MemsetUserDefinedObjectDataBuff();
  1600.     SetCurrEmsObjectDisplayListState(GetCategory143DataType());
  1601.     userDefinedObjectDataSize = GetCategory143DataSize();
  1602. #if defined(__MMI_IMELODY_SUPPORT__)
  1603.     if (currEmsObjectDisplayListState == EMS_OBJECT_MY_MELODY_STATE)
  1604.     {
  1605.         U8 userDefinedObjectDataBuffTemp[MAX_CURR_EMS_OBJECT_DATA_BUFF];
  1606.         GetCategory143Data(userDefinedObjectDataBuffTemp);
  1607.         EMS_userdefined_melody_detach_header(
  1608.             userDefinedObjectDataBuffTemp,
  1609.             userDefinedObjectDataBuff,
  1610.             &userDefinedObjectDataSize);
  1611.     }
  1612.     else
  1613. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1614.     {
  1615.         GetCategory143Data(userDefinedObjectDataBuff);
  1616.     }
  1617.     EntryScrSaveObjectName();
  1618. }
  1619. /*****************************************************************************
  1620.  * FUNCTION
  1621.  *  EntryScrSaveObjectName
  1622.  * DESCRIPTION
  1623.  *  Entry save object name screen
  1624.  * PARAMETERS
  1625.  *  void
  1626.  * RETURNS
  1627.  *  void
  1628.  *****************************************************************************/
  1629. void EntryScrSaveObjectName(void)
  1630. {
  1631.     /*----------------------------------------------------------------*/
  1632.     /* Local Variables                                                */
  1633.     /*----------------------------------------------------------------*/
  1634.     U8 *guiBuffer = NULL;
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Code Body                                                      */
  1637.     /*----------------------------------------------------------------*/
  1638.     EntryNewScreen(SCR_ID_MSG_SAVE_OBJECT_NAME, mmi_msg_exit_generic, EntryScrSaveObjectName, NULL);
  1639.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_SAVE_OBJECT_NAME);
  1640.     /* SetMessagesScrnIdToDelHistoryNodes (SCR_ID_MSG_SAVE_OBJECT_NAME); */
  1641.     ShowCategory5Screen(
  1642.         STR_EMS_OBJECT_NAME,
  1643.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1644.         STR_GLOBAL_OPTIONS,
  1645.         IMG_GLOBAL_OPTIONS,
  1646.         STR_GLOBAL_BACK,
  1647.         IMG_GLOBAL_BACK,
  1648.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1649.         (PU8) userEmsObjectNameInput,
  1650.         MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN,
  1651.         guiBuffer);
  1652.     SetLeftSoftkeyFunction(EntryEmsSaveObjectOption, KEY_EVENT_UP);
  1653.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1654. }
  1655. /*****************************************************************************
  1656.  * FUNCTION
  1657.  *  EntryEmsSaveObjectOption
  1658.  * DESCRIPTION
  1659.  *  Entry save object option screen
  1660.  * PARAMETERS
  1661.  *  void
  1662.  * RETURNS
  1663.  *  void
  1664.  *****************************************************************************/
  1665. void EntryEmsSaveObjectOption(void)
  1666. {
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     U16 numItems = 0;
  1671.     U8 *guiBuffer = NULL;
  1672.     U16 nStrItemList[MAX_SUB_MENUS];
  1673.     /*----------------------------------------------------------------*/
  1674.     /* Code Body                                                      */
  1675.     /*----------------------------------------------------------------*/
  1676.     EntryNewScreen(SCR_ID_MSG_SAVE_OBJECT_OPTION, mmi_msg_exit_generic, EntryEmsSaveObjectOption, NULL);
  1677.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_SAVE_OBJECT_OPTION);
  1678.     SetParentHandler(SMS_INBOX_OPT_SAVE_OBJECT_OPTION);
  1679.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1680.     numItems = GetNumOfChild(SMS_INBOX_OPT_SAVE_OBJECT_OPTION);
  1681.     GetSequenceStringIds(SMS_INBOX_OPT_SAVE_OBJECT_OPTION, nStrItemList);
  1682.     SetMessagesCurrScrnID(SCR_ID_MSG_SAVE_OBJECT_OPTION);
  1683.     ShowCategory52Screen(
  1684.         STR_GLOBAL_OPTIONS,
  1685.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1686.         STR_GLOBAL_OK,
  1687.         IMG_GLOBAL_OK,
  1688.         STR_GLOBAL_BACK,
  1689.         IMG_GLOBAL_BACK,
  1690.         numItems,
  1691.         nStrItemList,
  1692.         (U16*) gIndexIconsImageList,
  1693.         NULL,
  1694.         0,
  1695.         0,
  1696.         guiBuffer);
  1697. }
  1698. /*****************************************************************************
  1699.  * FUNCTION
  1700.  *  SaveEmsObjectNameAndDownLoadEmsObject
  1701.  * DESCRIPTION
  1702.  *  Save object name and data
  1703.  * PARAMETERS
  1704.  *  void
  1705.  * RETURNS
  1706.  *  void
  1707.  *****************************************************************************/
  1708. void SaveEmsObjectNameAndDownLoadEmsObject(void)
  1709. {
  1710.     /*----------------------------------------------------------------*/
  1711.     /* Local Variables                                                */
  1712.     /*----------------------------------------------------------------*/
  1713.     EMSTATUS saveResult;
  1714.     S32 create_directory_result = 0;
  1715.     /*----------------------------------------------------------------*/
  1716.     /* Code Body                                                      */
  1717.     /*----------------------------------------------------------------*/
  1718.     create_directory_result = mmi_ems_create_ems_folder();
  1719.     /* Create folder success */
  1720.     if (create_directory_result == FS_FILE_EXISTS || create_directory_result == FS_NO_ERROR)
  1721.     {
  1722.         saveResult = WriteDownloadObjectDataIntoFileSystem();
  1723.         ErrorHandlingWhileSavingObject(saveResult);
  1724.         if (saveResult != EMS_ALREADY_INITIALIZED &&
  1725.             saveResult != EMS_INVALID_FILE_NAME)
  1726.         {
  1727.             DeleteUptoScrID(SCR_ID_MSG_SAVE_OBJECT_LIST);
  1728.             FreeUserEmsObjectNameInputBuff();
  1729.         }
  1730.         else
  1731.         {
  1732.             DeleteUptoScrID(SCR_ID_MSG_SAVE_OBJECT_NAME);
  1733.         }
  1734.     }
  1735.     else
  1736.     {
  1737.         DisplayPopup(
  1738.             (PU8) GetString(GetFileSystemErrorString(create_directory_result)),
  1739.             IMG_GLOBAL_UNFINISHED,
  1740.             1,
  1741.             MESSAGES_POPUP_TIME_OUT,
  1742.             (U8) ERROR_TONE);
  1743.         DeleteUptoScrID(SCR_ID_MSG_SAVE_OBJECT_NAME);
  1744.     }
  1745. }
  1746. /*****************************************************************************
  1747.  * FUNCTION
  1748.  *  HighlightEmsSaveObjectDone
  1749.  * DESCRIPTION
  1750.  *  Highlight save object done handler
  1751.  * PARAMETERS
  1752.  *  void
  1753.  * RETURNS
  1754.  *  void
  1755.  *****************************************************************************/
  1756. void HighlightEmsSaveObjectDone(void)
  1757. {
  1758.     /*----------------------------------------------------------------*/
  1759.     /* Local Variables                                                */
  1760.     /*----------------------------------------------------------------*/
  1761.     /*----------------------------------------------------------------*/
  1762.     /* Code Body                                                      */
  1763.     /*----------------------------------------------------------------*/
  1764.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  1765.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  1766.     SetLeftSoftkeyFunction(SaveEmsObjectNameAndDownLoadEmsObject, KEY_EVENT_UP);
  1767.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1768.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1769.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1770. }
  1771. /*****************************************************************************
  1772.  * FUNCTION
  1773.  *  mmi_ems_create_ems_folder
  1774.  * DESCRIPTION
  1775.  *  Create EMS object folder in boot up
  1776.  * PARAMETERS
  1777.  *  void
  1778.  * RETURNS
  1779.  *  void
  1780.  *****************************************************************************/
  1781. S32 mmi_ems_create_ems_folder(void)
  1782. {
  1783. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1784.     /*----------------------------------------------------------------*/
  1785.     /* Local Variables                                                */
  1786.     /*----------------------------------------------------------------*/
  1787.     S8 emsObjectFileNameBuf[(MAX_EMS_DOWNLOAD_OBJECT_NAME_INIT_PATH + 1) * ENCODING_LENGTH] = {0, 0};
  1788.     U16 driveName;
  1789.     S8 temp[4];
  1790.     S32 result = FS_NO_ERROR;
  1791.     UI_character_type dir_ems_root[4];
  1792.     /*----------------------------------------------------------------*/
  1793.     /* Code Body                                                      */
  1794.     /*----------------------------------------------------------------*/
  1795.     driveName = MMI_PUBLIC_DRV;
  1796.     sprintf(temp, "%c:\", (S8) driveName);
  1797.     AnsiiToUnicodeString((S8*) dir_ems_root, temp);
  1798.     memset(emsObjectFileNameBuf, 0, ENCODING_LENGTH);
  1799.     pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  1800.     pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
  1801.     pcreateDir(emsObjectFileNameBuf);
  1802.     memset(emsObjectFileNameBuf, 0, ENCODING_LENGTH);
  1803.     pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  1804.     pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_AUDIO);
  1805.     result = (S32) pcreateDir(emsObjectFileNameBuf);
  1806. #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1807.     S32 result = 0;
  1808.     pcreateDir(MessagesGetString((S8*) STR_EMS_PIC_A_ANIM_OBJECT_FILE_NAME_INIT_PATH_ID));
  1809.     pcreateDir(MessagesGetString((S8*) STR_EMS_IMELODY_OBJECT_FILE_NAME_INIT_PATH_ID));
  1810. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1811.     return result;
  1812. }
  1813. #endif /* defined(__MMI_MESSAGES_EMS__) */ 
  1814. #endif /* __MOD_SMSAL__ */