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

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) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * EmsMiscell.C
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for MMI SMS APP.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  *------------------------------------------------------------------------------
  196.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  197.  *============================================================================
  198.  ****************************************************************************/
  199. /**
  200.  * Copyright Notice
  201.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  202.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  203.  *  (It is illegal to remove this copyright notice from this software or any
  204.  *  portion of it)
  205.  */
  206.  /**************************************************************
  207.    FILENAME : EmsMiscell.c
  208.    PURPOSE     : Dislay all EMS objects(Manufacture picture, 
  209.                User defined picture, Predefined animation, Usedefiend animation,
  210.                Manufacturer melodies, Usedefined melodies, Predefined sound.)
  211.    REMARKS     : nil
  212.    AUTHOR      : Hiran, Magesh k
  213.    DATE     : 
  214. **************************************************************/
  215. #ifdef __MOD_SMSAL__
  216. /*  */
  217. #include "MMI_features.h"
  218. #include "stdC.h"
  219. #include "L4Dr1.h"
  220. #include "PixtelDataTypes.h"
  221. /* ... Add More MMI header */
  222. #include "EventsGprot.h"
  223. #include "HistoryGprot.h"
  224. #include "GlobalMenuItems.h"
  225. #include "GlobalConstants.h"
  226. #include "Globaldefs.h"
  227. #include "wgui_categories.h"
  228. #include "wgui_categories_inputs.h"
  229. #include "CustMenuRes.h"
  230. #include "CommonScreens.h"
  231. #include "Unicodexdcl.h"
  232. #include "TimerEvents.h"
  233. #include "DebugInitDef.h"
  234. #include "FrameworkStruct.h"    /* for PsExtFuncPtr */
  235. #include "Fs_errcode.h"
  236. /* ...Add MSG header */
  237. #include "customer_ps_inc.h"
  238. #include "mmi_msg_context.h"
  239. #include "MessagesL4Def.h"
  240. #include "MessagesResourceData.h"
  241. #include "MessagesMiscell.h"
  242. #include "MessagesExDcl.h"
  243. #include "SmsGuiInterfaceProt.h"
  244. #include "SMsGuiInterfaceType.h"
  245. #include "SmsPsHandler.h"
  246. /*  */
  247. #include "ProfileGprots.h"
  248. /*  */
  249. #include "ems.h"
  250. #include "Gui_ems.h"
  251. #include "wgui_ems.h"
  252. #include "wgui_categories_ems.h"//062706 revise
  253. #include "GSM7BitDefaultAlphabet.h"
  254. /*  */
  255. #include "SettingProfile.h"
  256. #include "FileSystemDef.h"
  257. #include "FileSystemGProt.h"
  258. #include "DownloadDefs.h"
  259. #include "DownloadProtos.h"
  260. /*  */
  261. #include "NVRAMEnum.h"
  262. #include "NVRAMProt.h"
  263. #include "NVRAMType.h"
  264. /*  */
  265. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  266. #include "FileMgr.h"
  267. #include "FileManagerDef.h"
  268. #include "FileManagerGProt.h"
  269. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  270. #ifdef __MMI_IMELODY_SUPPORT__
  271. #include "resource_audio.h"
  272. extern audio_resource_struct *resource_ems_imelodys;
  273. #endif /* __MMI_IMELODY_SUPPORT__ */ 
  274. #ifdef MMI_ON_HARDWARE_P
  275. #include "nvram_user_defs.h"
  276. #endif 
  277. #include "SMSApi.h"
  278. #if defined(__MMI_MESSAGES_EMS__)
  279. /*  */
  280. #ifndef NVRAM_EMS_MY_PICTURE_NAME_RECORD_SIZE
  281. #define NVRAM_EMS_MY_PICTURE_NAME_RECORD_SIZE   140
  282. #endif 
  283. #ifndef NVRAM_EMS_MY_ANIMATION_NAME_RECORD_SIZE
  284. #define NVRAM_EMS_MY_ANIMATION_NAME_RECORD_SIZE 140
  285. #endif 
  286. #if defined(__MMI_IMELODY_SUPPORT__)
  287. #ifndef NVRAM_EMS_MY_MELODY_NAME_RECORD_SIZE
  288. #define NVRAM_EMS_MY_MELODY_NAME_RECORD_SIZE 140
  289. #endif 
  290. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  291. #define   MESSAGES_ONE_SEC_TIME_OUT     1000
  292. #define   MAX_EMS_OBJECT_LIST_DISPLAY     15
  293. #define   MAX_EMS_PREDEFINED_ANIMATION    15
  294. #define   MAX_EMS_PREDEFINED_SOUND     10
  295. #ifdef __EMS_REL5__
  296. #define   MAX_CURR_EMS_OBJECT_DATA_BUFF            1588+12
  297. #define   MAX_EMS_OBJECT_INSERT_SIZE            1588
  298. #else /* __EMS_REL5__ */ 
  299. #define   MAX_CURR_EMS_OBJECT_DATA_BUFF            128+12
  300. #define   MAX_EMS_OBJECT_INSERT_SIZE               128
  301. #endif /* __EMS_REL5__ */ 
  302. #if defined(MMI_ON_WIN32)
  303. #define   MAX_EMS_DOWNLOAD_OBJECTS              MAXIMUM_EMS_DOWNLOAD_IMELODY
  304. #define   MAX_EMS_DOWNLOAD_PICTURE_OBJECTS         MAX_EMS_DOWNLOAD_OBJECTS
  305. #define   MAX_EMS_DOWNLOAD_ANIMATION_OBJECTS    MAX_EMS_DOWNLOAD_OBJECTS
  306. #define   MAX_EMS_DOWNLOAD_IMELODY_OBJECTS         MAXIMUM_EMS_DOWNLOAD_IMELODY
  307. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN         13
  308. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_INIT_PATH   30
  309. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_EXTN_LEN 5
  310. #define  MAX_EMS_DISPLAY_NAME_LEN               (MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN*ENCODING_LENGTH)+ENCODING_LENGTH
  311. #define  MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN       MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN+MAX_EMS_DOWNLOAD_OBJECT_NAME_INIT_PATH+MAX_EMS_DOWNLOAD_OBJECT_NAME_EXTN_LEN
  312. #elif defined (__MMI_FILE_MANAGER__)
  313. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN         FMGR_MAX_INPUT_FILE_LEN
  314. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_INIT_PATH   FMGR_MAX_PATH_LEN
  315. #define   MAX_EMS_DOWNLOAD_OBJECT_NAME_EXTN_LEN FMGR_MAX_EXT_LEN
  316. #define  MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN       FMGR_MAX_PATH_LEN+FMGR_MAX_FILE_LEN
  317. #endif 
  318. #ifndef MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN
  319. #define  MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN          13
  320. #endif
  321. /*  */
  322. #define STR_EMS_PICTURE_OBJECT_FILE_NAME_EXTN_ID   ".ems"
  323. #define STR_EMS_ANIMATION_OBJECT_FILE_NAME_EXTN_ID ".anm"
  324. #define STR_EMS_IMELODY_OBJECT_FILE_NAME_EXTN_ID   ".imy"
  325. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  326. #define STR_EMS_PIC_A_ANIM_OBJECT_FILE_NAME_INIT_PATH_ID       FMGR_DEFAULT_FOLDER_IMAGES       /* "USER\image\ems\" */
  327. #define STR_EMS_IMELODY_OBJECT_FILE_NAME_INIT_PATH_ID          FMGR_DEFAULT_FOLDER_AUDIO        /* "USER\sound\ems\" */
  328. #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  329. #define STR_EMS_PIC_A_ANIM_OBJECT_FILE_NAME_INIT_PATH_ID       "c:\USER\image\ems\"
  330. #define STR_EMS_IMELODY_OBJECT_FILE_NAME_INIT_PATH_ID          "c:\USER\sound\ems\"
  331. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  332. /* MTK Joy added for file names, 1128 */
  333. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_0   "ems0"
  334. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_1   "ems1"
  335. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_2   "ems2"
  336. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_3   "ems3"
  337. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_4   "ems4"
  338. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_5   "ems5"
  339. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_6   "ems6"
  340. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_7   "ems7"
  341. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_8   "ems8"
  342. #define STR_EMS_MANUFACTURER_PIC_OBJECT_FILE_NAME_9   "ems9"
  343. /* MTK end */
  344. extern S32 pfError(S32 err);
  345. #ifdef MMI_ON_WIN32
  346. extern S32 fdelete(U8 *fName);
  347. #endif 
  348. extern void (*EMS_inputbox_input_callback) (void);
  349. #endif /* defined(__MMI_MESSAGES_EMS__) */ 
  350. #if defined (__MMI_VCARD__) || defined (__MMI_VCALENDAR__)
  351. #ifndef MAX_EMS_OBJECT_INSERT_SIZE
  352. #ifdef __EMS_REL5__
  353. #define   MAX_EMS_OBJECT_INSERT_SIZE               1588
  354. #else 
  355. #define   MAX_EMS_OBJECT_INSERT_SIZE               128
  356. #endif 
  357. #endif /* MAX_EMS_OBJECT_INSERT_SIZE */ 
  358. #ifndef MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN
  359. #define  MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN          260+41       /* FMGR_MAX_PATH_LEN+FMGR_MAX_FILE_LEN */
  360. #endif 
  361. PsFuncPtr emscallback;
  362. static S8 *file_path;
  363. #endif /* defined (__MMI_VCARD__) || defined (__MMI_VCALENDAR__) */ 
  364. /*  */
  365. #if defined(__MMI_MESSAGES_EMS__)
  366. U16 PredefinedAnimationStrIDs[] =   /* Predefined Animations */
  367. {
  368.     STR_PREDEFINED_ANIMATION_0,
  369.     STR_PREDEFINED_ANIMATION_1,
  370.     STR_PREDEFINED_ANIMATION_2,
  371.     STR_PREDEFINED_ANIMATION_3,
  372.     STR_PREDEFINED_ANIMATION_4,
  373.     STR_PREDEFINED_ANIMATION_5,
  374.     STR_PREDEFINED_ANIMATION_6,
  375.     STR_PREDEFINED_ANIMATION_7,
  376.     STR_PREDEFINED_ANIMATION_8,
  377.     STR_PREDEFINED_ANIMATION_9,
  378.     STR_PREDEFINED_ANIMATION_10,
  379.     STR_PREDEFINED_ANIMATION_11,
  380.     STR_PREDEFINED_ANIMATION_12,
  381.     STR_PREDEFINED_ANIMATION_13,
  382.     STR_PREDEFINED_ANIMATION_14
  383. };
  384. const U16 PredefinedSoundStrIDs[] = /* Predefined Sounds */
  385. {
  386.     STR_PREDEFINED_SOUND_0,
  387.     STR_PREDEFINED_SOUND_1,
  388.     STR_PREDEFINED_SOUND_2,
  389.     STR_PREDEFINED_SOUND_3,
  390.     STR_PREDEFINED_SOUND_4,
  391.     STR_PREDEFINED_SOUND_5,
  392.     STR_PREDEFINED_SOUND_6,
  393.     STR_PREDEFINED_SOUND_7,
  394.     STR_PREDEFINED_SOUND_8,
  395.     STR_PREDEFINED_SOUND_9
  396. };
  397. U16 ManufacturerPictureStrIDs[] =   /* ManufacturerPicture Str IDs */
  398. {
  399.     STR_MANUFACTURER_PICTURE_0,
  400.     STR_MANUFACTURER_PICTURE_1,
  401.     STR_MANUFACTURER_PICTURE_2,
  402.     STR_MANUFACTURER_PICTURE_3,
  403.     STR_MANUFACTURER_PICTURE_4,
  404.     STR_MANUFACTURER_PICTURE_5,
  405.     STR_MANUFACTURER_PICTURE_6,
  406.     STR_MANUFACTURER_PICTURE_7,
  407.     STR_MANUFACTURER_PICTURE_8,
  408.     STR_MANUFACTURER_PICTURE_9
  409. };
  410. const U16 ManufacturerMelodiesStrIDs[] =    /* Manufacturer Melodies Str IDs */
  411. {
  412.     STR_MANUFACTURER_MELODIES_0,
  413.     STR_MANUFACTURER_MELODIES_1,
  414.     STR_MANUFACTURER_MELODIES_2,
  415.     STR_MANUFACTURER_MELODIES_3,
  416.     STR_MANUFACTURER_MELODIES_4,
  417.     STR_MANUFACTURER_MELODIES_5,
  418.     STR_MANUFACTURER_MELODIES_6,
  419.     STR_MANUFACTURER_MELODIES_7,
  420.     STR_MANUFACTURER_MELODIES_8,
  421.     STR_MANUFACTURER_MELODIES_9
  422. };
  423. static U16 preDefinedObjectIds[MAX_EMS_OBJECT_LIST_DISPLAY] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
  424. static U8 *userDefinedObjectDataPtrs[MAX_EMS_OBJECT_LIST_DISPLAY];
  425. static U8 userDefinedObjectDataBuff[MAX_CURR_EMS_OBJECT_DATA_BUFF] = {0, 0};
  426. static S32 userDefinedObjectDataSize = 0;
  427. static S32 currObjectListHiliteIndex = 0;
  428. static U8 currMaxEmsObjectList = 0;
  429. static U8 currMaxEmsPictureObjects = 0;
  430. static U8 userEmsObjectNameInput[(MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN + 1) * ENCODING_LENGTH] = {0, 0};
  431. static U8 *emsObjectNameWhenPreview = NULL;
  432. static EMS_OBJECT_DISPLAY_STATE currEmsObjectDisplayListState;
  433. static U8 emsFmtTextStyleStates[4] = {0, 0, 0, 0};
  434. static U8 IsAllowed = FALSE;
  435. static S32 listOfIsAllowedData[MAX_EMS_OBJECT_LIST_DISPLAY];
  436. /*  */
  437. static EMSObject *previewObjectListPtr = NULL;
  438. static S32 nObjectLists = 0;
  439. static S32 currObjectIndex = 0;
  440. extern UI_EMS_input_box MMI_EMS_inputbox;
  441. extern EMSTextFormat wgui_EMS_text_format;
  442. /* MTK end */
  443. #if (defined(__MMI_FILE_MANAGER__))
  444. void mmi_ems_fm_send_by_ems(S8 *emsObjectFileNameBuf, EMS_OBJECT_DISPLAY_STATE emsObjectType);
  445. void mmi_ems_add_object_from_fm(void);
  446. void mmi_ems_preview_object_from_fm(PU16 filePath, S32 is_short);
  447. EMSTATUS mmi_ems_fm_open_file(S8 *emsObjectFileNameBuf, EMS_OBJECT_DISPLAY_STATE emsObjectType);
  448. #endif /* (defined(__MMI_FILE_MANAGER__)) */ 
  449. #if defined(__MMI_IMELODY_SUPPORT__)
  450. extern U32 GetEmsMelodyLength(S32 index);
  451. extern PU8 GetEmsMelodyData(S32 index);
  452. #ifdef MMI_ON_HARDWARE_P
  453. extern void custom_get_fixed_ems_imelody_range(U8 *min_id, U8 *max_id);
  454. #endif 
  455. #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  456. extern U32 GetEmsPictureLength(S32 index);
  457. extern PU8 GetEmsPictureData(S32 index);
  458. extern void handle_category28_input(void);
  459. extern void T9SynT9WithInputBox(void);
  460. #endif /* defined(__MMI_MESSAGES_EMS__) */ 
  461. extern EMSData *GetEMSDataForView(EMSData **p, U8 force);
  462. extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
  463. extern U8 DeInitMessagesEMSBuffer(msg_ems_data_struct *pE);
  464. //////////////////////////////////////////////////////////////////////
  465. // Routines for manipulating local buffers for EMS Edit and View
  466. //////////////////////////////////////////////////////////////////////
  467. /*****************************************************************************
  468.  * FUNCTION
  469.  *  ErrorHandlingWhileInsertingObject
  470.  * DESCRIPTION
  471.  *  Handle error case when insert object
  472.  * PARAMETERS
  473.  *  emsObjectStatus     [IN]        Insert status
  474.  * RETURNS
  475.  *  void
  476.  *****************************************************************************/
  477. void ErrorHandlingWhileInsertingObject(EMSTATUS emsObjectStatus)
  478. {
  479.     /*----------------------------------------------------------------*/
  480.     /* Local Variables                                                */
  481.     /*----------------------------------------------------------------*/
  482.     /*----------------------------------------------------------------*/
  483.     /* Code Body                                                      */
  484.     /*----------------------------------------------------------------*/
  485.     /* hander error case, if could not insert objects. */
  486.     switch (emsObjectStatus)
  487.     {
  488.         case EMS_OK:
  489.             break;
  490.         case EMS_NO_MEMORY:
  491.             DisplayPopup(
  492.                 (PU8) GetString(STR_EMS_OBJECT_NUM_EXCEED),
  493.                 IMG_GLOBAL_UNFINISHED,
  494.                 1,
  495.                 MESSAGES_POPUP_TIME_OUT,
  496.                 (U8) ERROR_TONE);
  497.             break;
  498.         case EMS_NO_SPACE:
  499.             DisplayPopup(
  500.                 (PU8) GetString(STR_NO_SPACE_TO_INSERT_OBJECT),
  501.                 IMG_GLOBAL_UNFINISHED,
  502.                 1,
  503.                 MESSAGES_POPUP_TIME_OUT,
  504.                 (U8) ERROR_TONE);
  505.             break;
  506.         case EMS_INVALID_OBJECT:
  507.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  508.             DisplayPopup(
  509.                 (PU8) GetString(STR_FMGR_INVALID_FORMAT),
  510.                 IMG_GLOBAL_UNFINISHED,
  511.                 1,
  512.                 MESSAGES_POPUP_TIME_OUT,
  513.                 (U8) ERROR_TONE);
  514.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  515.             DisplayPopup(
  516.                 (PU8) GetString(STR_SMS_DOES_NOT_SUPPORT),
  517.                 IMG_GLOBAL_UNFINISHED,
  518.                 1,
  519.                 MESSAGES_POPUP_TIME_OUT,
  520.                 (U8) ERROR_TONE);
  521.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  522.             break;
  523.         case EMS_EMS_DATA_EXCEEDED:
  524.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  525.             DisplayPopup(
  526.                 (PU8) GetString(FMGR_FS_FILE_TOO_LARGE_TEXT),
  527.                 IMG_GLOBAL_UNFINISHED,
  528.                 1,
  529.                 MESSAGES_POPUP_TIME_OUT,
  530.                 (U8) ERROR_TONE);
  531.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  532.             DisplayPopup(
  533.                 (PU8) GetString(STR_SMS_FAILURE_MSG_LEN_EXCEEDED),
  534.                 IMG_GLOBAL_UNFINISHED,
  535.                 1,
  536.                 MESSAGES_POPUP_TIME_OUT,
  537.                 (U8) ERROR_TONE);
  538.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  539.             break;
  540.         case EMS_NULL_POINTER:
  541.             DisplayPopup(
  542.                 (PU8) GetString(STR_READ_SMS_DATA_FAILED),
  543.                 IMG_GLOBAL_UNFINISHED,
  544.                 1,
  545.                 MESSAGES_POPUP_TIME_OUT,
  546.                 (U8) ERROR_TONE);
  547.             break;
  548.         case EMS_NO_ALIGNMENT_FMT:
  549.             DisplayPopup(
  550.                 (PU8) GetString(STR_SMS_OBJECT_EXISTENCE_ERROR),
  551.                 IMG_GLOBAL_UNFINISHED,
  552.                 1,
  553.                 MESSAGES_POPUP_TIME_OUT,
  554.                 (U8) ERROR_TONE);
  555.             break;
  556.         default /* EMS_UNSPECIFIED_ERROR */ :
  557.             DisplayPopup(
  558.                 (PU8) GetString(STR_SMS_DOES_NOT_SUPPORT),
  559.                 IMG_GLOBAL_UNFINISHED,
  560.                 1,
  561.                 MESSAGES_POPUP_TIME_OUT,
  562.                 (U8) ERROR_TONE);
  563.             break;
  564.     }
  565. }
  566. #if defined (__MMI_VCARD__) || defined (__MMI_VCALENDAR__)
  567. /*****************************************************************************
  568.  * FUNCTION
  569.  *  mmi_ems_vobject_send_by_ems_callback
  570.  * DESCRIPTION
  571.  *  Call back vobject send by ems function
  572.  * PARAMETERS
  573.  *  dummy       [?]         
  574.  *  mod         [IN]        
  575.  *  flag        [IN]        Send result
  576.  * RETURNS
  577.  *  void
  578.  *****************************************************************************/
  579. void mmi_ems_vobject_send_by_ems_callback(void *dummy, module_type mod, U16 flag)
  580. {
  581.     /*----------------------------------------------------------------*/
  582.     /* Local Variables                                                */
  583.     /*----------------------------------------------------------------*/
  584.     /*----------------------------------------------------------------*/
  585.     /* Code Body                                                      */
  586.     /*----------------------------------------------------------------*/
  587.     switch (flag)
  588.     {
  589.         case MMI_FRM_SMS_OK:
  590.             DisplayPopup(
  591.                 (PU8) GetString(STR_SMS_SEND_SUCCESS),
  592.                 IMG_SEND_SUCCESS_PIC_MSG,
  593.                 1,
  594.                 MESSAGES_POPUP_TIME_OUT,
  595.                 (U8) SUCCESS_TONE);
  596.             mmi_frm_sms_delete_screen_history();
  597.             break;
  598.         case MMI_FRM_SMS_RETURN:
  599.         case MMI_FRM_SMS_END:
  600.             /* do not keep vcard and vcalendar content when sending fail */
  601.             ReleaseEMSEditBuffer();
  602.             break;
  603.         case MMI_FRM_SMS_DATAEXCEED:
  604.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  605.             DisplayPopup(
  606.                 (PU8) GetString(FMGR_FS_FILE_TOO_LARGE_TEXT),
  607.                 IMG_GLOBAL_UNFINISHED,
  608.                 1,
  609.                 MESSAGES_POPUP_TIME_OUT,
  610.                 (U8) ERROR_TONE);
  611.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  612.             DisplayPopup(
  613.                 (PU8) GetString(STR_SMS_FAILURE_MSG_LEN_EXCEEDED),
  614.                 IMG_GLOBAL_UNFINISHED,
  615.                 1,
  616.                 MESSAGES_POPUP_TIME_OUT,
  617.                 (U8) ERROR_TONE);
  618.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  619.             mmi_frm_sms_delete_screen_history();
  620.             break;
  621.         case MMI_FRM_SMS_NOTREADY:
  622.             DisplayPopup(
  623.                 (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  624.                 IMG_SEND_FAIL_PIC_MSG,
  625.                 1,
  626.                 MESSAGES_POPUP_TIME_OUT,
  627.                 (U8) ERROR_TONE);
  628.             break;
  629.         case MMI_FRM_SMS_ABORT:
  630.             /* do not keep vcard and vcalendar content when sending aborts */
  631.             ReleaseEMSEditBuffer();
  632.             DisplayPopup(
  633.                 (PU8) GetString(STR_ABORT_SENDING_SMS),
  634.                 IMG_GLOBAL_ACTIVATED,
  635.                 1,
  636.                 MESSAGES_POPUP_TIME_OUT,
  637.                 (U8) SUCCESS_TONE);
  638.             mmi_frm_sms_delete_screen_history();
  639.             break;
  640.         default:
  641.             /* do not keep vcard and vcalendar content when sending fail */
  642.             ReleaseEMSEditBuffer();
  643.             DisplayPopup(
  644.                 (PU8) GetString(STR_SMS_SEND_FAILED),
  645.                 IMG_SEND_FAIL_PIC_MSG,
  646.                 1,
  647.                 MESSAGES_POPUP_TIME_OUT,
  648.                 (U8) ERROR_TONE);
  649.             mmi_frm_sms_delete_screen_history();
  650.             break;
  651.     }
  652.     if (file_path != NULL)
  653.     {
  654.         OslMfree(file_path);
  655.         file_path = NULL;
  656.     }
  657.     if (emscallback)
  658.     {
  659.         emscallback(&flag);
  660.     }
  661. }
  662. /*****************************************************************************
  663.  * FUNCTION
  664.  *  mmi_ems_vobject_send_by_ems
  665.  * DESCRIPTION
  666.  *  Send vobject by ems
  667.  * PARAMETERS
  668.  *  scrport         [IN]        Source port
  669.  *  dstport         [IN]        Destination port
  670.  *  filepath        [IN]        Filepath
  671.  *  callback        [IN]        Callback function
  672.  * RETURNS
  673.  *  void
  674.  *****************************************************************************/
  675. void mmi_ems_vobject_send_by_ems(U16 scrport, U16 dstport, S8 *filepath, PsFuncPtr callback)
  676. {
  677.     /*----------------------------------------------------------------*/
  678.     /* Local Variables                                                */
  679.     /*----------------------------------------------------------------*/
  680.     S32 result = TRUE;
  681.     mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  682.     /*----------------------------------------------------------------*/
  683.     /* Code Body                                                      */
  684.     /*----------------------------------------------------------------*/
  685.     memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
  686.     emscallback = callback;
  687.     sendData->sendrequire |= MMI_FRM_SMS_PORT;
  688.     sendData->srcport = scrport;
  689.     sendData->desport = dstport;
  690.     sendData->dcs = SMSAL_8BIT_DCS;
  691.     if (IsMessagesReEntering())
  692.     {
  693.         result = FALSE;
  694.         DisplayPopup(
  695.             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  696.             IMG_GLOBAL_UNFINISHED,
  697.             1,
  698.             MESSAGES_POPUP_TIME_OUT,
  699.             (U8) ERROR_TONE);
  700.         if (emscallback != NULL)
  701.         {
  702.             emscallback((PU16) & result);
  703.         }
  704.         OslMfree(sendData);
  705.         return;
  706.     }
  707.     if ((pfnUnicodeStrlen(filepath) == 0) || (pfnUnicodeStrlen(filepath) > MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN))
  708.     {
  709.         result = FALSE;
  710.         DisplayPopup(
  711.             (PU8) GetString(STR_EMS_OBJECT_SIZE_NOT_ALLOWED_ID),
  712.             IMG_GLOBAL_UNFINISHED,
  713.             1,
  714.             MESSAGES_POPUP_TIME_OUT,
  715.             (U8) ERROR_TONE);
  716.         if (emscallback != NULL)
  717.         {
  718.             emscallback((PU16) & result);
  719.         }
  720.         OslMfree(sendData);
  721.         return;
  722.     }
  723.     if (file_path != NULL)
  724.     {
  725.         OslMfree(file_path);
  726.         file_path = NULL;
  727.     }
  728.     file_path = OslMalloc((pfnUnicodeStrlen(filepath) + 1) * ENCODING_LENGTH);
  729.     pfnUnicodeStrcpy(file_path, filepath);
  730.     sendData->filename = file_path;
  731.     mmi_frm_sms_send_sms(mmi_ems_vobject_send_by_ems_callback, MOD_MMI, sendData);
  732.     OslMfree(sendData);
  733. }
  734. #if 0
  735. /* under construction !*/
  736. /* under construction !*/
  737. /* under construction !*/
  738. /* under construction !*/
  739. /* under construction !*/
  740. /* under construction !*/
  741. /* under construction !*/
  742. /* under construction !*/
  743. /* under construction !*/
  744. /* under construction !*/
  745. /* under construction !*/
  746. /* under construction !*/
  747. /* under construction !*/
  748. /* under construction !*/
  749. /* under construction !*/
  750. /* under construction !*/
  751. /* under construction !*/
  752. /* under construction !*/
  753. /* under construction !*/
  754. /* under construction !*/
  755. /* under construction !*/
  756. /* under construction !*/
  757. /* under construction !*/
  758. /* under construction !*/
  759. /* under construction !*/
  760. /* under construction !*/
  761. /* under construction !*/
  762. /* under construction !*/
  763. /* under construction !*/
  764. /* under construction !*/
  765. /* under construction !*/
  766. /* under construction !*/
  767. /* under construction !*/
  768. /* under construction !*/
  769. /* under construction !*/
  770. /* under construction !*/
  771. /* under construction !*/
  772. /* under construction !*/
  773. /* under construction !*/
  774. /* under construction !*/
  775. /* under construction !*/
  776. /* under construction !*/
  777. /* under construction !*/
  778. /* under construction !*/
  779. /* under construction !*/
  780. /* under construction !*/
  781. /* under construction !*/
  782. /* under construction !*/
  783. /* under construction !*/
  784. /* under construction !*/
  785. /* under construction !*/
  786. /* under construction !*/
  787. /* under construction !*/
  788. /* under construction !*/
  789. /* under construction !*/
  790. /* under construction !*/
  791. /* under construction !*/
  792. /* under construction !*/
  793. /* under construction !*/
  794. /* under construction !*/
  795. /* under construction !*/
  796. /* under construction !*/
  797. /* under construction !*/
  798. /* under construction !*/
  799. /* under construction !*/
  800. /* under construction !*/
  801. /* under construction !*/
  802. /* under construction !*/
  803. /* under construction !*/
  804. /* under construction !*/
  805. /* under construction !*/
  806. /* under construction !*/
  807. /* under construction !*/
  808. #ifdef MMI_ON_HARDWARE_P
  809. /* under construction !*/
  810. #endif
  811. /* under construction !*/
  812. /* under construction !*/
  813. /* under construction !*/
  814. /* under construction !*/
  815. /* under construction !*/
  816. /* under construction !*/
  817. /* under construction !*/
  818. /* under construction !*/
  819. #endif /* 0 */ 
  820. #endif /* defined (__MMI_VCARD__) || defined (__MMI_VCALENDAR__) */ 
  821. #if defined(__MMI_MESSAGES_EMS__)
  822. /**************************************************************
  823.             text format
  824. **************************************************************/
  825. /*****************************************************************************
  826.  * FUNCTION
  827.  *  GetFmtTextSize
  828.  * DESCRIPTION
  829.  *  Get text format size
  830.  * PARAMETERS
  831.  *  void
  832.  * RETURNS
  833.  *  size
  834.  *****************************************************************************/
  835. U8 GetFmtTextSize(void)
  836. {
  837.     /*----------------------------------------------------------------*/
  838.     /* Local Variables                                                */
  839.     /*----------------------------------------------------------------*/
  840.     /*----------------------------------------------------------------*/
  841.     /* Code Body                                                      */
  842.     /*----------------------------------------------------------------*/
  843.     switch (EMS_inputbox_get_text_size())
  844.     {
  845.         case EMS_FONTSIZE_SMALL:
  846.             return (U8) 0;
  847.         case EMS_FONTSIZE_NORMAL:
  848.             return (U8) 1;
  849.         case EMS_FONTSIZE_LARGE:
  850.             return (U8) 2;
  851.     }
  852.     return (U8) 0;
  853. }
  854. /*****************************************************************************
  855.  * FUNCTION
  856.  *  SetFmtTextSize
  857.  * DESCRIPTION
  858.  *  Set text format size
  859.  * PARAMETERS
  860.  *  void
  861.  * RETURNS
  862.  *  void
  863.  *****************************************************************************/
  864. void SetFmtTextSize(void)
  865. {
  866.     /*----------------------------------------------------------------*/
  867.     /* Local Variables                                                */
  868.     /*----------------------------------------------------------------*/
  869.     /*----------------------------------------------------------------*/
  870.     /* Code Body                                                      */
  871.     /*----------------------------------------------------------------*/
  872.     switch (GetHighlightedItem())
  873.     {
  874.         case 0:
  875.             EMS_inputbox_set_text_size(EMS_FONTSIZE_SMALL);
  876.             break;
  877.         case 1:
  878.             EMS_inputbox_set_text_size(EMS_FONTSIZE_NORMAL);
  879.             break;
  880.         case 2:
  881.             EMS_inputbox_set_text_size(EMS_FONTSIZE_LARGE);
  882.             break;
  883.     }
  884.     GoBackToHistory(SCR_ID_MSG_WRITE);
  885. }
  886. /*****************************************************************************
  887.  * FUNCTION
  888.  *  SetFmtTextStyle
  889.  * DESCRIPTION
  890.  *  Set text format style
  891.  * PARAMETERS
  892.  *  void
  893.  * RETURNS
  894.  *  void
  895.  *****************************************************************************/
  896. void SetFmtTextStyle(void)
  897. {
  898. #ifndef __MMI_TEXT_FORMAT_WITHOUT_BOLD__
  899.     /*----------------------------------------------------------------*/
  900.     /* Local Variables                                                */
  901.     /*----------------------------------------------------------------*/
  902.     /*----------------------------------------------------------------*/
  903.     /* Code Body                                                      */
  904.     /*----------------------------------------------------------------*/
  905.     EMS_inputbox_set_text_style(
  906.         emsFmtTextStyleStates[0],
  907.         emsFmtTextStyleStates[1],
  908.         emsFmtTextStyleStates[2],
  909.         emsFmtTextStyleStates[3]);
  910. #else /* __MMI_TEXT_FORMAT_WITHOUT_BOLD__ */ 
  911.     EMS_inputbox_set_text_style(
  912.         emsFmtTextStyleStates[3],
  913.         emsFmtTextStyleStates[0],
  914.         emsFmtTextStyleStates[1],
  915.         emsFmtTextStyleStates[2]);
  916. #endif /* __MMI_TEXT_FORMAT_WITHOUT_BOLD__ */ 
  917.     GoBackToHistory(SCR_ID_MSG_WRITE);
  918. }
  919. /*****************************************************************************
  920.  * FUNCTION
  921.  *  GetFmtTextAlignment
  922.  * DESCRIPTION
  923.  *  Get text format alignment
  924.  * PARAMETERS
  925.  *  void
  926.  * RETURNS
  927.  *  alignment
  928.  *****************************************************************************/
  929. U8 GetFmtTextAlignment(void)
  930. {
  931.     /*----------------------------------------------------------------*/
  932.     /* Local Variables                                                */
  933.     /*----------------------------------------------------------------*/
  934.     /*----------------------------------------------------------------*/
  935.     /* Code Body                                                      */
  936.     /*----------------------------------------------------------------*/
  937.     switch (EMS_inputbox_get_text_alignment())
  938.     {
  939.         case EMS_ALIGN_LANG_DEP:
  940.             return (U8) 0;
  941.         case EMS_ALIGN_LEFT:
  942.             return (U8) 1;
  943.         case EMS_ALIGN_CENTER:
  944.             return (U8) 2;
  945.         case EMS_ALIGN_RIGHT:
  946.             return (U8) 3;
  947.     }
  948.     return (U8) 0;
  949. }
  950. /*****************************************************************************
  951.  * FUNCTION
  952.  *  SetFmtTextAlignment
  953.  * DESCRIPTION
  954.  *  Set text format alignment
  955.  * PARAMETERS
  956.  *  void
  957.  * RETURNS
  958.  *  void
  959.  *****************************************************************************/
  960. void SetFmtTextAlignment(void)
  961. {
  962.     /*----------------------------------------------------------------*/
  963.     /* Local Variables                                                */
  964.     /*----------------------------------------------------------------*/
  965.     EMSTATUS emsObjectStatus;
  966.     /*----------------------------------------------------------------*/
  967.     /* Code Body                                                      */
  968.     /*----------------------------------------------------------------*/
  969.     switch (GetHighlightedItem())
  970.     {
  971.         case 0:
  972.             emsObjectStatus = EMS_inputbox_set_text_alignment(EMS_ALIGN_LANG_DEP);
  973.             break;
  974.         case 1:
  975.             emsObjectStatus = EMS_inputbox_set_text_alignment(EMS_ALIGN_LEFT);
  976.             break;
  977.         case 2:
  978.             emsObjectStatus = EMS_inputbox_set_text_alignment(EMS_ALIGN_CENTER);
  979.             break;
  980.         case 3:
  981.             emsObjectStatus = EMS_inputbox_set_text_alignment(EMS_ALIGN_RIGHT);
  982.             break;
  983.         default:
  984.             emsObjectStatus = EMS_inputbox_set_text_alignment(EMS_ALIGN_LANG_DEP);
  985.             break;
  986.     }
  987.     GoBackToHistory(SCR_ID_MSG_WRITE);
  988.     ErrorHandlingWhileInsertingObject(emsObjectStatus); /* check whetehr it is inserted or not. */
  989. }
  990. /*****************************************************************************
  991.  * FUNCTION
  992.  *  SetFmtTextNewParagraph
  993.  * DESCRIPTION
  994.  *  Set text format new paragraph
  995.  * PARAMETERS
  996.  *  void
  997.  * RETURNS
  998.  *  void
  999.  *****************************************************************************/
  1000. void SetFmtTextNewParagraph(void)
  1001. {
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Local Variables                                                */
  1004.     /*----------------------------------------------------------------*/
  1005.     EMSTATUS emsObjectStatus;
  1006.     /*----------------------------------------------------------------*/
  1007.     /* Code Body                                                      */
  1008.     /*----------------------------------------------------------------*/
  1009.     switch (GetHighlightedItem())
  1010.     {
  1011.         case 0:
  1012.             emsObjectStatus = EMS_inputbox_create_new_paragraph(EMS_ALIGN_LANG_DEP);
  1013.             break;
  1014.         case 1:
  1015.             emsObjectStatus = EMS_inputbox_create_new_paragraph(EMS_ALIGN_LEFT);
  1016.             break;
  1017.         case 2:
  1018.             emsObjectStatus = EMS_inputbox_create_new_paragraph(EMS_ALIGN_CENTER);
  1019.             break;
  1020.         case 3:
  1021.             emsObjectStatus = EMS_inputbox_create_new_paragraph(EMS_ALIGN_RIGHT);
  1022.             break;
  1023.         default:
  1024.             emsObjectStatus = EMS_inputbox_create_new_paragraph(EMS_ALIGN_LANG_DEP);
  1025.             break;
  1026.     }
  1027.     GoBackToHistory(SCR_ID_MSG_WRITE);
  1028.     ErrorHandlingWhileInsertingObject(emsObjectStatus); /* check whetehr it is inserted or not. */
  1029. }
  1030. /*****************************************************************************
  1031.  * FUNCTION
  1032.  *  EntryScrFmtTextSizeMenu
  1033.  * DESCRIPTION
  1034.  *  Entry text format size screen
  1035.  * PARAMETERS
  1036.  *  void
  1037.  * RETURNS
  1038.  *  void
  1039.  *****************************************************************************/
  1040. void EntryScrFmtTextSizeMenu(void)
  1041. {
  1042.     /*----------------------------------------------------------------*/
  1043.     /* Local Variables                                                */
  1044.     /*----------------------------------------------------------------*/
  1045.     U8 index = 0;
  1046.     U16 nNumofItem = 0;
  1047.     U16 nStrItemListIDs[MAX_SUB_MENUS] = {0, 0, 0};
  1048.     U8 *guiBuffer = NULL;
  1049.     U8 *nStrItemList[MAX_SUB_MENUS] = {NULL, NULL, NULL};
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Code Body                                                      */
  1052.     /*----------------------------------------------------------------*/
  1053.     EntryNewScreen(SCR_ID_MSG_TEXT_FORMAT_SIZE, mmi_msg_exit_generic, EntryScrFmtTextSizeMenu, NULL);
  1054.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_TEXT_FORMAT_SIZE);
  1055.     if (guiBuffer == NULL)
  1056.     {
  1057.         currObjectListHiliteIndex = GetFmtTextSize();
  1058.     }
  1059.     SetParentHandler(MENU_EMS_TEXT_SIZE_ID);
  1060.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1061.     nNumofItem = GetNumOfChild(MENU_EMS_TEXT_SIZE_ID);
  1062.     GetSequenceStringIds(MENU_EMS_TEXT_SIZE_ID, nStrItemListIDs);
  1063.     for (index = 0; index < nNumofItem; index++)
  1064.     {
  1065.         nStrItemList[index] = (PU8) GetString((U16) nStrItemListIDs[index]);
  1066.     }
  1067.     SetMessagesCurrScrnID(SCR_ID_MSG_TEXT_FORMAT_SIZE);
  1068.     ShowCategory109Screen(
  1069.         STR_EMS_TEXT_SIZE_ID,
  1070.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1071.         STR_GLOBAL_OK,
  1072.         IMG_GLOBAL_OK,
  1073.         STR_GLOBAL_BACK,
  1074.         IMG_GLOBAL_BACK,
  1075.         nNumofItem,
  1076.         nStrItemList,
  1077.         NULL,
  1078.         currObjectListHiliteIndex,
  1079.         guiBuffer);
  1080. }
  1081. /*****************************************************************************
  1082.  * FUNCTION
  1083.  *  EntryScrFmtTextStyleMenu
  1084.  * DESCRIPTION
  1085.  *  Entry text format style screen
  1086.  * PARAMETERS
  1087.  *  void
  1088.  * RETURNS
  1089.  *  void
  1090.  *****************************************************************************/
  1091. void EntryScrFmtTextStyleMenu(void)
  1092. {
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Local Variables                                                */
  1095.     /*----------------------------------------------------------------*/
  1096.     U8 index = 0;
  1097.     U16 nNumofItem = 0;
  1098.     U16 nStrItemListIDs[MAX_SUB_MENUS] = {0, 0, 0};
  1099.     U8 *guiBuffer = NULL;
  1100.     U8 *nStrItemList[MAX_SUB_MENUS] = {NULL, NULL, NULL, NULL};
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Code Body                                                      */
  1103.     /*----------------------------------------------------------------*/
  1104.     EntryNewScreen(SCR_ID_MSG_TEXT_FORMAT_STYLE, mmi_msg_exit_generic, EntryScrFmtTextStyleMenu, NULL);
  1105.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_TEXT_FORMAT_STYLE);
  1106.     if (guiBuffer == NULL)
  1107.     {
  1108.         currObjectListHiliteIndex = 0;
  1109.     #ifndef __MMI_TEXT_FORMAT_WITHOUT_BOLD__
  1110.         EMS_inputbox_get_text_style(
  1111.             &emsFmtTextStyleStates[0],
  1112.             &emsFmtTextStyleStates[1],
  1113.             &emsFmtTextStyleStates[2],
  1114.             &emsFmtTextStyleStates[3]);
  1115.     #else /* __MMI_TEXT_FORMAT_WITHOUT_BOLD__ */ 
  1116.         EMS_inputbox_get_text_style(
  1117.             &emsFmtTextStyleStates[3],
  1118.             &emsFmtTextStyleStates[0],
  1119.             &emsFmtTextStyleStates[1],
  1120.             &emsFmtTextStyleStates[2]);
  1121.     #endif /* __MMI_TEXT_FORMAT_WITHOUT_BOLD__ */ 
  1122.     }
  1123.     SetParentHandler(MENU_EMS_TEXT_STYLE_ID);
  1124.     nNumofItem = GetNumOfChild(MENU_EMS_TEXT_STYLE_ID);
  1125.     GetSequenceStringIds(MENU_EMS_TEXT_STYLE_ID, nStrItemListIDs);
  1126.     for (index = 0; index < nNumofItem; index++)
  1127.     {
  1128.         nStrItemList[index] = (PU8) GetString((U16) nStrItemListIDs[index]);
  1129.     }
  1130.     SetCheckboxToggleRightSoftkeyFunctions(SetFmtTextStyle, GoBackHistory);
  1131.     SetMessagesCurrScrnID(SCR_ID_MSG_TEXT_FORMAT_STYLE);
  1132.     ShowCategory140Screen(
  1133.         STR_EMS_TEXT_STYLE_ID,
  1134.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1135.         nNumofItem,
  1136.         nStrItemList,
  1137.         emsFmtTextStyleStates,
  1138.         currObjectListHiliteIndex,
  1139.         guiBuffer);
  1140.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1141. }
  1142. /*****************************************************************************
  1143.  * FUNCTION
  1144.  *  EntryScrFmtAlignmentMenu
  1145.  * DESCRIPTION
  1146.  *  Entry text format alignment screen
  1147.  * PARAMETERS
  1148.  *  void
  1149.  * RETURNS
  1150.  *  void
  1151.  *****************************************************************************/
  1152. void EntryScrFmtAlignmentMenu(void)
  1153. {
  1154.     /*----------------------------------------------------------------*/
  1155.     /* Local Variables                                                */
  1156.     /*----------------------------------------------------------------*/
  1157.     U8 index = 0;
  1158.     U16 nNumofItem = 0;
  1159.     U16 nStrItemListIDs[MAX_SUB_MENUS] = {0, 0, 0};
  1160.     U8 *guiBuffer = NULL;
  1161.     U8 *nStrItemList[MAX_SUB_MENUS] = {NULL, NULL, NULL};
  1162.     /*----------------------------------------------------------------*/
  1163.     /* Code Body                                                      */
  1164.     /*----------------------------------------------------------------*/
  1165.     EntryNewScreen(SCR_ID_MSG_TEXT_FORMAT_ALIGNMENT, mmi_msg_exit_generic, EntryScrFmtAlignmentMenu, NULL);
  1166.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_TEXT_FORMAT_ALIGNMENT);
  1167.     if (guiBuffer == NULL)
  1168.     {
  1169.         currObjectListHiliteIndex = GetFmtTextAlignment();
  1170.     }
  1171.     SetParentHandler(MENU_EMS_ALIGNMENT_ID);
  1172.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1173.     nNumofItem = GetNumOfChild(MENU_EMS_ALIGNMENT_ID);
  1174.     GetSequenceStringIds(MENU_EMS_ALIGNMENT_ID, nStrItemListIDs);
  1175.     for (index = 0; index < nNumofItem; index++)
  1176.     {
  1177.         nStrItemList[index] = (PU8) GetString((U16) nStrItemListIDs[index]);
  1178.     }
  1179.     SetMessagesCurrScrnID(SCR_ID_MSG_TEXT_FORMAT_ALIGNMENT);
  1180.     ShowCategory109Screen(
  1181.         STR_EMS_ALIGNMENT_ID,
  1182.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1183.         STR_GLOBAL_OK,
  1184.         IMG_GLOBAL_OK,
  1185.         STR_GLOBAL_BACK,
  1186.         IMG_GLOBAL_BACK,
  1187.         nNumofItem,
  1188.         nStrItemList,
  1189.         NULL,
  1190.         currObjectListHiliteIndex,
  1191.         guiBuffer);
  1192. }
  1193. /*****************************************************************************
  1194.  * FUNCTION
  1195.  *  EntryScrFmtNewParagraphMenu
  1196.  * DESCRIPTION
  1197.  *  Entry text format new paragraph screen
  1198.  * PARAMETERS
  1199.  *  void
  1200.  * RETURNS
  1201.  *  void
  1202.  *****************************************************************************/
  1203. void EntryScrFmtNewParagraphMenu(void)
  1204. {
  1205.     /*----------------------------------------------------------------*/
  1206.     /* Local Variables                                                */
  1207.     /*----------------------------------------------------------------*/
  1208.     U8 index = 0;
  1209.     U16 nNumofItem = 0;
  1210.     U16 nStrItemListIDs[MAX_SUB_MENUS] = {0, 0, 0};
  1211.     U8 *guiBuffer = NULL;
  1212.     U8 *nStrItemList[MAX_SUB_MENUS] = {NULL, NULL, NULL};
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Code Body                                                      */
  1215.     /*----------------------------------------------------------------*/
  1216.     EntryNewScreen(SCR_ID_MSG_TEXT_FORMAT_NEW_PARA, mmi_msg_exit_generic, EntryScrFmtNewParagraphMenu, NULL);
  1217.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_TEXT_FORMAT_NEW_PARA);
  1218.     if (guiBuffer == NULL)
  1219.     {
  1220.         currObjectListHiliteIndex = GetFmtTextAlignment();
  1221.     }
  1222.     SetParentHandler(MENU_EMS_NEW_PARAGRAPH_ID);
  1223.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1224.     nNumofItem = GetNumOfChild(MENU_EMS_NEW_PARAGRAPH_ID);
  1225.     GetSequenceStringIds(MENU_EMS_NEW_PARAGRAPH_ID, nStrItemListIDs);
  1226.     for (index = 0; index < nNumofItem; index++)
  1227.     {
  1228.         nStrItemList[index] = (PU8) GetString((U16) nStrItemListIDs[index]);
  1229.     }
  1230.     SetMessagesCurrScrnID(SCR_ID_MSG_TEXT_FORMAT_NEW_PARA);
  1231.     ShowCategory109Screen(
  1232.         STR_EMS_NEW_PARAGRAPH_ID,
  1233.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1234.         STR_GLOBAL_OK,
  1235.         IMG_GLOBAL_OK,
  1236.         STR_GLOBAL_BACK,
  1237.         IMG_GLOBAL_BACK,
  1238.         nNumofItem,
  1239.         nStrItemList,
  1240.         NULL,
  1241.         currObjectListHiliteIndex,
  1242.         guiBuffer);
  1243. }
  1244. /*****************************************************************************
  1245.  * FUNCTION
  1246.  *  EntryScrEmsFormatTextMenu
  1247.  * DESCRIPTION
  1248.  *  Entry text format screen
  1249.  * PARAMETERS
  1250.  *  void
  1251.  * RETURNS
  1252.  *  void
  1253.  *****************************************************************************/
  1254. void EntryScrEmsFormatTextMenu(void)
  1255. {
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Local Variables                                                */
  1258.     /*----------------------------------------------------------------*/
  1259.     U16 numItems = 0;
  1260.     PU8 guiBuffer = NULL;
  1261.     U16 nStrItemList[MAX_SUB_MENUS];
  1262.     /*----------------------------------------------------------------*/
  1263.     /* Code Body                                                      */
  1264.     /*----------------------------------------------------------------*/
  1265.     EntryNewScreen(SCR_ID_MSG_TEXT_FORMAT, mmi_msg_exit_generic, EntryScrEmsFormatTextMenu, NULL);
  1266.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_TEXT_FORMAT);
  1267.     SetParentHandler(MENU_EMS_FORMATING_TEXT_ID);
  1268.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1269.     numItems = GetNumOfChild(MENU_EMS_FORMATING_TEXT_ID);
  1270.     GetSequenceStringIds(MENU_EMS_FORMATING_TEXT_ID, nStrItemList);
  1271.     SetMessagesCurrScrnID(SCR_ID_MSG_TEXT_FORMAT);
  1272.     ShowCategory52Screen(
  1273.         STR_EMS_FORMATING_TEXT_ID,
  1274.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1275.         STR_GLOBAL_OK,
  1276.         IMG_GLOBAL_OK,
  1277.         STR_GLOBAL_BACK,
  1278.         IMG_GLOBAL_BACK,
  1279.         numItems,
  1280.         nStrItemList,
  1281.         (U16*) gIndexIconsImageList,
  1282.         NULL,
  1283.         0,
  1284.         0,
  1285.         guiBuffer);
  1286. }
  1287. /*****************************************************************************
  1288.  * FUNCTION
  1289.  *  HighlightEmsFormattingTextHandler
  1290.  * DESCRIPTION
  1291.  *  Highlight text format handler
  1292.  * PARAMETERS
  1293.  *  void
  1294.  * RETURNS
  1295.  *  void
  1296.  *****************************************************************************/
  1297. void HighlightEmsFormattingTextHandler(void)
  1298. {
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Local Variables                                                */
  1301.     /*----------------------------------------------------------------*/
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  1306.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_SMS_COMMON_NOIMAGE);
  1307.     SetLeftSoftkeyFunction(EntryScrEmsFormatTextMenu, KEY_EVENT_UP);
  1308.     SetKeyHandler(EntryScrEmsFormatTextMenu, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1309.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1310.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1311. }
  1312. /* /////////////////////////////////////////////////////////////////////////////////// */
  1313. /*****************************************************************************
  1314.  * FUNCTION
  1315.  *  InitUserDefinedObjectDataPtrs
  1316.  * DESCRIPTION
  1317.  *  Init user defined object data pointers
  1318.  * PARAMETERS
  1319.  *  void
  1320.  * RETURNS
  1321.  *  void
  1322.  *****************************************************************************/
  1323. void InitUserDefinedObjectDataPtrs(void)
  1324. {
  1325.     /*----------------------------------------------------------------*/
  1326.     /* Local Variables                                                */
  1327.     /*----------------------------------------------------------------*/
  1328.     U8 index = 0;
  1329.     /*----------------------------------------------------------------*/
  1330.     /* Code Body                                                      */
  1331.     /*----------------------------------------------------------------*/
  1332.     for (index = 0; index < MAX_EMS_OBJECT_LIST_DISPLAY; index++)
  1333.     {
  1334.         userDefinedObjectDataPtrs[index] = NULL;
  1335.     }
  1336. }
  1337. /*****************************************************************************
  1338.  * FUNCTION
  1339.  *  MemsetUserDefinedObjectDataBuff
  1340.  * DESCRIPTION
  1341.  *  Reset user defined object data buffer
  1342.  * PARAMETERS
  1343.  *  void
  1344.  * RETURNS
  1345.  *  void
  1346.  *****************************************************************************/
  1347. void MemsetUserDefinedObjectDataBuff(void)
  1348. {
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352.     /*----------------------------------------------------------------*/
  1353.     /* Code Body                                                      */
  1354.     /*----------------------------------------------------------------*/
  1355.     memset(&userDefinedObjectDataBuff, 0, MAX_CURR_EMS_OBJECT_DATA_BUFF);
  1356. }
  1357. /*****************************************************************************
  1358.  * FUNCTION
  1359.  *  FreeUserEmsObjectNameInputBuff
  1360.  * DESCRIPTION
  1361.  *  Reset user defined object name input buffer
  1362.  * PARAMETERS
  1363.  *  void
  1364.  * RETURNS
  1365.  *  void
  1366.  *****************************************************************************/
  1367. void FreeUserEmsObjectNameInputBuff(void)
  1368. {
  1369.     /*----------------------------------------------------------------*/
  1370.     /* Local Variables                                                */
  1371.     /*----------------------------------------------------------------*/
  1372.     /*----------------------------------------------------------------*/
  1373.     /* Code Body                                                      */
  1374.     /*----------------------------------------------------------------*/
  1375.     memset(&userEmsObjectNameInput, 0, (MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN * ENCODING_LENGTH) + ENCODING_LENGTH);
  1376. }
  1377. /*****************************************************************************
  1378.  * FUNCTION
  1379.  *  MessagesGetString
  1380.  * DESCRIPTION
  1381.  *  Get string in UCS2 format
  1382.  * PARAMETERS
  1383.  *  pathStr     [?]     
  1384.  * RETURNS
  1385.  *  void
  1386.  *****************************************************************************/
  1387. static S8 *MessagesGetString(S8 *pathStr)
  1388. {
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Local Variables                                                */
  1391.     /*----------------------------------------------------------------*/
  1392.     static S8 emsObjectFileNameStaticBuf[(MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN + 1) * ENCODING_LENGTH] = {0, 0};
  1393.     /*----------------------------------------------------------------*/
  1394.     /* Code Body                                                      */
  1395.     /*----------------------------------------------------------------*/
  1396.     memset(emsObjectFileNameStaticBuf, 0, (MAX_EMS_DOWNLOAD_OBJECT_NAME_LEN + 1) * ENCODING_LENGTH);
  1397.     AnsiiToUnicodeString(emsObjectFileNameStaticBuf, pathStr);
  1398.     return emsObjectFileNameStaticBuf;
  1399. }
  1400. /*****************************************************************************
  1401.  * FUNCTION
  1402.  *  GetEmsObjectDataSize
  1403.  * DESCRIPTION
  1404.  *  Get object data size
  1405.  * PARAMETERS
  1406.  *  void
  1407.  * RETURNS
  1408.  *  object data size
  1409.  *****************************************************************************/
  1410. S32 GetEmsObjectDataSize(void)
  1411. {
  1412.     /*----------------------------------------------------------------*/
  1413.     /* Local Variables                                                */
  1414.     /*----------------------------------------------------------------*/
  1415.     /*----------------------------------------------------------------*/
  1416.     /* Code Body                                                      */
  1417.     /*----------------------------------------------------------------*/
  1418.     IsAllowed = FALSE;
  1419.     switch (currEmsObjectDisplayListState)
  1420.     {
  1421.         case EMS_OBJECT_PICTURE_STATE:
  1422.             return EMS_check_predefined_picture_data_size(userDefinedObjectDataBuff, &IsAllowed);
  1423.         case EMS_OBJECT_MY_PICTURE_STATE:
  1424.             return EMS_check_userdefined_picture_size(userDefinedObjectDataBuff, &IsAllowed);
  1425.         case EMS_OBJECT_MY_ANIMATION_STATE:
  1426.             return EMS_check_userdefined_animation_size(userDefinedObjectDataBuff, &IsAllowed);
  1427.     #if defined(__MMI_IMELODY_SUPPORT__)
  1428.         case EMS_OBJECT_MELODY_STATE:
  1429.             return EMS_check_predefined_melody_data_size(userDefinedObjectDataBuff, &IsAllowed);
  1430.         case EMS_OBJECT_MY_MELODY_STATE:
  1431.         case EMS_OBJECT_MY_MELODY_DOWNLOAD_APP_STATE:
  1432.             return EMS_check_userdefined_melody_size(userDefinedObjectDataBuff, &IsAllowed);
  1433.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1434.         case EMS_OBJECT_MY_PICTURE_A_ANIMATION_DOWNLOAD_APP_STATE:
  1435.             if (currObjectListHiliteIndex < currMaxEmsPictureObjects)
  1436.             {
  1437.                 return EMS_check_userdefined_picture_size(userDefinedObjectDataBuff, &IsAllowed);
  1438.             }
  1439.             else
  1440.             {
  1441.                 return EMS_check_userdefined_animation_size(userDefinedObjectDataBuff, &IsAllowed);
  1442.             }
  1443.         default:
  1444.             return 0;
  1445.     }
  1446. }
  1447. /*****************************************************************************
  1448.  * FUNCTION
  1449.  *  ErrorHandlingWhileSavingObject
  1450.  * DESCRIPTION
  1451.  *  This function is just for template.
  1452.  * PARAMETERS
  1453.  *  emsObjectStatus     [IN]        
  1454.  * RETURNS
  1455.  *  void
  1456.  *****************************************************************************/
  1457. void ErrorHandlingWhileSavingObject(EMSTATUS emsObjectStatus)
  1458. {
  1459.     /*----------------------------------------------------------------*/
  1460.     /* Local Variables                                                */
  1461.     /*----------------------------------------------------------------*/
  1462.     /*----------------------------------------------------------------*/
  1463.     /* Code Body                                                      */
  1464.     /*----------------------------------------------------------------*/
  1465.     switch (emsObjectStatus)
  1466.     {
  1467.         case EMS_OK:
  1468.             DisplayPopup(
  1469.                 (PU8) GetString(STR_GLOBAL_SAVED),
  1470.                 IMG_GLOBAL_ACTIVATED,
  1471.                 1,
  1472.                 MESSAGES_POPUP_TIME_OUT,
  1473.                 (U8) SAVE_TONE);
  1474.             break;
  1475.         case EMS_ALREADY_INITIALIZED:
  1476.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1477.             DisplayPopup(
  1478.                 (PU8) GetString(FMGR_FS_FILE_EXISTS_TEXT),
  1479.                 IMG_GLOBAL_UNFINISHED,
  1480.                 1,
  1481.                 MESSAGES_POPUP_TIME_OUT,
  1482.                 (U8) ERROR_TONE);
  1483.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1484.             DisplayPopup(
  1485.                 (PU8) GetString(STR_EMS_OBJECT_DUPLICATED_NAME_INPUT_AGAIN),
  1486.                 IMG_GLOBAL_UNFINISHED,
  1487.                 1,
  1488.                 MESSAGES_POPUP_TIME_OUT,
  1489.                 (U8) ERROR_TONE);
  1490.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1491.             break;
  1492.         case EMS_NO_SPACE:
  1493.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1494.             DisplayPopup(
  1495.                 (PU8) GetString(FMGR_FS_DISK_FULL_TEXT),
  1496.                 IMG_GLOBAL_UNFINISHED,
  1497.                 1,
  1498.                 MESSAGES_POPUP_TIME_OUT,
  1499.                 (U8) ERROR_TONE);
  1500.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1501.             DisplayPopup(
  1502.                 (PU8) GetString(STR_EMS_OBJECT_STAORAGE_FULL),
  1503.                 IMG_GLOBAL_UNFINISHED,
  1504.                 1,
  1505.                 MESSAGES_POPUP_TIME_OUT,
  1506.                 (U8) ERROR_TONE);
  1507.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1508.             break;
  1509.         case EMS_INVALID_FILE_NAME:
  1510.             DisplayPopup(
  1511.                 (PU8) GetString(GetFileSystemErrorString(FS_INVALID_FILENAME)),
  1512.                 IMG_GLOBAL_UNFINISHED,
  1513.                 1,
  1514.                 MESSAGES_POPUP_TIME_OUT,
  1515.                 (U8) ERROR_TONE);
  1516.             break;
  1517.         default /* EMS_UNSPECIFIED_ERROR */ :
  1518.             DisplayPopup(
  1519.                 (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1520.                 IMG_GLOBAL_UNFINISHED,
  1521.                 1,
  1522.                 MESSAGES_POPUP_TIME_OUT,
  1523.                 (U8) ERROR_TONE);
  1524.             break;
  1525.     }
  1526. }
  1527. /*****************************************************************************
  1528.  * FUNCTION
  1529.  *  WriteDownloadObjectDataIntoFileSystem
  1530.  * DESCRIPTION
  1531.  *  Write object data into file system
  1532.  * PARAMETERS
  1533.  *  void
  1534.  * RETURNS
  1535.  *  write result
  1536.  *****************************************************************************/
  1537. EMSTATUS WriteDownloadObjectDataIntoFileSystem(void)
  1538. {
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Local Variables                                                */
  1541.     /*----------------------------------------------------------------*/
  1542.     S32 wByte = 0;
  1543.     S32 gOpenError = 0;
  1544.     S32 gWriteResult = 0;
  1545.     FILE_HANDLE emsObjectFilePtr = 0;
  1546.     S8 emsObjectFileNameBuf[(MAX_EMS_DOWNLOAD_OBJECT_FILE_LEN + 1) * ENCODING_LENGTH] = {0, 0};
  1547. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1548.     U16 driveName;
  1549.     S8 temp[4];
  1550.     UI_character_type dir_ems_root[4];
  1551.     /*----------------------------------------------------------------*/
  1552.     /* Code Body                                                      */
  1553.     /*----------------------------------------------------------------*/
  1554.     driveName = MMI_PUBLIC_DRV;
  1555.     sprintf(temp, "%c:\", (S8) driveName);
  1556.     AnsiiToUnicodeString((S8*) dir_ems_root, temp);
  1557. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1558.     switch (currEmsObjectDisplayListState)
  1559.     {
  1560.         case EMS_OBJECT_MY_PICTURE_STATE:   /* All Download Objects Only... */
  1561.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1562.             pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  1563.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
  1564.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1565.             pfnUnicodeStrcpy(
  1566.                 (S8*) emsObjectFileNameBuf,
  1567.                 (S8*) MessagesGetString((S8*) STR_EMS_PIC_A_ANIM_OBJECT_FILE_NAME_INIT_PATH_ID));
  1568.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1569.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) userEmsObjectNameInput);
  1570.             pfnUnicodeStrcat(
  1571.                 (S8*) emsObjectFileNameBuf,
  1572.                 (S8*) MessagesGetString((S8*) STR_EMS_PICTURE_OBJECT_FILE_NAME_EXTN_ID));
  1573.             break;
  1574.         case EMS_OBJECT_MY_ANIMATION_STATE:
  1575.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1576.             pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  1577.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_IMAGES);
  1578.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1579.             pfnUnicodeStrcpy(
  1580.                 (S8*) emsObjectFileNameBuf,
  1581.                 (S8*) MessagesGetString((S8*) STR_EMS_PIC_A_ANIM_OBJECT_FILE_NAME_INIT_PATH_ID));
  1582.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1583.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) userEmsObjectNameInput);
  1584.             pfnUnicodeStrcat(
  1585.                 (S8*) emsObjectFileNameBuf,
  1586.                 (S8*) MessagesGetString((S8*) STR_EMS_ANIMATION_OBJECT_FILE_NAME_EXTN_ID));
  1587.             break;
  1588.     #if defined(__MMI_IMELODY_SUPPORT__)
  1589.         case EMS_OBJECT_MY_MELODY_STATE:
  1590.     #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1591.             pfnUnicodeStrcpy((S8*) emsObjectFileNameBuf, (S8*) dir_ems_root);
  1592.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) FMGR_DEFAULT_FOLDER_AUDIO);
  1593.     #else /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1594.             pfnUnicodeStrcpy(
  1595.                 (S8*) emsObjectFileNameBuf,
  1596.                 (S8*) MessagesGetString((S8*) STR_EMS_IMELODY_OBJECT_FILE_NAME_INIT_PATH_ID));
  1597.     #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1598.             pfnUnicodeStrcat((S8*) emsObjectFileNameBuf, (S8*) userEmsObjectNameInput);
  1599.             pfnUnicodeStrcat(
  1600.                 (S8*) emsObjectFileNameBuf,
  1601.                 (S8*) MessagesGetString((S8*) STR_EMS_IMELODY_OBJECT_FILE_NAME_EXTN_ID));
  1602.             break;
  1603.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1604.     }
  1605.     /* duplicated filename */
  1606.     emsObjectFilePtr = pfopen(emsObjectFileNameBuf, PFS_READ);
  1607.     if (emsObjectFilePtr > 0)
  1608.     {
  1609.         pfclose(emsObjectFilePtr);
  1610.         return EMS_ALREADY_INITIALIZED;
  1611.     }
  1612.     emsObjectFilePtr = pfopen(emsObjectFileNameBuf, PFS_WRITE);
  1613.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] fopen result = %d -------*", emsObjectFilePtr));
  1614.     gOpenError = pfOpenError(emsObjectFilePtr);
  1615.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] fopen error = %d -------*", gOpenError));
  1616.     if (!gOpenError)
  1617.     {
  1618.         gWriteResult = pfwrite(userDefinedObjectDataBuff, 1, userDefinedObjectDataSize, emsObjectFilePtr, &wByte);
  1619.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] fwrite result = %d -------*", gWriteResult));
  1620.         /* if(userDefinedObjectDataSize==wByte) success ele failure; */
  1621.         pfclose(emsObjectFilePtr);
  1622.         if (gWriteResult < 0)
  1623.         {
  1624.             pfdelete(emsObjectFileNameBuf);
  1625.             return EMS_NO_SPACE;
  1626.         }
  1627.         else
  1628.         {
  1629.             return EMS_OK;
  1630.         }
  1631.     }
  1632.     if (emsObjectFilePtr == FS_INVALID_FILENAME)
  1633.     {
  1634.         return EMS_INVALID_FILE_NAME;
  1635.     }
  1636.     else
  1637.     {
  1638.         return EMS_UNSPECIFIED_ERROR;
  1639.     }    
  1640. }
  1641. /*****************************************************************************
  1642.  * FUNCTION
  1643.  *  ReadDownloadObjectDataFromFileSystem
  1644.  * DESCRIPTION
  1645.  *  Read object data from file system
  1646.  * PARAMETERS
  1647.  *  index       [IN]        
  1648.  * RETURNS
  1649.  *  read result
  1650.  *****************************************************************************/
  1651. U8 ReadDownloadObjectDataFromFileSystem(S32 index)
  1652. {
  1653.     /*----------------------------------------------------------------*/
  1654.     /* Local Variables                                                */
  1655.     /*----------------------------------------------------------------*/
  1656.     /*----------------------------------------------------------------*/
  1657.     /* Code Body                                                      */
  1658.     /*----------------------------------------------------------------*/
  1659.     switch (currEmsObjectDisplayListState)
  1660.     {
  1661.         case EMS_OBJECT_PICTURE_STATE:
  1662.         {
  1663.             U8 *imagedata;
  1664.             U16 imageindex = IMG_EMS01_PIC + (U16) index;
  1665.             U16 imagedatasize;
  1666.             MemsetUserDefinedObjectDataBuff();
  1667.             imagedata = (U8*) GetImage(imageindex);
  1668.             imagedatasize = 9 + (*(imagedata + 7)) | (*(imagedata + 8)) << 8;
  1669.             memcpy(userDefinedObjectDataBuff, imagedata, imagedatasize);
  1670.             emsObjectNameWhenPreview = (U8*) GetString(ManufacturerPictureStrIDs[index]);
  1671.             return TRUE;
  1672.         }
  1673.     #ifdef __MMI_IMELODY_SUPPORT__
  1674.         case EMS_OBJECT_MELODY_STATE:
  1675.         {
  1676.             U8 userDefinedObjectDataBuffTemp[MAX_CURR_EMS_OBJECT_DATA_BUFF];
  1677.             MemsetUserDefinedObjectDataBuff();
  1678.             memcpy(userDefinedObjectDataBuff, resource_ems_imelodys[index].data, resource_ems_imelodys[index].len);
  1679.             userDefinedObjectDataSize = resource_ems_imelodys[index].len;
  1680.             EMS_predefined_melody_attach_header(
  1681.                 userDefinedObjectDataBuff,
  1682.                 userDefinedObjectDataBuffTemp,
  1683.                 &userDefinedObjectDataSize);
  1684.             memcpy(userDefinedObjectDataBuff, userDefinedObjectDataBuffTemp, userDefinedObjectDataSize);
  1685.             return TRUE;
  1686.         }
  1687.     #endif /* __MMI_IMELODY_SUPPORT__ */ 
  1688.     }
  1689.     return FALSE;
  1690. }
  1691. /*****************************************************************************
  1692.  * FUNCTION
  1693.  *  SetCurrEmsObjectDisplayListState
  1694.  * DESCRIPTION
  1695.  *  Set object state
  1696.  * PARAMETERS
  1697.  *  userDefinedObjectDataType       [IN]        Object data type
  1698.  * RETURNS
  1699.  *  void
  1700.  *****************************************************************************/
  1701. void SetCurrEmsObjectDisplayListState(U8 userDefinedObjectDataType)
  1702. {
  1703.     /*----------------------------------------------------------------*/
  1704.     /* Local Variables                                                */
  1705.     /*----------------------------------------------------------------*/
  1706.     /*----------------------------------------------------------------*/
  1707.     /* Code Body                                                      */
  1708.     /*----------------------------------------------------------------*/
  1709.     switch (userDefinedObjectDataType)
  1710.     {
  1711.         case EMS_USERDEFINED_PICTURE:
  1712.             currEmsObjectDisplayListState = EMS_OBJECT_MY_PICTURE_STATE;
  1713.             break;
  1714.         case EMS_USERDEFINED_ANIMATION:
  1715.             currEmsObjectDisplayListState = EMS_OBJECT_MY_ANIMATION_STATE;
  1716.             break;
  1717.             /* MTK Joy added for customization, 1014 */
  1718.     #if defined(__MMI_IMELODY_SUPPORT__)
  1719.         case EMS_USERDEFINED_MELODY:
  1720.             currEmsObjectDisplayListState = EMS_OBJECT_MY_MELODY_STATE;
  1721.             break;
  1722.     #endif /* defined(__MMI_IMELODY_SUPPORT__) */ 
  1723.             /* MTK end */
  1724.     }
  1725. }
  1726. /*****************************************************************************
  1727.  * FUNCTION
  1728.  *  CallBackLoadUserDefinedObjectDataBuffPtr
  1729.  * DESCRIPTION
  1730.  *  Call back to get user defined object data
  1731.  * PARAMETERS
  1732.  *  index       [IN]        Object index
  1733.  * RETURNS
  1734.  *  data buffer pointer
  1735.  *****************************************************************************/
  1736. U8 *CallBackLoadUserDefinedObjectDataBuffPtr(S32 index)
  1737. {
  1738.     /*----------------------------------------------------------------*/
  1739.     /* Local Variables                                                */
  1740.     /*----------------------------------------------------------------*/
  1741.     /*----------------------------------------------------------------*/
  1742.     /* Code Body                                                      */
  1743.     /*----------------------------------------------------------------*/
  1744.     if (ReadDownloadObjectDataFromFileSystem(index))
  1745.     {
  1746.         userDefinedObjectDataSize = GetEmsObjectDataSize();
  1747.     #if !defined UI_SMALL_IMAGE_SELECTOR_SCREEN
  1748.         if (!whether_no_small_screen())
  1749.         {
  1750.             ChangeTitleString(emsObjectNameWhenPreview);
  1751.             draw_title();
  1752.         }
  1753.     #endif /* !defined UI_SMALL_IMAGE_SELECTOR_SCREEN */ 
  1754.         return userDefinedObjectDataBuff;
  1755.     }
  1756.     else
  1757.     {
  1758.         return NULL;
  1759.     }
  1760. }
  1761. /*****************************************************************************
  1762.  * FUNCTION
  1763.  *  GetEmsObjectDataInsertStatus
  1764.  * DESCRIPTION
  1765.  *  Get object insert status
  1766.  * PARAMETERS
  1767.  *  index       [IN]        Object index
  1768.  * RETURNS
  1769.  *  insert status
  1770.  *****************************************************************************/
  1771. U16 GetEmsObjectDataInsertStatus(S32 index)
  1772. {
  1773.     /*----------------------------------------------------------------*/
  1774.     /* Local Variables                                                */
  1775.     /*----------------------------------------------------------------*/
  1776.     /*----------------------------------------------------------------*/
  1777.     /* Code Body                                                      */
  1778.     /*----------------------------------------------------------------*/
  1779.     if (ReadDownloadObjectDataFromFileSystem(index))
  1780.     {
  1781.         userDefinedObjectDataSize = GetEmsObjectDataSize();
  1782.         listOfIsAllowedData[index] = IsAllowed;
  1783.     }
  1784.     else
  1785.     {
  1786.         IsAllowed = 0;
  1787.         listOfIsAllowedData[index] = IsAllowed;
  1788.     }
  1789.     if (IsAllowed)
  1790.     {
  1791.         return EMS_CAN_INSERT_OBJECT_ID;
  1792.     }
  1793.     else
  1794.     {
  1795.         return EMS_CANNOT_INSERT_OBJECT_ID;
  1796.     }
  1797. }
  1798. /*****************************************************************************
  1799.  * FUNCTION
  1800.  *  GetEmsObjectDataSizeHint
  1801.  * DESCRIPTION
  1802.  *  Get object data size hint
  1803.  * PARAMETERS
  1804.  *  index       [IN]        Object index
  1805.  * RETURNS
  1806.  *  hint data pointer
  1807.  *****************************************************************************/
  1808. U8 *GetEmsObjectDataSizeHint(U8 index)
  1809. {
  1810.     /*----------------------------------------------------------------*/
  1811.     /* Local Variables                                                */
  1812.     /*----------------------------------------------------------------*/
  1813.     /*----------------------------------------------------------------*/
  1814.     /* Code Body                                                      */
  1815.     /*----------------------------------------------------------------*/
  1816.     if (!IsAllowed)
  1817.     {
  1818.         U8 emsObjectDataSizeHintBuff[10] = { '', '' };
  1819.         memset(hintData[index], 0, MAX_SUB_MENU_HINT_SIZE);
  1820.         AnsiiToUnicodeString((S8*) hintData[index], (S8*) emsObjectDataSizeHintBuff);
  1821.         return hintData[index];
  1822.     }
  1823.     return NULL;
  1824. }
  1825. /*****************************************************************************
  1826.  * FUNCTION
  1827.  *  GetEmsObjectDisplayListDetails
  1828.  * DESCRIPTION
  1829.  *  Get object display list
  1830.  * PARAMETERS
  1831.  *  lskStrID            [IN/OUT]        LSK string ID
  1832.  *  strItemListPtr      [IN/OUT]        String list pointer
  1833.  *  imgItemListPtr      [IN/OUT]        Image list pointer
  1834.  *  popUpList           [IN/OUT]        Popup list pointer
  1835.  * RETURNS
  1836.  *  void
  1837.  *****************************************************************************/
  1838. void GetEmsObjectDisplayListDetails(U16 *lskStrID, U8 **strItemListPtr, U16 *imgItemListPtr, U8 **popUpList)
  1839. {
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Local Variables                                                */
  1842.     /*----------------------------------------------------------------*/
  1843.     U8 index = 0;
  1844. #if defined(__MMI_IMELODY_SUPPORT__)