mmimms_wintable.c
上传用户:tqh2500
上传日期:2014-05-09
资源大小:163k
文件大小:463k
开发平台:

Visual C++

  1.         MMK_SetAtvCtrl(win_id, menu_ctrl_id);
  2.         break;
  3. case MSG_CLOSE_WINDOW:
  4. destroy_mms_mem_file_info();
  5. break;
  6. case MSG_APP_OK:
  7.     case MSG_CTL_OK:
  8.         GUIMENU_GetRetID( menu_ctrl_id, (MMI_MENU_GROUP_ID_T *)(&group_id),(MMI_MENU_ID_T *) (&menu_id));
  9.         switch ( menu_id  )
  10.         {
  11. case ID_MMS_INBOX_PLAY:
  12. g_filetype = MMICMS_GetCurrentFFS();
  13. if (g_filetype != FS_INVALID)
  14. {
  15. g_readforstate = MMS_MSG_INBOX_READ_FOR_PLAY;
  16. MMIMMS_CreateReadMMSWaitingWin();
  17. MMIMMS_ReadMMS(g_pCurrentList);
  18. }
  19. break;
  20. case ID_MMS_INBOX_ANSWER_SMS://modify 2006-3-10  for reply sms for test liangliu
  21. MMISMS_WriteNewMessage(PNULL, g_pCurrentList->sender, strlen((char *)g_pCurrentList->sender));
  22.        break;
  23. case ID_MMS_INBOX_ANSWER_MMS:
  24. {
  25. MMSHANDLE p_mmsdoc = NULL;
  26. int8 from[MAX_NAME_LENGTH];
  27. SCI_MEMSET(from,0,sizeof(from));
  28. p_mmsdoc = (MMSHANDLE)MMS_NewMms();
  29. if(p_mmsdoc==0)
  30. {
  31. return err_code;
  32. }
  33. g_p_mms_subject = (int8 *)cms_malloc(MMIMMS_MAX_SUBJECTS_LEN+1);
  34. SCI_ASSERT(g_p_mms_subject != NULL);
  35. SCI_MEMSET(g_p_mms_subject,0,MMIMMS_MAX_SUBJECTS_LEN+1);
  36. if (g_pCurrentList->subject!= NULL)
  37. {
  38. uint16 outlen = 0;
  39. uint8 * uni_16 =PNULL;
  40. outlen =  Cms_UTF8toUTF16Len(g_pCurrentList->subject);
  41. SCI_TRACE_LOW("fnh outlen = %d",outlen);
  42. uni_16 = (uint8 *)cms_malloc(outlen);
  43. SCI_MEMSET(uni_16,0,outlen);
  44. Cms_UTF8toUTF16(g_pCurrentList->subject,SCI_STRLEN((char *)g_pCurrentList->subject),outlen,uni_16);
  45. if (outlen > MMIMMS_MAX_SUBJECTS_LEN-2)
  46. {
  47. outlen = MMIMMS_MAX_SUBJECTS_LEN-2;
  48. }
  49. SCI_MEMCPY(g_p_mms_subject,&outlen,2);
  50. SCI_MEMCPY((int8 *)(g_p_mms_subject+2),uni_16,outlen); 
  51. SCI_TRACE_BUF("FNH g_p_mms_subject = %x",g_p_mms_subject,10);
  52. if (uni_16)
  53. {
  54. cms_free(uni_16);
  55. uni_16 = NULL;
  56. }
  57. MMIMMS_OptionSubject(MMSRE);
  58. }
  59. else
  60. {
  61. MMIMMS_OptionSubject(MMSRE);
  62. }
  63. MMS_SetMmsFile(p_mmsdoc, (char *)g_pCurrentList->filename);
  64. /* 获得发件人信息,作为收件人 */
  65.         MMS_DecodeMms(p_mmsdoc); 
  66. if (g_pCurrentList->sender != NULL)
  67. {
  68. SCI_ASSERT(SCI_STRLEN((char *)g_pCurrentList->sender) < MAX_NAME_LENGTH);
  69. if ( (SCI_STRLEN((char *)g_pCurrentList->sender) < MAX_NAME_LENGTH) && (SCI_STRLEN((char *)g_pManager->currentfolder->currentmessage->sender)>0) )
  70. {
  71. g_p_mms_to = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  72. SCI_MEMSET(g_p_mms_to,0,sizeof(MMS_RECEPIENT));
  73. SCI_STRCPY(g_p_mms_to->m_address,(char *)g_pCurrentList->sender);
  74. }
  75. }
  76. /* 删除临时彩信文档 */
  77. MMS_DeleteMms(p_mmsdoc);
  78. g_peditdoc = MMS_New();
  79. SCI_ASSERT(g_peditdoc != NULL);
  80. SCI_TRACE_LOW("FNH new mms!");
  81. SCI_ASSERT(g_peditdoc != NULL);
  82. g_mms_edit_status = MMS_EDIT_ANSWER_MMS;
  83. if ((g_nv_setting_mirror.auto_sign == MMS_MSG_SETTINGS_ON) && (g_filetype != FS_INVALID))
  84. {
  85. MMIMMS_CreateReadMMSWaitingWin();
  86. g_readsignstate = MMS_MSG_READ_SIGN_FOR_ANSWER_MMS;
  87. MMIMMS_ReadAutosign() ;
  88. }
  89. else if (g_nv_setting_mirror.auto_sign == MMS_MSG_SETTINGS_OFF)
  90. {
  91. MMK_CreateWin((uint32 *)MMIMMS_EDIT_WIN_TAB,PNULL);
  92. }
  93. }
  94. break;
  95. case ID_MMS_INBOX_FORWARD:
  96. g_filetype = MMICMS_GetCurrentFFS();
  97. if (g_filetype != FS_INVALID)
  98. {
  99. g_readforstate = MMS_MSG_INBOX_READ_FOR_FW;
  100. MMIMMS_CreateReadMMSWaitingWin();
  101. MMIMMS_ReadMMS(g_pCurrentList);
  102. }
  103. break;
  104. case ID_MMS_INBOX_SAVE_IMAGE:
  105. g_filetype = MMICMS_GetCurrentFFS();
  106. if (g_filetype != FS_INVALID)
  107.     {
  108. g_readforstate = MMS_MSG_INBOX_READ_FOR_SAVEPIC;
  109. MMIMMS_CreateReadMMSWaitingWin();
  110. MMIMMS_ReadMMS(g_pCurrentList);
  111.     }
  112. break;
  113. case ID_MMS_INBOX_SAVE_SOUND:
  114. g_filetype = MMICMS_GetCurrentFFS();
  115. if (g_filetype != FS_INVALID)
  116.     {
  117.                 g_readforstate = MMS_MSG_INBOX_READ_FOR_SAVESOUND;
  118. MMIMMS_CreateReadMMSWaitingWin();
  119.         MMIMMS_ReadMMS(g_pCurrentList);
  120.     }
  121. break;
  122. case ID_MMS_INBOX_SAVE_VIDEO:
  123. #ifdef HAVE_MPEG4
  124. g_filetype = MMICMS_GetCurrentFFS();
  125. if (g_filetype != FS_INVALID)
  126.     {
  127. g_readforstate = MMS_MSG_INBOX_READ_FOR_SAVEVIDEO;
  128. MMIMMS_CreateReadMMSWaitingWin();
  129.         MMIMMS_ReadMMS(g_pCurrentList);
  130.     }
  131. #else
  132. #endif
  133. break;
  134. case ID_MMS_INBOX_DEL:
  135. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  136. break;
  137. case ID_MMS_INBOX_DEL_ALL:
  138. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  139. break;
  140. case ID_MMS_INBOX_DOWNLOAD_MMS:
  141. //judge whether it's making a call
  142. if (CC_IsInCall())
  143. {
  144. //alert : TXT_MMS_CANNOT_DOWNLOAD_IN_CALL
  145. PUBWIN_OpenPromptAlertWin(
  146. PUBWIN_SOFTKEY_ONE, 
  147. TXT_MMS_CANNOT_DOWNLOAD_IN_CALL, 
  148. IMAGE_PROMPT_ICON_ALERT, 
  149. ALERT_TIMEOUT, 
  150. PNULL
  151. );
  152. }
  153. else
  154. {
  155.        g_filetype = MMICMS_GetCurrentFFS();
  156.        if((g_filetype == FS_INVALID)||MMIMMS_GetManagerTotalNum() > (MMS_MAX_NUM -1)||!MMIMMS_IsMoreSpace())//modify liangliu 2005-12-14
  157.        {
  158.             PUBWIN_OpenPromptAlertWin(
  159.   PUBWIN_SOFTKEY_ONE, 
  160.   TXT_MMS_MEMORYFULL, 
  161.   IMAGE_PROMPT_ICON_ALERT, 
  162.   ALERT_TIMEOUT, 
  163.   PNULL);
  164.            
  165.        }else
  166.        {
  167.            MMK_CloseWin(win_id);
  168.     MMIMMS_Download_CreateDownloadingWin();
  169. g_backautodownload = FALSE;
  170.     g_netusing = MMS_MSG_NETUSING_STEP1 ;
  171.    //MMK_CreateWin((uint32 *)MMIMMS_SEND_WIN_TAB,PNULL);
  172.    g_progressneedsize = g_pCurrentList->size;
  173.                                MMIMMS_Receive_MMS(g_pCurrentList);
  174.        }
  175. }
  176. break;
  177. case ID_MMS_INBOX_DETAIL:
  178. MMK_CreateWin((uint32 *)MMIMMS_INBOX_DETAIL_WIN, PNULL);
  179. break;
  180.          
  181. default:
  182. SCI_ASSERT(0);
  183. break;
  184.         }
  185.         break;
  186.       
  187. case MSG_PROMPTWIN_OK:
  188. GUIMENU_GetRetID(menu_ctrl_id, (MMI_MENU_GROUP_ID_T *)(&group_id),(MMI_MENU_ID_T *) (&menu_id));
  189. switch(menu_id)
  190. {
  191. case ID_MMS_INBOX_DEL:
  192. //close query win
  193. g_pCurrentList->needautodw = 0;
  194. MMIMMS_DeleteAutodownList();
  195. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  196. g_savestate = MMS_MSG_SAVEFILE_FOR_INBOX_DELETE;
  197. MMIMMS_CreateNormalWaitingWin();
  198. MMIMMS_DeleteMMS(g_pManager->currentfolder);
  199. MMK_CloseWin(win_id);
  200. break;
  201. case ID_MMS_INBOX_DEL_ALL:
  202. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  203. MMK_CloseWin(win_id);
  204. g_savestate = MMS_MSG_SAVEFILE_FOR_INBOX_DELETE;
  205. MMIMMS_CreateNormalWaitingWin();
  206. MMIMMS_DeleteAllMMS(g_pManager->currentfolder);
  207. MMIMMS_FreeAutodownList();
  208. break;
  209. default:
  210. break;
  211. }
  212. break;
  213. case MSG_PROMPTWIN_CANCEL:
  214. PUBWIN_ClosePromptQueryWin();
  215. break;
  216. case MSG_MMS_READ_FOR_PLAY:
  217. g_peditdoc = MMS_New();
  218. SCI_ASSERT(g_peditdoc != NULL);
  219. SCI_TRACE_LOW("FNH new mms!");
  220.             SCI_TRACE_LOW("FNH before cms_parse_mms");
  221. //SCI_TRACE_LOW("FNH IN READ FOR PLAY g_pManager->currentfolder->currentmessage = %d",g_pManager->currentfolder->currentmessage);
  222. SCI_TRACE_LOW("FNH IN READ FOR PLAY g_pManager->currentfolder->currentmessage->filename = %d",g_pCurrentList->filename);
  223. cms_parse_mms((char *)g_pCurrentList->filename,g_peditdoc);
  224. mmsf_Remove((char *)g_pCurrentList->filename);
  225. SCI_TRACE_LOW("FNH IN READ FOR PLAY g_peditdoc->size = %d",g_peditdoc->totalsize);
  226. if (g_peditdoc->slide_cur == NULL)
  227. {
  228. PUBWIN_OpenPromptAlertWin(
  229. PUBWIN_SOFTKEY_ONE, 
  230. TXT_MMS_EDIT_NO_CONTENT, 
  231. IMAGE_PROMPT_ICON_ALERT,
  232. ALERT_TIMEOUT, 
  233. PNULL
  234. );
  235. break;
  236. }
  237. else 
  238. {
  239. play_or_preview = MMS_PLAY;//播放
  240. SCI_TRACE_LOW("FNH before play mms!");
  241. MMK_CreateWin((uint32 *)MMIMMS_EDIT_PREVIEW_TAB,(ADD_DATA)g_peditdoc);
  242. }
  243. break;
  244.     case MSG_MMS_READ_FOR_FW:
  245. {
  246. MMSHANDLE p_mmsdoc = NULL;
  247. int8 from[MAX_NAME_LENGTH];
  248. SCI_MEMSET(from,0,sizeof(from));
  249.  p_mmsdoc = (MMSHANDLE)MMS_NewMms();
  250. if(p_mmsdoc==0)
  251. {
  252. return err_code;
  253. }
  254. g_p_mms_subject = (int8 *)cms_malloc(MMIMMS_MAX_SUBJECTS_LEN+1);
  255. SCI_ASSERT(g_p_mms_subject != NULL);
  256. SCI_MEMSET(g_p_mms_subject,0,MMIMMS_MAX_SUBJECTS_LEN+1);
  257. if (g_pCurrentList->subject!= NULL)
  258. {
  259. uint16 outlen = 0;
  260. uint8 * uni_16 =PNULL;
  261. outlen =  Cms_UTF8toUTF16Len(g_pCurrentList->subject);
  262. uni_16 = (uint8 *)cms_malloc(outlen);
  263. SCI_MEMSET(uni_16,0,outlen);
  264. Cms_UTF8toUTF16(g_pCurrentList->subject,SCI_STRLEN((char *)g_pCurrentList->subject),outlen,uni_16);
  265. if (outlen > MMIMMS_MAX_SUBJECTS_LEN-2)
  266. {
  267. outlen = MMIMMS_MAX_SUBJECTS_LEN-2;
  268. }
  269. SCI_MEMCPY(g_p_mms_subject,&outlen,2);
  270. SCI_MEMCPY((int8 *)(g_p_mms_subject+2),uni_16,outlen); 
  271. SCI_TRACE_BUF("FNH g_p_mms_subject = ",g_p_mms_subject,10);
  272. if (uni_16)
  273. {
  274. cms_free(uni_16);
  275. uni_16 = NULL;
  276. }
  277. MMIMMS_OptionSubject(MMSFW);
  278. }
  279. else
  280. {
  281. MMIMMS_OptionSubject(MMSFW);
  282. }
  283. MMS_SetMmsFile(p_mmsdoc, (char *)g_pCurrentList->filename);
  284. /* 获得发件人信息,作为收件人 */
  285.          MMS_DecodeMms(p_mmsdoc); 
  286. /* 删除临时彩信文档 */
  287. MMS_DeleteMms(p_mmsdoc);
  288. g_peditdoc = MMS_New();
  289. SCI_ASSERT(g_peditdoc != NULL);
  290. SCI_TRACE_LOW("FNH before cms_parse_mms");
  291. cms_parse_mms((char *)g_pCurrentList->filename,g_peditdoc);
  292. mmsf_Remove((char *)g_pCurrentList->filename);
  293. // cms_parse_mms((char *)transit_filename,g_peditdoc);
  294. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  295. g_mms_edit_status = MMS_EDIT_FORWARD_MMS;
  296. MMK_CreateWin((uint32 *)MMIMMS_EDIT_WIN_TAB,PNULL);
  297. }
  298. //reedit, then add "Fw" to subject
  299. break;
  300.    case MSG_MMS_READ_FOR_SAVEVIDEO:
  301. #ifdef HAVE_MPEG4
  302. {
  303. BOOLEAN video_exist = FALSE;
  304. pMMS_EDocument p_edoc = NULL;
  305. int8 slide_count = 0;
  306. if(g_pCurrentList->filename[0] == '')
  307. {
  308. break;
  309. }
  310. p_edoc = MMS_New();
  311. SCI_ASSERT(p_edoc != NULL);
  312. SCI_TRACE_LOW("FNH new mms!");
  313.                 SCI_TRACE_LOW("FNH before cms_parse_mms");
  314. cms_parse_mms((char *)g_pCurrentList->filename,p_edoc);
  315. mmsf_Remove((char *)g_pCurrentList->filename);
  316. SCI_TRACE_LOW("FNH AFTER cms_parse_mms");
  317. slide_count = MMSGetSlideCount(p_edoc);
  318. if (slide_count > 0)//彩信有内容
  319. {
  320. pMMS_Slide p_mms_slide_temp = NULL;
  321. MMS_HeadSlide(p_edoc);
  322. while(p_edoc->slide_cur)
  323. {
  324. p_mms_slide_temp = p_edoc->slide_cur;
  325. if (p_mms_slide_temp->video_flag == 1)
  326. {
  327. video_exist = TRUE;
  328. break;
  329. }
  330. p_edoc->slide_cur = p_edoc->slide_cur->next;
  331. }
  332. }
  333. else //彩信没有内容
  334. {
  335. MMSDelDocument(p_edoc);
  336. SCI_TRACE_LOW("FNH after free MMS!");
  337. p_edoc = NULL;
  338. PUBWIN_OpenPromptAlertWin(
  339. PUBWIN_SOFTKEY_ONE, 
  340. TXT_MMS_EDIT_NO_CONTENT, 
  341. IMAGE_PROMPT_ICON_ALERT,
  342. ALERT_TIMEOUT, 
  343. PNULL
  344. );
  345. break;
  346. }
  347. if (video_exist ) //如果存在视频
  348. {
  349. P_MMS_FOLDER_SAVE_PARAM p_folder_save_param = NULL;  /* 编辑器入口参数 */
  350. /*编辑器入口参数创建*/
  351. p_folder_save_param = cms_malloc(sizeof(MMS_FOLDER_SAVE_PARAM));
  352. SCI_ASSERT(p_folder_save_param != NULL);
  353. SCI_MEMSET(p_folder_save_param,0,sizeof(MMS_FOLDER_SAVE_PARAM));
  354. p_folder_save_param->p_edit_doc = p_edoc;
  355. p_folder_save_param->save_type = MMS_FOLDER_SAVE_TYPE_IMAGE;
  356. MMK_CreateWin((uint32*)MMIMMS_SAVE_VIDEO_LIST_TAB,(ADD_DATA)p_folder_save_param);
  357. }
  358. else if (!video_exist) //不存在视频
  359. {
  360. MMSDelDocument(p_edoc);
  361. SCI_TRACE_LOW("FNH after free MMS!");
  362. p_edoc = NULL;
  363. PUBWIN_OpenPromptAlertWin(
  364. PUBWIN_SOFTKEY_ONE, 
  365. TXT_MMS_VIDEO_EMPTY, 
  366. IMAGE_PROMPT_ICON_ALERT,
  367. ALERT_TIMEOUT, 
  368. PNULL
  369. );
  370. }
  371. }
  372. #else
  373. #endif
  374.     break;
  375.           case MSG_MMS_READ_FOR_SAVEPIC:
  376.                          {
  377. BOOLEAN image_exist = FALSE;
  378. pMMS_EDocument p_edoc = NULL;
  379. int8 slide_count = 0;
  380. if(g_pCurrentList->filename[0] == '')
  381. {
  382. break;
  383. }
  384. p_edoc = MMS_New();
  385. SCI_ASSERT(p_edoc != NULL);
  386. SCI_TRACE_LOW("FNH new mms!");
  387.                 SCI_TRACE_LOW("FNH before cms_parse_mms");
  388. cms_parse_mms((char *)g_pCurrentList->filename,p_edoc);
  389. mmsf_Remove((char *)g_pCurrentList->filename);
  390. SCI_TRACE_LOW("FNH AFTER cms_parse_mms");
  391. slide_count = MMSGetSlideCount(p_edoc);
  392. SCI_TRACE_LOW("FNH slide_count = %d",slide_count);
  393. if (slide_count > 0)//彩信有内容
  394. {
  395. pMMS_Slide p_mms_slide_temp = NULL;
  396. MMS_HeadSlide(p_edoc);
  397. while(p_edoc->slide_cur)
  398. {
  399. p_mms_slide_temp = p_edoc->slide_cur;
  400. if (p_mms_slide_temp->image_flag == 1)
  401. {
  402. image_exist = TRUE;
  403. SCI_TRACE_LOW("FNH image_exist = %d",image_exist);
  404. break;
  405. }
  406. p_edoc->slide_cur = p_edoc->slide_cur->next;
  407. }
  408. SCI_TRACE_LOW("FNH image_exist = %d",image_exist);
  409. }
  410. else //彩信没有内容
  411. {
  412. MMSDelDocument(p_edoc);
  413. SCI_TRACE_LOW("FNH after free MMS!");
  414. p_edoc = NULL;
  415. PUBWIN_OpenPromptAlertWin(
  416. PUBWIN_SOFTKEY_ONE, 
  417. TXT_MMS_EDIT_NO_CONTENT, 
  418. IMAGE_PROMPT_ICON_ALERT,
  419. ALERT_TIMEOUT, 
  420. PNULL
  421. );
  422. break;
  423. }
  424. if (image_exist ) //如果存在图象
  425. {
  426. P_MMS_FOLDER_SAVE_PARAM p_folder_save_param = NULL;  /* 编辑器入口参数 */
  427. /*编辑器入口参数创建*/
  428. p_folder_save_param = cms_malloc(sizeof(MMS_FOLDER_SAVE_PARAM));
  429. SCI_ASSERT(p_folder_save_param != NULL);
  430. SCI_MEMSET(p_folder_save_param,0,sizeof(MMS_FOLDER_SAVE_PARAM));
  431. p_folder_save_param->p_edit_doc = p_edoc;
  432. p_folder_save_param->save_type = MMS_FOLDER_SAVE_TYPE_IMAGE;
  433. SCI_TRACE_LOW("FNH before mmimms_save_image_list_tab");
  434. MMK_CreateWin((uint32*)MMIMMS_SAVE_IMAGE_LIST_TAB,(ADD_DATA)p_folder_save_param);
  435. }
  436. else if (!image_exist) //不存在图象
  437. {
  438. MMSDelDocument(p_edoc);
  439. SCI_TRACE_LOW("FNH after free MMS!");
  440. p_edoc = NULL;
  441. PUBWIN_OpenPromptAlertWin(
  442. PUBWIN_SOFTKEY_ONE, 
  443. TXT_MMS_IMAGE_EMPTY, 
  444. IMAGE_PROMPT_ICON_ALERT,
  445. ALERT_TIMEOUT, 
  446. PNULL
  447. );
  448. }
  449. }
  450. break;
  451.        case MSG_MMS_READ_FOR_SAVESOUND:
  452.     {
  453. BOOLEAN audio_exist = FALSE;
  454. pMMS_EDocument p_edoc = NULL;
  455. int8 slide_count = 0;
  456. if(g_pCurrentList->filename[0] == '')
  457. {
  458. break;
  459. }
  460. p_edoc = MMS_New();
  461. SCI_ASSERT(p_edoc != NULL);
  462. SCI_TRACE_LOW("FNH new mms!");
  463.                 SCI_TRACE_LOW("FNH before cms_parse_mms");
  464. cms_parse_mms((char *)g_pCurrentList->filename,p_edoc);
  465. mmsf_Remove((char *)g_pCurrentList->filename);
  466. slide_count = MMSGetSlideCount(p_edoc);
  467. if (slide_count > 0)//彩信有内容
  468. {
  469. pMMS_Slide p_mms_slide_temp = NULL;
  470. MMS_HeadSlide(p_edoc);
  471. while(p_edoc->slide_cur)
  472. {
  473. p_mms_slide_temp = p_edoc->slide_cur;
  474. if (p_mms_slide_temp->audio_type != 0)
  475. {
  476. audio_exist = TRUE;
  477. break;
  478. }
  479. p_edoc->slide_cur = p_edoc->slide_cur->next;
  480. }
  481. }
  482. else //彩信没有内容
  483. {
  484. MMSDelDocument(p_edoc);
  485. SCI_TRACE_LOW("FNH after free MMS!");
  486. p_edoc = NULL;
  487. PUBWIN_OpenPromptAlertWin(
  488. PUBWIN_SOFTKEY_ONE, 
  489. TXT_MMS_EDIT_NO_CONTENT, 
  490. IMAGE_PROMPT_ICON_ALERT,
  491. ALERT_TIMEOUT, 
  492. PNULL
  493. );
  494. break;
  495. }
  496. if (audio_exist ) //如果存在音乐
  497. {
  498. P_MMS_FOLDER_SAVE_PARAM p_folder_save_param = NULL;  /* 编辑器入口参数 */
  499. /*编辑器入口参数创建*/
  500. p_folder_save_param = cms_malloc(sizeof(MMS_FOLDER_SAVE_PARAM));
  501. SCI_ASSERT(p_folder_save_param != NULL);
  502. SCI_MEMSET(p_folder_save_param,0,sizeof(MMS_FOLDER_SAVE_PARAM));
  503. p_folder_save_param->p_edit_doc = p_edoc;
  504. p_folder_save_param->save_type = MMS_FOLDER_SAVE_TYPE_IMAGE;
  505. MMK_CreateWin((uint32*)MMIMMS_SAVE_MUSIC_LIST_TAB,(ADD_DATA)p_folder_save_param);
  506. }
  507. else if (!audio_exist) //不存在音乐
  508. {
  509. MMSDelDocument(p_edoc);
  510. SCI_TRACE_LOW("FNH after free MMS!");
  511. p_edoc = NULL;
  512. PUBWIN_OpenPromptAlertWin(
  513. PUBWIN_SOFTKEY_ONE, 
  514. TXT_MMS_MUSIC_EMPTY, 
  515. IMAGE_PROMPT_ICON_ALERT,
  516. ALERT_TIMEOUT, 
  517. PNULL
  518. );
  519. }
  520. }
  521. break;
  522. case MSG_APP_CANCEL:
  523. case MSG_CTL_CANCEL:
  524. // close the option window
  525. if(g_donewmms == TRUE)
  526. {
  527.        MMIMMS_StoreFolder(g_pManager->inboxfolder);
  528. g_donewmms = FALSE;
  529.                      MMIMMS_SaveManagerInboxFile(MMS_SAVE_INBOX);   //modify liangliu 2006-2-15 
  530.        PUBWIN_OpenPromptAlertWin(
  531. PUBWIN_SOFTKEY_ONE,
  532. TXTSYS_WAITING,
  533. IMAGE_PROMPT_ICON_WAIT,
  534. ALERT_TIMEOUT,
  535. PNULL);
  536.   
  537. }else
  538. {
  539.          MMK_CloseWin(win_id);
  540.          if(g_peditdoc != NULL)
  541.         {
  542.        MMSDelDocument(g_peditdoc);
  543.        SCI_TRACE_LOW("FNH after free MMS!");
  544.       g_peditdoc = NULL;
  545.         }
  546. }
  547. break;
  548. default:
  549. err_code = MMI_RESULT_FALSE;
  550. break;
  551.     }
  552.     
  553.     return err_code;
  554. }
  555. /*****************************************************************************/
  556. //  Description : 5.4.7 Inbox : MMS detail  window message handler
  557. // Global resource dependence : 
  558. //  Author:Bruce.Chi
  559. //  changed liangliu for detail show
  560. // Note: 
  561. /*****************************************************************************/
  562. LOCAL MMI_RESULT_E  Inbox_HandleMMSDetailWinMsg(
  563. MMS_WINDOW_ID_E win_id, 
  564. MMI_MESSAGE_ID_E msg_id, 
  565. DPARAM param
  566. )
  567. {
  568.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  569. MMI_STRING_T      dst_ptr = {0};
  570. MMI_STRING_T      dst_temp = {0};
  571. MMI_STRING_T      dst_temp1 = {0};
  572. MMI_STRING_T      dst_temp2 ={0};
  573. MMI_STRING_T      dst_temp3 ={0};
  574. MMI_STRING_T      dst_temp4 ={0};
  575. MMI_STRING_T      dst_temp5  ={0};
  576. MMI_STRING_T      dst_temp6  ={0};
  577. MMI_STRING_T      dst_time ={0};
  578. MMI_STRING_T      dst_subject ={0};
  579. MMI_STRING_T      dst_size ={0};
  580. MMI_STRING_T      dst_pritority ={0};
  581. MMI_STRING_T      dst_expiry = {0};
  582. MMI_STRING_T      dst_sender = {0};
  583. MMI_STRING_T   dst_to = {0};
  584. MMI_STRING_T   dst_cc    = {0};
  585. MMI_STRING_T      changeline_ptr; 
  586. char *                      changeline_str2_ptr = PNULL;
  587. uint8 * nowsubject = PNULL ;
  588. pMessageList tlist  =  PNULL;
  589. changeline_str2_ptr = (char *)cms_malloc(4);
  590. SCI_MEMSET(changeline_str2_ptr, 0, 4);
  591.    sprintf(changeline_str2_ptr, "r");
  592.    changeline_ptr.str_ptr = (uint8*)changeline_str2_ptr;
  593.    changeline_ptr.is_ucs2 = FALSE;
  594.    changeline_ptr.length =strlen(changeline_str2_ptr);
  595.    
  596.    
  597.    switch(msg_id)
  598.    {
  599.    case MSG_FULL_PAINT:
  600.    //clear
  601.    MMIMMS_CLEAR_CLIENT();
  602.    SCI_MEMSET(&dst_ptr, 0, sizeof(MMI_STRING_T));
  603.    SCI_MEMSET(&dst_temp, 0, sizeof(MMI_STRING_T));
  604.    SCI_MEMSET(&dst_temp1, 0, sizeof(MMI_STRING_T));
  605.    SCI_MEMSET(&dst_temp2, 0, sizeof(MMI_STRING_T));
  606.    SCI_MEMSET(&dst_temp3, 0, sizeof(MMI_STRING_T)); 
  607.    SCI_MEMSET(&dst_temp4, 0, sizeof(MMI_STRING_T));   
  608.    SCI_MEMSET(&dst_temp5, 0, sizeof(MMI_STRING_T));   
  609.    SCI_MEMSET(&dst_temp6, 0, sizeof(MMI_STRING_T));   
  610.    SCI_MEMSET(&dst_time, 0, sizeof(MMI_STRING_T));
  611.    SCI_MEMSET(&dst_subject, 0, sizeof(MMI_STRING_T));
  612.    SCI_MEMSET(&dst_size, 0, sizeof(MMI_STRING_T));
  613.    SCI_MEMSET(&dst_pritority, 0, sizeof(MMI_STRING_T));
  614.    SCI_MEMSET(&dst_expiry, 0, sizeof(MMI_STRING_T));
  615.    SCI_MEMSET(&dst_sender, 0, sizeof(MMI_STRING_T));
  616.    SCI_MEMSET(&dst_to, 0, sizeof(MMI_STRING_T));
  617.    SCI_MEMSET(&dst_cc, 0, sizeof(MMI_STRING_T));
  618.    if(g_pManager->currentfolder->type == MMS_FOLDER_TYPE_INBOX)
  619.    {
  620.    tlist = g_pCurrentList;
  621.    if (tlist->state == 0)
  622.    {
  623.    //notification
  624.    /*fnh add 0509*/
  625.    nowsubject = MMIMMS_GetListSubject(tlist);
  626.    SCI_TRACE_BUF("nowsubject is %x",nowsubject,100);
  627.    Detail_FormTime(&dst_time,tlist->date);
  628.    Detail_FormSize(&dst_size,tlist->size);
  629.    Detail_FormSubject(&dst_subject,nowsubject);
  630.    Detail_FormPriority(&dst_pritority,tlist->pritority);
  631.    Detail_FormExpiry(&dst_expiry,tlist->expiry);
  632.    CatString(&dst_temp, &dst_time,&dst_size);
  633.    CatString(&dst_temp2,&dst_temp,&dst_subject);
  634.    CatString(&dst_temp3,&dst_temp2,&changeline_ptr);  
  635.    CatString(&dst_temp4, &dst_temp3,&dst_pritority);
  636.    CatString(&dst_ptr, &dst_temp4, &dst_expiry);
  637.    }
  638.    else 
  639.    {
  640.    nowsubject = MMIMMS_GetListSubject(tlist);
  641.    SCI_TRACE_BUF("nowsubject is %x",nowsubject,100);
  642.    Detail_FormTime(&dst_time,tlist->date);
  643.    Detail_FormSize(&dst_size,tlist->size);
  644.    Detail_FormSubject(&dst_subject,nowsubject);
  645.    Detail_FormSender(&dst_sender,tlist->sender);
  646.    if (strcmp((char *)tlist->to_address,MMIMMS_UNKNOWN_SENDER) == 0)
  647.    {
  648.    Detail_FormTo(&dst_to,NULL);
  649.    }
  650.    else
  651.    {
  652.    Detail_FormTo(&dst_to, tlist->to_address);
  653.    }
  654.    Detail_FormCc(&dst_cc, tlist->cc_address);
  655.    Detail_FormPriority(&dst_pritority,tlist->pritority);
  656.    CatString(&dst_temp, &dst_time,&dst_size);
  657.    CatString(&dst_temp1,&dst_temp,&dst_subject);
  658.    CatString(&dst_temp2,&dst_temp1,&changeline_ptr);  
  659.    CatString(&dst_temp3, &dst_temp2,&dst_sender);
  660.    CatString(&dst_temp4, &dst_temp3, &dst_to);
  661.    CatString(&dst_temp5, &dst_temp4, &dst_cc);
  662.    CatString(&dst_ptr, &dst_temp5, &dst_pritority);
  663.    }
  664.    }else
  665.    {
  666.    tlist = g_pManager->currentfolder->currentmessage;
  667.    nowsubject = MMIMMS_GetListSubject(tlist);
  668.    SCI_TRACE_BUF("nowsubject is %x",nowsubject,100);
  669.    SCI_TRACE_LOW("FNH in detail tlist->date = %s",tlist->date);
  670.    Detail_FormTime(&dst_time,tlist->date);
  671.    Detail_FormSize(&dst_size,tlist->size);
  672.    Detail_FormSubject(&dst_subject,nowsubject);
  673. //    Detail_FormSender(&dst_sender,tlist->sender);
  674. //    SCI_TRACE_LOW("FNH to string is %s",tlist->to_address);
  675.    if (strcmp((char *)tlist->to_address,MMIMMS_UNKNOWN_SENDER) == 0)
  676.    {
  677.    Detail_FormTo(&dst_to,NULL);
  678.    }
  679.    else
  680.    {
  681.    Detail_FormTo(&dst_to, tlist->to_address);
  682.    }
  683.    Detail_FormCc(&dst_cc, tlist->cc_address);
  684.    Detail_FormPriority(&dst_pritority,tlist->pritority);
  685.    CatString(&dst_temp, &dst_time,&dst_size);
  686.    CatString(&dst_temp1,&dst_temp,&dst_subject);
  687.    CatString(&dst_temp2,&dst_temp1,&changeline_ptr);  
  688. //    CatString(&dst_temp3, &dst_temp2,&dst_sender);
  689.    CatString(&dst_temp4, &dst_temp2, &dst_to);
  690.    CatString(&dst_temp5, &dst_temp4, &dst_cc);
  691.    CatString(&dst_ptr, &dst_temp5, &dst_pritority);
  692.    }
  693.    /*fnh add 0509*/
  694.    
  695.    
  696.    GUITEXTBOX_SetText(MMIMMS_DETAIL_TEXTBOX_CTRL_ID, &dst_ptr, TRUE);
  697.    
  698.    //set sofkey
  699.    MMK_SetWinSoftkeyId(win_id, COMMON_TXT_NULL, COMMON_TXT_NULL, STXT_RETURN, TRUE);
  700.    break;
  701.    
  702.    case MSG_OPEN_WINDOW:  
  703.    //set active control
  704.    MMK_SetAtvCtrl(win_id, MMIMMS_DETAIL_TEXTBOX_CTRL_ID);
  705.    break;
  706.    
  707.    case MSG_APP_CANCEL:
  708.    // close the edit window
  709.    
  710.    MMK_CloseWin(win_id);
  711.    break;
  712.    case MSG_CLOSE_WINDOW:
  713.    if(changeline_str2_ptr!=PNULL)
  714.    {
  715.    cms_free(changeline_str2_ptr);
  716.    changeline_str2_ptr = PNULL;
  717.    }
  718.    if(nowsubject != PNULL)
  719.    {
  720.    cms_free(nowsubject);
  721.    nowsubject = PNULL;
  722.    }    
  723.    
  724.    break;
  725.    
  726.    
  727.    default:
  728.    err_code = MMI_RESULT_FALSE;
  729.    break;
  730.     }
  731.     
  732.     return err_code;
  733. }
  734. /* ----------------------------------------------------------------------------
  735. * Function Name: Detail_FormSize
  736. * Purpose: 详情中得到彩信大小字符串
  737. * Input:  MMI_STRING_T *str_dst, //out.
  738.   uint8* size
  739. * Returns: BOOLEAN
  740. * Author:nihongf@mobilesoft.com.cn
  741. * ----------------------------------------------------------------------------*/ 
  742.  BOOLEAN Detail_FormSize(
  743.                                    MMI_STRING_T *str_dst, //out.
  744. uint32 size
  745.  )
  746. {
  747. char* label_str2_ptr = PNULL;
  748. MMI_STRING_T label_string2;
  749. uint8       display_str[16] = {0};
  750. sprintf((void*)display_str,":%.1fkr",(float)size/ONE_K_LEN);
  751. label_string2.is_ucs2 = FALSE;
  752. label_string2.str_ptr = (uint8 *)display_str;
  753. label_string2.length = strlen((char*)display_str);
  754. CatStringByTextID(str_dst, TXT_MMS_DETAIL_SIZE, &label_string2);
  755. if(label_str2_ptr != PNULL)
  756. {
  757. cms_free(label_str2_ptr);
  758. label_str2_ptr = PNULL;
  759. }
  760. return TRUE;
  761. }
  762. /* ----------------------------------------------------------------------------
  763. * Function Name: Detail_FormTime
  764. * Purpose: 详情中得到时间字符串
  765. * Input:  MMI_STRING_T *str_dst, //out.
  766.   uint8* time
  767. * Returns: BOOLEAN
  768. * Author:nihongf@mobilesoft.com.cn
  769. * ----------------------------------------------------------------------------*/ 
  770. LOCAL BOOLEAN Detail_FormTime(
  771.                                    MMI_STRING_T *str_dst, //out.
  772. uint8* time
  773.  )
  774. {
  775. char* label_str2_ptr = PNULL;
  776. uint32 label_str2_len = 0;
  777. MMI_STRING_T label_string2;
  778. //fill label_string2 with "from"
  779. label_str2_len = 64;
  780. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  781. SCI_MEMSET(label_str2_ptr, 0, label_str2_len+1);
  782.        sprintf(label_str2_ptr, 
  783. ":%sr",time);
  784. // strcat(label_str2_ptr,"r");
  785. label_string2.is_ucs2 = FALSE;
  786. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  787. label_string2.length = strlen(label_str2_ptr);
  788. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  789. CatStringByTextID(str_dst, TXT_TIME, &label_string2);
  790. if(label_str2_ptr != PNULL)
  791. {
  792. cms_free(label_str2_ptr);
  793. label_str2_ptr = PNULL;
  794. }
  795. return TRUE;
  796. }
  797. /*****************************************************************************/
  798. //  Description : get the time string
  799. // Global resource dependence : 
  800. //  Author:liangliu 2005-11-25
  801. // Note: 
  802. /*****************************************************************************/
  803. LOCAL BOOLEAN Detail_FormSubject(
  804.                                    MMI_STRING_T *str_dst, //out.
  805. uint8* subject
  806.  )
  807. {
  808. //char* label_str2_ptr = PNULL;
  809. //uint32 label_str2_len = 0;
  810. MMI_STRING_T label_string2 = {0};
  811. //UTF8_T utf8_str = {0};
  812. uint8* usc2_ptr = PNULL;
  813. label_string2.is_ucs2 = TRUE;
  814. label_string2.str_ptr = subject;//subject+2 to subject 2006-11-12 for download reset. 
  815. label_string2.length =  Cms_UTF16Strlen(subject)*2;
  816. CatStringByTextID(str_dst, TXT_MMS_VIEW_SUBJECT, &label_string2);
  817. //cms_free(label_str2_ptr);
  818. if(usc2_ptr != PNULL)
  819. {
  820. cms_free(usc2_ptr);
  821. usc2_ptr = PNULL;
  822. }
  823. return TRUE;
  824. }
  825. /* ----------------------------------------------------------------------------
  826. * Function Name: Detail_FormCc
  827. * Purpose: 详情中得到抄送人的字符串
  828. * Input:  MMI_STRING_T *str_dst, //out.
  829.   uint8* cc
  830. * Returns: BOOLEAN
  831. * Author:nihongf@mobilesoft.com.cn
  832. * ----------------------------------------------------------------------------*/ 
  833. LOCAL BOOLEAN Detail_FormCc(
  834.                                    MMI_STRING_T *str_dst, //out.
  835. uint8* cc
  836.  )
  837. {
  838. char* label_str2_ptr = PNULL;
  839. uint32 label_str2_len = 0;
  840. MMI_STRING_T label_string2;
  841. //fill label_string2 with "from"
  842. label_str2_len = 512;
  843. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  844. SCI_MEMSET(label_str2_ptr, 0, label_str2_len + 1);
  845.     if(cc)
  846.     {
  847.           sprintf(label_str2_ptr, 
  848. ":%sr",cc);
  849.    label_string2.is_ucs2 = FALSE;
  850.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  851.    label_string2.length = strlen(label_str2_ptr);
  852.     }
  853. else
  854. {
  855.    sprintf(label_str2_ptr, 
  856. ":%sr"," ");
  857.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  858.    label_string2.is_ucs2 = FALSE;
  859.    label_string2.length =strlen(label_str2_ptr);
  860. }
  861. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  862. CatStringByTextID(str_dst, TXT_MMS_VIEW_CC, &label_string2);
  863. if(label_str2_ptr != PNULL)
  864. {
  865. cms_free(label_str2_ptr);
  866. label_str2_ptr = PNULL;
  867. }
  868. return TRUE;
  869. }
  870. /* ----------------------------------------------------------------------------
  871. * Function Name: Detail_FormSender
  872. * Purpose: 详情中得到发件人的字符串
  873. * Input:  MMI_STRING_T *str_dst, //out.
  874.   uint8* sender
  875. * Returns: BOOLEAN
  876. * Author:nihongf@mobilesoft.com.cn
  877. * ----------------------------------------------------------------------------*/ 
  878. LOCAL BOOLEAN Detail_FormSender(
  879.                                    MMI_STRING_T *str_dst, //out.
  880. uint8* sender
  881.  )
  882. {
  883. char* label_str2_ptr = PNULL;
  884. uint32 label_str2_len = 0;
  885. MMI_STRING_T label_string2;
  886. //fill label_string2 with "from"
  887. label_str2_len = 64;
  888. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  889. SCI_MEMSET(label_str2_ptr, 0, label_str2_len + 1);
  890.        if(sender)
  891.      {
  892.           sprintf(label_str2_ptr, 
  893. "%sr",sender);
  894.    label_string2.is_ucs2 = FALSE;
  895.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  896.    label_string2.length = strlen(label_str2_ptr);
  897.      }
  898. else
  899. {
  900.    sprintf(label_str2_ptr, 
  901. "%sr"," ");
  902.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  903.    label_string2.is_ucs2 = FALSE;
  904.    label_string2.length =strlen(label_str2_ptr);
  905. }
  906. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  907. CatStringByTextID(str_dst, TXT_MMS_DETAIL_FROM, &label_string2);
  908. if(label_str2_ptr != PNULL)
  909. {
  910. cms_free(label_str2_ptr);
  911. label_str2_ptr = PNULL;
  912. }
  913. return TRUE;
  914. }
  915. /* ----------------------------------------------------------------------------
  916. * Function Name: Detail_FormTo
  917. * Purpose: 详情中得到收件人的字符串
  918. * Input:  MMI_STRING_T *str_dst, //out.
  919.   uint8* to
  920. * Returns: BOOLEAN
  921. * Author:nihongf@mobilesoft.com.cn
  922. * ----------------------------------------------------------------------------*/ 
  923. LOCAL BOOLEAN Detail_FormTo(
  924.                                    MMI_STRING_T *str_dst, //out.
  925. uint8* to
  926.  )
  927. {
  928. char* label_str2_ptr = PNULL;
  929. uint32 label_str2_len = 0;
  930. MMI_STRING_T label_string2;
  931. //fill label_string2 with "from"
  932. label_str2_len = 512;
  933. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  934. SCI_MEMSET(label_str2_ptr, 0, label_str2_len + 1);
  935. // SCI_TRACE_LOW("fnh in formto is %s",to);
  936.        if(to)
  937.      {
  938.           sprintf(label_str2_ptr, 
  939. ":%sr",to);
  940. // SCI_TRACE_LOW("fnh label_str2_ptr = %s",label_str2_ptr);
  941.    label_string2.is_ucs2 = FALSE;
  942.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  943.    label_string2.length = strlen(label_str2_ptr);
  944.      }
  945. else
  946. {
  947.    sprintf(label_str2_ptr, 
  948. ":%sr"," ");
  949.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  950.    label_string2.is_ucs2 = FALSE;
  951.    label_string2.length =strlen(label_str2_ptr);
  952. }
  953. // CatStringByTextID(&str_dst, TXT_MMS_DETAIL_RCV_TIME, &label_string2);
  954. CatStringByTextID(str_dst, TXT_MMS_DETAIL_TO, &label_string2);
  955. if(label_str2_ptr != PNULL)
  956. {
  957. cms_free(label_str2_ptr);
  958. label_str2_ptr = PNULL;
  959. }
  960. return TRUE;
  961. }
  962. /* ----------------------------------------------------------------------------
  963. * Function Name: Detail_FormPriority
  964. * Purpose: 详情中得到优先级的字符串
  965. * Input:  MMI_STRING_T *str_dst, //out.
  966.   uint8* prioruty
  967. * Returns: BOOLEAN
  968. * Author:nihongf@mobilesoft.com.cn
  969. * ----------------------------------------------------------------------------*/ 
  970. LOCAL BOOLEAN Detail_FormPriority(
  971.                                    MMI_STRING_T *str_dst, //out.
  972. uint32 priority
  973.  )
  974. {
  975. uint32 text_id2 = COMMON_TXT_NULL;
  976. //char end_str[2] = "r";
  977. //MMI_STRING_T dst_str;
  978. //MMI_STRING_T label_string;
  979. //MMI_STRING_T label_string1;
  980. SCI_TRACE_LOW("FNH priority = %d",priority);
  981. switch(priority)
  982. {
  983. case MMS_PRIORITY_VALUE_LOW:
  984. text_id2 = TXT_MMS_PRIORITY_LOW;
  985. CatStringByTextID2(str_dst, TXT_MMS_DETAIL_PRIO, text_id2);
  986. break;
  987. case MMS_PRIORITY_VALUE_NORMAL:
  988. text_id2 = TXT_MMS_PRIORITY_MID;
  989. CatStringByTextID2(str_dst, TXT_MMS_DETAIL_PRIO, text_id2);
  990. break;
  991. case MMS_PRIORITY_VALUE_HIGH:
  992. text_id2 = TXT_MMS_PRIORITY_HIGH;
  993. CatStringByTextID2(str_dst, TXT_MMS_DETAIL_PRIO, text_id2);
  994. break;
  995. default:
  996. {
  997. char* label_str2_ptr = PNULL;
  998. uint32 label_str2_len = 0;
  999. MMI_STRING_T label_string2;
  1000. label_str2_len = 10;
  1001. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  1002. SCI_MEMSET(label_str2_ptr, 0, label_str2_len + 1);
  1003. sprintf(label_str2_ptr, 
  1004. "%sr"," ");
  1005. label_string2.str_ptr = (uint8 *)label_str2_ptr;
  1006. label_string2.is_ucs2 = FALSE;
  1007. label_string2.length =strlen(label_str2_ptr);
  1008. CatStringByTextID(str_dst, TXT_MMS_DETAIL_PRIO, &label_string2);
  1009. }
  1010. break;
  1011. }
  1012. return TRUE;
  1013. }
  1014. /* ----------------------------------------------------------------------------
  1015. * Function Name: Detail_FormExpiry
  1016. * Purpose: 详情中得到有效期的字符串
  1017. * Input:  MMI_STRING_T *str_dst, //out.
  1018.   uint8* expiry
  1019. * Returns: BOOLEAN
  1020. * Author:nihongf@mobilesoft.com.cn
  1021. * ----------------------------------------------------------------------------*/ 
  1022. LOCAL BOOLEAN Detail_FormExpiry(
  1023.                                    MMI_STRING_T *str_dst, //out.
  1024. uint32 expiry
  1025.  )
  1026. {
  1027. char* label_str2_ptr = PNULL;
  1028. uint32 label_str2_len = 0;
  1029. MMI_STRING_T label_string2;
  1030. label_str2_len = 16;
  1031. label_str2_ptr = (char*)cms_malloc(label_str2_len + 1);
  1032. SCI_MEMSET(label_str2_ptr, 0, label_str2_len + 1);
  1033. sprintf(label_str2_ptr,":%ld hoursr",expiry);
  1034.    label_string2.str_ptr = (uint8 *)label_str2_ptr;
  1035.    label_string2.is_ucs2 = FALSE;
  1036.    label_string2.length =SCI_STRLEN((char *)label_str2_ptr);
  1037. CatStringByTextID(str_dst, TXT_MMS_DURATION, &label_string2);
  1038. if(label_str2_ptr != PNULL)
  1039. {
  1040. cms_free(label_str2_ptr);
  1041. label_str2_ptr = PNULL;
  1042. }
  1043. return TRUE;
  1044. }
  1045. /*****************************************************************************/
  1046. //  Description : 5.5.1A Sentbox: message list  window message handler
  1047. // Global resource dependence : 
  1048. //  Author:Bruce.Chi
  1049. //changed liangl for message show
  1050. // Note: 
  1051. /*****************************************************************************/
  1052. LOCAL MMI_RESULT_E  Sentbox_HandleListWinMsg(
  1053. MMS_WINDOW_ID_E win_id, 
  1054. MMI_MESSAGE_ID_E msg_id, 
  1055. DPARAM param
  1056. )
  1057. {
  1058.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  1059. uint16 list_index = 0;
  1060. int i = 0;
  1061. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SENTBOX_LIST_CTRL_ID;
  1062. MMI_STRING_T name_ptr;
  1063. MMI_MENU_GROUP_ID_T group_id = 0;
  1064. MMI_MENU_ID_T menu_id = 0;
  1065. uint16 message_num = 0;
  1066. BOOLEAN is_content_ucs2 = FALSE;
  1067. pMessageList         tlist = PNULL;
  1068. uint8                  listptr[LISTMAXLENGTH];
  1069.     switch(msg_id)
  1070.     {
  1071.     case MSG_FULL_PAINT:
  1072. MMIMMS_CLEAR_CLIENT();
  1073. break;
  1074. case MSG_OPEN_WINDOW:
  1075. // MMK_SetWinSoftkeyId(win_id, STXT_OK, 0, STXT_RETURN, FALSE);
  1076. MMK_SetWinSoftkeyId(win_id, STXT_OPTION, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  1077. message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  1078. if (message_num == 0)
  1079. {
  1080. PUBWIN_OpenPromptAlertWin(
  1081. PUBWIN_SOFTKEY_ONE, 
  1082. TXT_MMS_DRAFTBOX_EMPTY, 
  1083. IMAGE_PROMPT_ICON_WRONG, 
  1084. ALERT_TIMEOUT, 
  1085. PNULL
  1086. );
  1087. MMK_CloseWin(win_id);
  1088. break;
  1089. }
  1090. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  1091. //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
  1092. //SCI_ASSERT(mms_sort_ptr != PNULL);
  1093. if (message_num > 0)
  1094. {
  1095.        tlist = g_pManager->currentfolder->root;
  1096. for(i = 0; i < message_num; i++)
  1097. {
  1098. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  1099. if(tlist == g_pManager->currentfolder->currentmessage)
  1100. {
  1101. list_index = i ;
  1102. }
  1103. if(tlist->to_address != NULL)
  1104. {
  1105. //    SCI_TRACE_LOW("FNH tlist->to_address  = %s",tlist->to_address);
  1106.    SCI_TRACE_LOW("FNH address length = %d",strlen((char *)tlist->to_address));
  1107. }
  1108. else
  1109. {
  1110. SCI_TRACE_LOW("to address is NULL");
  1111. }
  1112. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  1113. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  1114.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  1115. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  1116. {
  1117. // tlist->to_address[LISTMAXLENGTH-1] = '';
  1118.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  1119. }else
  1120. {
  1121.      SCI_STRCPY((char*)listptr,(char*)tlist->to_address);
  1122. }
  1123. // SCI_TRACE_LOW("fnh after strcpy tlist->to_address is %s",tlist->to_address);
  1124. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  1125. {
  1126. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  1127. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  1128. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  1129. AppendListItemWithIcon(
  1130. (uint8 *)name_ptr.str_ptr,
  1131. name_ptr.length,
  1132. IMAGE_READ_MMS_ICON,
  1133. name_ptr.is_ucs2,
  1134. list_ctrl_id,
  1135. STXT_OPTION
  1136. );
  1137. }
  1138. else
  1139. {
  1140. AppendListItemWithIcon(
  1141. listptr,
  1142. SCI_STRLEN((char *)listptr),
  1143. IMAGE_READ_MMS_ICON,
  1144. is_content_ucs2,
  1145. list_ctrl_id,
  1146. STXT_OPTION
  1147. );
  1148. }
  1149. if(tlist->next!=NULL)
  1150. {
  1151.                                   tlist = tlist->next;//这里还要增加意外判断
  1152. }
  1153. else
  1154. {
  1155.      tlist = g_pManager->currentfolder->root;
  1156. }
  1157. if (name_ptr.str_ptr)
  1158. {
  1159. cms_free(name_ptr.str_ptr);
  1160. name_ptr.str_ptr = NULL;
  1161. }
  1162. }
  1163. }
  1164. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1165. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  1166. GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1167.         break;
  1168. case MSG_APP_OK:
  1169.       MMK_TrackPopupMenu(win_id);
  1170.       break; 
  1171. case MSG_GET_FOCUS://be careful, memory leak.
  1172. g_pManager->currentfolder =g_pManager->sentfolder;
  1173.  message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  1174. if (message_num == 0)
  1175. {
  1176. MMK_CloseWin(win_id);
  1177. break;
  1178. }
  1179. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  1180. if (message_num > 0)
  1181. {
  1182.     tlist = g_pManager->currentfolder->root;
  1183. for(i = 0; i < message_num; i++)
  1184. {
  1185. if(tlist == g_pManager->currentfolder->currentmessage)
  1186. {
  1187. list_index = i ;
  1188. }
  1189. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  1190. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  1191.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  1192. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  1193. {
  1194.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  1195. }else
  1196. {
  1197.      SCI_STRCPY((char*)listptr,(char*)tlist->to_address);
  1198. }
  1199. // SCI_TRACE_LOW("fnh get_focus to is %s",tlist->to_address);
  1200. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  1201. {
  1202. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  1203. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  1204. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  1205. AppendListItemWithIcon(
  1206. (uint8 *)name_ptr.str_ptr,
  1207. name_ptr.length,
  1208. IMAGE_READ_MMS_ICON,
  1209. name_ptr.is_ucs2,
  1210. list_ctrl_id,
  1211. STXT_OPTION
  1212. );
  1213. }
  1214. else
  1215. {
  1216. AppendListItemWithIcon(
  1217. listptr,
  1218. SCI_STRLEN((char*)listptr),
  1219. IMAGE_READ_MMS_ICON,
  1220. is_content_ucs2,
  1221. list_ctrl_id,
  1222. STXT_OPTION
  1223. );
  1224. }
  1225. if(tlist->next!=NULL)
  1226. {
  1227.                                   tlist = tlist->next;//这里还要增加意外判断
  1228. }
  1229. else
  1230. {
  1231.      tlist = g_pManager->currentfolder->root;
  1232. }
  1233. if (name_ptr.str_ptr)
  1234. {
  1235. cms_free(name_ptr.str_ptr);
  1236. name_ptr.str_ptr = NULL;
  1237. }
  1238. }
  1239. }
  1240.       GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1241. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  1242. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1243.         break;
  1244. case MSG_LOSE_FOCUS:
  1245. break;
  1246.  
  1247.     case MSG_CTL_OK:
  1248. if ( MMIMMS_SENTBOX_POPMENU_CTRL_ID != (MMI_CTRL_ID_T)param ) 
  1249. {
  1250. break;
  1251. }
  1252.       //get selected list index
  1253. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  1254. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  1255. for(i = 0 ;i < list_index;i++)
  1256. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  1257. }
  1258.       GUIMENU_GetRetID((MMI_CTRL_ID_T)param, &group_id, &menu_id);
  1259.       switch( menu_id )
  1260.   {
  1261.         case ID_MMS_SENTBOX_FORWARD:
  1262. g_filetype = MMICMS_GetCurrentFFS();
  1263. if (g_filetype != FS_INVALID)
  1264. {
  1265. g_readforstate = MMS_MSG_SENTBOX_READ_FOR_FW;
  1266. MMIMMS_CreateReadMMSWaitingWin();
  1267. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1268. }
  1269. break;
  1270. case ID_MMS_SENTBOX_PLAY:
  1271. g_filetype = MMICMS_GetCurrentFFS();
  1272. if (g_filetype != FS_INVALID)
  1273. {
  1274. g_readforstate = MMS_MSG_SENTBOX_READ_FOR_PLAY;
  1275. MMIMMS_CreateReadMMSWaitingWin();
  1276. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1277. }
  1278. break;
  1279.         case ID_MMS_SENTBOX_DEL:
  1280. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  1281.           break;
  1282.         case ID_MMS_SENTBOX_DEL_MORE:
  1283. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  1284.           break;
  1285.         case ID_MMS_SENTBOX_DETAIL:
  1286. MMK_CreateWin((uint32 *)MMIMMS_INBOX_DETAIL_WIN, PNULL);
  1287. break;
  1288.         default:
  1289.           SCI_ASSERT(0);
  1290.           break;
  1291.       }
  1292.       break; 
  1293. case MSG_PROMPTWIN_OK:
  1294. GUIMENU_GetRetID((MMI_CTRL_ID_T)MMIMMS_SENTBOX_POPMENU_CTRL_ID, (MMI_MENU_GROUP_ID_T *)(&group_id),(MMI_MENU_ID_T *) (&menu_id));
  1295. switch(menu_id )
  1296. {
  1297. case ID_MMS_SENTBOX_DEL:
  1298. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  1299. g_savestate = MMS_MSG_SAVEFILE_FOR_SENTBOX_DELETE;
  1300. MMIMMS_CreateNormalWaitingWin();
  1301. MMIMMS_DeleteMMS(g_pManager->currentfolder);
  1302. // MMK_CloseWin(win_id);
  1303. break;
  1304. case ID_MMS_SENTBOX_DEL_MORE:
  1305.               PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  1306. // MMK_CloseWin(win_id);
  1307. g_savestate = MMS_MSG_SAVEFILE_FOR_SENTBOX_DELETE;
  1308. MMIMMS_CreateNormalWaitingWin();
  1309. MMIMMS_DeleteAllMMS(g_pManager->currentfolder);
  1310. break;
  1311. default:
  1312. break;
  1313. }
  1314. break;
  1315. case MSG_MMS_READ_FOR_PLAY:
  1316. {
  1317. g_peditdoc = MMS_New();
  1318. SCI_ASSERT(g_peditdoc != NULL);
  1319. SCI_TRACE_LOW("FNH new mms!");
  1320.                 SCI_TRACE_LOW("FNH before cms_parse_mms");
  1321. cms_parse_mms((char *)g_pManager->currentfolder->currentmessage->filename,g_peditdoc);
  1322. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  1323. mmsf_Remove((char *)g_pManager->currentfolder->currentmessage->filename);
  1324. SCI_TRACE_LOW("FNH after mmsf_Remove");
  1325. if (g_peditdoc->slide_cur == NULL)
  1326. {
  1327. MMSDelDocument(g_peditdoc);
  1328. g_peditdoc = NULL;
  1329. PUBWIN_OpenPromptAlertWin(
  1330. PUBWIN_SOFTKEY_ONE, 
  1331. TXT_MMS_EDIT_NO_CONTENT, 
  1332. IMAGE_PROMPT_ICON_ALERT,
  1333. ALERT_TIMEOUT, 
  1334. PNULL
  1335. );
  1336. break;
  1337. }
  1338. else 
  1339. {
  1340. play_or_preview = MMS_PLAY;//播放
  1341. SCI_TRACE_LOW("FNH before play mms!");
  1342. MMK_CreateWin((uint32 *)MMIMMS_EDIT_PREVIEW_TAB,(ADD_DATA)g_peditdoc);
  1343. }
  1344. break;
  1345. }
  1346. case MSG_MMS_READ_FOR_FW:
  1347. {
  1348. MMSHANDLE p_mmsdoc = NULL;
  1349. int8 from[MAX_NAME_LENGTH];
  1350. SCI_MEMSET(from,0,sizeof(from));
  1351. g_p_mms_subject = (int8 *)cms_malloc(MMIMMS_MAX_SUBJECTS_LEN+1);
  1352. SCI_ASSERT(g_p_mms_subject != NULL);
  1353. SCI_MEMSET(g_p_mms_subject,0,MMIMMS_MAX_SUBJECTS_LEN+1);
  1354.  p_mmsdoc = (MMSHANDLE)MMS_NewMms();
  1355.  if(p_mmsdoc==0)
  1356. {
  1357. return err_code;
  1358. }
  1359. if (g_pManager->currentfolder->currentmessage->subject!= NULL)
  1360. {
  1361. uint16 outlen = 0;
  1362. uint8 * uni_16 =PNULL;
  1363. outlen =  Cms_UTF8toUTF16Len(g_pManager->currentfolder->currentmessage->subject);
  1364. uni_16 =(uint8 *)cms_malloc(outlen);
  1365. SCI_MEMSET(uni_16,0,outlen);
  1366. Cms_UTF8toUTF16(g_pManager->currentfolder->currentmessage->subject,SCI_STRLEN((char *)g_pManager->currentfolder->currentmessage->subject),outlen,uni_16);
  1367. if (outlen > MMIMMS_MAX_SUBJECTS_LEN-2)
  1368. {
  1369. outlen = MMIMMS_MAX_SUBJECTS_LEN-2;
  1370. }
  1371. SCI_MEMCPY(g_p_mms_subject,&outlen,2);
  1372. SCI_MEMCPY((int8 *)(g_p_mms_subject+2),uni_16,outlen); 
  1373. SCI_TRACE_BUF("FNH g_p_mms_subject = ",g_p_mms_subject,10);
  1374. if (uni_16)
  1375. {
  1376. cms_free(uni_16);
  1377. uni_16 = NULL;
  1378. }
  1379. MMIMMS_OptionSubject(MMSFW);
  1380. }
  1381. else
  1382. {
  1383. MMIMMS_OptionSubject(MMSFW);
  1384. }
  1385. MMS_SetMmsFile(p_mmsdoc, (char *)g_pManager->currentfolder->currentmessage->filename);
  1386. /* 获得发件人信息,作为收件人 */
  1387.  MMS_DecodeMms(p_mmsdoc); 
  1388. /* 删除临时彩信文档 */
  1389. MMS_DeleteMms(p_mmsdoc);
  1390. g_peditdoc = MMS_New();
  1391. SCI_ASSERT(g_peditdoc != NULL);
  1392. SCI_TRACE_LOW("FNH before cms_parse_mms");
  1393. cms_parse_mms((char *)g_pManager->currentfolder->currentmessage->filename,g_peditdoc);
  1394. mmsf_Remove((char *)g_pManager->currentfolder->currentmessage->filename);
  1395. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  1396. // MMK_CreateWin((uint32 *)MMIMMS_EDIT_OPTION_TAB,PNULL);
  1397. g_mms_edit_status = MMS_EDIT_FORWARD_MMS;
  1398. MMK_CreateWin((uint32 *)MMIMMS_EDIT_WIN_TAB,PNULL);
  1399. }
  1400. break;
  1401. case MSG_PROMPTWIN_CANCEL:
  1402. //close query window
  1403. PUBWIN_ClosePromptQueryWin();
  1404. break;
  1405. case MSG_CTL_DBCLICK:
  1406. // if ( MMIMMS_SENTBOX_POPMENU_CTRL_ID != (MMI_CTRL_ID_T)param ) 
  1407. // {
  1408. // break;
  1409. // }
  1410.       //get selected list index
  1411. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  1412. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  1413. for(i = 0 ;i < list_index;i++)
  1414. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  1415. }
  1416. g_readforstate = MMS_MSG_SENTBOX_READ_FOR_PLAY;
  1417. MMIMMS_CreateReadMMSWaitingWin();
  1418. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1419. break;
  1420.             
  1421. case MSG_APP_CANCEL:
  1422. case MSG_CTL_CANCEL:
  1423. if(MMK_GetActiveCtrlId(win_id) == MMIMMS_SENTBOX_POPMENU_CTRL_ID)
  1424. {
  1425.        uint8 i = 4;
  1426.  uint32 j = 0x00ad0002;
  1427. MMK_SetAtvCtrl(win_id, MMIMMS_SENTBOX_LIST_CTRL_ID);
  1428. MMK_PostMsg(win_id, MSG_TP_PRESS_DOWN, (DPARAM)&j, i);
  1429. }
  1430. else
  1431. {
  1432.          MMK_CloseWin(win_id);
  1433. }           //cloud6
  1434. break;
  1435. case MSG_CLOSE_WINDOW:
  1436. /* 删除编辑器资源 */
  1437. if(g_peditdoc != NULL)
  1438. {
  1439. MMSDelDocument(g_peditdoc);
  1440. SCI_TRACE_LOW("FNH after free MMS!");
  1441. g_peditdoc = NULL;
  1442. }
  1443. break;
  1444.         
  1445. default:
  1446. err_code = MMI_RESULT_FALSE;
  1447. break;
  1448.         }
  1449.        
  1450. return err_code;
  1451. }
  1452. /*****************************************************************************/
  1453. //  Description : 5.7.1A Outbox: message list  window message handler
  1454. // Global resource dependence : 
  1455. //  Author:Bruce.Chi
  1456. //changed liangl for messsage show
  1457. // Note: 
  1458. /*****************************************************************************/
  1459. LOCAL MMI_RESULT_E  Outbox_HandleListWinMsg(
  1460. MMS_WINDOW_ID_E win_id, 
  1461. MMI_MESSAGE_ID_E msg_id, 
  1462. DPARAM param
  1463. )
  1464. {
  1465.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  1466. uint16 list_index = 0;
  1467. int i = 0;
  1468. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_OUTBOX_LIST_CTRL_ID;
  1469. uint16 message_num = 0;
  1470. BOOLEAN is_content_ucs2 = FALSE;
  1471. pMessageList         tlist = PNULL;
  1472. MMI_STRING_T name_ptr;
  1473. MMI_MENU_ID_T       menu_id  = 0;
  1474.     MMI_MENU_GROUP_ID_T group_id = 0;
  1475. uint8                  listptr[LISTMAXLENGTH];      
  1476.     switch(msg_id)
  1477.     {
  1478.     case MSG_FULL_PAINT:
  1479. MMIMMS_CLEAR_CLIENT();
  1480. break;
  1481. case MSG_OPEN_WINDOW:
  1482. MMK_SetWinSoftkeyId(win_id, STXT_OPTION, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  1483. message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  1484. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;//modify 2005-12-2
  1485. if (message_num == 0)
  1486. {
  1487. MMK_CloseWin(win_id);
  1488. break;
  1489. }
  1490. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  1491. if (message_num > 0)
  1492. {
  1493.        tlist = g_pManager->currentfolder->root;
  1494. for(i = 0; i < message_num; i++)
  1495. {
  1496. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  1497. if(tlist == g_pManager->currentfolder->currentmessage)
  1498. {
  1499. list_index = i ;
  1500. }
  1501. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  1502. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  1503.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  1504. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  1505. {
  1506.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  1507. }else
  1508. {
  1509.      SCI_STRCPY((char*)listptr,(char*)tlist->to_address);
  1510. }
  1511. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  1512. {
  1513. SCI_TRACE_LOW("fnh get pb_name = %s",name_ptr.str_ptr);
  1514. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  1515. AppendListItemWithIcon(
  1516. (uint8 *)name_ptr.str_ptr,
  1517. name_ptr.length,
  1518. IMAGE_READ_MMS_ICON,
  1519. name_ptr.is_ucs2,
  1520. list_ctrl_id,
  1521. STXT_OPTION
  1522. );
  1523. }
  1524. else
  1525. {
  1526. AppendListItemWithIcon(
  1527. listptr,
  1528. SCI_STRLEN((char*)listptr),
  1529. IMAGE_READ_MMS_ICON,
  1530. is_content_ucs2,
  1531. list_ctrl_id,
  1532. STXT_OPTION
  1533. );
  1534. }
  1535. if(tlist->next!=NULL)
  1536. {
  1537.                                   tlist = tlist->next;//这里还要增加意外判断
  1538. }
  1539. else
  1540. {
  1541.      tlist = g_pManager->currentfolder->root;
  1542. }
  1543. if (name_ptr.str_ptr)
  1544. {
  1545. cms_free(name_ptr.str_ptr);
  1546. name_ptr.str_ptr = NULL;
  1547. }
  1548. }
  1549. }
  1550. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1551. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  1552. GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1553.         break;
  1554. case MSG_GET_FOCUS://be careful, memory leak.
  1555. //total_num = MMIMMS_GetMailboxMsgNum(MMIMESSAGE_INBOX);
  1556. g_pManager->currentfolder =g_pManager->outboxfolder;
  1557.  message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  1558. if (message_num == 0)
  1559. {
  1560. MMK_CloseWin(win_id);
  1561. break;
  1562. }
  1563. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  1564. //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
  1565. //SCI_ASSERT(mms_sort_ptr != PNULL);
  1566. if (message_num > 0)
  1567. {
  1568.        tlist = g_pManager->currentfolder->root;
  1569. for(i = 0; i < message_num; i++)
  1570. {
  1571. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  1572. if(tlist == g_pManager->currentfolder->currentmessage)
  1573. {
  1574. list_index = i ;
  1575. }
  1576. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  1577. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  1578.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  1579. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  1580. {
  1581.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  1582. }else
  1583. {
  1584.      SCI_STRCPY((char*)listptr,(char*)tlist->to_address);
  1585. }
  1586. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  1587. {
  1588. SCI_TRACE_LOW("fnh get pb_name = %s",name_ptr.str_ptr);
  1589. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  1590. AppendListItemWithIcon(
  1591. (uint8 *)name_ptr.str_ptr,
  1592. name_ptr.length,
  1593. IMAGE_READ_MMS_ICON,
  1594. name_ptr.is_ucs2,
  1595. list_ctrl_id,
  1596. STXT_OPTION
  1597. );
  1598. }
  1599. else
  1600. {
  1601. AppendListItemWithIcon(
  1602. listptr,
  1603. SCI_STRLEN((char*)listptr),
  1604. IMAGE_READ_MMS_ICON,
  1605. is_content_ucs2,
  1606. list_ctrl_id,
  1607. STXT_OPTION
  1608. );
  1609. }
  1610. if(tlist->next!=NULL)
  1611. {
  1612.                                   tlist = tlist->next;//这里还要增加意外判断
  1613. }
  1614. else
  1615. {
  1616.      tlist = g_pManager->currentfolder->root;
  1617. }
  1618. if (name_ptr.str_ptr)
  1619. {
  1620. cms_free(name_ptr.str_ptr);
  1621. name_ptr.str_ptr = NULL;
  1622. }
  1623. }
  1624. }
  1625.       GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1626. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  1627. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  1628.         break;
  1629. case MSG_LOSE_FOCUS:
  1630. break;
  1631.  
  1632. case MSG_APP_OK:
  1633. if(MMK_GetActiveCtrlId(win_id) != MMIMMS_OUTBOX_POPMENU_CTRL_ID)
  1634.       MMK_TrackPopupMenu(win_id);
  1635.       break;
  1636.   
  1637.     case MSG_CTL_OK:
  1638. if ( MMIMMS_OUTBOX_POPMENU_CTRL_ID != (MMI_CTRL_ID_T)param ) 
  1639. {
  1640. break;
  1641. }
  1642.       //get selected list index
  1643.       list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  1644. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  1645. for(i = 0 ;i < list_index;i++)
  1646. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  1647. }
  1648.       GUIMENU_GetRetID((MMI_CTRL_ID_T)param, &group_id, &menu_id);
  1649.       switch( menu_id )
  1650.   {
  1651.         case ID_MMS_OUTBOX_SEND:
  1652.             if (CC_IsInCall())
  1653. {
  1654. //alert : TXT_MMS_CANNOT_SEND_IN_CALL
  1655. PUBWIN_OpenPromptAlertWin(
  1656. PUBWIN_SOFTKEY_ONE, 
  1657. TXT_MMS_CANNOT_SEND_IN_CALL, 
  1658. IMAGE_PROMPT_ICON_ALERT, 
  1659. ALERT_TIMEOUT, 
  1660. PNULL
  1661. );
  1662. }
  1663. else
  1664. {
  1665. g_filetype = MMICMS_GetCurrentFFS();
  1666. if (g_filetype != FS_INVALID)
  1667. {
  1668. g_readforstate = MMS_MSG_OUTBOX_READ_FOR_SEND;
  1669. MMIMMS_CreateReadMMSWaitingWin();
  1670. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1671. }
  1672. break;
  1673. }
  1674. break;
  1675. case ID_MMS_OUTBOX_PLAY:
  1676. g_filetype = MMICMS_GetCurrentFFS();
  1677. if (g_filetype != FS_INVALID)
  1678. {
  1679. g_readforstate = MMS_MSG_OUTBOX_READ_FOR_PLAY;
  1680. MMIMMS_CreateReadMMSWaitingWin();
  1681. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1682. }
  1683. break;
  1684.         case ID_MMS_OUTBOX_EDIT:
  1685. g_filetype = MMICMS_GetCurrentFFS();
  1686. if (g_filetype != FS_INVALID)
  1687. {
  1688. g_readforstate = MMS_MSG_OUTBOX_READ_FOR_EDIT;
  1689. MMIMMS_CreateReadMMSWaitingWin();
  1690. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1691. }
  1692.           break;
  1693.         case ID_MMS_OUTBOX_DEL:
  1694.           PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  1695.           break;
  1696.         case ID_MMS_OUTBOX_DEL_MORE:
  1697. PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  1698.           break;
  1699.         default:
  1700.           SCI_ASSERT(0);
  1701.           break;
  1702.       }
  1703.       break;
  1704. case MSG_MMS_READ_FOR_SEND:
  1705. if (CC_IsInCall()) //judge whether it's making a call
  1706. {
  1707. //alert : TXT_MMS_CANNOT_SEND_IN_CALL
  1708. PUBWIN_OpenPromptAlertWin(
  1709. PUBWIN_SOFTKEY_ONE, 
  1710. TXT_MMS_CANNOT_SEND_IN_CALL, 
  1711. IMAGE_PROMPT_ICON_ALERT, 
  1712. ALERT_TIMEOUT, 
  1713. PNULL
  1714. );
  1715. }
  1716. else if (! (MMISMS_IsReady() && MMISMS_IsOrderOk())) //judge whether sms_order ready
  1717. {
  1718. PUBWIN_OpenPromptAlertWin(
  1719. PUBWIN_SOFTKEY_ONE,
  1720. TXTSYS_WAITING,
  1721. IMAGE_PROMPT_ICON_WAIT,
  1722. MMISMS_3SECOND, PNULL
  1723. );   
  1724. }
  1725. else
  1726. {
  1727. g_mailbox_status = SEND_OUTBOX_MMS;
  1728. g_progressneedsize = g_pManager->currentfolder->currentmessage->size;
  1729. MMIMMS_SendMMS_CreateSendingWin();
  1730. g_netusing = MMS_MSG_NETUSING_STEP1;//modify 2006-2-10 liangliu
  1731. CmsSendMessage(SEND_OUTBOX_MMS);
  1732. // MMK_CloseWin(win_id);//liangliu modify 2005-12-2
  1733. }
  1734. break;
  1735. case MSG_MMS_READ_FOR_PLAY:
  1736. {
  1737. g_peditdoc = MMS_New();
  1738. SCI_ASSERT(g_peditdoc != NULL);
  1739. SCI_TRACE_LOW("FNH new mms!");
  1740. SCI_TRACE_LOW("FNH before cms_parse_mms");
  1741. cms_parse_mms((char *)g_pManager->currentfolder->currentmessage->filename,g_peditdoc);
  1742. mmsf_Remove((char *)g_pManager->currentfolder->currentmessage->filename);
  1743. //SCI_MEMSET(g_peditdoc, 0, sizeof(MMS_EDOCUMENT) );
  1744. //cms_parse_mms(transit_filename,g_peditdoc);
  1745. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  1746. if (g_peditdoc->slide_cur == NULL)
  1747. {
  1748. MMSDelDocument(g_peditdoc);
  1749. g_peditdoc = NULL;
  1750. PUBWIN_OpenPromptAlertWin(
  1751. PUBWIN_SOFTKEY_ONE, 
  1752. TXT_MMS_EDIT_NO_CONTENT, 
  1753. IMAGE_PROMPT_ICON_ALERT,
  1754. ALERT_TIMEOUT, 
  1755. PNULL
  1756. );
  1757. break;
  1758. }
  1759. else 
  1760. {
  1761. play_or_preview = MMS_PLAY;//播放
  1762. SCI_TRACE_LOW("FNH before play mms!");
  1763. MMK_CreateWin((uint32 *)MMIMMS_EDIT_PREVIEW_TAB,(ADD_DATA)g_peditdoc);
  1764. }
  1765. }
  1766. break;
  1767. case MSG_MMS_READ_FOR_EDIT:
  1768. {
  1769. g_peditdoc = MMS_New();
  1770. SCI_ASSERT(g_peditdoc != NULL);
  1771. SCI_TRACE_LOW("FNH new mms!");
  1772. g_p_mms_subject = (int8 *)cms_malloc(MMIMMS_MAX_SUBJECTS_LEN+1);
  1773. SCI_ASSERT(g_p_mms_subject != NULL);
  1774. SCI_MEMSET(g_p_mms_subject,0,MMIMMS_MAX_SUBJECTS_LEN+1);
  1775. if (g_pManager->currentfolder->currentmessage->subject!= NULL)
  1776. {
  1777. uint16 outlen = 0;
  1778. uint8 * uni_16 =PNULL;
  1779. outlen =  Cms_UTF8toUTF16Len(g_pManager->currentfolder->currentmessage->subject);
  1780. uni_16 =(uint8 *)cms_malloc(outlen);
  1781. SCI_MEMSET(uni_16,0,outlen);
  1782. Cms_UTF8toUTF16(g_pManager->currentfolder->currentmessage->subject,SCI_STRLEN((char *)g_pManager->currentfolder->currentmessage->subject),outlen,uni_16);
  1783. if (outlen > MMIMMS_MAX_SUBJECTS_LEN-2)
  1784. {
  1785. outlen = MMIMMS_MAX_SUBJECTS_LEN-2;
  1786. }
  1787. SCI_MEMCPY(g_p_mms_subject,&outlen,2);
  1788. SCI_MEMCPY((int8 *)(g_p_mms_subject+2),uni_16,outlen); 
  1789. SCI_TRACE_BUF("FNH g_p_mms_subject = ",g_p_mms_subject,10);
  1790. if (uni_16)
  1791. {
  1792. cms_free(uni_16);
  1793. uni_16 = NULL;
  1794. }
  1795. MMIMMS_OptionSubject(MMSEDIT);
  1796. }
  1797. if ((g_pManager->currentfolder->currentmessage->to_address != NULL) 
  1798. && (strcmp((char *)g_pManager->currentfolder->currentmessage->to_address ,MMIMMS_UNKNOWN_SENDER)!=0))
  1799. {
  1800. g_p_mms_to = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  1801. SCI_MEMSET(g_p_mms_to,0,sizeof(MMS_RECEPIENT));
  1802. CmsMmsParseRecepient(g_p_mms_to,(char *)g_pManager->currentfolder->currentmessage->to_address);
  1803. }
  1804. if (g_pManager->currentfolder->currentmessage->cc_address != NULL)
  1805. {
  1806. g_p_mms_cc = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  1807. SCI_MEMSET(g_p_mms_cc,0,sizeof(MMS_RECEPIENT));
  1808. CmsMmsParseRecepient(g_p_mms_cc,(char *)g_pManager->currentfolder->currentmessage->cc_address);
  1809. }
  1810. if (g_pManager->currentfolder->currentmessage->bcc_address != NULL)
  1811. {
  1812. g_p_mms_bcc = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  1813. SCI_MEMSET(g_p_mms_bcc,0,sizeof(MMS_RECEPIENT));
  1814. CmsMmsParseRecepient(g_p_mms_bcc,(char *)g_pManager->currentfolder->currentmessage->bcc_address);
  1815. }
  1816. SCI_TRACE_LOW("before cms_parse_mms");
  1817. SCI_TRACE_LOW("fnh filename = %s",g_pManager->currentfolder->currentmessage->filename);
  1818. cms_parse_mms((char *)g_pManager->currentfolder->currentmessage->filename,g_peditdoc);
  1819. SCI_TRACE_LOW("fnh g_peditdoc->slide_cur = %d",g_peditdoc->slide_cur);
  1820. mmsf_Remove((char *)g_pManager->currentfolder->currentmessage->filename);
  1821. // cms_parse_mms((char *)transit_filename,g_peditdoc);
  1822. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  1823. // MMK_CreateWin((uint32 *)MMIMMS_EDIT_OPTION_TAB,PNULL);
  1824. g_mms_edit_status = MMS_EDIT_REPEAT_EDIT_MMS;
  1825. MMK_CreateWin((uint32 *)MMIMMS_EDIT_WIN_TAB,PNULL);
  1826. }
  1827. break;
  1828.     
  1829. case MSG_PROMPTWIN_OK:
  1830. GUIMENU_GetRetID((MMI_CTRL_ID_T)MMIMMS_OUTBOX_POPMENU_CTRL_ID, (MMI_MENU_GROUP_ID_T *)(&group_id),(MMI_MENU_ID_T *) (&menu_id));
  1831. switch(menu_id)
  1832. {
  1833. case ID_MMS_OUTBOX_DEL:
  1834. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  1835. g_savestate = MMS_MSG_SAVEFILE_FOR_OUTBOX_DELETE;
  1836. MMIMMS_CreateNormalWaitingWin();
  1837. MMIMMS_DeleteMMS(g_pManager->currentfolder);
  1838. // MMK_CloseWin(win_id);
  1839. break;
  1840. case ID_MMS_OUTBOX_DEL_MORE:
  1841. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  1842. // MMK_CloseWin(win_id);
  1843. g_savestate = MMS_MSG_SAVEFILE_FOR_OUTBOX_DELETE;
  1844. MMIMMS_CreateNormalWaitingWin();
  1845. MMIMMS_DeleteAllMMS(g_pManager->currentfolder);
  1846. break;
  1847. default:
  1848. break;
  1849. }
  1850. break;
  1851. case MSG_PROMPTWIN_CANCEL:
  1852. //close query window
  1853. PUBWIN_ClosePromptQueryWin();
  1854. break;
  1855. case MSG_APP_CANCEL:
  1856. case MSG_CTL_CANCEL:
  1857. if(MMK_GetActiveCtrlId(win_id) == MMIMMS_OUTBOX_POPMENU_CTRL_ID)
  1858. {
  1859.        uint8 i = 4;
  1860.  uint32 j = 0x00ad0002;
  1861. MMK_SetAtvCtrl(win_id, MMIMMS_OUTBOX_LIST_CTRL_ID);
  1862. MMK_PostMsg(win_id, MSG_TP_PRESS_DOWN, (DPARAM)&j, i);
  1863. }
  1864. else
  1865. {
  1866.          MMK_CloseWin(win_id);
  1867. }           //cloud6   
  1868. /* FILENAME */
  1869. break;
  1870. case MSG_CTL_DBCLICK:
  1871. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  1872. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  1873. for(i = 0 ;i < list_index;i++)
  1874. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  1875. }
  1876. g_readforstate = MMS_MSG_OUTBOX_READ_FOR_PLAY;
  1877. MMIMMS_CreateReadMMSWaitingWin();
  1878. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  1879.         break;
  1880.         
  1881. default:
  1882. err_code = MMI_RESULT_FALSE;
  1883. break;
  1884.         }
  1885.        
  1886. return err_code;
  1887. }
  1888. /*****************************************************************************/
  1889. //  Description : 5.7.1A DraftBox : list of draft  window message handler
  1890. // Global resource dependence : 
  1891. //  Author:Bruce.Chi
  1892. // changed liangl for message show
  1893. // Note: 
  1894. /*****************************************************************************/
  1895. LOCAL MMI_RESULT_E  DraftBox_HandleListWinMsg(
  1896. MMS_WINDOW_ID_E win_id, 
  1897. MMI_MESSAGE_ID_E msg_id, 
  1898. DPARAM param
  1899.   )
  1900. {
  1901.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  1902. uint16 list_index = 0;
  1903. int i = 0;
  1904. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_DRAFTBOX_LIST_CTRL_ID;
  1905. MMI_STRING_T name_ptr;
  1906. MMI_MENU_ID_T       menu_id  = 0;
  1907.     MMI_MENU_GROUP_ID_T group_id = 0;
  1908.     
  1909. uint16 message_num = 0;
  1910. BOOLEAN is_content_ucs2 = FALSE;
  1911. pMessageList         tlist = PNULL;
  1912. uint8                  listptr[LISTMAXLENGTH];
  1913.     switch(msg_id)
  1914.     {
  1915.     case MSG_FULL_PAINT:
  1916. MMIMMS_CLEAR_CLIENT();
  1917. break;
  1918. case MSG_OPEN_WINDOW:
  1919. // MMK_SetWinSoftkeyId(win_id, STXT_OK, 0, STXT_RETURN, FALSE);
  1920. MMK_SetWinSoftkeyId(win_id, STXT_OPTION, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  1921. g_pManager->currentfolder =g_pManager->draftfolder; 
  1922. message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  1923.  g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;//modify 2006-2-16
  1924.  
  1925.  SCI_TRACE_LOW("message number is %d",message_num);
  1926. if (message_num == 0)
  1927. {
  1928. // PUBWIN_OpenPromptAlertWin(
  1929. // PUBWIN_SOFTKEY_ONE, 
  1930. // TXT_MMS_DRAFTBOX_EMPTY, 
  1931. // IMAGE_PROMPT_ICON_WRONG, 
  1932. // ALERT_TIMEOUT, 
  1933. // PNULL
  1934. // );
  1935. MMK_CloseWin(win_id);
  1936. break;
  1937. }
  1938. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  1939. //mms_sort_ptr = MMIMMS_Sort(MMIMESSAGE_INBOX, &message_num);
  1940. //SCI_ASSERT(mms_sort_ptr != PNULL);
  1941. if (message_num > 0)
  1942. {
  1943.        tlist = g_pManager->currentfolder->root;
  1944. for(i = 0; i < message_num; i++)
  1945. {
  1946. //is_content_ucs2 = ((mms_sort_ptr[i].status_flag & FLAG_MMS_CONTENT_IS_UCS2) != 0) ? TRUE : FALSE;
  1947. if(tlist == g_pManager->currentfolder->currentmessage)
  1948. {
  1949. list_index = i ;
  1950. }
  1951. if(tlist->to_address != NULL)
  1952. {
  1953. //    SCI_TRACE_LOW("FNH tlist->to_address  = %s",tlist->to_address);
  1954.    SCI_TRACE_LOW("FNH address length = %d",strlen((char *)tlist->to_address));
  1955. }
  1956. else
  1957. {
  1958. SCI_TRACE_LOW("to address is NULL");
  1959. }
  1960. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  1961. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  1962.                             SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  1963. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  1964. {
  1965.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  1966. }else
  1967. {
  1968.      SCI_STRCPY((char*)listptr,(char*)tlist->to_address);
  1969. }
  1970. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  1971. {
  1972. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  1973. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  1974. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  1975. AppendListItemWithIcon(
  1976. (uint8 *)name_ptr.str_ptr,
  1977. name_ptr.length,
  1978. IMAGE_READ_MMS_ICON,
  1979. name_ptr.is_ucs2,
  1980. list_ctrl_id,
  1981. STXT_OPTION
  1982. );
  1983. }
  1984. else
  1985. {
  1986. AppendListItemWithIcon(
  1987. listptr,
  1988. SCI_STRLEN((char*)listptr),
  1989. IMAGE_READ_MMS_ICON,
  1990. is_content_ucs2,
  1991. list_ctrl_id,
  1992. STXT_OPTION
  1993. );
  1994. }
  1995. if(tlist->next!=NULL)
  1996. {
  1997.                                   tlist = tlist->next;//这里还要增加意外判断
  1998. }
  1999. else
  2000. {
  2001.      tlist = g_pManager->currentfolder->root;
  2002. }
  2003. if (name_ptr.str_ptr)
  2004. {
  2005. cms_free(name_ptr.str_ptr);
  2006. name_ptr.str_ptr = NULL;
  2007. }
  2008. }
  2009. }
  2010. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  2011. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2012. GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  2013.         break;
  2014. case MSG_GET_FOCUS://be careful, memory leak.
  2015. g_pManager->currentfolder =g_pManager->draftfolder;
  2016.  message_num = MMIMMS_GetMessageNum(g_pManager->currentfolder);
  2017. if (message_num == 0)
  2018. {
  2019. // PUBWIN_OpenPromptAlertWin(
  2020. // PUBWIN_SOFTKEY_ONE, 
  2021. // TXT_MMS_DRAFTBOX_EMPTY, 
  2022. // IMAGE_PROMPT_ICON_WRONG, 
  2023. // ALERT_TIMEOUT, 
  2024. // PNULL
  2025. // );
  2026. MMK_CloseWin(win_id);
  2027. break;
  2028. }
  2029. GUILISTBOX_SetMaxItem(list_ctrl_id, MMIMMS_MAX_MMS_AND_MMSNOTI_NUM);
  2030. if (message_num > 0)
  2031. {
  2032.        tlist = g_pManager->currentfolder->root;
  2033. for(i = 0; i < message_num; i++)
  2034. {
  2035. if(tlist == g_pManager->currentfolder->currentmessage)
  2036. {
  2037. list_index = i ;
  2038. }
  2039. SCI_MEMSET(&name_ptr, 0, sizeof(MMI_STRING_T));
  2040. name_ptr.str_ptr = cms_malloc(MMIPB_NAME_MAX_LEN);
  2041.  SCI_MEMSET(listptr, 0, LISTMAXLENGTH)
  2042. if(SCI_STRLEN((char*)tlist->to_address) > LISTMAXLENGTH)
  2043. {
  2044.       strncpy((char*)listptr,(char*)tlist->to_address,LISTMAXLENGTH);
  2045. }else
  2046. {
  2047.      SCI_STRCPY((char*)listptr, (char*)tlist->to_address);
  2048. }
  2049. if (MMIMMS_GetPBNameByNumber(listptr,&name_ptr)== 1) //从电话簿中选择与号码匹配的名字
  2050. {
  2051. SCI_TRACE_BUF("fnh get pb_name = %x",name_ptr.str_ptr,10);
  2052. SCI_TRACE_LOW("FNH GET PB_NAME_LENGTH = %d",name_ptr.length);
  2053. SCI_TRACE_LOW("FNH is_ucs2 = %d",name_ptr.is_ucs2);
  2054. AppendListItemWithIcon(
  2055. (uint8 *)name_ptr.str_ptr,
  2056. name_ptr.length,
  2057. IMAGE_READ_MMS_ICON,
  2058. name_ptr.is_ucs2,
  2059. list_ctrl_id,
  2060. STXT_OPTION
  2061. );
  2062. }
  2063. else
  2064. {
  2065. AppendListItemWithIcon(
  2066. listptr,
  2067. SCI_STRLEN((char *)listptr),
  2068. IMAGE_READ_MMS_ICON,
  2069. is_content_ucs2,
  2070. list_ctrl_id,
  2071. STXT_OPTION
  2072. );
  2073. }
  2074. if(tlist->next!=NULL)
  2075. {
  2076.                                   tlist = tlist->next;//这里还要增加意外判断
  2077. }
  2078. else
  2079. {
  2080.      tlist = g_pManager->currentfolder->root;
  2081. }
  2082. if (name_ptr.str_ptr)
  2083. {
  2084. cms_free(name_ptr.str_ptr);
  2085. name_ptr.str_ptr = NULL;
  2086. }
  2087. }
  2088. }
  2089.       GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  2090. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2091. //GUILISTBOX_SetCurItemIndex(list_ctrl_id,list_index);
  2092.         break;
  2093. case MSG_LOSE_FOCUS:
  2094. break;
  2095.   
  2096. case MSG_APP_OK:
  2097. if(MMK_GetActiveCtrlId(win_id) != MMIMMS_DRAFTBOX_POPMENU_CTRL_ID)
  2098.       MMK_TrackPopupMenu(win_id);
  2099.       break;
  2100.   
  2101.     case MSG_CTL_OK:
  2102. if ( MMIMMS_DRAFTBOX_POPMENU_CTRL_ID != (MMI_CTRL_ID_T)param ) 
  2103. {
  2104. break;
  2105. }
  2106. //get selected list index
  2107. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2108. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  2109. for(i = 0 ;i < list_index;i++)
  2110. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  2111. }
  2112. GUIMENU_GetRetID((MMI_CTRL_ID_T)param, &group_id, &menu_id);
  2113. switch( menu_id )
  2114. {
  2115.         case ID_MMS_DRAFTBOX_SEND:
  2116.             
  2117.           break;
  2118.         case ID_MMS_DRAFTBOX_EDIT:
  2119.         g_filetype = MMICMS_GetCurrentFFS();
  2120. if (g_filetype != FS_INVALID)
  2121. {
  2122. g_readforstate = MMS_MSG_DRAFTBOX_READ_FOR_EDIT;
  2123. MMIMMS_CreateReadMMSWaitingWin();
  2124. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  2125. }
  2126.           break;
  2127.         case ID_MMS_DRAFTBOX_DEL:
  2128.           PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  2129.           break;
  2130.         
  2131.         case ID_MMS_DRAFTBOX_DEL_MORE:
  2132.   PUBWIN_OpenPromptQueryWin(TXT_MMS_IF_DEL, IMAGE_PROMPT_ICON_QUERY);
  2133.           break;  
  2134.         default:
  2135.           SCI_ASSERT(0);
  2136.           break;
  2137.       }
  2138.       break;
  2139. case MSG_MMS_READ_FOR_EDIT:
  2140. {
  2141. g_peditdoc = MMS_New();
  2142. SCI_ASSERT(g_peditdoc != NULL);
  2143. SCI_TRACE_LOW("draftbox message read for edit!");
  2144. g_p_mms_subject = (int8 *)cms_malloc(MMIMMS_MAX_SUBJECTS_LEN+1);
  2145. SCI_ASSERT(g_p_mms_subject != NULL);
  2146. SCI_MEMSET(g_p_mms_subject,0,MMIMMS_MAX_SUBJECTS_LEN+1);
  2147. if (g_pManager->currentfolder->currentmessage->subject!= NULL)
  2148. {
  2149. uint16 outlen = 0;
  2150. uint8 * uni_16 =PNULL;
  2151. outlen =  Cms_UTF8toUTF16Len(g_pManager->currentfolder->currentmessage->subject);
  2152. uni_16 = cms_malloc(outlen);
  2153. SCI_MEMSET(uni_16,0,outlen);
  2154. Cms_UTF8toUTF16(g_pManager->currentfolder->currentmessage->subject,SCI_STRLEN((char *)g_pManager->currentfolder->currentmessage->subject),outlen,uni_16);
  2155. if (outlen > MMIMMS_MAX_SUBJECTS_LEN-2)
  2156. {
  2157. outlen = MMIMMS_MAX_SUBJECTS_LEN-2;
  2158. }
  2159. SCI_MEMCPY(g_p_mms_subject,&outlen,2);
  2160. SCI_MEMCPY((int8 *)(g_p_mms_subject+2),uni_16,outlen); 
  2161. SCI_TRACE_BUF("FNH g_p_mms_subject = ",g_p_mms_subject,10);
  2162. if (uni_16)
  2163. {
  2164. cms_free(uni_16);
  2165. uni_16 = NULL;
  2166. }
  2167. MMIMMS_OptionSubject(MMSEDIT);
  2168. }
  2169. if ((g_pManager->currentfolder->currentmessage->to_address != NULL) 
  2170. && (strcmp((char *)g_pManager->currentfolder->currentmessage->to_address ,MMIMMS_UNKNOWN_SENDER)!=0))
  2171. {
  2172. g_p_mms_to = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  2173. SCI_MEMSET(g_p_mms_to,0,sizeof(MMS_RECEPIENT));
  2174. CmsMmsParseRecepient(g_p_mms_to,(char *)g_pManager->currentfolder->currentmessage->to_address);
  2175. }
  2176. if (g_pManager->currentfolder->currentmessage->cc_address != NULL)
  2177. {
  2178. g_p_mms_cc = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  2179. SCI_MEMSET(g_p_mms_cc,0,sizeof(MMS_RECEPIENT));
  2180. CmsMmsParseRecepient(g_p_mms_cc,(char *)g_pManager->currentfolder->currentmessage->cc_address);
  2181. }
  2182. if (g_pManager->currentfolder->currentmessage->bcc_address != NULL)
  2183. {
  2184. g_p_mms_bcc = (p_MMS_RECEPIENT)cms_malloc(sizeof(MMS_RECEPIENT));
  2185. SCI_MEMSET(g_p_mms_bcc,0,sizeof(MMS_RECEPIENT));
  2186. CmsMmsParseRecepient(g_p_mms_bcc,(char *)g_pManager->currentfolder->currentmessage->bcc_address);
  2187. }
  2188. cms_parse_mms((char *)g_pManager->currentfolder->currentmessage->filename,g_peditdoc);
  2189. mmsf_Remove((char *)g_pManager->currentfolder->currentmessage->filename);
  2190. // cms_parse_mms((char *)transit_filename,g_peditdoc);
  2191. SCI_TRACE_LOW("FNH after cms_parse_Mms");
  2192. // MMK_CreateWin((uint32 *)MMIMMS_EDIT_OPTION_TAB,PNULL);
  2193. g_mms_edit_status = MMS_EDIT_REPEAT_EDIT_MMS;
  2194. MMK_CreateWin((uint32 *)MMIMMS_EDIT_WIN_TAB,PNULL);
  2195. }
  2196. break;
  2197. case MSG_PROMPTWIN_OK:
  2198. GUIMENU_GetRetID(MMIMMS_DRAFTBOX_POPMENU_CTRL_ID, (MMI_MENU_GROUP_ID_T *)(&group_id),(MMI_MENU_ID_T *) (&menu_id));
  2199. switch(menu_id)
  2200. {
  2201. case ID_MMS_DRAFTBOX_DEL:
  2202.       PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  2203. g_savestate = MMS_MSG_SAVEFILE_FOR_DRAFTBOX_DELETE;
  2204. MMIMMS_CreateNormalWaitingWin();
  2205. MMIMMS_DeleteMMS(g_pManager->draftfolder);//modify 2005-12-8
  2206. // MMK_CloseWin(win_id);
  2207. break;
  2208.              case ID_MMS_DRAFTBOX_DEL_MORE:
  2209. PUBWIN_ClosePromptQueryWin();//here should close the win and open the waitwin for delete.
  2210. // MMK_CloseWin(win_id);
  2211. g_savestate = MMS_MSG_SAVEFILE_FOR_DRAFTBOX_DELETE;
  2212. MMIMMS_CreateNormalWaitingWin();
  2213. MMIMMS_DeleteAllMMS(g_pManager->draftfolder);
  2214. break;
  2215. default:
  2216. break;
  2217. }
  2218. break;
  2219. case MSG_PROMPTWIN_CANCEL:
  2220. //close query window
  2221. PUBWIN_ClosePromptQueryWin();
  2222. break;
  2223. case MSG_CTL_DBCLICK:
  2224. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2225. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->root;
  2226. for(i = 0 ;i < list_index;i++)
  2227. g_pManager->currentfolder->currentmessage = g_pManager->currentfolder->currentmessage->next;
  2228. }
  2229. g_readforstate = MMS_MSG_DRAFTBOX_READ_FOR_EDIT;
  2230. MMIMMS_CreateReadMMSWaitingWin();
  2231. MMIMMS_ReadMMS(g_pManager->currentfolder->currentmessage);
  2232.         break;
  2233. case MSG_APP_CANCEL:
  2234. case MSG_CTL_CANCEL:
  2235.             //
  2236.             // close the edit window
  2237. if(MMK_GetActiveCtrlId(win_id) == MMIMMS_DRAFTBOX_POPMENU_CTRL_ID)
  2238. {
  2239.        uint8 i = 4;
  2240.  uint32 j = 0x00ad0002;
  2241. MMK_SetAtvCtrl(win_id, MMIMMS_DRAFTBOX_LIST_CTRL_ID);
  2242. MMK_PostMsg(win_id, MSG_TP_PRESS_DOWN, (DPARAM)&j, i);
  2243. }
  2244. else
  2245. {
  2246.          MMK_CloseWin(win_id);
  2247. }           //cloud6        
  2248. break;
  2249.         
  2250. case MSG_CLOSE_WINDOW:
  2251. break;
  2252. default:
  2253. err_code = MMI_RESULT_FALSE;
  2254. break;
  2255.         }
  2256.        
  2257. return err_code;
  2258. }
  2259. /*****************************************************************************/
  2260. //  Description : 5.8.1 Setting : autodownload  window message handler
  2261. // Global resource dependence : 
  2262. //  Author:Bruce.Chi
  2263. // Note: 
  2264. /*****************************************************************************/
  2265. LOCAL MMI_RESULT_E  Setting_HandleAutoDownloadListWinMsg(
  2266. MMS_WINDOW_ID_E win_id, 
  2267. MMI_MESSAGE_ID_E msg_id, 
  2268. DPARAM param
  2269.   )
  2270. {
  2271.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2272. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_AUTO_DOWNLOAD_LIST_CTRL_ID;
  2273. uint16 list_index = 0;
  2274. MESSAGES_MMS_MSG_SETTINGS_RETRIEVE auto_download = MMS_MSG_SETTINGS_RETRIEVE_MANUAL;
  2275.    switch(msg_id)
  2276.     {
  2277.     case MSG_FULL_PAINT:
  2278. MMIMMS_CLEAR_CLIENT();
  2279. break;
  2280. case MSG_OPEN_WINDOW:
  2281. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2282. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2283. AppendListItemByTextId( //open
  2284. TXT_MMS_RETRIEVE_MANUAL,
  2285. list_ctrl_id
  2286. );
  2287. AppendListItemByTextId( //close
  2288. TXT_MMS_RETRIEVE_AUTO,
  2289. list_ctrl_id
  2290. );
  2291. auto_download = MMIMMS_Setting_GetAutoDownload();
  2292. SCI_TRACE_LOW("auto_download is %d",g_nv_setting_mirror.retrieve_mode);
  2293. GUILISTBOX_SetSelectedItem(list_ctrl_id, auto_download, TRUE);
  2294. GUILISTBOX_SetCurItemIndex(list_ctrl_id, auto_download);
  2295. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2296.         break;
  2297.         
  2298. case MSG_APP_OK:       
  2299.     case MSG_CTL_OK:
  2300. //get selected list index
  2301. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2302. SCI_TRACE_LOW("auto_download is %d",g_nv_setting_mirror.retrieve_mode);
  2303. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2304. MMIMMS_Setting_SetAutoDownload(list_index);
  2305. // MMIMMS_SaveConfigFile();
  2306. PUBWIN_OpenPromptAlertWin(
  2307. PUBWIN_SOFTKEY_ONE, 
  2308. TXT_MMS_DONE, 
  2309. IMAGE_PROMPT_ICON_SUCCESS, 
  2310. ALERT_TIMEOUT, 
  2311. PNULL
  2312. );
  2313. MMK_CloseWin(win_id);
  2314. break;
  2315. case MSG_APP_CANCEL:
  2316. case MSG_CTL_CANCEL:
  2317. MMK_CloseWin(win_id);        
  2318. break;
  2319.         
  2320. default:
  2321. err_code = MMI_RESULT_FALSE;
  2322. break;
  2323.         }
  2324.        
  2325. return err_code;
  2326. }
  2327. /*****************************************************************************/
  2328. //  Description : 5.8.6 Setting : Arrive report  window message handler
  2329. // Global resource dependence : 
  2330. //  Author:liangliu
  2331. //  date : 2005-11-15
  2332. // Note: 
  2333. /*****************************************************************************/
  2334. LOCAL MMI_RESULT_E  Setting_HandleArriveReportWinMsg(
  2335. MMS_WINDOW_ID_E win_id, 
  2336. MMI_MESSAGE_ID_E msg_id, 
  2337. DPARAM param
  2338.   )
  2339. {
  2340.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2341. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_ARRIVE_REPORT_LIST_CTRL_ID;
  2342. uint16 list_index = 0;
  2343. MESSAGES_MMS_MSG_SETTINGS_ONOFF arrivereport = MMS_MSG_SETTINGS_OFF;
  2344.     switch(msg_id)
  2345.     {
  2346.     case MSG_FULL_PAINT:
  2347. MMIMMS_CLEAR_CLIENT();
  2348. break;
  2349. case MSG_OPEN_WINDOW:
  2350. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2351. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2352. AppendListItemByTextId( //close
  2353. TXT_MMS_SR_DISABLE,
  2354. list_ctrl_id
  2355. );
  2356. AppendListItemByTextId( //open
  2357. TXT_MMS_SR_ENABLE,
  2358. list_ctrl_id
  2359. );
  2360. arrivereport = MMIMMS_Setting_GetDeliveryReport();
  2361. GUILISTBOX_SetSelectedItem(list_ctrl_id, arrivereport, TRUE);
  2362. GUILISTBOX_SetCurItemIndex(list_ctrl_id, arrivereport);
  2363. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2364.         break;
  2365.         
  2366.  
  2367. case MSG_APP_OK:
  2368.     case MSG_CTL_OK:
  2369. //get selected list index
  2370. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2371. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2372. MMIMMS_Setting_SetDeliveryReport(list_index);
  2373. // MMIMMS_SaveConfigFile();
  2374. PUBWIN_OpenPromptAlertWin(
  2375. PUBWIN_SOFTKEY_ONE, 
  2376. TXT_MMS_DONE, 
  2377. IMAGE_PROMPT_ICON_SUCCESS, 
  2378. ALERT_TIMEOUT, 
  2379. PNULL
  2380. );
  2381. MMK_CloseWin(win_id);
  2382. break;
  2383. case MSG_APP_CANCEL:
  2384. case MSG_CTL_CANCEL:
  2385. MMK_CloseWin(win_id);        
  2386. break;
  2387.         
  2388. default:
  2389. err_code = MMI_RESULT_FALSE;
  2390. break;
  2391.         }
  2392.        
  2393. return err_code;
  2394. }
  2395. /*****************************************************************************/
  2396. //  Description : 5.8.6 Setting : Arrive report  window message handler
  2397. // Global resource dependence : 
  2398. //  Author:liangliu@palmsource.com
  2399. //  date : 2005-11-15
  2400. // Note: 
  2401. /*****************************************************************************/
  2402. LOCAL MMI_RESULT_E  Setting_HandleReadReportWinMsg(
  2403. MMS_WINDOW_ID_E win_id, 
  2404. MMI_MESSAGE_ID_E msg_id, 
  2405. DPARAM param
  2406.   )
  2407. {
  2408.   MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2409. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_READ_REPORT_LIST_CTRL_ID;
  2410. uint16 list_index = 0;
  2411. MESSAGES_MMS_MSG_SETTINGS_ONOFF readreport = MMS_MSG_SETTINGS_OFF;
  2412.     switch(msg_id)
  2413.     {
  2414.     case MSG_FULL_PAINT:
  2415. MMIMMS_CLEAR_CLIENT();
  2416. break;
  2417. case MSG_OPEN_WINDOW:
  2418. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2419. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2420. AppendListItemByTextId( //close
  2421. TXT_MMS_SR_DISABLE,
  2422. list_ctrl_id
  2423. );
  2424. AppendListItemByTextId( //open
  2425. TXT_MMS_SR_ENABLE,
  2426. list_ctrl_id
  2427. );
  2428. readreport = MMIMMS_Setting_GetReadReport();
  2429. GUILISTBOX_SetSelectedItem(list_ctrl_id, readreport, TRUE);
  2430. GUILISTBOX_SetCurItemIndex(list_ctrl_id, readreport);
  2431. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2432.         break;
  2433.         
  2434. case MSG_APP_OK:      
  2435.     case MSG_CTL_OK:
  2436. //get selected list index
  2437. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2438. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2439. MMIMMS_Setting_SetReadReport(list_index);
  2440. // MMIMMS_SaveConfigFile();
  2441. PUBWIN_OpenPromptAlertWin(
  2442. PUBWIN_SOFTKEY_ONE, 
  2443. TXT_MMS_DONE, 
  2444. IMAGE_PROMPT_ICON_SUCCESS, 
  2445. ALERT_TIMEOUT, 
  2446. PNULL
  2447. );
  2448. MMK_CloseWin(win_id);
  2449. break;
  2450. case MSG_APP_CANCEL:
  2451. case MSG_CTL_CANCEL:
  2452. MMK_CloseWin(win_id);        
  2453. break;
  2454.         
  2455. default:
  2456. err_code = MMI_RESULT_FALSE;
  2457. break;
  2458.         }
  2459.        
  2460. return err_code;
  2461. }
  2462. /*****************************************************************************/
  2463. //  Description : 5.8.6 Setting : OPEN sign  window message handler
  2464. // Global resource dependence : 
  2465. //  Author:nihong.feng@palmsource.com
  2466. //  date : 2006-05-16
  2467. // Note: 
  2468. /*****************************************************************************/
  2469. LOCAL MMI_RESULT_E  Setting_HandleOpenSignWinMsg(
  2470. MMS_WINDOW_ID_E win_id, 
  2471. MMI_MESSAGE_ID_E msg_id, 
  2472. DPARAM param
  2473.   )
  2474. {
  2475.   MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2476. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_OPEN_SIGN_LIST_CTRL_ID;
  2477. uint16 list_index = 0;
  2478. MESSAGES_MMS_MSG_SETTINGS_ONOFF opensign = MMS_MSG_SETTINGS_OFF;
  2479.     switch(msg_id)
  2480.     {
  2481.     case MSG_FULL_PAINT:
  2482. MMIMMS_CLEAR_CLIENT();
  2483. break;
  2484. case MSG_OPEN_WINDOW:
  2485. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2486. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2487. AppendListItemByTextId( //close
  2488. TXT_MMS_SR_DISABLE,
  2489. list_ctrl_id
  2490. );
  2491. AppendListItemByTextId( //open
  2492. TXT_MMS_SR_ENABLE,
  2493. list_ctrl_id
  2494. );
  2495. opensign = MMIMMS_Setting_GetAutoSign();
  2496. GUILISTBOX_SetSelectedItem(list_ctrl_id, opensign, TRUE);
  2497. GUILISTBOX_SetCurItemIndex(list_ctrl_id, opensign);
  2498. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2499.         break;
  2500.     case MSG_GET_FOCUS:
  2501. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2502. break;
  2503.     case MSG_CTL_DBCLICK:
  2504. case MSG_APP_OK:
  2505.     case MSG_CTL_OK:
  2506. //get selected list index
  2507. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2508. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2509. MMIMMS_Setting_SetAutoSign(list_index);
  2510. // MMIMMS_SaveConfigFile();
  2511. PUBWIN_OpenPromptAlertWin(
  2512. PUBWIN_SOFTKEY_ONE, 
  2513. TXT_MMS_DONE, 
  2514. IMAGE_PROMPT_ICON_SUCCESS, 
  2515. ALERT_TIMEOUT, 
  2516. PNULL
  2517. );
  2518. MMK_CloseWin(win_id);
  2519. break;
  2520. case MSG_APP_CANCEL:
  2521. case MSG_CTL_CANCEL:
  2522. MMK_CloseWin(win_id);        
  2523. break;
  2524.         
  2525. default:
  2526. err_code = MMI_RESULT_FALSE;
  2527. break;
  2528.         }
  2529.        
  2530. return err_code;
  2531. }
  2532. /*****************************************************************************/
  2533. //  Description : 5.8.6 Setting : Arrive report  window message handler
  2534. // Global resource dependence : 
  2535. //  Author:liangliu
  2536. //  date : 2005-11-15
  2537. // Note: 
  2538. /*****************************************************************************/
  2539. LOCAL MMI_RESULT_E  Setting_HandleAnonymityWinMsg(
  2540. MMS_WINDOW_ID_E win_id, 
  2541. MMI_MESSAGE_ID_E msg_id, 
  2542. DPARAM param
  2543.   )
  2544. {
  2545.   MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2546. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_ANONYMITY_LIST_CTRL_ID;
  2547. uint16 list_index = 0;
  2548. MESSAGES_MMS_MSG_SETTINGS_ONOFF anonymouson = MMS_MSG_SETTINGS_OFF;
  2549.     switch(msg_id)
  2550.     {
  2551.     case MSG_FULL_PAINT:
  2552. MMIMMS_CLEAR_CLIENT();
  2553. break;
  2554. case MSG_OPEN_WINDOW:
  2555. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2556. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2557. AppendListItemByTextId( //close
  2558. TXT_MMS_SR_DISABLE,
  2559. list_ctrl_id
  2560. );
  2561. AppendListItemByTextId( //open
  2562. TXT_MMS_SR_ENABLE,
  2563. list_ctrl_id
  2564. );
  2565. anonymouson = MMIMMS_Setting_GetAnonymous();
  2566. GUILISTBOX_SetSelectedItem(list_ctrl_id, anonymouson, TRUE);
  2567. GUILISTBOX_SetCurItemIndex(list_ctrl_id, anonymouson);
  2568. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2569.         break;
  2570.         
  2571. case MSG_APP_OK:      
  2572.     case MSG_CTL_OK:
  2573. //get selected list index
  2574. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2575. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2576. MMIMMS_Setting_SetAnonymous(list_index);
  2577. // MMIMMS_SaveConfigFile();
  2578. PUBWIN_OpenPromptAlertWin(
  2579. PUBWIN_SOFTKEY_ONE, 
  2580. TXT_MMS_DONE, 
  2581. IMAGE_PROMPT_ICON_SUCCESS, 
  2582. ALERT_TIMEOUT, 
  2583. PNULL
  2584. );
  2585. MMK_CloseWin(win_id);
  2586. break;
  2587. case MSG_APP_CANCEL:
  2588. case MSG_CTL_CANCEL:
  2589. MMK_CloseWin(win_id);        
  2590. break;
  2591.         
  2592. default:
  2593. err_code = MMI_RESULT_FALSE;
  2594. break;
  2595.         }
  2596.        
  2597. return err_code;
  2598. }
  2599. /*****************************************************************************/
  2600. //  Description : 5.8.6 Setting : Arrive report  window message handler
  2601. // Global resource dependence : 
  2602. //  Author:liangliu
  2603. //  date : 2005-11-15
  2604. // Note: 
  2605. /*****************************************************************************/
  2606. LOCAL MMI_RESULT_E  Setting_HandleSoundWinMsg(
  2607. MMS_WINDOW_ID_E win_id, 
  2608. MMI_MESSAGE_ID_E msg_id, 
  2609. DPARAM param
  2610.   )
  2611. {
  2612.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2613. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_SOUND_LIST_CTRL_ID;
  2614. uint16 list_index = 0;
  2615. MESSAGES_MMS_MSG_SETTINGS_ONOFF play_sound = MMS_MSG_SETTINGS_OFF;
  2616.     switch(msg_id)
  2617.     {
  2618.     case MSG_FULL_PAINT:
  2619. MMIMMS_CLEAR_CLIENT();
  2620. break;
  2621. case MSG_OPEN_WINDOW:
  2622. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2623. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2624. AppendListItemByTextId( //open
  2625. TXT_MMS_SR_ENABLE,
  2626. list_ctrl_id
  2627. );
  2628. AppendListItemByTextId( //close
  2629. TXT_MMS_SR_DISABLE,
  2630. list_ctrl_id
  2631. );
  2632. play_sound = MMIMMS_Setting_GetPlaySoundAble();
  2633. GUILISTBOX_SetSelectedItem(list_ctrl_id, 1-play_sound, TRUE);
  2634. GUILISTBOX_SetCurItemIndex(list_ctrl_id, 1-play_sound);
  2635. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2636.         break;
  2637.         
  2638. case MSG_APP_OK:       
  2639.     case MSG_CTL_OK:
  2640. //get selected list index
  2641. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2642. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2643. MMIMMS_Setting_SetPlaySound(list_index);
  2644. // MMIMMS_SaveConfigFile();
  2645. PUBWIN_OpenPromptAlertWin(
  2646. PUBWIN_SOFTKEY_ONE, 
  2647. TXT_MMS_DONE, 
  2648. IMAGE_PROMPT_ICON_SUCCESS, 
  2649. ALERT_TIMEOUT, 
  2650. PNULL
  2651. );
  2652. MMK_CloseWin(win_id);
  2653. break;
  2654. case MSG_APP_CANCEL:
  2655. case MSG_CTL_CANCEL:
  2656. MMK_CloseWin(win_id);        
  2657. break;
  2658.         
  2659. default:
  2660. err_code = MMI_RESULT_FALSE;
  2661. break;
  2662.         }
  2663.        
  2664. return err_code;
  2665. }
  2666. /*****************************************************************************/
  2667. //  Description : 5.8.6 Setting : Arrive report  window message handler
  2668. // Global resource dependence : 
  2669. //  Author:liangliu
  2670. //  date : 2005-11-15
  2671. // Note: 
  2672. /*****************************************************************************/
  2673. LOCAL MMI_RESULT_E  Setting_HandleAdvertisingWinMsg(
  2674. MMS_WINDOW_ID_E win_id, 
  2675. MMI_MESSAGE_ID_E msg_id, 
  2676. DPARAM param
  2677.   )
  2678. {
  2679.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2680. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_ADVERTISING_LIST_CTRL_ID;
  2681. uint16 list_index = 0;
  2682. MESSAGES_MMS_MSG_SETTINGS_ONOFF advertisingallowable = MMS_MSG_SETTINGS_OFF;
  2683.     switch(msg_id)
  2684.     {
  2685.     case MSG_FULL_PAINT:
  2686. MMIMMS_CLEAR_CLIENT();
  2687. break;
  2688. case MSG_OPEN_WINDOW:
  2689. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2690. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_ONOFF);
  2691. AppendListItemByTextId( //close
  2692. TXT_MMS_SR_DISABLE,
  2693. list_ctrl_id
  2694. );
  2695. AppendListItemByTextId( //open
  2696. TXT_MMS_SR_ENABLE,
  2697. list_ctrl_id
  2698. );
  2699. advertisingallowable = MMIMMS_Setting_GetAdvertisingallowable();
  2700. GUILISTBOX_SetSelectedItem(list_ctrl_id, advertisingallowable, TRUE);
  2701. GUILISTBOX_SetCurItemIndex(list_ctrl_id, advertisingallowable);
  2702. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2703.         break;
  2704.         
  2705. case MSG_APP_OK:      
  2706.     case MSG_CTL_OK:
  2707. //get selected list index
  2708. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2709. SCI_ASSERT(list_index < NUM_MMS_MSG_SETTINGS_ONOFF);
  2710. MMIMMS_Setting_SetAdvertising(list_index);
  2711. // MMIMMS_SaveConfigFile();
  2712. PUBWIN_OpenPromptAlertWin(
  2713. PUBWIN_SOFTKEY_ONE, 
  2714. TXT_MMS_DONE, 
  2715. IMAGE_PROMPT_ICON_SUCCESS, 
  2716. ALERT_TIMEOUT, 
  2717. PNULL
  2718. );
  2719. MMK_CloseWin(win_id);
  2720. break;
  2721. case MSG_APP_CANCEL:
  2722. case MSG_CTL_CANCEL:
  2723. MMK_CloseWin(win_id);        
  2724. break;
  2725.         
  2726. default:
  2727. err_code = MMI_RESULT_FALSE;
  2728. break;
  2729.         }
  2730.        
  2731. return err_code;
  2732. }
  2733. /*****************************************************************************/
  2734. //  Description : 5.8.2 Setting : Priority  window message handler
  2735. // Global resource dependence : 
  2736. //  Author:Bruce.Chi
  2737. // Note: 
  2738. /*****************************************************************************/
  2739. LOCAL MMI_RESULT_E  Setting_HandlePriorityListWinMsg(
  2740. MMS_WINDOW_ID_E win_id, 
  2741. MMI_MESSAGE_ID_E msg_id, 
  2742. DPARAM param
  2743.   )
  2744. {
  2745.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2746. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_PRIORITY_LIST_CTRL_ID;
  2747. uint16 list_index = 0;
  2748. MESSAGES_MMS_MSG_SETTINGS_PRIORITY priority;
  2749.     switch(msg_id)
  2750.     {
  2751.     case MSG_FULL_PAINT:
  2752. MMIMMS_CLEAR_CLIENT();
  2753. break;
  2754. case MSG_OPEN_WINDOW:
  2755. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2756. GUILISTBOX_SetMaxItem(list_ctrl_id, NUM_MMS_MSG_SETTINGS_PRIORITY);
  2757. AppendListItemByTextId(
  2758. TXT_MMS_PRIORITY_HIGH,
  2759. list_ctrl_id
  2760. );
  2761. AppendListItemByTextId(
  2762. TXT_MMS_PRIORITY_MID,
  2763. list_ctrl_id
  2764. ); //fnh modify 0323
  2765. AppendListItemByTextId(
  2766. TXT_MMS_PRIORITY_LOW,
  2767. list_ctrl_id
  2768. );
  2769. priority = MMIMMS_Setting_GetPriority();
  2770. GUILISTBOX_SetSelectedItem(list_ctrl_id, priority, TRUE);
  2771. GUILISTBOX_SetCurItemIndex(list_ctrl_id, priority);
  2772. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2773.         break;
  2774.         
  2775. case MSG_APP_OK:        
  2776.     case MSG_CTL_OK:
  2777. //get selected list index
  2778. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2779. SCI_ASSERT(list_index < MMIMMS_PRIORITY_TOTAL);
  2780. MMIMMS_Setting_SetPriority(list_index);
  2781. // MMIMMS_SaveConfigFile();
  2782. PUBWIN_OpenPromptAlertWin(
  2783. PUBWIN_SOFTKEY_ONE, 
  2784. TXT_MMS_DONE, 
  2785. IMAGE_PROMPT_ICON_SUCCESS, 
  2786. ALERT_TIMEOUT, 
  2787. PNULL
  2788. );
  2789. MMK_CloseWin(win_id);
  2790. break;
  2791. case MSG_APP_CANCEL:
  2792. case MSG_CTL_CANCEL:
  2793. MMK_CloseWin(win_id);        
  2794. break;
  2795.         
  2796. default:
  2797. err_code = MMI_RESULT_FALSE;
  2798. break;
  2799.         }
  2800.        
  2801. return err_code;
  2802. }
  2803. /*****************************************************************************/
  2804. //  Description : 5.8.3 Setting : mms duaration  window message handler
  2805. // Global resource dependence : 
  2806. //  Author:Bruce.Chi
  2807. // Note: 
  2808. /*****************************************************************************/
  2809. LOCAL MMI_RESULT_E  Setting_HandleValidPeriodListWinMsg(
  2810. MMS_WINDOW_ID_E win_id, 
  2811. MMI_MESSAGE_ID_E msg_id, 
  2812. DPARAM param
  2813.   )
  2814. {
  2815.     MMI_RESULT_E err_code = MMI_RESULT_TRUE;
  2816. MMS_CONTROL_ID_E list_ctrl_id = MMIMMS_SETTING_VALIDATE_PERIOD_LIST_CTRL_ID;
  2817. uint16 list_index = 0;
  2818. MESSAGES_MMS_SETTING_VALID_PERIOD valid_period;
  2819.     switch(msg_id)
  2820.     {
  2821.     case MSG_FULL_PAINT:
  2822. MMIMMS_CLEAR_CLIENT();
  2823. break;
  2824. case MSG_OPEN_WINDOW:
  2825. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2826. GUILISTBOX_SetMaxItem(list_ctrl_id, MMS_MSG_VALID_PERIOD_TOTAL);
  2827. AppendListItemByTextId(
  2828. TXT_MMS_TWELVE_HOUR,
  2829. list_ctrl_id
  2830. );
  2831. AppendListItemByTextId(
  2832. TXT_MMS_ONE_DAY,
  2833. list_ctrl_id
  2834. );
  2835. AppendListItemByTextId(
  2836. TXT_MMS_ONE_WEEK,
  2837. list_ctrl_id
  2838. );
  2839. AppendListItemByTextId(
  2840. TXT_MMS_LONGGEST_DURATION,
  2841. list_ctrl_id
  2842. );
  2843. valid_period = MMIMMS_Setting_GetValidPeriod();
  2844. GUILISTBOX_SetSelectedItem(list_ctrl_id, valid_period, TRUE);
  2845. GUILISTBOX_SetCurItemIndex(list_ctrl_id, valid_period);
  2846. MMK_SetAtvCtrl(win_id, list_ctrl_id);
  2847.         break;
  2848.         
  2849. case MSG_APP_OK:       
  2850.     case MSG_CTL_OK:
  2851. //get selected list index
  2852. list_index = GUILISTBOX_GetCurItemIndex(list_ctrl_id);
  2853. SCI_ASSERT(list_index < MMIMMS_VALID_PERIOD_TOTAL);
  2854. MMIMMS_Setting_SetValidPeriod(list_index);
  2855. // MMIMMS_SaveConfigFile();
  2856. PUBWIN_OpenPromptAlertWin(
  2857. PUBWIN_SOFTKEY_ONE, 
  2858. TXT_MMS_DONE, 
  2859. IMAGE_PROMPT_ICON_SUCCESS, 
  2860. ALERT_TIMEOUT, 
  2861. PNULL
  2862. );
  2863. MMK_CloseWin(win_id);
  2864. break;
  2865. case MSG_APP_CANCEL:
  2866. case MSG_CTL_CANCEL:
  2867. MMK_CloseWin(win_id);        
  2868. break;
  2869.         
  2870. default:
  2871. err_code = MMI_RESULT_FALSE;
  2872. break;
  2873.         }
  2874.        
  2875. return err_code;
  2876. }
  2877. /*****************************************************************************/
  2878. //  Description : 5.8.5 Setting : mmsc
  2879. // Global resource dependence : 
  2880. //  Author:Bruce.Chi
  2881. // Note: 
  2882. /*****************************************************************************/
  2883. LOCAL MMI_RESULT_E  Setting_HandleMMSCWinMsg(
  2884. MMS_WINDOW_ID_E win_id, 
  2885. MMI_MESSAGE_ID_E msg_id, 
  2886. DPARAM param
  2887.   )
  2888. {
  2889. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_MMSC_CTRL_ID;
  2890. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  2891. uint8* mmsc_str_ptr = 0;
  2892. uint16 mmsc_str_len = 0;
  2893. TEXTEDIT_STRING_INFO_T string_info = {0};
  2894. switch(msg_id)
  2895.     {
  2896.     case MSG_OPEN_WINDOW:
  2897. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2898. //set text according to former setting
  2899. mmsc_str_ptr = MMIMMS_Setting_GetMMSC();
  2900. SCI_TRACE_LOW("FNH open window setting mmsc_str_ptr = %s",mmsc_str_ptr);
  2901. if (mmsc_str_ptr != NULL)
  2902. {
  2903. mmsc_str_len = strlen((char *)mmsc_str_ptr);
  2904. }
  2905. SCI_TRACE_LOW("FNH open window setting mmsc_str_len = %d",mmsc_str_len);
  2906. GUIEDITBOX_SetTextEditBoxStringInfo(editbox_ctrl_id,
  2907. mmsc_str_ptr,
  2908. mmsc_str_len,
  2909. FALSE);
  2910. MMK_SetAtvCtrl(
  2911. win_id,
  2912. editbox_ctrl_id);
  2913. break;
  2914. case MSG_FULL_PAINT:
  2915. MMIMMS_CLEAR_CLIENT();
  2916. break;
  2917. case MSG_APP_OK:
  2918.     case MSG_CTL_OK:
  2919. //save to nv
  2920. SCI_MEMSET(&string_info,0,sizeof(TEXTEDIT_STRING_INFO_T));
  2921. SCI_TRACE_LOW("FNH before get text string_info.str_ptr = %s",string_info.str_ptr);
  2922. SCI_TRACE_LOW("FNH before get text string_info.str_len = %d",string_info.str_len);
  2923. GUIEDITBOX_GetTextEditBoxInfo(
  2924. editbox_ctrl_id,
  2925. &string_info);
  2926. string_info.str_ptr[string_info.str_len] = '';
  2927. SCI_TRACE_LOW("FNH after get text string_info.str_ptr = %s",string_info.str_ptr);
  2928. SCI_TRACE_LOW("FNH after get text string_info.str_len = %d",string_info.str_len);
  2929. if (string_info.str_len == 0)
  2930. {
  2931. //提示用户
  2932. PUBWIN_OpenPromptAlertWin(
  2933. PUBWIN_SOFTKEY_ONE,
  2934. TXT_MMS_INPUT_ERROR,
  2935. IMAGE_PROMPT_ICON_FAIL,
  2936. ALERT_TIMEOUT,
  2937. PNULL);
  2938. MMK_CloseWin(win_id);
  2939. break;
  2940. }
  2941. MMIMMS_Setting_SetMMSC(string_info.str_ptr, string_info.str_len);
  2942. // MMIMMS_SaveConfigFile();
  2943. //提示用户
  2944.         PUBWIN_OpenPromptAlertWin(
  2945.                 PUBWIN_SOFTKEY_ONE,
  2946.                 TXT_MMS_DONE,
  2947.                 IMAGE_PROMPT_ICON_SUCCESS,
  2948.                 ALERT_TIMEOUT,
  2949. PNULL);
  2950. MMK_CloseWin(win_id);
  2951. break;
  2952.  
  2953. case MSG_APP_CANCEL:
  2954.     case MSG_CTL_CANCEL:        
  2955. MMK_CloseWin(win_id);//返回上一级
  2956.         break;
  2957. default:
  2958. recode = MMI_RESULT_FALSE;
  2959. break;
  2960. }
  2961. return recode;
  2962. }
  2963. /*****************************************************************************/
  2964. //  Description : 5.8.5 Setting : GateWay
  2965. // Global resource dependence : 
  2966. //  Author:Bruce.Chi
  2967. // Note: 
  2968. /*****************************************************************************/
  2969. LOCAL MMI_RESULT_E  Setting_HandleGateWayWinMsg(
  2970. MMS_WINDOW_ID_E win_id, 
  2971. MMI_MESSAGE_ID_E msg_id, 
  2972. DPARAM param
  2973.   )
  2974. {
  2975. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_GATEWAY_CTRL_ID;
  2976. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  2977. uint8* mmsc_str_ptr = 0;
  2978. uint16 mmsc_str_len = 0;
  2979. TEXTEDIT_STRING_INFO_T string_info = {0};
  2980. switch(msg_id)
  2981.     {
  2982.     case MSG_OPEN_WINDOW:
  2983. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  2984. //set text according to former setting
  2985. mmsc_str_ptr = MMIMMS_Setting_GetGATEWAY();
  2986. if (mmsc_str_ptr != NULL)
  2987. {
  2988. mmsc_str_len = strlen((char *)mmsc_str_ptr);
  2989. }
  2990. GUIEDITBOX_SetTextEditBoxStringInfo(editbox_ctrl_id,
  2991. mmsc_str_ptr,
  2992. mmsc_str_len,
  2993. FALSE);
  2994. MMK_SetAtvCtrl(
  2995. win_id,
  2996. editbox_ctrl_id);
  2997. break;
  2998. case MSG_FULL_PAINT:
  2999. MMIMMS_CLEAR_CLIENT();
  3000. break;
  3001. case MSG_APP_OK:
  3002.     case MSG_CTL_OK:
  3003. {
  3004. BOOLEAN isipaddress = FALSE;
  3005. GUIEDITBOX_GetTextEditBoxInfo(
  3006. editbox_ctrl_id,
  3007. &string_info);
  3008. if (string_info.str_ptr != NULL)
  3009. {
  3010. string_info.str_ptr[string_info.str_len] = '';
  3011. }
  3012. isipaddress = MMIMMS_IsIPAddress((char *)string_info.str_ptr);
  3013. if (!isipaddress)
  3014. {
  3015. //提示用户
  3016. PUBWIN_OpenPromptAlertWin(
  3017. PUBWIN_SOFTKEY_ONE,
  3018. TXT_MMS_INPUT_ERROR,
  3019. IMAGE_PROMPT_ICON_FAIL,
  3020. ALERT_TIMEOUT,
  3021. PNULL);
  3022. MMK_CloseWin(win_id);
  3023. break;
  3024. }
  3025. MMIMMS_Setting_SetGATEWAY(string_info.str_ptr, string_info.str_len);
  3026. //        MMIMMS_SaveConfigFile();
  3027. //提示用户
  3028.         PUBWIN_OpenPromptAlertWin(
  3029. PUBWIN_SOFTKEY_ONE,
  3030. TXT_MMS_DONE,
  3031. IMAGE_PROMPT_ICON_SUCCESS,
  3032. ALERT_TIMEOUT,
  3033. PNULL);
  3034. MMK_CloseWin(win_id);
  3035. }
  3036. break;
  3037.  
  3038. case MSG_APP_CANCEL:
  3039.     case MSG_CTL_CANCEL:        
  3040. MMK_CloseWin(win_id);//返回上一级
  3041.         break;
  3042. default:
  3043. recode = MMI_RESULT_FALSE;
  3044. break;
  3045. }
  3046. return recode;
  3047. }
  3048. /*****************************************************************************/
  3049. //  Description : 5.8.5 Setting : Port
  3050. // Global resource dependence : 
  3051. //  Author:Bruce.Chi
  3052. // Note: 
  3053. /*****************************************************************************/
  3054. LOCAL MMI_RESULT_E  Setting_HandlePortWinMsg(
  3055. MMS_WINDOW_ID_E win_id, 
  3056. MMI_MESSAGE_ID_E msg_id, 
  3057. DPARAM param
  3058.   )
  3059. {
  3060. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_PORT_CTRL_ID;
  3061. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  3062. uint8* mmsc_str_ptr = 0;
  3063. uint16 mmsc_str_len = 0;
  3064. TEXTEDIT_STRING_INFO_T string_info = {0};
  3065. switch(msg_id)
  3066.     {
  3067.     case MSG_OPEN_WINDOW:
  3068. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  3069. //set text according to former setting
  3070. mmsc_str_ptr = MMIMMS_Setting_GetPORT();
  3071. SCI_TRACE_LOW("FNH in get port mmsc_str_ptr = %s",mmsc_str_ptr);
  3072. if (mmsc_str_ptr != NULL)
  3073. {
  3074. mmsc_str_len = strlen((char *)mmsc_str_ptr);
  3075. }
  3076. SCI_TRACE_LOW("FNH in get port mmsc_str_len = %d",mmsc_str_len);
  3077. GUIEDITBOX_SetTextEditBoxStringInfo(MMIMMS_SETTING_PORT_CTRL_ID,
  3078. mmsc_str_ptr,
  3079. mmsc_str_len,
  3080. FALSE);
  3081. MMK_SetAtvCtrl(
  3082. win_id,
  3083. editbox_ctrl_id);
  3084. break;
  3085. case MSG_FULL_PAINT:
  3086. MMIMMS_CLEAR_CLIENT();
  3087. break;
  3088. case MSG_APP_OK:
  3089.     case MSG_CTL_OK:
  3090. //save to nv
  3091. SCI_MEMSET(&string_info ,0,sizeof(STRING_INFO_T));
  3092. SCI_TRACE_LOW("FNH before get string_info.str_ptr = %s",string_info.str_ptr);
  3093. SCI_TRACE_LOW("FNH before get string_info.str_len = %d",string_info.str_len);
  3094. GUIEDITBOX_GetTextEditBoxInfo(
  3095. MMIMMS_SETTING_PORT_CTRL_ID,
  3096. &string_info);
  3097. SCI_TRACE_LOW("FNH after get string_info.str_ptr = %s",string_info.str_ptr);
  3098. SCI_TRACE_LOW("FNH after get string_info.str_len = %d",string_info.str_len);
  3099. if (string_info.str_ptr != NULL)
  3100. {
  3101. string_info.str_ptr[string_info.str_len] = '';
  3102. }
  3103. if (string_info.str_len == 0)
  3104. {
  3105. //提示用户
  3106. PUBWIN_OpenPromptAlertWin(
  3107. PUBWIN_SOFTKEY_ONE,
  3108. TXT_MMS_INPUT_ERROR,
  3109. IMAGE_PROMPT_ICON_FAIL,
  3110. ALERT_TIMEOUT,
  3111. PNULL);
  3112. MMK_CloseWin(win_id);
  3113. break;
  3114. }
  3115. MMIMMS_Setting_SetPORT((uint8 *)string_info.str_ptr, string_info.str_len);
  3116. // MMIMMS_SaveConfigFile();
  3117. //提示用户
  3118.         PUBWIN_OpenPromptAlertWin(
  3119.                 PUBWIN_SOFTKEY_ONE,
  3120.                 TXT_MMS_DONE,
  3121.                 IMAGE_PROMPT_ICON_SUCCESS,
  3122.                 ALERT_TIMEOUT,
  3123. PNULL);
  3124. MMK_CloseWin(win_id);
  3125. break;
  3126. case MSG_APP_CANCEL:
  3127.     case MSG_CTL_CANCEL:        
  3128. MMK_CloseWin(win_id);//返回上一级
  3129.         break;
  3130. default:
  3131. recode = MMI_RESULT_FALSE;
  3132. break;
  3133. }
  3134. return recode;
  3135. }
  3136. /*****************************************************************************/
  3137. //  Description : 5.8.5 Setting : UserName
  3138. // Global resource dependence : 
  3139. //  Author:Bruce.Chi
  3140. // Note: 
  3141. /*****************************************************************************/
  3142. LOCAL MMI_RESULT_E Setting_HandleUserNameWinMsg(
  3143.  MMS_WINDOW_ID_E win_id, 
  3144.  MMI_MESSAGE_ID_E msg_id, 
  3145.  DPARAM param
  3146.  )
  3147. {
  3148. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_USERNAME_CTRL_ID;
  3149. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  3150. uint8* username_str_ptr = 0;
  3151. uint16 username_str_len = 0;
  3152. TEXTEDIT_STRING_INFO_T string_info = {0};
  3153. switch(msg_id)
  3154.     {
  3155.     case MSG_OPEN_WINDOW:
  3156. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  3157. //set text according to former setting
  3158. username_str_ptr = MMIMMS_Setting_GetUserName();
  3159. SCI_TRACE_LOW("FNH open window setting username_str_ptr = %s",username_str_ptr);
  3160. if (username_str_ptr != NULL)
  3161. {
  3162. username_str_len = strlen((char *)username_str_ptr);
  3163. }
  3164. SCI_TRACE_LOW("FNH open window setting username_str_len = %d",username_str_len);
  3165. GUIEDITBOX_SetTextEditBoxStringInfo(editbox_ctrl_id,
  3166. username_str_ptr,
  3167. username_str_len,
  3168. FALSE);
  3169. MMK_SetAtvCtrl(
  3170. win_id,
  3171. editbox_ctrl_id);
  3172. break;
  3173. case MSG_FULL_PAINT:
  3174. MMIMMS_CLEAR_CLIENT();
  3175. break;
  3176. case MSG_APP_OK:
  3177.     case MSG_CTL_OK:
  3178. //save to nv
  3179. SCI_MEMSET(&string_info,0,sizeof(TEXTEDIT_STRING_INFO_T));
  3180. SCI_TRACE_LOW("FNH before get text string_info.str_ptr = %s",string_info.str_ptr);
  3181. SCI_TRACE_LOW("FNH before get text string_info.str_len = %d",string_info.str_len);
  3182. GUIEDITBOX_GetTextEditBoxInfo(
  3183. editbox_ctrl_id,
  3184. &string_info);
  3185. string_info.str_ptr[string_info.str_len] = '';
  3186. SCI_TRACE_LOW("FNH after get text string_info.str_ptr = %s",string_info.str_ptr);
  3187. SCI_TRACE_LOW("FNH after get text string_info.str_len = %d",string_info.str_len);
  3188. MMIMMS_Setting_SetUserName(string_info.str_ptr, string_info.str_len);
  3189. // MMIMMS_SaveConfigFile();
  3190. //提示用户
  3191.         PUBWIN_OpenPromptAlertWin(
  3192.                 PUBWIN_SOFTKEY_ONE,
  3193.                 TXT_MMS_DONE,
  3194.                 IMAGE_PROMPT_ICON_SUCCESS,
  3195.                 ALERT_TIMEOUT,
  3196. PNULL);
  3197. MMK_CloseWin(win_id);
  3198. break;
  3199.   
  3200. case MSG_APP_CANCEL:
  3201.     case MSG_CTL_CANCEL:        
  3202. MMK_CloseWin(win_id);//返回上一级
  3203.         break;
  3204. default:
  3205. recode = MMI_RESULT_FALSE;
  3206. break;
  3207. }
  3208. return recode;
  3209. }
  3210. /*****************************************************************************/
  3211. //  Description : 5.8.5 Setting : Password
  3212. // Global resource dependence : 
  3213. //  Author:Bruce.Chi
  3214. // Note: 
  3215. /*****************************************************************************/
  3216. LOCAL MMI_RESULT_E Setting_HandlePasswordWinMsg(
  3217.  MMS_WINDOW_ID_E win_id, 
  3218.  MMI_MESSAGE_ID_E msg_id, 
  3219.  DPARAM param
  3220.  )
  3221. {
  3222. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_PASSWORD_CTRL_ID;
  3223. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  3224. uint8* password_str_ptr = 0;
  3225. uint16 password_str_len = 0;
  3226. TEXTEDIT_STRING_INFO_T string_info = {0};
  3227. switch(msg_id)
  3228.     {
  3229.     case MSG_OPEN_WINDOW:
  3230. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  3231. //set text according to former setting
  3232. password_str_ptr = MMIMMS_Setting_GetPassword();
  3233. SCI_TRACE_LOW("FNH open window setting password_str_ptr = %s",password_str_ptr);
  3234. if (password_str_ptr != NULL)
  3235. {
  3236. password_str_len = strlen((char *)password_str_ptr);
  3237. }
  3238. SCI_TRACE_LOW("FNH open window setting password_str_len = %d",password_str_len);
  3239. GUIEDITBOX_SetTextEditBoxStringInfo(editbox_ctrl_id,
  3240. password_str_ptr,
  3241. password_str_len,
  3242. FALSE);
  3243. MMK_SetAtvCtrl(
  3244. win_id,
  3245. editbox_ctrl_id);
  3246. break;
  3247. case MSG_FULL_PAINT:
  3248. MMIMMS_CLEAR_CLIENT();
  3249. break;
  3250. case MSG_APP_OK:
  3251.     case MSG_CTL_OK:
  3252. //save to nv
  3253. SCI_MEMSET(&string_info,0,sizeof(TEXTEDIT_STRING_INFO_T));
  3254. SCI_TRACE_LOW("FNH before get text string_info.str_ptr = %s",string_info.str_ptr);
  3255. SCI_TRACE_LOW("FNH before get text string_info.str_len = %d",string_info.str_len);
  3256. GUIEDITBOX_GetTextEditBoxInfo(
  3257. editbox_ctrl_id,
  3258. &string_info);
  3259. string_info.str_ptr[string_info.str_len] = '';
  3260. SCI_TRACE_LOW("FNH after get text string_info.str_ptr = %s",string_info.str_ptr);
  3261. SCI_TRACE_LOW("FNH after get text string_info.str_len = %d",string_info.str_len);
  3262. MMIMMS_Setting_SetPassword(string_info.str_ptr, string_info.str_len);
  3263. // MMIMMS_SaveConfigFile();
  3264. //提示用户
  3265.         PUBWIN_OpenPromptAlertWin(
  3266.                 PUBWIN_SOFTKEY_ONE,
  3267.                 TXT_MMS_DONE,
  3268.                 IMAGE_PROMPT_ICON_SUCCESS,
  3269.                 ALERT_TIMEOUT,
  3270. PNULL);
  3271. MMK_CloseWin(win_id);
  3272. break;
  3273.  
  3274. case MSG_APP_CANCEL:
  3275.     case MSG_CTL_CANCEL:        
  3276. MMK_CloseWin(win_id);//返回上一级
  3277.         break;
  3278. default:
  3279. recode = MMI_RESULT_FALSE;
  3280. break;
  3281. }
  3282. return recode;
  3283. }
  3284. /*****************************************************************************/
  3285. //  Description : 5.8.5 Setting : APN
  3286. // Global resource dependence : 
  3287. //  Author:Bruce.Chi
  3288. // Note: 
  3289. /*****************************************************************************/
  3290. LOCAL MMI_RESULT_E Setting_HandleAPNWinMsg(
  3291.  MMS_WINDOW_ID_E win_id, 
  3292.  MMI_MESSAGE_ID_E msg_id, 
  3293.  DPARAM param
  3294.  )
  3295. {
  3296. MMS_CONTROL_ID_E editbox_ctrl_id = MMIMMS_SETTING_APN_CTRL_ID;
  3297. MMI_RESULT_E recode = MMI_RESULT_TRUE;
  3298. uint8* apn_str_ptr = 0;
  3299. uint16 apn_str_len = 0;
  3300. TEXTEDIT_STRING_INFO_T string_info = {0};
  3301. switch(msg_id)
  3302.     {
  3303.     case MSG_OPEN_WINDOW:
  3304. MMK_SetWinSoftkeyId(win_id, STXT_OK, COMMON_TXT_NULL, STXT_RETURN, FALSE);
  3305. //set text according to former setting
  3306. apn_str_ptr = MMIMMS_Setting_GetAPN();
  3307. SCI_TRACE_LOW("FNH open window setting apn_str_ptr = %s",apn_str_ptr);
  3308. if (apn_str_ptr != NULL)
  3309. {
  3310. apn_str_len = strlen((char *)apn_str_ptr);
  3311. }