MyPicture.c
上传用户:helaifa584
上传日期:2022-06-15
资源大小:29k
文件大小:32k
源码类别:

MTK

开发平台:

Objective-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.  * MyPicture.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * PDG-1
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements procedures to save and retreive ringtones.
  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.  *------------------------------------------------------------------------------
  116.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  117.  *============================================================================
  118.  ****************************************************************************/
  119.  /**
  120.  * Copyright Notice
  121.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  122.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  123.  *  (It is illegal to remove this copyright notice from this software or any
  124.  *  portion of it)
  125.  */
  126. /**************************************************************
  127.    FILENAME : MyPicture.c
  128.    PURPOSE     : Main function to save and retreive pictures
  129.    REMARKS     : nil
  130.    AUTHOR      : JaiPrakash S.
  131.    DATE     : Oct-11-2004
  132. **************************************************************/
  133. #include "MMI_include.h"
  134. #ifdef __MOD_SMSAL__
  135. /*  Include: MMI header file */
  136. /* ... Add More MMI header */
  137. #include "CommonScreens.h"
  138. /* ...Add MSG header */
  139. #include "customer_ps_inc.h"
  140. #include "MessagesL4Def.h"
  141. #include "MessagesResourceData.h"
  142. #include "MessagesMiscell.h"
  143. #include "MessagesExDcl.h"
  144. #include "SmsGuiInterfaceProt.h"
  145. #include "SmsGuiInterfaceType.h"
  146. #include "SmsPsHandler.h"
  147. #include "mmi_msg_context.h"
  148. #include "CellBroadcastType.h"
  149. #ifdef __MMI_MESSAGES_CHAT__
  150. #include "ChatAppGprot.h"
  151. #include "ChatAppResDef.h"
  152. #include "ChatGtype.h"
  153. #include "ChatAppGexdcl.h"
  154. #endif /* __MMI_MESSAGES_CHAT__ */ 
  155. #include "wgui_ems.h"
  156. #include "GSM7BitDefaultAlphabet.h"
  157. #include "ProtocolEvents.h"
  158. #include "SettingDefs.h"
  159. #include "SettingsGdcl.h"
  160. /*  */
  161. #include "smsal_l4c_enum.h"
  162. /*  */
  163. /*  */
  164. #include "CSP.h"
  165. #include "MainMenuDef.h"
  166. #include "CallHistoryGProts.h"
  167. #include "CallManagementGprot.h"
  168. #include "CallhistoryEnum.h"
  169. #include "MiscFunctions.h"
  170. #include "SettingProfile.h"
  171. #include "ProfileGprots.h"
  172. #include "PhoneBookGprot.h"
  173. #include "IdleAppProt.h"
  174. #include "AlarmFrameworkProt.h"
  175. #include "CallsDefs.h"
  176. #include "wgui_status_icons.h"
  177. #include "gpioInc.h"
  178. #include "mdi_datatype.h"
  179. #include "mdi_audio.h"
  180. #include "PicMsgApiToOthers.h"
  181. #include "MyPicture.h"
  182. #include "MyTone.h"
  183. #ifdef __MMI_EMAIL__
  184. #include "EmailAppGProt.h"
  185. #endif 
  186. #include "FileMgr.h"
  187. #include "FileManagerDef.h"
  188. #ifdef __MMI_DUAL_SIM_MASTER__
  189. #include "MTPNP_PFAL_CC.h"
  190. #endif /* __MMI_DUAL_SIM_MASTER__ */
  191. #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
  192. extern S32 mmi_nsm_send_pic_msg(U8 *bmpDataPtr, U8 *PicTextPtr);
  193. extern U32 mmi_smrt_midi_file_size(U8 *midifile);
  194. S8 PictureMessageDir[NSM_FILE_NAME_BUFF];
  195. U8 gNSMBuffer[1024];    /* Global buffer for NSM picture and ringtone message */
  196. U8 gaddtext_buffer[MAX_PICMSG_DEFAULT_DCS_TEXT_LEN];
  197. #endif /* defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */ 
  198. #if defined(__MMI_MYPICTURE__)
  199. U8 gaddtext_buffer[320];
  200. U8 gfilecount = 0;
  201. void display_nsm_mypicture_list(void);
  202. extern U16 gSelected_Item;
  203. extern U8 gfilecount;
  204. extern PendingSaveSendDataStruct PendingSaveSendData;
  205. /*****************************************************************************
  206.  * FUNCTION
  207.  *  highlight_mypic_handler
  208.  * DESCRIPTION
  209.  *  Highlight handler for My Picture
  210.  * PARAMETERS
  211.  *  void
  212.  * RETURNS
  213.  *  void
  214.  *****************************************************************************/
  215. void highlight_mypic_handler(void)
  216. {
  217.     
  218. #if defined(__MMI_FILE_MANAGER__)
  219.     SetLeftSoftkeyFunction(mmi_mypic_pre_entry_mypic_list, KEY_EVENT_UP);
  220.     SetKeyHandler(mmi_mypic_pre_entry_mypic_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  221.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  222.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  223. #endif /* defined(__MMI_FILE_MANAGER__) */ 
  224. }
  225. /*****************************************************************************
  226.  * FUNCTION
  227.  *  mmi_mypic_pre_entry_mypic_list
  228.  * DESCRIPTION
  229.  *  Pre Entry function to display list of pictures in My Picture
  230.  * CALLS
  231.  *  mmi_nsm_get_list        To get picture list in My Picture
  232.  *  mmi_mypic_entry_mypic_list To display picture list
  233.  * PARAMETERS
  234.  *  void
  235.  * RETURNS
  236.  *  void
  237.  *****************************************************************************/
  238. void mmi_mypic_pre_entry_mypic_list(void)
  239. {
  240. #if defined(__MMI_FILE_MANAGER__)
  241.     /*----------------------------------------------------------------*/
  242.     /* Local Variables                                                */
  243.     /*----------------------------------------------------------------*/
  244.     S8 DirPath[64];
  245.     /*----------------------------------------------------------------*/
  246.     /* Code Body                                                      */
  247.     /*----------------------------------------------------------------*/
  248.     memset(gNSMBuffer, '', 1024);
  249.     memset(gaddtext_buffer, '', 320);
  250.     memset(DirPath, '', sizeof(DirPath));
  251.     display_nsm_mypicture_list();
  252. #endif /* defined(__MMI_FILE_MANAGER__) */ 
  253. }
  254. /*****************************************************************************
  255.  * FUNCTION
  256.  *  display_nsm_mypicture_list
  257.  * DESCRIPTION
  258.  *  
  259.  * PARAMETERS
  260.  *  void
  261.  * RETURNS
  262.  *  void
  263.  *****************************************************************************/
  264. void display_nsm_mypicture_list(void)
  265. {
  266.     /*----------------------------------------------------------------*/
  267.     /* Local Variables                                                */
  268.     /*----------------------------------------------------------------*/
  269.     S8 DirPath[64];
  270.     FMGR_FILTER filter;
  271.     /*----------------------------------------------------------------*/
  272.     /* Code Body                                                      */
  273.     /*----------------------------------------------------------------*/
  274.     memset(PictureMessageDir, 0x00, NSM_FILE_NAME_BUFF);
  275.     /* Get directory path for My Picture */
  276.     sprintf(DirPath, "%c:\%s", MMI_PUBLIC_DRV, (S8*) "Images\");
  277.     FMGR_FILTER_INIT(&filter);
  278.     FMGR_FILTER_SET(&filter, FMGR_TYPE_BMP);
  279.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  280.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  281.     /* mmi_ucs2cat((S8*)DirPath, ( S8*)FMGR_DEFAULT_FOLDER_IMAGES); */
  282.     mmi_asc_to_ucs2((S8*) PictureMessageDir, (S8*) DirPath);     // DirPath/*.*
  283.     mmi_fmgr_select_path_and_enter(
  284.         APP_MESSAGES,
  285.         FMGR_SELECT_FILE | FMGR_FLAG_CHECK_SENDABLE,
  286.         filter,
  287.         (PS8) PictureMessageDir,
  288.         (PsExtFuncPtr) mmi_mypic_pre_entry_display_pic);
  289. }
  290. /*****************************************************************************
  291.  * FUNCTION
  292.  *  mmi_mypic_pre_entry_display_pic
  293.  * DESCRIPTION
  294.  *  Entry function to display selected pictures in My Picture
  295.  * CALLS
  296.  *  mmi_get_file_data    To get file data in global buffer gNSMBuffer
  297.  * PARAMETERS
  298.  *  filePath        [IN]        
  299.  *  is_short        [IN]        
  300.  * RETURNS
  301.  *  void
  302.  *****************************************************************************/
  303. void mmi_mypic_pre_entry_display_pic(PU16 filePath, int is_short)
  304. {
  305.     /*----------------------------------------------------------------*/
  306.     /* Local Variables                                                */
  307.     /*----------------------------------------------------------------*/
  308.     FS_HANDLE file_handle = 0;
  309.     INT wByte = 0;
  310.     S16 Result = 0;
  311.     /*----------------------------------------------------------------*/
  312.     /* Code Body                                                      */
  313.     /*----------------------------------------------------------------*/
  314.     if (filePath == NULL)
  315.     {
  316.         GoBackHistory();
  317.         return;
  318.     }
  319.     file_handle = FS_Open(filePath, FS_READ_ONLY);
  320.     if (file_handle >= 0)
  321.     {
  322.         FS_Read( file_handle, (void*)gNSMBuffer, 1024, &wByte);
  323.         FS_Close(file_handle);
  324.     }
  325.     Result = mmi_pmsg_add_bmp_header_info(gNSMBuffer);
  326.     if (Result != 0)
  327.     {
  328.         DisplayPopup(
  329.             (U8*) GetString(STR_ID_NSM_RINGTOEN_FORMAT_NOT_SUPPORTED_MSG),
  330.             IMG_GLOBAL_WARNING,
  331.             1,
  332.             MESSAGES_POPUP_TIME_OUT,
  333.             (U8) ERROR_TONE);
  334.         return;
  335.     }
  336.     mmi_mypic_entry_display_pic();
  337. }
  338. /*****************************************************************************
  339.  * FUNCTION
  340.  *  mmi_mypic_entry_display_pic
  341.  * DESCRIPTION
  342.  *  Display a picture message
  343.  * PARAMETERS
  344.  *  void
  345.  * RETURNS
  346.  *  void
  347.  *****************************************************************************/
  348. void mmi_mypic_entry_display_pic(void)
  349. {
  350.     /*----------------------------------------------------------------*/
  351.     /* Local Variables                                                */
  352.     /*----------------------------------------------------------------*/
  353.     U8 *guiBuffer = NULL;
  354.     /*----------------------------------------------------------------*/
  355.     /* Code Body                                                      */
  356.     /*----------------------------------------------------------------*/
  357.     EntryNewScreen(SCR_ID_MYPIC_DISPLAY, mmi_msg_exit_generic, mmi_mypic_entry_display_pic, NULL);
  358.     mmi_nsm_set_msg_type(PICTURE_MESSAGE);
  359.     SetMessagesCurrScrnID(SCR_ID_MYPIC_DISPLAY);
  360.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MYPIC_DISPLAY);
  361.     ShowCategory620Screen(
  362.         STR_ID_NSM_PICTURE,
  363.         0,
  364.         STR_GLOBAL_OPTIONS,
  365.         0,
  366.         STR_GLOBAL_BACK,
  367.         0,
  368.         gaddtext_buffer,
  369.         NULL,
  370.         gNSMBuffer,
  371.         guiBuffer);
  372.     SetLeftSoftkeyFunction(mmi_mypic_entry_options, KEY_EVENT_UP);
  373.     SetKeyHandler(mmi_mypic_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  374.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  375.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  376. }
  377. /*****************************************************************************
  378.  * FUNCTION
  379.  *  mmi_mypic_entry_options
  380.  * DESCRIPTION
  381.  *  Entry function to display My Picture options
  382.  * PARAMETERS
  383.  *  void
  384.  * RETURNS
  385.  *  void
  386.  *****************************************************************************/
  387. void mmi_mypic_entry_options(void)
  388. {
  389.     /*----------------------------------------------------------------*/
  390.     /* Local Variables                                                */
  391.     /*----------------------------------------------------------------*/
  392.     U8 *guiBuffer = NULL;
  393.     U16 numItems = 0;
  394.     U16 nStrItemList[MAX_SUB_MENUS];
  395.     /*----------------------------------------------------------------*/
  396.     /* Code Body                                                      */
  397.     /*----------------------------------------------------------------*/
  398.     EntryNewScreen(SCR_ID_MYPIC_OPTION, mmi_msg_exit_generic, mmi_mypic_entry_options, NULL);
  399.     SetMessagesCurrScrnID(SCR_ID_MYPIC_OPTION);
  400.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MYPIC_OPTION);
  401.     numItems = GetNumOfChild(MENU_ID_MY_PICTURE);
  402.     GetSequenceStringIds(MENU_ID_MY_PICTURE, nStrItemList);
  403.     SetParentHandler(MENU_ID_MY_PICTURE);
  404.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  405.     ShowCategory52Screen(
  406.         STR_GLOBAL_OPTIONS,
  407.         IMG_SMS_ENTRY_SCRN_CAPTION,
  408.         STR_GLOBAL_OK,
  409.         IMG_GLOBAL_OK,
  410.         STR_GLOBAL_BACK,
  411.         IMG_GLOBAL_BACK,
  412.         numItems,
  413.         nStrItemList,
  414.         (U16*) gIndexIconsImageList,
  415.         NULL,
  416.         0,
  417.         0,
  418.         guiBuffer);
  419. }
  420. #endif /* defined(__MMI_MYPICTURE__) */ 
  421. #if defined(__MMI_MYPICTURE__) || defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
  422. /*****************************************************************************
  423.  * FUNCTION
  424.  *  mmi_nsm_create_dir
  425.  * DESCRIPTION
  426.  *  Create a directory at the given path
  427.  * PARAMETERS
  428.  *  DirnameInAnsii      [?]         
  429.  *  DirPath(?)          [IN]        DirPath in Ansii
  430.  * RETURNS
  431.  *  void
  432.  *****************************************************************************/
  433. void mmi_nsm_create_dir(S8 *DirnameInAnsii)
  434. {
  435.     /*----------------------------------------------------------------*/
  436.     /* Local Variables                                                */
  437.     /*----------------------------------------------------------------*/
  438.     FS_HANDLE file_handle;
  439.     S8 DirnameInUnicode[96];
  440.     /*----------------------------------------------------------------*/
  441.     /* Code Body                                                      */
  442.     /*----------------------------------------------------------------*/
  443.     mmi_asc_to_ucs2((S8*) DirnameInUnicode, (S8*) DirnameInAnsii);
  444.     file_handle = FS_Open((PU16) DirnameInUnicode, FS_OPEN_DIR | FS_READ_ONLY);
  445.     if (file_handle < 0)
  446.     {
  447.         FS_CreateDir((U16*)DirnameInUnicode);
  448.     }
  449.     FS_Close(file_handle);
  450. }
  451. /*****************************************************************************
  452.  * FUNCTION
  453.  *  mmi_nsm_save_buffer_in_file
  454.  * DESCRIPTION
  455.  *  Create a file and save buffer in that file
  456.  * PARAMETERS
  457.  *  fullfilenameInUnicode       [IN]        Absolute file name in Unicode
  458.  * RETURNS
  459.  * BOOL
  460.  *****************************************************************************/
  461. U16 mmi_nsm_save_buffer_in_file(S8 *fullfilenameInUnicode)
  462. {
  463.     /*----------------------------------------------------------------*/
  464.     /* Local Variables                                                */
  465.     /*----------------------------------------------------------------*/
  466.     INT file_handle;
  467.     // S8 fullfilenameInUnicode[128];   /* JP to fix MTK Chinese file name */
  468.     U32 wByte = 0;
  469.     U16 BufferSize = 0;
  470.     S32 result;
  471.     S8 temp[NSM_DIRECTORY_BUFF];
  472.     /*----------------------------------------------------------------*/
  473.     /* Code Body                                                      */
  474.     /*----------------------------------------------------------------*/
  475.     // memset(fullfilenameInUnicode,0x00,128);  /* JP to fix MTK Chinese file name */
  476.     memset(temp, '', NSM_DIRECTORY_BUFF);
  477.     if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
  478.     {
  479.         sprintf(temp, "%c:\%s", MMI_PUBLIC_DRV, (S8*) MYPICTURE_DIR_PATH);
  480.     }
  481.     if (mmi_nsm_get_msg_type() == RINGTONE_MESSAGE)
  482.     {
  483.         sprintf(temp, "%c:\%s", MMI_PUBLIC_DRV, (S8*) MY_TONE_PATH);
  484.     }
  485.     mmi_nsm_create_dir(temp);
  486.     if (mmi_nsm_is_file_exist(fullfilenameInUnicode))
  487.     {
  488.         return NSM_DUPLICATE_FILE_4;
  489.     }
  490.     file_handle = FS_Open((const U16*)fullfilenameInUnicode, (FS_CREATE_ALWAYS | FS_READ_WRITE));
  491.     if (file_handle == FS_DISK_FULL)
  492.     {
  493.         return NSM_SPACE_FULL_3;
  494.     }
  495.     else if (file_handle == FS_INVALID_FILENAME)
  496.     {
  497.         return NSM_FILE_ERROR_5;
  498.     }
  499.     else if (file_handle < 0)
  500.     {
  501.         return NSM_COMMOM_ERROR_6;
  502.     }
  503.     if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
  504.     {
  505.         BufferSize = mmi_pmsg_get_size_bmp_data((U8*) gNSMBuffer);     /* /-6;: JP for Operator Logo */
  506.         /* pfwrite((gNSMBuffer+6),      1, BufferSize, file_handle, &wByte); */
  507.         result = FS_Write(file_handle, (void*)(gNSMBuffer + 6), BufferSize, &wByte);
  508.     }
  509.     else
  510.     {
  511.         BufferSize = mmi_smrt_midi_file_size((U8*) gNSMBuffer);
  512.         /* write(gNSMBuffer,    1, BufferSize, file_handle, &wByte); */
  513.         result = FS_Write(file_handle, (void*)(gNSMBuffer), BufferSize, &wByte);
  514.     }
  515.     /* JP for Disk full File Manager issue */
  516.     if (result < 0)
  517.     {
  518.         if (result == FS_DISK_FULL)
  519.         {   /* Disk full */
  520.             FS_Close(file_handle);
  521.             FS_Delete((const U16*)fullfilenameInUnicode);
  522.             return NSM_SPACE_FULL_3;
  523.         }
  524.         FS_Close(file_handle);
  525.         return NSM_COMMOM_ERROR_6;
  526.     }
  527.     FS_Close(file_handle);
  528.     return NSM_SUCCESS_0;
  529. }
  530. /*****************************************************************************
  531.  * FUNCTION
  532.  *  mmi_nsm_is_file_exist
  533.  * DESCRIPTION
  534.  *  Checks for duplicate file
  535.  * PARAMETERS
  536.  *  fullfilenameInUnicode       [IN]        Absolute file name in Unicode
  537.  * RETURNS
  538.  * BOOL
  539.  *****************************************************************************/
  540. BOOL mmi_nsm_is_file_exist(S8 *fullfilenameInUnicode)
  541. {
  542.     /*----------------------------------------------------------------*/
  543.     /* Local Variables                                                */
  544.     /*----------------------------------------------------------------*/
  545.     FS_HANDLE h;
  546.     /*----------------------------------------------------------------*/
  547.     /* Code Body                                                      */
  548.     /*----------------------------------------------------------------*/
  549.     h = FS_Open((U16*)fullfilenameInUnicode, FS_READ_ONLY);
  550.     if (h > 0)
  551.     {
  552.         FS_Close(h);
  553.         return TRUE;
  554.     }
  555.     return FALSE;
  556. }
  557. #endif /* defined(__MMI_MYPICTURE__) || defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */ 
  558. #if defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_MYPICTURE__)
  559. extern S8 g_pmsg_TextInMessage[];
  560. /*****************************************************************************
  561.  * FUNCTION
  562.  *  mmi_mypic_entry_done_option
  563.  * DESCRIPTION
  564.  *  Display send options for picture message
  565.  * PARAMETERS
  566.  *  void
  567.  * RETURNS
  568.  *  void
  569.  *****************************************************************************/
  570. void mmi_mypic_entry_done_option(void)
  571. {
  572.     /*----------------------------------------------------------------*/
  573.     /* Local Variables                                                */
  574.     /*----------------------------------------------------------------*/
  575.     U8 *guiBuffer = NULL;
  576.     U16 numItems = 0;
  577.     U16 nStrItemList[MAX_SUB_MENUS];
  578.     /*----------------------------------------------------------------*/
  579.     /* Code Body                                                      */
  580.     /*----------------------------------------------------------------*/
  581.     EntryNewScreen(SCR_ID_MSG_SEND_OPTION, mmi_msg_exit_generic, mmi_mypic_entry_done_option, NULL);
  582.     g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;   /* reset : JAI 27-11-2004 */
  583.     numItems = GetNumOfChild(MENU_ID_MYPIC_DONE);
  584.     GetSequenceStringIds(MENU_ID_MYPIC_DONE, nStrItemList);
  585.     SetParentHandler(MENU_ID_MYPIC_DONE);
  586.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  587.     SetMessagesCurrScrnID(SCR_ID_MSG_SEND_OPTION);
  588.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_SEND_OPTION);
  589.     ShowCategory52Screen(
  590.         STR_SEND_OPTIONS_CAPTION,
  591.         IMG_SMS_ENTRY_SCRN_CAPTION,
  592.         STR_GLOBAL_OK,
  593.         IMG_GLOBAL_OK,
  594.         STR_GLOBAL_BACK,
  595.         IMG_GLOBAL_BACK,
  596.         numItems,
  597.         nStrItemList,
  598.         (U16*) gIndexIconsImageList,
  599.         NULL,
  600.         0,
  601.         0,
  602.         guiBuffer);
  603. }
  604. /*****************************************************************************
  605.  * FUNCTION
  606.  *  highlight_mypic_send_handler
  607.  * DESCRIPTION
  608.  *  Highlight handler for My Picture - Send option
  609.  * PARAMETERS
  610.  *  void
  611.  * RETURNS
  612.  *  void
  613.  *****************************************************************************/
  614. void highlight_mypic_send_handler(void)
  615. {
  616.     /*----------------------------------------------------------------*/
  617.     /* Local Variables                                                */
  618.     /*----------------------------------------------------------------*/
  619.     /*----------------------------------------------------------------*/
  620.     /* Code Body                                                      */
  621.     /*----------------------------------------------------------------*/
  622.     mmi_msg_highlight_generic(
  623.         STR_GLOBAL_OK,
  624.         IMG_GLOBAL_OK,
  625.         STR_GLOBAL_BACK,
  626.         IMG_GLOBAL_BACK,
  627.         mmi_mypic_send_picmsg_to_only_entry,
  628.         GoBackHistory);
  629. }
  630. /*****************************************************************************
  631.  * FUNCTION
  632.  *  mmi_mypic_send_picmsg_to_only_entry
  633.  * DESCRIPTION
  634.  *  Send picture message to single destination
  635.  * PARAMETERS
  636.  *  void
  637.  * RETURNS
  638.  *  void
  639.  *****************************************************************************/
  640. void mmi_mypic_send_picmsg_to_only_entry(void)
  641. {
  642.     /*----------------------------------------------------------------*/
  643.     /* Local Variables                                                */
  644.     /*----------------------------------------------------------------*/
  645.     /*----------------------------------------------------------------*/
  646.     /* Code Body                                                      */
  647.     /*----------------------------------------------------------------*/
  648.     g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;
  649.     memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
  650.     if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST))
  651.     {
  652.         mmi_ucs2cpy(g_msg_cntx.smsPhoneNumber, (S8*) PendingSaveSendData.number);
  653.     }
  654.     mmi_mypic_send_picmsg_to_entry();
  655. }
  656. /*****************************************************************************
  657.  * FUNCTION
  658.  *  mmi_mypic_send_picmsg_to_entry
  659.  * DESCRIPTION
  660.  *  Send picutre message to entry
  661.  * PARAMETERS
  662.  *  void
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. void mmi_mypic_send_picmsg_to_entry(void)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     /*----------------------------------------------------------------*/
  672.     /* Code Body                                                      */
  673.     /*----------------------------------------------------------------*/
  674.     if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))  /* JAI 06-12-2004 for My Pic */
  675.     {
  676.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
  677.     }
  678.     else if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
  679.     {
  680.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
  681.     }
  682.     else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
  683.     {
  684.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
  685.     }
  686.     else if (IsScreenPresent(SCR_ID_MSG_WRITE))
  687.     {
  688.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);
  689.     }
  690.     else if (IsScreenPresent(SCR_ID_MSG_NUMBER))
  691.     {
  692.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_NUMBER);
  693.     }
  694.     else
  695.     {
  696.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_SENDING);
  697.     }
  698. }
  699. /* PMT JAI 24-11-2004 */
  700. /*****************************************************************************
  701.  * FUNCTION
  702.  *  highlight_mypic_addtext_handler
  703.  * DESCRIPTION
  704.  *  Highlight handler for My Picture - Add Text option
  705.  * PARAMETERS
  706.  *  void
  707.  * RETURNS
  708.  *  void
  709.  *****************************************************************************/
  710. void highlight_mypic_addtext_handler(void)
  711. {
  712.     /*----------------------------------------------------------------*/
  713.     /* Local Variables                                                */
  714.     /*----------------------------------------------------------------*/
  715.     /*----------------------------------------------------------------*/
  716.     /* Code Body                                                      */
  717.     /*----------------------------------------------------------------*/
  718.     SetLeftSoftkeyFunction(mmi_mypic_entry_addtext, KEY_EVENT_UP);
  719.     SetKeyHandler(mmi_mypic_entry_addtext, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  720.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  721.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  722. }
  723. /*****************************************************************************
  724.  * FUNCTION
  725.  *  mmi_mypic_entry_addtext
  726.  * DESCRIPTION
  727.  *  Entry function for Add Text
  728.  * PARAMETERS
  729.  *  void
  730.  * RETURNS
  731.  *  void
  732.  *****************************************************************************/
  733. void mmi_mypic_entry_addtext(void)
  734. {
  735.     /*----------------------------------------------------------------*/
  736.     /* Local Variables                                                */
  737.     /*----------------------------------------------------------------*/
  738.     U8 *guiBuffer;
  739.     U16 StrID;
  740.     /*----------------------------------------------------------------*/
  741.     /* Code Body                                                      */
  742.     /*----------------------------------------------------------------*/
  743.     EntryNewScreen(SCR_ID_NSM_EDITOR, NULL, mmi_mypic_entry_addtext, NULL);
  744.     SetMessagesCurrScrnID(SCR_ID_NSM_EDITOR);
  745.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  746.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NSM_EDITOR);
  747.     if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST))
  748.     {
  749.         StrID = STR_ID_PICMSG_EDIT_TEXT;
  750.     }
  751.     else
  752.     {
  753.         StrID = STR_ID_MYPIC_ADDTEXT;
  754.     }
  755.     ShowCategory5Screen(
  756.         StrID,
  757.         0,
  758.         STR_GLOBAL_OPTIONS,
  759.         0,
  760.         STR_GLOBAL_BACK,
  761.         0,
  762.         IMM_INPUT_TYPE_SENTENCE,
  763.         (U8*) gaddtext_buffer,
  764.         129,
  765.         guiBuffer);
  766.     /* SetLeftSoftkeyFunction( mmi_mypic_entry_done,        KEY_EVENT_UP); //PMT JAI : 23122004 */
  767.     SetLeftSoftkeyFunction(mmi_mypic_insert_text_options, KEY_EVENT_UP);
  768.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  769.     SetKeyHandler(mmi_mypic_entry_done_option, KEY_SEND, KEY_EVENT_UP);
  770. }
  771. /*****************************************************************************
  772.  * FUNCTION
  773.  *  mmi_mypic_insert_text_options
  774.  * DESCRIPTION
  775.  *  
  776.  * PARAMETERS
  777.  *  void
  778.  * RETURNS
  779.  *  void
  780.  *****************************************************************************/
  781. void mmi_mypic_insert_text_options(void)
  782. {
  783.     /*----------------------------------------------------------------*/
  784.     /* Local Variables                                                */
  785.     /*----------------------------------------------------------------*/
  786.     U16 NumOfItems = 0;
  787.     U8 *guiBuffer = NULL;
  788.     U16 nStrItemsList[2];
  789.     /*----------------------------------------------------------------*/
  790.     /* Code Body                                                      */
  791.     /*----------------------------------------------------------------*/
  792.     EntryNewScreen(SCR_ID_EDIT_OPTIONS, mmi_msg_exit_generic, mmi_mypic_insert_text_options, NULL);
  793.     SetParentHandler(MENU_ID_MYPIC_INSERT_TEXT_OPTION);
  794.     SetMessagesCurrScrnID(SCR_ID_EDIT_OPTIONS);
  795.     NumOfItems = GetNumOfChild(MENU_ID_MYPIC_INSERT_TEXT_OPTION);
  796.     GetSequenceStringIds(MENU_ID_MYPIC_INSERT_TEXT_OPTION, nStrItemsList);
  797.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EDIT_OPTIONS);
  798.     ShowCategory529Screen(
  799.         STR_GLOBAL_OPTIONS,
  800.         IMG_SMS_ENTRY_SCRN_CAPTION,
  801.         STR_GLOBAL_OK,
  802.         IMG_GLOBAL_OK,
  803.         STR_GLOBAL_BACK,
  804.         IMG_GLOBAL_BACK,
  805.         NumOfItems,
  806.         nStrItemsList,
  807.         (U16*) gIndexIconsImageList,
  808.         NULL,
  809.         0,
  810.         0,
  811.         guiBuffer,
  812.         ExecuteCurrHiliteHandler,
  813.         Messages2GoBackHistory);
  814. }
  815. /*****************************************************************************
  816.  * FUNCTION
  817.  *  highlight_mypic_insert_text_done
  818.  * DESCRIPTION
  819.  *  
  820.  * PARAMETERS
  821.  *  void
  822.  * RETURNS
  823.  *  void
  824.  *****************************************************************************/
  825. void highlight_mypic_insert_text_done(void)
  826. {
  827.     /*----------------------------------------------------------------*/
  828.     /* Local Variables                                                */
  829.     /*----------------------------------------------------------------*/
  830.     /*----------------------------------------------------------------*/
  831.     /* Code Body                                                      */
  832.     /*----------------------------------------------------------------*/
  833.     SetLeftSoftkeyFunction(mmi_mypic_entry_done, KEY_EVENT_UP);
  834.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  835. }
  836. /*****************************************************************************
  837.  * FUNCTION
  838.  *  mmi_mypic_entry_done
  839.  * DESCRIPTION
  840.  *  Takes user back to MyPicture List
  841.  * PARAMETERS
  842.  *  void
  843.  * RETURNS
  844.  *  void
  845.  *****************************************************************************/
  846. void mmi_mypic_entry_done(void)
  847. {
  848.     /*----------------------------------------------------------------*/
  849.     /* Local Variables                                                */
  850.     /*----------------------------------------------------------------*/
  851.     /*----------------------------------------------------------------*/
  852.     /* Code Body                                                      */
  853.     /*----------------------------------------------------------------*/
  854.     /* Jai 1-12-2004 */
  855.     if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST))
  856.     {
  857.         mmi_ucs2_to_asc((S8*) g_pmsg_TextInMessage, (S8*) gaddtext_buffer);
  858.     }
  859.     GoBacknHistory(2);
  860. }
  861. #endif /* defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_MYPICTURE__) */ 
  862. #endif /* __MOD_SMSAL__ */