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

MTK

开发平台:

C/C++

  1.     else if (GetMessagesCurrScrnID() == SCR_ID_MSG_CB_MESSAGE_LIST)
  2.     {
  3.         mmi_msg_entry_cb_read_message();
  4.         DeleteScreenIfPresent(SCR_ID_MSG_CB_MESSAGE_LIST);
  5.     }
  6.     WriteCBMessageInfoToNvram();    /* ->no need!!! only write when shut down: check if ok */
  7. }
  8. /*****************************************************************************
  9.  * FUNCTION
  10.  *  mmi_msg_delete_new_cb_message
  11.  * DESCRIPTION
  12.  *  Delete new CB message
  13.  * PARAMETERS
  14.  *  void
  15.  * RETURNS
  16.  *  void
  17.  *****************************************************************************/
  18. void mmi_msg_delete_new_cb_message(void)
  19. {
  20.     /*----------------------------------------------------------------*/
  21.     /* Local Variables                                                */
  22.     /*----------------------------------------------------------------*/
  23.     /*----------------------------------------------------------------*/
  24.     /* Code Body                                                      */
  25.     /*----------------------------------------------------------------*/
  26.     DeleteCBMessage((S32) cbMsgIndex.currCBIndex);
  27.     cb_display.unread[cbMsgIndex.currCBIndex] = FALSE;
  28.     if (cbMsgIndex.currCBIndex < cbMsgIndex.currCBTotal)
  29.     {
  30.         S8 i = 0;
  31.         for (i = cbMsgIndex.currCBIndex; i < cbMsgIndex.currCBTotal; i++)
  32.         {
  33.             cb_display.unread[i] = cb_display.unread[i + 1];
  34.         }
  35.         cb_display.unread[i] = FALSE;
  36.     }
  37.     WriteCBMessageInfoToNvram();
  38.     GoBackHistory();
  39. }
  40. /*****************************************************************************
  41.  * FUNCTION
  42.  *  mmi_msg_go_back_from_new_cb_ind
  43.  * DESCRIPTION
  44.  *  Reset CB unread index before go back screen
  45.  * PARAMETERS
  46.  *  void
  47.  * RETURNS
  48.  *  void
  49.  *****************************************************************************/
  50. void mmi_msg_go_back_from_new_cb_ind(void)
  51. {
  52.     /*----------------------------------------------------------------*/
  53.     /* Local Variables                                                */
  54.     /*----------------------------------------------------------------*/
  55.     /*----------------------------------------------------------------*/
  56.     /* Code Body                                                      */
  57.     /*----------------------------------------------------------------*/
  58.     cb_display.unread[cbMsgIndex.currCBIndex] = FALSE;
  59.     GoBackHistory();
  60. }
  61. /*****************************************************************************
  62.  * FUNCTION
  63.  *  mmi_msg_end_key_from_new_cb_ind
  64.  * DESCRIPTION
  65.  *  Reset CB unread index before go to idle
  66.  * PARAMETERS
  67.  *  void
  68.  * RETURNS
  69.  *  void
  70.  *****************************************************************************/
  71. void mmi_msg_end_key_from_new_cb_ind(void)
  72. {
  73.     /*----------------------------------------------------------------*/
  74.     /* Local Variables                                                */
  75.     /*----------------------------------------------------------------*/
  76.     /*----------------------------------------------------------------*/
  77.     /* Code Body                                                      */
  78.     /*----------------------------------------------------------------*/
  79.     memset(&cb_display.unread, 0, MAX_STORE_CB_MSG);
  80.     ExecCurrEndKeyDownHandler();
  81. }
  82. #ifdef __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__
  83. /*****************************************************************************
  84.  * FUNCTION
  85.  *  mmi_msg_get_new_cb_ind_string
  86.  * DESCRIPTION
  87.  *  Get new msg indication string
  88.  * PARAMETERS
  89.  *  void
  90.  * RETURNS
  91.  *  new msg indication string
  92.  *****************************************************************************/
  93. U8 *mmi_msg_get_new_cb_ind_string(void)
  94. {
  95.     /*----------------------------------------------------------------*/
  96.     /* Local Variables                                                */
  97.     /*----------------------------------------------------------------*/
  98.     U8 i = 0;
  99.     U8 number[(MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH];
  100.     static S8 temp[(MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH];
  101.     /*----------------------------------------------------------------*/
  102.     /* Code Body                                                      */
  103.     /*----------------------------------------------------------------*/
  104.     memset(number, 0, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  105.     for (i = 0; i < cb_info.totalmi; i++)
  106.     {
  107.         if ((cb_info.cbchnlentry[i].mi == cbMsgInfo.MsgMI[cbMsgIndex.currCBIndex]) &&
  108.             (strlen((S8*) cb_info.cbchnlentry[i].name) > 0))
  109.         {
  110.             break;
  111.         }
  112.     }
  113.     if (i < cb_info.totalmi)
  114.     {
  115.         if (cb_info.cbchnlentry[i].dcs == PHB_ASCII)
  116.         {
  117.             AnsiiToUnicodeString(temp, (S8*) cb_info.cbchnlentry[i].name);
  118.         }
  119.         else
  120.         {
  121.             pfnUnicodeStrcpy(temp, (S8*) cb_info.cbchnlentry[i].name);
  122.         }
  123.     }
  124.     else
  125.     {
  126.         sprintf((PS8) number, "%d", cbMsgInfo.MsgMI[cbMsgIndex.currCBIndex]);
  127.         AnsiiToUnicodeString(temp, (S8*) number);
  128.     }
  129.     return (U8*) temp;
  130. }
  131. /*****************************************************************************
  132.  * FUNCTION
  133.  *  mmi_msg_entry_new_cb_immediate_ind
  134.  * DESCRIPTION
  135.  *  Entry new CB indication
  136.  * PARAMETERS
  137.  *  void
  138.  * RETURNS
  139.  *  void
  140.  *****************************************************************************/
  141. void mmi_msg_entry_new_cb_immediate_ind(void)
  142. {
  143.     /*----------------------------------------------------------------*/
  144.     /* Local Variables                                                */
  145.     /*----------------------------------------------------------------*/
  146.     U16 page = (U16) cbMsgInfo.MsgPage[cbMsgIndex.currCBIndex] * NVRAM_SMS_CB_SMS_PAGE_SIZE;
  147.     /*----------------------------------------------------------------*/
  148.     /* Code Body                                                      */
  149.     /*----------------------------------------------------------------*/
  150.     EntryNewScreen(SCR_ID_MSG_CB_MESSAGE_IDLE, mmi_msg_exit_generic, NULL, NULL);
  151.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] EntryScrCBMessageBodyWhenIdle ---*n"));
  152.     GetCurrEndKeyDownHandler();
  153.     ReadCBMessageContent(
  154.         (PU32) & dispCBLength,
  155.         cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBIndex],
  156.         page,
  157.         cbMsgInfo.MsgDCS[cbMsgIndex.currCBIndex]);
  158.     if (!IsKeyPadLockState())   /* keypad is unlocked */
  159.     {
  160.         SetMessagesCurrScrnID(SCR_ID_MSG_CB_MESSAGE_IDLE);
  161.         GetCurrEndKeyDownHandler();
  162.         ShowCategory74Screen(
  163.             STR_CB_MSG_IND_INFORMATION_CAPTION,
  164.             IMG_SMS_ENTRY_SCRN_CAPTION,
  165.             STR_GLOBAL_DELETE,
  166.             IMG_GLOBAL_OK,
  167.             STR_GLOBAL_BACK,
  168.             IMG_GLOBAL_BACK,
  169.             (PU8) dispCBMessage,
  170.             (S32) dispCBLength,
  171.             NULL);
  172.         SetLeftSoftkeyFunction(mmi_msg_delete_new_cb_message, KEY_EVENT_UP);
  173.         SetRightSoftkeyFunction(mmi_msg_go_back_from_new_cb_ind, KEY_EVENT_UP);
  174.         SetKeyHandler(mmi_msg_end_key_from_new_cb_ind, KEY_END, KEY_EVENT_DOWN);
  175.         SetKeyHandler(mmi_msg_pre_entry_cb_idle_use_number, KEY_SEND, KEY_EVENT_UP);
  176.     }
  177.     else    /* keypad is locked */
  178.     {
  179.         ShowCategory74Screen(
  180.             STR_CB_MSG_IND_INFORMATION_CAPTION,
  181.             IMG_SMS_ENTRY_SCRN_CAPTION,
  182.             g_keylock_context.KeyLockLSKStringID,
  183.             g_keylock_context.KeyLockLSKIconID,
  184.             g_keylock_context.KeyLockRSKStringID,
  185.             g_keylock_context.KeyLockRSKIconID,
  186.             (PU8) dispCBMessage,
  187.             (S32) dispCBLength,
  188.             NULL);
  189.         /* prevent category scrolling */
  190.         SetKeyHandler(NULL, KEY_UP_ARROW, KEY_EVENT_DOWN);
  191.         SetKeyHandler(NULL, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  192.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  193.     }
  194. }
  195. /*****************************************************************************
  196.  * FUNCTION
  197.  *  mmi_msg_entry_new_cb_normal_ind
  198.  * DESCRIPTION
  199.  *  Entry new CB indication
  200.  * PARAMETERS
  201.  *  void
  202.  * RETURNS
  203.  *  void
  204.  *****************************************************************************/
  205. void mmi_msg_entry_new_cb_normal_ind(void)
  206. {
  207.     /*----------------------------------------------------------------*/
  208.     /* Local Variables                                                */
  209.     /*----------------------------------------------------------------*/
  210.     /*----------------------------------------------------------------*/
  211.     /* Code Body                                                      */
  212.     /*----------------------------------------------------------------*/
  213.     EntryNewScreen(SCR_ID_MSG_CB_MESSAGE_IND, mmi_msg_exit_generic, NULL, NULL);
  214.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_MESSAGE_IND);
  215.     GetCurrEndKeyDownHandler();
  216.     if (!IsKeyPadLockState())   /* keypad is unlocked */
  217.     {
  218.         ShowCategory154Screen(
  219.             0,
  220.             0,
  221.             STR_SCR6035_LSK,
  222.             IMG_SMS_COMMON_NOIMAGE,
  223.             STR_GLOBAL_BACK,
  224.             IMG_SMS_COMMON_NOIMAGE,
  225.             (PU8) GetString(STR_NEW_MESSAGE_FROM_ID),
  226.             (PU8) mmi_msg_get_new_cb_ind_string(),
  227.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  228.             NULL);
  229.         SetRightSoftkeyFunction(mmi_msg_go_back_from_new_cb_ind, KEY_EVENT_UP);
  230.         SetLeftSoftkeyFunction(mmi_msg_entry_new_cb_immediate_ind, KEY_EVENT_UP);
  231.         SetKeyHandler(mmi_msg_end_key_from_new_cb_ind, KEY_END, KEY_EVENT_DOWN);
  232.     }
  233.     else    /* keypad is locked */
  234.     {
  235.         ShowCategory154Screen(
  236.             0,
  237.             0,
  238.             g_keylock_context.KeyLockLSKStringID,
  239.             g_keylock_context.KeyLockLSKIconID,
  240.             g_keylock_context.KeyLockRSKStringID,
  241.             g_keylock_context.KeyLockRSKIconID,
  242.             (PU8) GetString(STR_NEW_MESSAGE_FROM_ID),
  243.             (PU8) mmi_msg_get_new_cb_ind_string(),
  244.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  245.             NULL);
  246.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  247.     }
  248. }
  249. /*****************************************************************************
  250.  * FUNCTION
  251.  *  mmi_msg_entry_new_cb_ind
  252.  * DESCRIPTION
  253.  *  Entry new CB indication
  254.  * PARAMETERS
  255.  *  void
  256.  * RETURNS
  257.  *  void
  258.  *****************************************************************************/
  259. void mmi_msg_entry_new_cb_ind(void)
  260. {
  261.     /*----------------------------------------------------------------*/
  262.     /* Local Variables                                                */
  263.     /*----------------------------------------------------------------*/
  264.     /*----------------------------------------------------------------*/
  265.     /* Code Body                                                      */
  266.     /*----------------------------------------------------------------*/
  267.     if (cb_display.immediate[cbMsgIndex.currCBIndex] == TRUE)
  268.     {
  269.         mmi_msg_entry_new_cb_immediate_ind();
  270.     }
  271.     else if (GetMessagesCurrScrnID() != SCR_ID_MSG_CB_MESSAGE_IDLE)
  272.     {
  273.         mmi_msg_entry_new_cb_normal_ind();
  274.     }
  275. }
  276. #else /* __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__ */ 
  277. /*****************************************************************************
  278.  * FUNCTION
  279.  *  mmi_msg_entry_new_cb_ind
  280.  * DESCRIPTION
  281.  *  Entry new CB indication
  282.  * PARAMETERS
  283.  *  void
  284.  * RETURNS
  285.  *  void
  286.  *****************************************************************************/
  287. void mmi_msg_entry_new_cb_ind(void)
  288. {
  289.     /*----------------------------------------------------------------*/
  290.     /* Local Variables                                                */
  291.     /*----------------------------------------------------------------*/
  292.     U16 page = (U16) cbMsgInfo.MsgPage[cbMsgIndex.currCBIndex] * NVRAM_SMS_CB_SMS_PAGE_SIZE;
  293.     /*----------------------------------------------------------------*/
  294.     /* Code Body                                                      */
  295.     /*----------------------------------------------------------------*/
  296.     if (IsKeyPadLockState() == 0)
  297.     {
  298.         EntryNewScreen(SCR_ID_MSG_CB_MESSAGE_IDLE, mmi_msg_exit_generic, NULL, NULL);
  299.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] EntryScrCBMessageBodyWhenIdle ---*n"));
  300.         ReadCBMessageContent(
  301.             (PU32) & dispCBLength,
  302.             cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBIndex],
  303.             page,
  304.             cbMsgInfo.MsgDCS[cbMsgIndex.currCBIndex]);
  305.         SetMessagesCurrScrnID(SCR_ID_MSG_CB_MESSAGE_IDLE);
  306.         GetCurrEndKeyDownHandler();
  307.         ShowCategory74Screen(
  308.             STR_CB_MSG_IND_INFORMATION_CAPTION,
  309.             IMG_SMS_ENTRY_SCRN_CAPTION,
  310.             STR_GLOBAL_DELETE,
  311.             IMG_GLOBAL_OK,
  312.             STR_GLOBAL_BACK,
  313.             IMG_GLOBAL_BACK,
  314.             (PU8) dispCBMessage,
  315.             (S32) dispCBLength,
  316.             NULL);
  317.         SetLeftSoftkeyFunction(mmi_msg_delete_new_cb_message, KEY_EVENT_UP);
  318.         SetRightSoftkeyFunction(mmi_msg_go_back_from_new_cb_ind, KEY_EVENT_UP);
  319.         SetKeyHandler(mmi_msg_end_key_from_new_cb_ind, KEY_END, KEY_EVENT_DOWN);
  320.         SetKeyHandler(mmi_msg_pre_entry_cb_idle_use_number, KEY_SEND, KEY_EVENT_UP);
  321.     }
  322.     else
  323.     {
  324.         ReadCBMessageContent(
  325.             (PU32) & dispCBLength,
  326.             cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBIndex],
  327.             page,
  328.             cbMsgInfo.MsgDCS[cbMsgIndex.currCBIndex]);
  329.         ShowCategory74Screen(
  330.             STR_CB_MSG_IND_INFORMATION_CAPTION,
  331.             IMG_SMS_ENTRY_SCRN_CAPTION,
  332.             g_keylock_context.KeyLockLSKStringID,
  333.             g_keylock_context.KeyLockLSKIconID,
  334.             g_keylock_context.KeyLockRSKStringID,
  335.             g_keylock_context.KeyLockRSKIconID,
  336.             (PU8) dispCBMessage,
  337.             (S32) dispCBLength,
  338.             NULL);
  339.         /* prevent category scrolling */
  340.         SetKeyHandler(NULL, KEY_UP_ARROW, KEY_EVENT_DOWN);
  341.         SetKeyHandler(NULL, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  342.         SetKeyHandler(NULL, KEY_VOL_UP, KEY_EVENT_DOWN);
  343.         SetKeyHandler(NULL, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  344.     }
  345. }
  346. #endif /* __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__ */ 
  347. /*****************************************************************************
  348.  * FUNCTION
  349.  *  mmi_msg_need_new_cb_ind
  350.  * DESCRIPTION
  351.  *  Check if new CB indication is needed
  352.  * PARAMETERS
  353.  *  void
  354.  * RETURNS
  355.  *  TRUE: indication needed, FALSE: indication not needed
  356.  *****************************************************************************/
  357. U8 mmi_msg_need_new_cb_ind(void)
  358. {
  359.     /*----------------------------------------------------------------*/
  360.     /* Local Variables                                                */
  361.     /*----------------------------------------------------------------*/
  362.     U8 i = 0;
  363.     /*----------------------------------------------------------------*/
  364.     /* Code Body                                                      */
  365.     /*----------------------------------------------------------------*/
  366.     if (cbMsgIndex.currCBTotal == 0)
  367.     {
  368.         return FALSE;
  369.     }
  370.     for (i = (cbMsgIndex.currCBTotal - 1);; i--)
  371.     {
  372.         if (cb_display.unread[i] == TRUE)
  373.         {
  374.             cbMsgIndex.currCBIndex = i;
  375.             return TRUE;
  376.         }
  377.         if (i == 0)
  378.         {
  379.             break;
  380.         }
  381.     }
  382.     return FALSE;
  383. }
  384. /*****************************************************************************
  385.  * FUNCTION
  386.  *  mmi_msg_restore_cb
  387.  * DESCRIPTION
  388.  *  Restore CB settings
  389.  * PARAMETERS
  390.  *  void
  391.  * RETURNS
  392.  *  void
  393.  *****************************************************************************/
  394. void mmi_msg_restore_cb(void)
  395. {
  396.     /*----------------------------------------------------------------*/
  397.     /* Local Variables                                                */
  398.     /*----------------------------------------------------------------*/
  399.     /*----------------------------------------------------------------*/
  400.     /* Code Body                                                      */
  401.     /*----------------------------------------------------------------*/
  402.     cb_state = SMS_CB_DEFAULT_SETTINGS_MODE_STATE;
  403.     SetProtocolEventHandler(mmi_msg_subscribe_cb_rsp, PRT_MSG_ID_MMI_CB_SUBSCRIBE_RSP);
  404.     mmi_msg_subscribe_cb_req(FALSE);
  405. }
  406. /*****************************************************************************
  407.  * FUNCTION
  408.  *  mmi_msg_subscribe_cb
  409.  * DESCRIPTION
  410.  *  Subscribe CB
  411.  * PARAMETERS
  412.  *  void
  413.  * RETURNS
  414.  *  void
  415.  *****************************************************************************/
  416. void mmi_msg_subscribe_cb(void)
  417. {
  418.     /*----------------------------------------------------------------*/
  419.     /* Local Variables                                                */
  420.     /*----------------------------------------------------------------*/
  421.     U8 mode = !cb_info.mode;
  422.     /*----------------------------------------------------------------*/
  423.     /* Code Body                                                      */
  424.     /*----------------------------------------------------------------*/
  425. #ifndef MMI_ON_HARDWARE_P
  426.     cb_info.mode = mode;
  427.     if (cb_info.mode == TRUE)
  428.     {
  429.         pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_ON));
  430.     }
  431.     else
  432.     {
  433.         pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_OFF));
  434.     }
  435.     mmi_msg_refresh_cb_main_menu();
  436. #else /* MMI_ON_HARDWARE_P */ 
  437.     ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
  438.     SetProtocolEventHandler(mmi_msg_subscribe_cb_rsp, PRT_MSG_ID_MMI_CB_SUBSCRIBE_RSP);
  439.     mmi_msg_subscribe_cb_req(mode);
  440. #endif /* MMI_ON_HARDWARE_P */ 
  441. }
  442. /*****************************************************************************
  443.  * FUNCTION
  444.  *  mmi_msg_save_cb_channel
  445.  * DESCRIPTION
  446.  *  Save CB channel info
  447.  * PARAMETERS
  448.  *  void
  449.  * RETURNS
  450.  *  void
  451.  *****************************************************************************/
  452. void mmi_msg_save_cb_channel(void)
  453. {
  454.     /*----------------------------------------------------------------*/
  455.     /* Local Variables                                                */
  456.     /*----------------------------------------------------------------*/
  457.     U32 mi = 0;
  458.     U8 number[(MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH] = {0, 0};
  459.     U16 length;
  460.     U8 i = 0;
  461.     /*----------------------------------------------------------------*/
  462.     /* Code Body                                                      */
  463.     /*----------------------------------------------------------------*/
  464.     if ((pfnUnicodeStrlen((S8*) cb_display.mi)) == 0)
  465.     {
  466.         DisplayPopup(
  467.             (PU8) GetString(STR_SMS_NUM_CANNOT_BE_EMPTY),
  468.             IMG_GLOBAL_UNFINISHED,
  469.             1,
  470.             MESSAGES_POPUP_TIME_OUT,
  471.             (U8) ERROR_TONE);
  472.         return;
  473.     }
  474.     memset(&number, 0, (MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH);
  475.     length = UnicodeNToAnsii(
  476.                 (S8*) number,
  477.                 (S8*) cb_display.mi,
  478.                 (pfnUnicodeStrlen((S8*) cb_display.mi)) * ENCODING_LENGTH);
  479.     number[length] = '';
  480.     mi = atoi((S8*) number);
  481.     if (mi > MAX_CB_CHNL_NUMBER)
  482.     {
  483.         DisplayPopup(
  484.             (PU8) GetString(STR_CB_CHNL_NUMBER_LEN_EXCEEDED),
  485.             IMG_GLOBAL_UNFINISHED,
  486.             1,
  487.             MESSAGES_POPUP_TIME_OUT,
  488.             (U8) ERROR_TONE);
  489.         return;
  490.     }
  491.     for (i = 0; i < cb_info.totalmi; i++)
  492.     {
  493.         if ((cb_state == SMS_CB_CHNL_EDIT_STATE) && (i == g_msg_cntx.currHiliteIndex))
  494.         {
  495.             continue;
  496.         }
  497.         if (cb_info.cbchnlentry[i].mi == (U16) mi)
  498.         {
  499.             DisplayPopup(
  500.                 (PU8) GetString(STR_CB_CHNL_DUPLICATE_NUMBER_NOT_ALLOWED),
  501.                 IMG_GLOBAL_UNFINISHED,
  502.                 1,
  503.                 MESSAGES_POPUP_TIME_OUT,
  504.                 (U8) ERROR_TONE);
  505.             return;
  506.         }
  507.     }
  508.     if (cb_state == SMS_CB_CHNL_ADD_STATE)
  509.     {
  510.         mmi_msg_add_cb_channel((U16) mi);
  511.     }
  512.     else
  513.     {
  514.         mmi_msg_edit_cb_channel((U16) mi);
  515.     }
  516. }
  517. /*****************************************************************************
  518.  * FUNCTION
  519.  *  mmi_msg_pre_save_cb_channel
  520.  * DESCRIPTION
  521.  *  Save CB channel info
  522.  * PARAMETERS
  523.  *  void
  524.  * RETURNS
  525.  *  void
  526.  *****************************************************************************/
  527. void mmi_msg_pre_save_cb_channel(void)
  528. {
  529.     /*----------------------------------------------------------------*/
  530.     /* Local Variables                                                */
  531.     /*----------------------------------------------------------------*/
  532.     /*----------------------------------------------------------------*/
  533.     /* Code Body                                                      */
  534.     /*----------------------------------------------------------------*/
  535.     mmi_msg_set_confirm_screen(STR_GLOBAL_SAVE, mmi_msg_save_cb_channel, Messages2GoBackHistory);
  536.     mmi_msg_entry_confirm_generic();
  537. }
  538. /*****************************************************************************
  539.  * FUNCTION
  540.  *  mmi_msg_select_cb_channel
  541.  * DESCRIPTION
  542.  *  Select CB channel
  543.  * PARAMETERS
  544.  *  void
  545.  * RETURNS
  546.  *  void
  547.  *****************************************************************************/
  548. void mmi_msg_select_cb_channel(void)
  549. {
  550.     /*----------------------------------------------------------------*/
  551.     /* Local Variables                                                */
  552.     /*----------------------------------------------------------------*/
  553.     U8 i = 0;
  554.     /*----------------------------------------------------------------*/
  555.     /* Code Body                                                      */
  556.     /*----------------------------------------------------------------*/
  557.     for (i = 0; i < cb_info.totalmi; i++)
  558.     {
  559.         cb_info.cbchnlentry[i].mask = cb_display.mask[i + 1];
  560.     }
  561.     ClearInputEventHandler(MMI_DEVICE_ALL);
  562.     SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
  563.     mmi_msg_set_cb_mode_req(SMSAL_CB_MI_MASK);
  564. }
  565. /*****************************************************************************
  566.  * FUNCTION
  567.  *  mmi_msg_add_cb_channel
  568.  * DESCRIPTION
  569.  *  Add CB channel
  570.  * PARAMETERS
  571.  *  mi      [IN]        Mi to be added
  572.  * RETURNS
  573.  *  void
  574.  *****************************************************************************/
  575. void mmi_msg_add_cb_channel(U16 mi)
  576. {
  577.     /*----------------------------------------------------------------*/
  578.     /* Local Variables                                                */
  579.     /*----------------------------------------------------------------*/
  580.     /*----------------------------------------------------------------*/
  581.     /* Code Body                                                      */
  582.     /*----------------------------------------------------------------*/
  583.     cb_info.cbchnlentry[cb_info.totalmi].index = cb_display.addindex;
  584.     cb_info.cbchnlentry[cb_info.totalmi].mask = 1;
  585.     cb_info.cbchnlentry[cb_info.totalmi].mi = mi;
  586.     memset(cb_info.cbchnlentry[cb_info.totalmi].name, 0, ENCODING_LENGTH);
  587.     if (GetUCS2Flag((PS8) cb_display.name))
  588.     {
  589.         cb_display.dcs = PHB_UCS2;
  590.     }
  591.     else
  592.     {
  593.         cb_display.dcs = PHB_ASCII;
  594.     }
  595.     if (cb_display.dcs == PHB_ASCII)
  596.     {
  597.         UnicodeToAnsii((S8*) cb_info.cbchnlentry[cb_info.totalmi].name, (S8*) cb_display.name);
  598.     }
  599.     else
  600.     {
  601.         pfnUnicodeStrcpy((S8*) cb_info.cbchnlentry[cb_info.totalmi].name, (S8*) cb_display.name);
  602.     }
  603.     cb_info.cbchnlentry[cb_info.totalmi].dcs = cb_display.dcs;
  604.     /* delete if apply new interface */
  605.     memset(cbNvramStruct.chnlNames[cb_info.totalmi].name, 0, MAX_CB_CHNL_NAME_LENGTH + 1);
  606.     memcpy(
  607.         cbNvramStruct.chnlNames[cb_info.totalmi].name,
  608.         (S8*) cb_info.cbchnlentry[cb_info.totalmi].name,
  609.         MAX_CB_CHNL_NAME_LENGTH);
  610.     cbNvramStruct.chnlNames[cb_info.totalmi].name_dcs = cb_display.dcs;
  611.     cbNvramStruct.l4MidIndex[cb_info.totalmi] = cb_display.addindex;
  612.     WriteCbChnlInfoToNvram();
  613.     /* end */
  614.     cb_info.totalmi++;
  615.     ClearInputEventHandler(MMI_DEVICE_ALL);
  616.     SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
  617.     mmi_msg_set_cb_mode_req(SMSAL_CB_MI | SMSAL_CB_MI_MASK);
  618. }
  619. /*****************************************************************************
  620.  * FUNCTION
  621.  *  mmi_msg_edit_cb_channel
  622.  * DESCRIPTION
  623.  *  Edit CB channel
  624.  * PARAMETERS
  625.  *  mi      [IN]        Mi to be modified
  626.  * RETURNS
  627.  *  void
  628.  *****************************************************************************/
  629. void mmi_msg_edit_cb_channel(U16 mi)
  630. {
  631.     /*----------------------------------------------------------------*/
  632.     /* Local Variables                                                */
  633.     /*----------------------------------------------------------------*/
  634.     /*----------------------------------------------------------------*/
  635.     /* Code Body                                                      */
  636.     /*----------------------------------------------------------------*/
  637.     cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].mi = mi;
  638.     memset(cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name, 0, MAX_CB_CHNL_NAME_LENGTH + 1);
  639.     if (GetUCS2Flag((PS8) cb_display.name))
  640.     {
  641.         cb_display.dcs = PHB_UCS2;
  642.     }
  643.     else
  644.     {
  645.         cb_display.dcs = PHB_ASCII;
  646.     }
  647.     if (cb_display.dcs == PHB_ASCII)
  648.     {
  649.         UnicodeNToAnsii(
  650.             (S8*) cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name,
  651.             (S8*) cb_display.name,
  652.             MAX_CB_CHNL_NAME_LENGTH * ENCODING_LENGTH);
  653.     }
  654.     else
  655.     {
  656.         pfnUnicodeStrcpy((S8*) cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name, (S8*) cb_display.name);
  657.     }
  658.     cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].dcs = cb_display.dcs;
  659.     /* delete if apply new interface */
  660.     memset(cbNvramStruct.chnlNames[g_msg_cntx.currHiliteIndex].name, 0, MAX_CB_CHNL_NAME_LENGTH + 1);
  661.     memcpy(
  662.         cbNvramStruct.chnlNames[g_msg_cntx.currHiliteIndex].name,
  663.         (S8*) cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name,
  664.         MAX_CB_CHNL_NAME_LENGTH);
  665.     cbNvramStruct.chnlNames[g_msg_cntx.currHiliteIndex].name_dcs = cb_display.dcs;
  666.     WriteCbChnlInfoToNvram();
  667.     /* end */
  668.     ClearInputEventHandler(MMI_DEVICE_ALL);
  669.     SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
  670.     mmi_msg_set_cb_mode_req(SMSAL_CB_MI);
  671. }
  672. /*****************************************************************************
  673.  * FUNCTION
  674.  *  mmi_msg_delete_cb_channel
  675.  * DESCRIPTION
  676.  *  Delete CB channel
  677.  * PARAMETERS
  678.  *  void
  679.  * RETURNS
  680.  *  void
  681.  *****************************************************************************/
  682. void mmi_msg_delete_cb_channel(void)
  683. {
  684.     /*----------------------------------------------------------------*/
  685.     /* Local Variables                                                */
  686.     /*----------------------------------------------------------------*/
  687.     U8 i = 0;
  688.     /*----------------------------------------------------------------*/
  689.     /* Code Body                                                      */
  690.     /*----------------------------------------------------------------*/
  691.     for (i = (g_msg_cntx.currHiliteIndex + 1); i < cb_info.totalmi; i++)
  692.     {
  693.         memcpy(&cb_info.cbchnlentry[i - 1], &cb_info.cbchnlentry[i], sizeof(msg_cb_channel_struct));
  694.     }
  695.     cb_info.totalmi--;
  696.     cb_info.cbchnlentry[cb_info.totalmi].mi = SMSAL_CB_UNUSED_CBMI;
  697.     cb_info.cbchnlentry[cb_info.totalmi].mask = 0;
  698.     memset(cb_info.cbchnlentry[cb_info.totalmi].name, 0, MAX_CB_CHNL_NAME_LENGTH);
  699.     memset(&cbNvramStruct, 0xff, sizeof(msg_cb_channel_nvram_struct));
  700.     for (i = 0; i < cb_info.totalmi; i++)
  701.     {
  702.         cbNvramStruct.l4MidIndex[i] = cb_info.cbchnlentry[i].index;
  703.         cbNvramStruct.chnlNames[i].name_dcs = cb_info.cbchnlentry[i].dcs;
  704.         memcpy((S8*) cbNvramStruct.chnlNames[i].name, (S8*) cb_info.cbchnlentry[i].name, MAX_CB_CHNL_NAME_LENGTH + 1);
  705.     }
  706.     WriteCbChnlInfoToNvram();
  707.     ClearInputEventHandler(MMI_DEVICE_ALL);
  708.     SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
  709.     mmi_msg_set_cb_mode_req(SMSAL_CB_MI | SMSAL_CB_MI_MASK);
  710. }
  711. /*****************************************************************************
  712.  * FUNCTION
  713.  *  mmi_msg_select_cb_language
  714.  * DESCRIPTION
  715.  *  Select CB language
  716.  * PARAMETERS
  717.  *  void
  718.  * RETURNS
  719.  *  void
  720.  *****************************************************************************/
  721. void mmi_msg_select_cb_language(void)
  722. {
  723.     /*----------------------------------------------------------------*/
  724.     /* Local Variables                                                */
  725.     /*----------------------------------------------------------------*/
  726.     U8 i = 0;
  727.     /*----------------------------------------------------------------*/
  728.     /* Code Body                                                      */
  729.     /*----------------------------------------------------------------*/
  730.     for (i = 0; i < cb_info.totaldcs; i++)
  731.     {
  732.         cb_info.cblanentry[i].mask = cb_display.mask[i + 1];
  733.     }
  734.     cb_info.dcsall = cb_display.mask[0];
  735.     ClearInputEventHandler(MMI_DEVICE_ALL);
  736.     SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
  737.     mmi_msg_set_cb_mode_req(SMSAL_CB_DCS_MASK | SMSAL_CB_ALL_LANG);
  738. }
  739. /*****************************************************************************
  740.  * FUNCTION
  741.  *  mmi_msg_refresh_cb_main_menu
  742.  * DESCRIPTION
  743.  *  Refresh CB main menu
  744.  * PARAMETERS
  745.  *  void
  746.  * RETURNS
  747.  *  void
  748.  *****************************************************************************/
  749. void mmi_msg_refresh_cb_main_menu(void)
  750. {
  751.     /*----------------------------------------------------------------*/
  752.     /* Local Variables                                                */
  753.     /*----------------------------------------------------------------*/
  754.     /*----------------------------------------------------------------*/
  755.     /* Code Body                                                      */
  756.     /*----------------------------------------------------------------*/
  757.     if (GetExitScrnID() == SCR_ID_MSG_CB_MAIN_MENU)
  758.     {
  759.         S32 index = GetChildMenuIDIndexByParentMenuID(MESSAGES_MENU_CB_MENUID, MITEM102_CB_SERVICE);;
  760.         if (index != -1)
  761.         {
  762.             Category52ChangeItemDescription(index, cb_display.mode);
  763.         }
  764.         if (cb_info.mode == TRUE)
  765.         {
  766.             ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_GLOBAL_OK);
  767.         }
  768.         else
  769.         {
  770.             ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_GLOBAL_OK);
  771.         }
  772.         SetLeftSoftkeyFunction(mmi_msg_subscribe_cb, KEY_EVENT_UP);
  773.         RedrawCategoryFunction();
  774.     }
  775. }
  776. /*****************************************************************************
  777.  * FUNCTION
  778.  *  mmi_msg_entry_cb_main_menu
  779.  * DESCRIPTION
  780.  *  Entry CB main menu
  781.  * PARAMETERS
  782.  *  void
  783.  * RETURNS
  784.  *  void
  785.  *****************************************************************************/
  786. void mmi_msg_entry_cb_main_menu(void)
  787. {
  788.     /*----------------------------------------------------------------*/
  789.     /* Local Variables                                                */
  790.     /*----------------------------------------------------------------*/
  791.     U8 *guiBuffer = NULL;
  792.     U16 numItems = 0;
  793.     U16 nStrItemList[MAX_SUB_MENUS];
  794.     U8 *popUpList[MAX_SUB_MENUS];
  795.     /*----------------------------------------------------------------*/
  796.     /* Code Body                                                      */
  797.     /*----------------------------------------------------------------*/
  798.     EntryNewScreen(SCR_ID_MSG_CB_MAIN_MENU, mmi_msg_exit_generic, mmi_msg_entry_cb_main_menu, NULL);
  799.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[SmsMoMtGuiInterface.c] mmi_msg_entry_cb_main_menu -------*n"));
  800.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_MAIN_MENU);
  801.     numItems = GetNumOfChild(MESSAGES_MENU_CB_MENUID);
  802.     GetSequenceStringIds(MESSAGES_MENU_CB_MENUID, nStrItemList);
  803.     SetParentHandler(MESSAGES_MENU_CB_MENUID);
  804.     ConstructHintsList(MESSAGES_MENU_CB_MENUID, popUpList);
  805.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  806.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_MAIN_MENU);
  807.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MAIN_MENU);
  808.     ShowCategory52Screen(
  809.         STR_CB_MENUENTRY,
  810.         IMG_SMS_ENTRY_SCRN_CAPTION,
  811.         STR_GLOBAL_OK,
  812.         IMG_GLOBAL_OK,
  813.         STR_GLOBAL_BACK,
  814.         IMG_GLOBAL_BACK,
  815.         numItems,
  816.         nStrItemList,
  817.         (U16*) gIndexIconsImageList,
  818.         popUpList,
  819.         0,
  820.         0,
  821.         guiBuffer);
  822. }
  823. /*****************************************************************************
  824.  * FUNCTION
  825.  *  mmi_msg_pre_entry_cb_main_menu
  826.  * DESCRIPTION
  827.  *  Get CB mode request before entry CB main menu
  828.  * PARAMETERS
  829.  *  void
  830.  * RETURNS
  831.  *  void
  832.  *****************************************************************************/
  833. void mmi_msg_pre_entry_cb_main_menu(void)
  834. {
  835. #ifdef MMI_ON_HARDWARE_P
  836.     /*----------------------------------------------------------------*/
  837.     /* Local Variables                                                */
  838.     /*----------------------------------------------------------------*/
  839.     /*----------------------------------------------------------------*/
  840.     /* Code Body                                                      */
  841.     /*----------------------------------------------------------------*/
  842.     if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_NOBOX) == MMI_FRM_SMS_INVALID_INDEX)
  843.     {
  844.         DisplayPopup(
  845.             (PU8) GetString(STR_CB_NOT_READY_YET),
  846.             IMG_GLOBAL_UNFINISHED,
  847.             1,
  848.             MESSAGES_POPUP_TIME_OUT,
  849.             (U8) ERROR_TONE);
  850.         return;
  851.     }
  852.     /* disallow re-entering SMS application when there is a pending SMS job running in the background */
  853.     else if (mmi_frm_sms_check_action_pending())
  854.     {
  855.         DisplayPopup(
  856.             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  857.             IMG_GLOBAL_UNFINISHED,
  858.             1,
  859.             MESSAGES_POPUP_TIME_OUT,
  860.             (U8) ERROR_TONE);
  861.         return;
  862.     }
  863. #endif /* MMI_ON_HARDWARE_P */ 
  864.     cb_state = SMS_CB_SERVICE_MODE_STATE;
  865.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_active, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  866.     mmi_msg_get_cb_mode_req();
  867. }
  868. /*****************************************************************************
  869.  * FUNCTION
  870.  *  mmi_msg_entry_cb_channel_settings
  871.  * DESCRIPTION
  872.  *  Entry CB channel settings screen
  873.  * PARAMETERS
  874.  *  void
  875.  * RETURNS
  876.  *  void
  877.  *****************************************************************************/
  878. void mmi_msg_entry_cb_channel_settings(void)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     U8 *guiBuffer = NULL;
  884.     U16 numItems = 0;
  885.     U16 nStrItemList[MAX_SUB_MENUS];
  886.     /*----------------------------------------------------------------*/
  887.     /* Code Body                                                      */
  888.     /*----------------------------------------------------------------*/
  889.     EntryNewScreen(SCR_ID_MSG_CB_CHANNEL_SETTINGS, mmi_msg_exit_generic, mmi_msg_entry_cb_channel_settings, NULL);
  890.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[SmsMoMtGuiInterface.c] mmi_msg_entry_option_other -------*n"));
  891.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_CHANNEL_SETTINGS);
  892.     numItems = GetNumOfChild(MITEM103_CB_CHANNEL_ENBL_OPTIONS);
  893.     GetSequenceStringIds(MITEM103_CB_CHANNEL_ENBL_OPTIONS, nStrItemList);
  894.     SetParentHandler(MITEM103_CB_CHANNEL_ENBL_OPTIONS);
  895.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  896.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_CHANNEL_SETTINGS);
  897.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_CHANNEL_SETTINGS);
  898.     ShowCategory52Screen(
  899.         STR102_SCR103_CAPTION,
  900.         IMG_SMS_ENTRY_SCRN_CAPTION,
  901.         STR_GLOBAL_OK,
  902.         IMG_GLOBAL_OK,
  903.         STR_GLOBAL_BACK,
  904.         IMG_GLOBAL_BACK,
  905.         numItems,
  906.         nStrItemList,
  907.         (U16*) gIndexIconsImageList,
  908.         NULL,
  909.         0,
  910.         0,
  911.         guiBuffer);
  912. }
  913. /*****************************************************************************
  914.  * FUNCTION
  915.  *  mmi_msg_pre_entry_cb_channel_bootup
  916.  * DESCRIPTION
  917.  *  Get CB mode request in bootup procedure.
  918.  *  This is for filling up cb_info to display channel name when getting a CB message.
  919.  * PARAMETERS
  920.  *  void
  921.  * RETURNS
  922.  *  void
  923.  *****************************************************************************/
  924. void mmi_msg_pre_entry_cb_channel_bootup(void)
  925. {
  926.     /*----------------------------------------------------------------*/
  927.     /* Local Variables                                                */
  928.     /*----------------------------------------------------------------*/
  929.     /*----------------------------------------------------------------*/
  930.     /* Code Body                                                      */
  931.     /*----------------------------------------------------------------*/
  932.     cb_state = SMS_CB_BOOT_UP_STATE;
  933.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  934.     mmi_msg_get_cb_mode_req();
  935. }
  936. /*****************************************************************************
  937.  * FUNCTION
  938.  *  mmi_msg_entry_cb_channel_select
  939.  * DESCRIPTION
  940.  *  Entry CB channel select screen
  941.  * PARAMETERS
  942.  *  void
  943.  * RETURNS
  944.  *  void
  945.  *****************************************************************************/
  946. void mmi_msg_entry_cb_channel_select(void)
  947. {
  948.     /*----------------------------------------------------------------*/
  949.     /* Local Variables                                                */
  950.     /*----------------------------------------------------------------*/
  951.     U8 *guiBuffer;
  952.     U16 numItems;
  953.     U8 i = 0;
  954.     U8 selectall = TRUE;
  955.     U8 number[MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1];
  956.     /*----------------------------------------------------------------*/
  957.     /* Code Body                                                      */
  958.     /*----------------------------------------------------------------*/
  959.     EntryNewScreen(SCR_ID_MSG_CB_CHANNEL_LIST, mmi_msg_exit_generic, mmi_msg_entry_cb_channel_select, NULL);
  960.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] mmi_msg_entry_cb_channel_select -------*n"));
  961.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_CHANNEL_LIST);
  962.     pfnUnicodeStrncpy(
  963.         (S8*) subMenuDataPtrs[0],
  964.         (S8*) GetString((U16) STR_CB_ALL_CHANNELS_FOR_SELECT),
  965.         MAX_CB_CHNL_NAME_LENGTH * ENCODING_LENGTH);
  966.     for (i = 0; i < cb_info.totalmi; i++)
  967.     {
  968.         if (strlen((S8*) cb_info.cbchnlentry[i].name) == 0)
  969.         {
  970.             memset(number, 0, sizeof(number));
  971.             sprintf((PS8) number, "%d", cb_info.cbchnlentry[i].mi);
  972.             AnsiiToUnicodeString((S8*) subMenuDataPtrs[i + 1], (S8*) number);
  973.         }
  974.         else
  975.         {
  976.             if (cb_info.cbchnlentry[i].dcs == PHB_ASCII)
  977.             {
  978.                 AnsiiToUnicodeString((S8*) subMenuDataPtrs[i + 1], (S8*) cb_info.cbchnlentry[i].name);
  979.             }
  980.             else
  981.             {
  982.                 pfnUnicodeStrcpy((S8*) subMenuDataPtrs[i + 1], (S8*) cb_info.cbchnlentry[i].name);
  983.             }
  984.         }
  985.         cb_display.mask[i + 1] = cb_info.cbchnlentry[i].mask;
  986.         if (cb_display.mask[i + 1] == 0)
  987.         {
  988.             selectall = FALSE;
  989.         }
  990.     }
  991.     cb_display.mask[0] = selectall;
  992.     numItems = cb_info.totalmi + 1;
  993.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_CHANNEL_LIST);
  994.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_CHANNEL_LIST);
  995.     mmi_msg_set_confirm_screen(STR_GLOBAL_SAVE, mmi_msg_select_cb_channel, Messages2GoBackHistory);
  996.     SetCheckboxToggleRightSoftkeyFunctions(mmi_msg_entry_confirm_generic, GoBackHistory);
  997.     ShowCategory140Screen(
  998.         STR_CB_SELECT_CHNL,
  999.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1000.         numItems,
  1001.         (U8 **) subMenuDataPtrs,
  1002.         (U8*) cb_display.mask,
  1003.         0,
  1004.         guiBuffer);
  1005.     SetLeftSoftkeyFunction(special_check_list_handle_left_softkey_up, KEY_EVENT_UP);
  1006.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1007.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1008. }
  1009. /*****************************************************************************
  1010.  * FUNCTION
  1011.  *  mmi_msg_pre_entry_cb_channel_select
  1012.  * DESCRIPTION
  1013.  *  Get CB mode request before enter CB channel select
  1014.  * PARAMETERS
  1015.  *  void
  1016.  * RETURNS
  1017.  *  void
  1018.  *****************************************************************************/
  1019. void mmi_msg_pre_entry_cb_channel_select(void)
  1020. {
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Local Variables                                                */
  1023.     /*----------------------------------------------------------------*/
  1024.     /*----------------------------------------------------------------*/
  1025.     /* Code Body                                                      */
  1026.     /*----------------------------------------------------------------*/
  1027.     cb_state = SMS_CB_CHNL_SELECT_STATE;
  1028.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1029.     mmi_msg_get_cb_mode_req();
  1030. }
  1031. /*****************************************************************************
  1032.  * FUNCTION
  1033.  *  mmi_msg_entry_cb_channel_list
  1034.  * DESCRIPTION
  1035.  *  Entry CB channel list
  1036.  * PARAMETERS
  1037.  *  void
  1038.  * RETURNS
  1039.  *  void
  1040.  *****************************************************************************/
  1041. void mmi_msg_entry_cb_channel_list(void)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     U8 *guiBuffer = NULL;
  1047.     S32 hiliteitem = 0;
  1048.     /*----------------------------------------------------------------*/
  1049.     /* Code Body                                                      */
  1050.     /*----------------------------------------------------------------*/
  1051.     EntryNewScreen(SCR_ID_MSG_CB_CHANNEL_LIST, mmi_msg_exit_generic, mmi_msg_entry_cb_channel_list, NULL);
  1052.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] mmi_msg_entry_cb_channel_list -------*n"));
  1053.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_CHANNEL_LIST);
  1054.     if (guiBuffer != NULL)
  1055.     {
  1056.         hiliteitem = (g_msg_cntx.currHiliteIndex < cb_info.totalmi) ? g_msg_cntx.currHiliteIndex : 0;
  1057.     }
  1058.     RegisterHighlightHandler(GetHiliteIndex);
  1059.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_CHANNEL_LIST);
  1060.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_CHANNEL_LIST);
  1061.     ShowCategory184Screen(
  1062.         STR_CB_CHNL_LIST,
  1063.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1064.         STR_GLOBAL_OK,
  1065.         IMG_GLOBAL_OK,
  1066.         STR_GLOBAL_BACK,
  1067.         IMG_GLOBAL_BACK,
  1068.         cb_info.totalmi,
  1069.         mmi_msg_cb_channel_list_get_item,
  1070.         mmi_msg_cb_channel_list_get_hint,
  1071.         hiliteitem,
  1072.         guiBuffer);
  1073.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1074.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1075.     if (cb_state == SMS_CB_CHNL_EDIT_STATE)
  1076.     {
  1077.         SetLeftSoftkeyFunction(mmi_msg_pre_entry_cb_channel_edit, KEY_EVENT_UP);
  1078.     }
  1079.     else
  1080.     {
  1081.         mmi_msg_set_confirm_screen(STR_GLOBAL_DELETE, mmi_msg_delete_cb_channel, GoBackHistory);
  1082.         SetLeftSoftkeyFunction(mmi_msg_entry_confirm_generic, KEY_EVENT_UP);
  1083.     }
  1084. }
  1085. /*****************************************************************************
  1086.  * FUNCTION
  1087.  *  mmi_msg_cb_channel_list_get_item
  1088.  * DESCRIPTION
  1089.  *  Get CB channel list item
  1090.  * PARAMETERS
  1091.  *  item_index          [IN]            
  1092.  *  str_buff            [IN]            
  1093.  *  img_buff_p          [?]             
  1094.  *  str_img_mask        [IN]            
  1095.  *  a(?)                [IN]            Item index
  1096.  *  d(?)                [IN/OUT]        String image mask
  1097.  *  c(?)                [IN/OUT]        Image buffer
  1098.  *  b(?)                [IN/OUT]        String buffer
  1099.  * RETURNS
  1100.  * TRUE
  1101.  *****************************************************************************/
  1102. pBOOL mmi_msg_cb_channel_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  1103. {
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Local Variables                                                */
  1106.     /*----------------------------------------------------------------*/
  1107.     U8 number[MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1];
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Code Body                                                      */
  1110.     /*----------------------------------------------------------------*/
  1111.     if ((item_index < 0) || (item_index >= cb_info.totalmi))
  1112.     {
  1113.         return FALSE;
  1114.     }
  1115.     if (cb_info.cbchnlentry[item_index].dcs == PHB_ASCII)
  1116.     {
  1117.         if (strlen((S8*) cb_info.cbchnlentry[item_index].name) == 0)
  1118.         {
  1119.             memset(number, 0, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  1120.             sprintf((PS8) number, "%d", cb_info.cbchnlentry[item_index].mi);
  1121.             AnsiiToUnicodeString((S8*) str_buff, (S8*) number);
  1122.         }
  1123.         else
  1124.         {
  1125.             AnsiiToUnicodeString((S8*) str_buff, (S8*) cb_info.cbchnlentry[item_index].name);
  1126.         }
  1127.     }
  1128.     else
  1129.     {
  1130.         if (pfnUnicodeStrlen((S8*) cb_info.cbchnlentry[item_index].name) == 0)
  1131.         {
  1132.             memset(number, 0, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  1133.             sprintf((PS8) number, "%d", cb_info.cbchnlentry[item_index].mi);
  1134.             AnsiiToUnicodeString((S8*) str_buff, (S8*) number);
  1135.         }
  1136.         else
  1137.         {
  1138.             pfnUnicodeStrcpy((S8*) str_buff, (S8*) cb_info.cbchnlentry[item_index].name);
  1139.         }
  1140.     }
  1141.     *img_buff_p = get_image(IMG_CB_CHNL_TITLE);
  1142.     return TRUE;
  1143. }
  1144. /*****************************************************************************
  1145.  * FUNCTION
  1146.  *  mmi_msg_cb_channel_list_get_hint
  1147.  * DESCRIPTION
  1148.  *  Get CB channel list hint
  1149.  * PARAMETERS
  1150.  *  item_index      [IN]            
  1151.  *  hint_array      [?]             
  1152.  *  a(?)            [IN]            Item index
  1153.  *  b(?)            [IN/OUT]        Hint array
  1154.  * RETURNS
  1155.  *  TRUE: display hint, FALSE: not display hint
  1156.  *****************************************************************************/
  1157. S32 mmi_msg_cb_channel_list_get_hint(S32 item_index, UI_string_type *hint_array)
  1158. {
  1159.     /*----------------------------------------------------------------*/
  1160.     /* Local Variables                                                */
  1161.     /*----------------------------------------------------------------*/
  1162.     U8 number[MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1];
  1163.     /*----------------------------------------------------------------*/
  1164.     /* Code Body                                                      */
  1165.     /*----------------------------------------------------------------*/
  1166.     if (strlen((S8*) cb_info.cbchnlentry[item_index].name) == 0)
  1167.     {
  1168.         return 0;
  1169.     }
  1170.     memset(number, 0, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  1171.     sprintf((PS8) number, "%d", cb_info.cbchnlentry[item_index].mi);
  1172.     AnsiiNToUnicodeString((S8*) hint_array[0], (S8*) number, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  1173.     return 1;
  1174. }
  1175. /*****************************************************************************
  1176.  * FUNCTION
  1177.  *  mmi_msg_pre_entry_cb_channel_add
  1178.  * DESCRIPTION
  1179.  *  Before add CB channel, check if unused CBMI available
  1180.  * PARAMETERS
  1181.  *  void
  1182.  * RETURNS
  1183.  *  void
  1184.  *****************************************************************************/
  1185. void mmi_msg_pre_entry_cb_channel_add(void)
  1186. {
  1187.     /*----------------------------------------------------------------*/
  1188.     /* Local Variables                                                */
  1189.     /*----------------------------------------------------------------*/
  1190.     /*----------------------------------------------------------------*/
  1191.     /* Code Body                                                      */
  1192.     /*----------------------------------------------------------------*/
  1193.     cb_state = SMS_CB_CHNL_ADD_STATE;
  1194.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1195.     mmi_msg_get_cb_mode_req();
  1196. }
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  mmi_msg_pre_entry_cb_channel_list_edit
  1200.  * DESCRIPTION
  1201.  *  Before enter CB channel edit, get chennel list
  1202.  * PARAMETERS
  1203.  *  void
  1204.  * RETURNS
  1205.  *  void
  1206.  *****************************************************************************/
  1207. void mmi_msg_pre_entry_cb_channel_list_edit(void)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     /*----------------------------------------------------------------*/
  1213.     /* Code Body                                                      */
  1214.     /*----------------------------------------------------------------*/
  1215.     cb_state = SMS_CB_CHNL_EDIT_STATE;
  1216.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1217.     mmi_msg_get_cb_mode_req();
  1218. }
  1219. /*****************************************************************************
  1220.  * FUNCTION
  1221.  *  mmi_msg_pre_entry_cb_channel_list_delete
  1222.  * DESCRIPTION
  1223.  *  Before enter CB channel delete, get chennel list
  1224.  * PARAMETERS
  1225.  *  void
  1226.  * RETURNS
  1227.  *  void
  1228.  *****************************************************************************/
  1229. void mmi_msg_pre_entry_cb_channel_list_delete(void)
  1230. {
  1231.     /*----------------------------------------------------------------*/
  1232.     /* Local Variables                                                */
  1233.     /*----------------------------------------------------------------*/
  1234.     /*----------------------------------------------------------------*/
  1235.     /* Code Body                                                      */
  1236.     /*----------------------------------------------------------------*/
  1237.     cb_state = SMS_CB_CHNL_DELETE_STATE;
  1238.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1239.     mmi_msg_get_cb_mode_req();
  1240. }
  1241. /*****************************************************************************
  1242.  * FUNCTION
  1243.  *  mmi_msg_set_cb_channel_inline_item
  1244.  * DESCRIPTION
  1245.  *  Set CB channel inline item for channel edit screen
  1246.  * PARAMETERS
  1247.  *  void
  1248.  * RETURNS
  1249.  *  void
  1250.  *****************************************************************************/
  1251. void mmi_msg_set_cb_channel_inline_item(void)
  1252. {
  1253.     /*----------------------------------------------------------------*/
  1254.     /* Local Variables                                                */
  1255.     /*----------------------------------------------------------------*/
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Code Body                                                      */
  1258.     /*----------------------------------------------------------------*/
  1259.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  1260.     SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
  1261.     SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
  1262.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1263.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_CB_CHNL_TITLE));
  1264.     SetInlineItemFullScreenEdit(
  1265.         &wgui_inline_items[1],
  1266.         STR_CB_CHNL_TITLE_FULL_EDIT,
  1267.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1268.         (U8*) cb_display.name,
  1269.         MAX_CB_CHNL_NAME_LENGTH + 1,
  1270.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ONE_LESS_CHARACTER | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  1271.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_msg_inline_generic_custom_function);
  1272.     SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_CB_CHNL_NUMBER));
  1273.     SetInlineItemTextEdit(
  1274.         &wgui_inline_items[3],
  1275.         (U8*) cb_display.mi,
  1276.         MAX_CB_CHNL_NUMBER_LENGTH + 1,
  1277.         INPUT_TYPE_NUMERIC);
  1278.     DisableInlineItemHighlight(&wgui_inline_items[3]);
  1279. }
  1280. /*****************************************************************************
  1281.  * FUNCTION
  1282.  *  mmi_msg_entry_cb_channel_edit
  1283.  * DESCRIPTION
  1284.  *  Entry CB channel edit screen
  1285.  * PARAMETERS
  1286.  *  void
  1287.  * RETURNS
  1288.  *  void
  1289.  *****************************************************************************/
  1290. void mmi_msg_entry_cb_channel_edit(void)
  1291. {
  1292.     /*----------------------------------------------------------------*/
  1293.     /* Local Variables                                                */
  1294.     /*----------------------------------------------------------------*/
  1295.     PU8 guiBuffer = NULL;
  1296.     PU8 inputBuffer = NULL;
  1297.     U16 inputBufferSize = 0;
  1298.     /*----------------------------------------------------------------*/
  1299.     /* Code Body                                                      */
  1300.     /*----------------------------------------------------------------*/
  1301.     EntryNewScreen(SCR_ID_MSG_CB_CHANNEL_EDIT, mmi_msg_exit_cb_channel_edit, NULL, NULL);
  1302.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] EntryScrCBChannelEditor ---*n"));
  1303.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_CHANNEL_EDIT);
  1304.     inputBuffer = GetCurrNInputBuffer(SCR_ID_MSG_CB_CHANNEL_EDIT, &inputBufferSize);
  1305.     InitializeCategory57Screen();
  1306.     mmi_msg_set_cb_channel_inline_item();
  1307.     if (inputBuffer != NULL)
  1308.     {
  1309.         SetCategory57Data(wgui_inline_items, MAX_CB_CHNL_INLINE_ITEM, inputBuffer);
  1310.     }
  1311.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_CHANNEL_EDIT);
  1312.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_CHANNEL_EDIT);
  1313.     ShowCategory57Screen(
  1314.         STR_CB_CHNL_EDITOR,
  1315.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1316.         STR_GLOBAL_EDIT,
  1317.         IMG_GLOBAL_OK,
  1318.         STR_GLOBAL_BACK,
  1319.         IMG_GLOBAL_BACK,
  1320.         MAX_CB_CHNL_INLINE_ITEM,
  1321.         cbChnlEditorIcons,
  1322.         wgui_inline_items,
  1323.         0,
  1324.         guiBuffer);
  1325.     SetCategory57RightSoftkeyFunctions(mmi_msg_pre_save_cb_channel, GoBackHistory);
  1326. }
  1327. /*****************************************************************************
  1328.  * FUNCTION
  1329.  *  mmi_msg_exit_cb_channel_edit
  1330.  * DESCRIPTION
  1331.  *  Exit CB channel inline edit screen
  1332.  * PARAMETERS
  1333.  *  void
  1334.  * RETURNS
  1335.  *  void
  1336.  *****************************************************************************/
  1337. void mmi_msg_exit_cb_channel_edit(void)
  1338. {
  1339.     /*----------------------------------------------------------------*/
  1340.     /* Local Variables                                                */
  1341.     /*----------------------------------------------------------------*/
  1342.     history currHistory;
  1343.     U16 inputBufferSize = 0;
  1344.     S16 nHistory = 0;
  1345.     /*----------------------------------------------------------------*/
  1346.     /* Code Body                                                      */
  1347.     /*----------------------------------------------------------------*/
  1348.     g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_CB_CHANNEL_EDIT;
  1349.     SetMessagesCurrScrnID(0);
  1350.     currHistory.scrnID = SCR_ID_MSG_CB_CHANNEL_EDIT;
  1351.     CloseCategory57Screen();
  1352.     currHistory.entryFuncPtr = mmi_msg_entry_cb_channel_edit;
  1353.     pfnUnicodeStrcpy((S8*) currHistory.inputBuffer, (S8*) & nHistory);
  1354.     GetCategory57History(currHistory.guiBuffer);
  1355.     inputBufferSize = (U16) GetCategory57DataSize();
  1356.     GetCategory57Data((U8*) currHistory.inputBuffer);
  1357.     AddNHistory(currHistory, inputBufferSize);
  1358. }
  1359. /*****************************************************************************
  1360.  * FUNCTION
  1361.  *  mmi_msg_pre_entry_cb_channel_edit
  1362.  * DESCRIPTION
  1363.  *  Before edit CB channel, set the item for edit
  1364.  * PARAMETERS
  1365.  *  void
  1366.  * RETURNS
  1367.  *  void
  1368.  *****************************************************************************/
  1369. void mmi_msg_pre_entry_cb_channel_edit(void)
  1370. {
  1371.     /*----------------------------------------------------------------*/
  1372.     /* Local Variables                                                */
  1373.     /*----------------------------------------------------------------*/
  1374.     U8 number[(MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH];
  1375.     /*----------------------------------------------------------------*/
  1376.     /* Code Body                                                      */
  1377.     /*----------------------------------------------------------------*/
  1378.     if (cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].mi > MAX_CB_CHNL_NUMBER_TO_EDIT)
  1379.     {
  1380.         DisplayPopup(
  1381.             (PU8) GetString(STR_CB_CHNL_NUMBER_LEN_EXCEEDED),
  1382.             IMG_GLOBAL_UNFINISHED,
  1383.             1,
  1384.             MESSAGES_POPUP_TIME_OUT,
  1385.             (U8) ERROR_TONE);
  1386.         return;
  1387.     }
  1388.     
  1389.     cb_display.dcs = cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].dcs;
  1390.     if (cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].dcs == PHB_ASCII)
  1391.     {
  1392.         AnsiiToUnicodeString((S8*) cb_display.name, (S8*) cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name);
  1393.     }
  1394.     else
  1395.     {
  1396.         pfnUnicodeStrcpy((S8*) cb_display.name, (S8*) cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].name);
  1397.     }
  1398.     memset(number, 0, sizeof(number));
  1399.     sprintf((S8*) number, "%d", cb_info.cbchnlentry[g_msg_cntx.currHiliteIndex].mi);
  1400.     memset(cb_display.mi, 0, sizeof(cb_display.mi));
  1401.     AnsiiNToUnicodeString((S8*) cb_display.mi, (S8*) number, strlen((S8*) number));
  1402.     mmi_msg_entry_cb_channel_edit();
  1403. }
  1404. /*****************************************************************************
  1405.  * FUNCTION
  1406.  *  mmi_msg_entry_cb_language
  1407.  * DESCRIPTION
  1408.  *  Entry CB language list
  1409.  * PARAMETERS
  1410.  *  void
  1411.  * RETURNS
  1412.  *  void
  1413.  *****************************************************************************/
  1414. void mmi_msg_entry_cb_language(void)
  1415. {
  1416.     /*----------------------------------------------------------------*/
  1417.     /* Local Variables                                                */
  1418.     /*----------------------------------------------------------------*/
  1419.     U8 *guiBuffer;
  1420.     U16 numItems;
  1421.     U8 i = 0;
  1422.     /*----------------------------------------------------------------*/
  1423.     /* Code Body                                                      */
  1424.     /*----------------------------------------------------------------*/
  1425.     EntryNewScreen(SCR_ID_MSG_CB_LANGUAGE, mmi_msg_exit_generic, mmi_msg_entry_cb_language, NULL);
  1426.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] mmi_msg_entry_cb_channel_select -------*n"));
  1427.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_LANGUAGE);
  1428.     pfnUnicodeStrncpy(
  1429.         (S8*) subMenuDataPtrs[0],
  1430.         (S8*) GetString((U16) STR_CB_ALL_LANGUAGES_FOR_SELECT),
  1431.         MAX_CB_CHNL_NAME_LENGTH * ENCODING_LENGTH);
  1432.     for (i = 0; i < cb_info.totaldcs; i++)
  1433.     {
  1434.         pfnUnicodeStrcpy(
  1435.             (S8*) subMenuDataPtrs[i + 1],
  1436.             (PS8) GetString((U16) LangEnumAndStrID[cb_info.cblanentry[i].dcs][1]));
  1437.         cb_display.mask[i + 1] = cb_info.cblanentry[i].mask;
  1438.     }
  1439.     cb_display.mask[0] = cb_info.dcsall;
  1440.     numItems = cb_info.totaldcs + 1;
  1441.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_LANGUAGE);
  1442.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_LANGUAGE);
  1443.     mmi_msg_set_confirm_screen(STR_GLOBAL_SAVE, mmi_msg_select_cb_language, Messages2GoBackHistory);
  1444.     SetCheckboxToggleRightSoftkeyFunctions(mmi_msg_entry_confirm_generic, GoBackHistory);
  1445.     ShowCategory140Screen(
  1446.         STR103_SCR101_CAPTION,
  1447.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1448.         numItems,
  1449.         (U8 **) subMenuDataPtrs,
  1450.         (U8*) cb_display.mask,
  1451.         0,
  1452.         guiBuffer);
  1453.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1454.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1455. }
  1456. /*****************************************************************************
  1457.  * FUNCTION
  1458.  *  mmi_msg_pre_entry_cb_language
  1459.  * DESCRIPTION
  1460.  *  Before enter CB language screen, get language list
  1461.  * PARAMETERS
  1462.  *  void
  1463.  * RETURNS
  1464.  *  void
  1465.  *****************************************************************************/
  1466. void mmi_msg_pre_entry_cb_language(void)
  1467. {
  1468.     /*----------------------------------------------------------------*/
  1469.     /* Local Variables                                                */
  1470.     /*----------------------------------------------------------------*/
  1471.     /*----------------------------------------------------------------*/
  1472.     /* Code Body                                                      */
  1473.     /*----------------------------------------------------------------*/
  1474.     cb_state = SMS_CB_LANGUAGE_STATE;
  1475.     SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_language, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1476.     mmi_msg_get_cb_mode_req();
  1477. }
  1478. /*****************************************************************************
  1479.  * FUNCTION
  1480.  *  mmi_msg_entry_cb_read_message
  1481.  * DESCRIPTION
  1482.  *  Entry CB message list screen
  1483.  * PARAMETERS
  1484.  *  void
  1485.  * RETURNS
  1486.  *  void
  1487.  *****************************************************************************/
  1488. void mmi_msg_entry_cb_read_message(void)
  1489. {
  1490.     /*----------------------------------------------------------------*/
  1491.     /* Local Variables                                                */
  1492.     /*----------------------------------------------------------------*/
  1493.     U8 *guiBuffer = NULL;
  1494.     S32 hiliteitem = 0;
  1495.     /*----------------------------------------------------------------*/
  1496.     /* Code Body                                                      */
  1497.     /*----------------------------------------------------------------*/
  1498.     EntryNewScreen(SCR_ID_MSG_CB_MESSAGE_LIST, mmi_msg_exit_generic, mmi_msg_pre_entry_cb_read_message, NULL);
  1499.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] mmi_msg_entry_cb_channel_list -------*n"));
  1500.     memset(&cb_display.unread, 0, MAX_STORE_CB_MSG);
  1501.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_MESSAGE_LIST);
  1502.     if ((guiBuffer != NULL) || (g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes == SCR_ID_MSG_CB_MESSAGE_LIST)
  1503.         || (g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes == SCR_ID_MSG_CB_MESSAGE))
  1504.     {
  1505.         hiliteitem = (g_msg_cntx.currBoxIndex < cbMsgIndex.currCBTotal) ? g_msg_cntx.currBoxIndex : 0;
  1506.     }
  1507.     RegisterHighlightHandler(GetMsgIndex);
  1508.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_MESSAGE_LIST);
  1509.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MESSAGE_LIST);
  1510.     ShowCategory184Screen(
  1511.         STR101_MITEM102_CB_READ_MESSAGE,
  1512.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1513.         STR_GLOBAL_OK,
  1514.         IMG_GLOBAL_OK,
  1515.         STR_GLOBAL_BACK,
  1516.         IMG_GLOBAL_BACK,
  1517.         cbMsgIndex.currCBTotal,
  1518.         mmi_msg_cb_read_message_get_item,
  1519.         NULL,
  1520.         hiliteitem,
  1521.         guiBuffer);
  1522.     SetLeftSoftkeyFunction(mmi_msg_entry_cb_message, KEY_EVENT_UP);
  1523.     SetKeyHandler(mmi_msg_entry_cb_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1524.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1525.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1526. }
  1527. /*****************************************************************************
  1528.  * FUNCTION
  1529.  *  mmi_msg_pre_entry_cb_read_message
  1530.  * DESCRIPTION
  1531.  *  Before entering CB message list screen, get channel info for display
  1532.  * PARAMETERS
  1533.  *  void
  1534.  * RETURNS
  1535.  *  void
  1536.  *****************************************************************************/
  1537. void mmi_msg_pre_entry_cb_read_message(void)
  1538. {
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Local Variables                                                */
  1541.     /*----------------------------------------------------------------*/
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Code Body                                                      */
  1544.     /*----------------------------------------------------------------*/
  1545.     if (cbMsgIndex.currCBTotal == 0)
  1546.     {
  1547.         DisplayPopup(
  1548.             (PU8) GetString(STR_GLOBAL_EMPTY),
  1549.             IMG_GLOBAL_EMPTY,
  1550.             1,
  1551.             MESSAGES_POPUP_TIME_OUT,
  1552.             (U8) EMPTY_LIST_TONE);
  1553.     }
  1554.     else
  1555.     {
  1556.         cb_state = SMS_CB_READ_MESSAGE_STATE;
  1557.         SetProtocolEventHandler(mmi_msg_get_cb_mode_rsp_display, PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
  1558.         mmi_msg_get_cb_mode_req();
  1559.     }
  1560. }
  1561. /*****************************************************************************
  1562.  * FUNCTION
  1563.  *  mmi_msg_cb_read_message_get_item
  1564.  * DESCRIPTION
  1565.  *  Get CB message list item
  1566.  * PARAMETERS
  1567.  *  item_index          [IN]            
  1568.  *  str_buff            [IN]            
  1569.  *  img_buff_p          [?]             
  1570.  *  str_img_mask        [IN]            
  1571.  *  a(?)                [IN]            Item index
  1572.  *  d(?)                [IN/OUT]        String image mask
  1573.  *  c(?)                [IN/OUT]        Image buffer
  1574.  *  b(?)                [IN/OUT]        String buffer
  1575.  * RETURNS
  1576.  * TRUE
  1577.  *****************************************************************************/
  1578. pBOOL mmi_msg_cb_read_message_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  1579. {
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Local Variables                                                */
  1582.     /*----------------------------------------------------------------*/
  1583.     U8 number[(MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH];
  1584.     U8 i = 0;
  1585.     /*----------------------------------------------------------------*/
  1586.     /* Code Body                                                      */
  1587.     /*----------------------------------------------------------------*/
  1588.     if ((item_index < 0) || (item_index >= cbMsgIndex.currCBTotal))
  1589.     {
  1590.         return FALSE;
  1591.     }
  1592.     for (i = 0; i < cb_info.totalmi; i++)
  1593.     {
  1594.         if ((cb_info.cbchnlentry[i].mi == cbMsgInfo.MsgMI[item_index]) &&
  1595.             (strlen((S8*) cb_info.cbchnlentry[i].name) > 0))
  1596.         {
  1597.             break;
  1598.         }
  1599.     }
  1600.     if (i < cb_info.totalmi)
  1601.     {
  1602.         if (cb_info.cbchnlentry[i].dcs == PHB_ASCII)
  1603.         {
  1604.             AnsiiToUnicodeString((S8*) str_buff, (S8*) cb_info.cbchnlentry[i].name);
  1605.         }
  1606.         else
  1607.         {
  1608.             pfnUnicodeStrcpy((S8*) str_buff, (S8*) cb_info.cbchnlentry[i].name);
  1609.         }
  1610.     }
  1611.     else
  1612.     {
  1613.         memset(number, 0, MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1);
  1614.         sprintf((PS8) number, "%d", cbMsgInfo.MsgMI[item_index]);
  1615.         AnsiiToUnicodeString((S8*) str_buff, (S8*) number);
  1616.     }
  1617.     *img_buff_p = get_image(gIndexIconsImageList[item_index]);
  1618.     return TRUE;
  1619. }
  1620. /*****************************************************************************
  1621.  * FUNCTION
  1622.  *  mmi_msg_go_back_from_cb_message
  1623.  * DESCRIPTION
  1624.  *  Reset current display index before go back screen
  1625.  * PARAMETERS
  1626.  *  void
  1627.  * RETURNS
  1628.  *  void
  1629.  *****************************************************************************/
  1630. void mmi_msg_go_back_from_cb_message(void)
  1631. {
  1632.     /*----------------------------------------------------------------*/
  1633.     /* Local Variables                                                */
  1634.     /*----------------------------------------------------------------*/
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Code Body                                                      */
  1637.     /*----------------------------------------------------------------*/
  1638.     cb_display.currindex = MAX_STORE_CB_MSG;
  1639.     GoBackHistory();
  1640. }
  1641. /*****************************************************************************
  1642.  * FUNCTION
  1643.  *  mmi_msg_end_key_from_cb_message
  1644.  * DESCRIPTION
  1645.  *  Reset current display index before go to idle
  1646.  * PARAMETERS
  1647.  *  void
  1648.  * RETURNS
  1649.  *  void
  1650.  *****************************************************************************/
  1651. void mmi_msg_end_key_from_cb_message(void)
  1652. {
  1653.     /*----------------------------------------------------------------*/
  1654.     /* Local Variables                                                */
  1655.     /*----------------------------------------------------------------*/
  1656.     /*----------------------------------------------------------------*/
  1657.     /* Code Body                                                      */
  1658.     /*----------------------------------------------------------------*/
  1659.     if (isInCall() == FALSE)
  1660.     {
  1661.         cb_display.currindex = MAX_STORE_CB_MSG;
  1662.     }
  1663.     ExecCurrEndKeyDownHandler();
  1664. }
  1665. /*****************************************************************************
  1666.  * FUNCTION
  1667.  *  mmi_msg_entry_cb_message
  1668.  * DESCRIPTION
  1669.  *  Entry CB message screen
  1670.  * PARAMETERS
  1671.  *  void
  1672.  * RETURNS
  1673.  *  void
  1674.  *****************************************************************************/
  1675. void mmi_msg_entry_cb_message(void)
  1676. {
  1677.     /*----------------------------------------------------------------*/
  1678.     /* Local Variables                                                */
  1679.     /*----------------------------------------------------------------*/
  1680.     U8 *guiBuffer = NULL;
  1681.     U16 page;
  1682.     /*----------------------------------------------------------------*/
  1683.     /* Code Body                                                      */
  1684.     /*----------------------------------------------------------------*/
  1685.     EntryNewScreen(SCR_ID_MSG_CB_MESSAGE, mmi_msg_exit_generic, mmi_msg_entry_cb_message, NULL);
  1686.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] EntryScrCBMessageBody ---*n"));
  1687.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_MESSAGE);
  1688.     if (guiBuffer == NULL)
  1689.     {
  1690.         cb_display.currindex = (U8) g_msg_cntx.currBoxIndex;
  1691.     }
  1692.     SetMessagesCurrScrnID(SCR_ID_MSG_CB_MESSAGE);
  1693.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MESSAGE);
  1694.     page = (U16) cbMsgInfo.MsgPage[cb_display.currindex] * NVRAM_SMS_CB_SMS_PAGE_SIZE;
  1695.     ReadCBMessageContent(
  1696.         (PU32) & dispCBLength,
  1697.         cbMsgIndex.pCBMsgContent[cb_display.currindex],
  1698.         page,
  1699.         cbMsgInfo.MsgDCS[cb_display.currindex]);
  1700.     mmi_msg_set_confirm_screen(STR_GLOBAL_DELETE, mmi_msg_delete_cb_message, GoBackHistory);
  1701.     GetCurrEndKeyDownHandler();
  1702.     ShowCategory74Screen(
  1703.         STR_CB_MESSAGE_BODY,
  1704.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1705.         STR_GLOBAL_DELETE,
  1706.         IMG_SMS_COMMON_NOIMAGE,
  1707.         STR_GLOBAL_BACK,
  1708.         IMG_SMS_COMMON_NOIMAGE,
  1709.         (PU8) dispCBMessage,
  1710.         (S32) (cbMsgInfo.MsgPage[cb_display.currindex] * NVRAM_SMS_CB_SMS_PAGE_SIZE * ENCODING_LENGTH),
  1711.         guiBuffer);
  1712.     SetLeftSoftkeyFunction(mmi_msg_entry_confirm_generic, KEY_EVENT_UP);
  1713.     SetRightSoftkeyFunction(mmi_msg_go_back_from_cb_message, KEY_EVENT_UP);
  1714.     SetKeyHandler(mmi_msg_go_back_from_cb_message, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1715.     SetKeyHandler(mmi_msg_end_key_from_cb_message, KEY_END, KEY_EVENT_DOWN);
  1716.     SetKeyHandler(mmi_msg_entry_cb_use_number, KEY_SEND, KEY_EVENT_UP);
  1717. }
  1718. /*****************************************************************************
  1719.  * FUNCTION
  1720.  *  mmi_msg_delete_cb_message
  1721.  * DESCRIPTION
  1722.  *  Delete CB message
  1723.  * PARAMETERS
  1724.  *  void
  1725.  * RETURNS
  1726.  *  void
  1727.  *****************************************************************************/
  1728. void mmi_msg_delete_cb_message(void)
  1729. {
  1730.     /*----------------------------------------------------------------*/
  1731.     /* Local Variables                                                */
  1732.     /*----------------------------------------------------------------*/
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Code Body                                                      */
  1735.     /*----------------------------------------------------------------*/
  1736.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] mmi_msg_delete_cb_message ---*n"));
  1737.     SetMessagesScrnIdDelUpToHistoryNodes(SCR_ID_MSG_CB_MESSAGE);
  1738.     if (cbMsgIndex.pCBMsgContent[cb_display.currindex])
  1739.     {
  1740.         DeleteCBMessage(cb_display.currindex);
  1741.         WriteCBMessageInfoToNvram();
  1742.         if (cbMsgIndex.currCBTotal == 0)
  1743.         {
  1744.             SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MESSAGE_LIST);
  1745.         }
  1746.         else
  1747.         {
  1748.             if (g_msg_cntx.currBoxIndex == (S32) cbMsgIndex.currCBTotal)
  1749.             {
  1750.                 g_msg_cntx.currBoxIndex--;
  1751.             }
  1752.             else if (g_msg_cntx.currBoxIndex > (S32) cbMsgIndex.currCBTotal)
  1753.             {
  1754.                 g_msg_cntx.currBoxIndex = 0;
  1755.             }
  1756.             SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MESSAGE);
  1757.         }
  1758.         DisplayPopup(
  1759.             (PU8) GetString(STR_MESSAGES_DELETED_ID),
  1760.             IMG_GLOBAL_ACTIVATED,
  1761.             1,
  1762.             MESSAGES_POPUP_TIME_OUT,
  1763.             (U8) SUCCESS_TONE);
  1764.         cb_display.currindex = MAX_STORE_CB_MSG;
  1765.         DeleteMessagesHistoryNodes();
  1766.     }
  1767.     else
  1768.     {
  1769.         SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_MESSAGE_LIST);
  1770.         DisplayPopup(
  1771.             (PU8) GetString(STR_CB_ERROR_MESSAGE),
  1772.             IMG_GLOBAL_UNFINISHED,
  1773.             1,
  1774.             MESSAGES_POPUP_TIME_OUT,
  1775.             (U8) ERROR_TONE);
  1776.         DeleteMessagesHistoryNodes();
  1777.     }
  1778. }
  1779. /*****************************************************************************
  1780.  * FUNCTION
  1781.  *  mmi_msg_highlight_cb_mode
  1782.  * DESCRIPTION
  1783.  *  Highlight CB mode handler, check current CB mode
  1784.  * PARAMETERS
  1785.  *  void
  1786.  * RETURNS
  1787.  *  void
  1788.  *****************************************************************************/
  1789. void mmi_msg_highlight_cb_mode(void)
  1790. {
  1791.     /*----------------------------------------------------------------*/
  1792.     /* Local Variables                                                */
  1793.     /*----------------------------------------------------------------*/
  1794.     /*----------------------------------------------------------------*/
  1795.     /* Code Body                                                      */
  1796.     /*----------------------------------------------------------------*/
  1797.     mmi_msg_highlight_generic(
  1798.         STR_GLOBAL_OK,
  1799.         IMG_GLOBAL_OK,
  1800.         STR_GLOBAL_BACK,
  1801.         IMG_GLOBAL_BACK,
  1802.         mmi_msg_subscribe_cb,
  1803.         GoBackHistory);
  1804.     if (cb_info.mode == TRUE)
  1805.     {
  1806.         ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_GLOBAL_OK);
  1807.     }
  1808.     else
  1809.     {
  1810.         ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_GLOBAL_OK);
  1811.     }
  1812.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1813. }
  1814. /*****************************************************************************
  1815.  * FUNCTION
  1816.  *  mmi_msg_hint_cb_mode
  1817.  * DESCRIPTION
  1818.  *  Hint CB mode handler
  1819.  * PARAMETERS
  1820.  *  index       [IN]        Current menu index
  1821.  * RETURNS
  1822.  *  void
  1823.  *****************************************************************************/
  1824. void mmi_msg_hint_cb_mode(U16 index)
  1825. {
  1826.     /*----------------------------------------------------------------*/
  1827.     /* Local Variables                                                */
  1828.     /*----------------------------------------------------------------*/
  1829.     /*----------------------------------------------------------------*/
  1830.     /* Code Body                                                      */
  1831.     /*----------------------------------------------------------------*/
  1832.     memset((S8*) hintData[index], 0, sizeof(hintData[index]));
  1833.     pfnUnicodeStrcpy((S8*) hintData[index], (S8*) cb_display.mode);
  1834. }
  1835. /*****************************************************************************
  1836.  * FUNCTION
  1837.  *  mmi_msg_highlight_cb_read_message
  1838.  * DESCRIPTION
  1839.  *  Highlight CB read message handler
  1840.  * PARAMETERS
  1841.  *  void
  1842.  * RETURNS
  1843.  *  void
  1844.  *****************************************************************************/
  1845. void mmi_msg_highlight_cb_read_message(void)
  1846. {
  1847.     /*----------------------------------------------------------------*/
  1848.     /* Local Variables                                                */
  1849.     /*----------------------------------------------------------------*/
  1850.     /*----------------------------------------------------------------*/
  1851.     /* Code Body                                                      */
  1852.     /*----------------------------------------------------------------*/
  1853.     mmi_msg_highlight_generic(
  1854.         STR_GLOBAL_OK,
  1855.         IMG_GLOBAL_OK,
  1856.         STR_GLOBAL_BACK,
  1857.         IMG_GLOBAL_BACK,
  1858.         mmi_msg_pre_entry_cb_read_message,
  1859.         GoBackHistory);
  1860. }
  1861. /*****************************************************************************
  1862.  * FUNCTION
  1863.  *  mmi_msg_highlight_cb_language
  1864.  * DESCRIPTION
  1865.  *  Highlight CB language handler
  1866.  * PARAMETERS
  1867.  *  void
  1868.  * RETURNS
  1869.  *  void
  1870.  *****************************************************************************/
  1871. void mmi_msg_highlight_cb_language(void)
  1872. {
  1873.     /*----------------------------------------------------------------*/
  1874.     /* Local Variables                                                */
  1875.     /*----------------------------------------------------------------*/
  1876.     /*----------------------------------------------------------------*/
  1877.     /* Code Body                                                      */
  1878.     /*----------------------------------------------------------------*/
  1879.     mmi_msg_highlight_generic(
  1880.         STR_GLOBAL_OK,
  1881.         IMG_GLOBAL_OK,
  1882.         STR_GLOBAL_BACK,
  1883.         IMG_GLOBAL_BACK,
  1884.         mmi_msg_pre_entry_cb_language,
  1885.         GoBackHistory);
  1886. }
  1887. /*****************************************************************************
  1888.  * FUNCTION
  1889.  *  mmi_msg_highlight_cb_channel_settings
  1890.  * DESCRIPTION
  1891.  *  Highlight CB channel settings handler
  1892.  * PARAMETERS
  1893.  *  void
  1894.  * RETURNS
  1895.  *  void
  1896.  *****************************************************************************/
  1897. void mmi_msg_highlight_cb_channel_settings(void)
  1898. {
  1899.     /*----------------------------------------------------------------*/
  1900.     /* Local Variables                                                */
  1901.     /*----------------------------------------------------------------*/
  1902.     /*----------------------------------------------------------------*/
  1903.     /* Code Body                                                      */
  1904.     /*----------------------------------------------------------------*/
  1905.     mmi_msg_highlight_generic(
  1906.         STR_GLOBAL_OK,
  1907.         IMG_GLOBAL_OK,
  1908.         STR_GLOBAL_BACK,
  1909.         IMG_GLOBAL_BACK,
  1910.         mmi_msg_entry_cb_channel_settings,
  1911.         GoBackHistory);
  1912. }
  1913. /*****************************************************************************
  1914.  * FUNCTION
  1915.  *  mmi_msg_highlight_cb_channel_select
  1916.  * DESCRIPTION
  1917.  *  Highlight CB channel select handler
  1918.  * PARAMETERS
  1919.  *  void
  1920.  * RETURNS
  1921.  *  void
  1922.  *****************************************************************************/
  1923. void mmi_msg_highlight_cb_channel_select(void)
  1924. {
  1925.     /*----------------------------------------------------------------*/
  1926.     /* Local Variables                                                */
  1927.     /*----------------------------------------------------------------*/
  1928.     /*----------------------------------------------------------------*/
  1929.     /* Code Body                                                      */
  1930.     /*----------------------------------------------------------------*/
  1931.     mmi_msg_highlight_generic(
  1932.         STR_GLOBAL_OK,
  1933.         IMG_GLOBAL_OK,
  1934.         STR_GLOBAL_BACK,
  1935.         IMG_GLOBAL_BACK,
  1936.         mmi_msg_pre_entry_cb_channel_select,
  1937.         GoBackHistory);
  1938. }
  1939. /*****************************************************************************
  1940.  * FUNCTION
  1941.  *  mmi_msg_highlight_cb_channel_add
  1942.  * DESCRIPTION
  1943.  *  Highlight CB channel add handler
  1944.  * PARAMETERS
  1945.  *  void
  1946.  * RETURNS
  1947.  *  void
  1948.  *****************************************************************************/
  1949. void mmi_msg_highlight_cb_channel_add(void)
  1950. {
  1951.     /*----------------------------------------------------------------*/
  1952.     /* Local Variables                                                */
  1953.     /*----------------------------------------------------------------*/
  1954.     /*----------------------------------------------------------------*/
  1955.     /* Code Body                                                      */
  1956.     /*----------------------------------------------------------------*/
  1957.     mmi_msg_highlight_generic(
  1958.         STR_GLOBAL_OK,
  1959.         IMG_GLOBAL_OK,
  1960.         STR_GLOBAL_BACK,
  1961.         IMG_GLOBAL_BACK,
  1962.         mmi_msg_pre_entry_cb_channel_add,
  1963.         GoBackHistory);
  1964. }
  1965. /*****************************************************************************
  1966.  * FUNCTION
  1967.  *  mmi_msg_highlight_cb_channel_edit
  1968.  * DESCRIPTION
  1969.  *  Highlight CB channel edit handler
  1970.  * PARAMETERS
  1971.  *  void
  1972.  * RETURNS
  1973.  *  void
  1974.  *****************************************************************************/
  1975. void mmi_msg_highlight_cb_channel_edit(void)
  1976. {
  1977.     /*----------------------------------------------------------------*/
  1978.     /* Local Variables                                                */
  1979.     /*----------------------------------------------------------------*/
  1980.     /*----------------------------------------------------------------*/
  1981.     /* Code Body                                                      */
  1982.     /*----------------------------------------------------------------*/
  1983.     mmi_msg_highlight_generic(
  1984.         STR_GLOBAL_OK,
  1985.         IMG_GLOBAL_OK,
  1986.         STR_GLOBAL_BACK,
  1987.         IMG_GLOBAL_BACK,
  1988.         mmi_msg_pre_entry_cb_channel_list_edit,
  1989.         GoBackHistory);
  1990. }
  1991. /*****************************************************************************
  1992.  * FUNCTION
  1993.  *  mmi_msg_highlight_cb_channel_delete
  1994.  * DESCRIPTION
  1995.  *  Highlight CB channel delete handler
  1996.  * PARAMETERS
  1997.  *  void
  1998.  * RETURNS
  1999.  *  void
  2000.  *****************************************************************************/
  2001. void mmi_msg_highlight_cb_channel_delete(void)
  2002. {
  2003.     /*----------------------------------------------------------------*/
  2004.     /* Local Variables                                                */
  2005.     /*----------------------------------------------------------------*/
  2006.     /*----------------------------------------------------------------*/
  2007.     /* Code Body                                                      */
  2008.     /*----------------------------------------------------------------*/
  2009.     mmi_msg_highlight_generic(
  2010.         STR_GLOBAL_OK,
  2011.         IMG_GLOBAL_OK,
  2012.         STR_GLOBAL_BACK,
  2013.         IMG_GLOBAL_BACK,
  2014.         mmi_msg_pre_entry_cb_channel_list_delete,
  2015.         GoBackHistory);
  2016. }
  2017. /*****************************************************************************
  2018.  * FUNCTION
  2019.  *  mmi_msg_pre_entry_cb_idle_use_number
  2020.  * DESCRIPTION
  2021.  *  Pre -Entry function for CB use number
  2022.  * PARAMETERS
  2023.  *  void
  2024.  * RETURNS
  2025.  *  void
  2026.  *****************************************************************************/
  2027. void mmi_msg_pre_entry_cb_idle_use_number(void)
  2028. {
  2029.     /*----------------------------------------------------------------*/
  2030.     /* Local Variables                                                */
  2031.     /*----------------------------------------------------------------*/
  2032.     history h;
  2033.     S16 nHistory = 0;
  2034.     /*----------------------------------------------------------------*/
  2035.     /* Code Body                                                      */
  2036.     /*----------------------------------------------------------------*/
  2037.     h.scrnID = SCR_ID_MSG_CB_MESSAGE_IDLE;
  2038. #ifdef __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__
  2039.     h.entryFuncPtr = mmi_msg_entry_new_cb_immediate_ind;
  2040. #else 
  2041.     h.entryFuncPtr = mmi_msg_entry_new_cb_ind;
  2042. #endif 
  2043.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  2044.     GetCategoryHistory(h.guiBuffer);
  2045.     AddHistory(h);
  2046.     mmi_msg_entry_cb_use_number();
  2047. }
  2048. /*****************************************************************************
  2049.  * FUNCTION
  2050.  *  mmi_msg_entry_cb_use_number
  2051.  * DESCRIPTION
  2052.  *  Entry function for CB use number
  2053.  * PARAMETERS
  2054.  *  void
  2055.  * RETURNS
  2056.  *  void
  2057.  *****************************************************************************/
  2058. void mmi_msg_entry_cb_use_number(void)
  2059. {
  2060.     /*----------------------------------------------------------------*/
  2061.     /* Local Variables                                                */
  2062.     /*----------------------------------------------------------------*/
  2063.     U16 numbersCount = 0;
  2064.     U8 *guiBuffer = NULL;
  2065.     S8 number[MAX_DIGITS_SMS * ENCODING_LENGTH];
  2066.     /*----------------------------------------------------------------*/
  2067.     /* Code Body                                                      */
  2068.     /*----------------------------------------------------------------*/
  2069.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[CellBroadcast.c] mmi_msg_entry_cb_use_number *n"));
  2070.     memset((S8*) number, 0, sizeof(number));
  2071.     numbersCount = ObtainNumbersFromMessageText((S8*) number, dispCBMessage, (U16) dispCBLength, 0);
  2072.     if (numbersCount > 0)
  2073.     {
  2074.         EntryNewScreen(SCR_ID_MSG_CB_USE_NUMBER_LIST, mmi_msg_exit_generic, mmi_msg_entry_cb_use_number, NULL);
  2075.         GetCurrEndKeyDownHandler();
  2076.         guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CB_USE_NUMBER_LIST);
  2077.         RegisterHighlightHandler(GetHiliteIndex);
  2078.         SetMessagesCurrScrnID(SCR_ID_MSG_CB_USE_NUMBER_LIST);
  2079.         ShowCategory53Screen(
  2080.             STR_USE_NUMBER_CAPTION,
  2081.             IMG_SMS_ENTRY_SCRN_CAPTION,
  2082.             STR_GLOBAL_DIAL,
  2083.             IMG_SMS_COMMON_NOIMAGE,
  2084.             STR_GLOBAL_BACK,
  2085.             IMG_GLOBAL_BACK,
  2086.             numbersCount,
  2087.             (U8 **) g_msg_cntx.numbersList,
  2088.             (U16*) gIndexIconsImageList,
  2089.             NULL,
  2090.             0,
  2091.             0,
  2092.             guiBuffer);
  2093.         SetLeftSoftkeyFunction(mmi_msg_dial_use_number, KEY_EVENT_UP);
  2094.         SetKeyHandler(mmi_msg_dial_use_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2095.         SetKeyHandler(mmi_msg_dial_use_number, KEY_SEND, KEY_EVENT_UP);
  2096.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2097.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2098.         SetKeyHandler(mmi_msg_end_key_from_new_cb_ind, KEY_END, KEY_EVENT_DOWN);
  2099.     }
  2100.     else
  2101.     {
  2102.         DisplayPopup(
  2103.             (PU8) GetString(STR_NONUMBER_NOTIFICATION),
  2104.             IMG_GLOBAL_EMPTY,
  2105.             1,
  2106.             MESSAGES_POPUP_TIME_OUT,
  2107.             (U8) EMPTY_LIST_TONE);
  2108.     }
  2109. }
  2110. /*****************************************************************************
  2111.  * FUNCTION
  2112.  *  InitCellBroadcastProtocolEventHanler
  2113.  * DESCRIPTION
  2114.  *  Init CB protocol event handler
  2115.  * PARAMETERS
  2116.  *  void
  2117.  * RETURNS
  2118.  *  void
  2119.  *****************************************************************************/
  2120. void InitCellBroadcastProtocolEventHanler(void)
  2121. {
  2122.     /*----------------------------------------------------------------*/
  2123.     /* Local Variables                                                */
  2124.     /*----------------------------------------------------------------*/
  2125.     /*----------------------------------------------------------------*/
  2126.     /* Code Body                                                      */
  2127.     /*----------------------------------------------------------------*/
  2128.     SetProtocolEventHandler(mmi_msg_handle_new_cb_ind, PRT_MSG_ID_MMI_CB_MSG_IND);
  2129. }
  2130. /*****************************************************************************
  2131.  * FUNCTION
  2132.  *  InitCBNVRAMData
  2133.  * DESCRIPTION
  2134.  *  Init CB NVRAMData
  2135.  * PARAMETERS
  2136.  *  void
  2137.  * RETURNS
  2138.  *  void
  2139.  *****************************************************************************/
  2140. void InitCBNVRAMData(void)
  2141. {
  2142.     /*----------------------------------------------------------------*/
  2143.     /* Local Variables                                                */
  2144.     /*----------------------------------------------------------------*/
  2145.     /*----------------------------------------------------------------*/
  2146.     /* Code Body                                                      */
  2147.     /*----------------------------------------------------------------*/
  2148.     if (IsCBMessageReadOperRequired)
  2149.     {
  2150.         IsCBMessageReadOperRequired = FALSE;
  2151.     #ifdef MMI_ON_WIN32
  2152.         cbMsgStart = (U8*) cbMsgContent[0];
  2153.         cbMsgIndex.pCBMsgTail = (U8*) cbMsgContent[0];
  2154.     #else /* MMI_ON_WIN32 */ 
  2155.         ReadCBMessageInfoFromNvram();
  2156.     #endif /* MMI_ON_WIN32 */ 
  2157.     }
  2158. }
  2159. /*****************************************************************************
  2160.  * FUNCTION
  2161.  *  InitCellBroadcastApp
  2162.  * DESCRIPTION
  2163.  *  Init CB application: highlight handler, data structure
  2164.  * PARAMETERS
  2165.  *  void
  2166.  * RETURNS
  2167.  *  the description of return value, if any.(?)
  2168.  *****************************************************************************/
  2169. void InitCellBroadcastApp(void)
  2170. {
  2171.     /*----------------------------------------------------------------*/
  2172.     /* Local Variables                                                */
  2173.     /*----------------------------------------------------------------*/
  2174.     /*----------------------------------------------------------------*/
  2175.     /* Code Body                                                      */
  2176.     /*----------------------------------------------------------------*/
  2177.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[CellBroadcast.c] InitCellBroadcastApp*n"));
  2178.     /* Set Hilite Handlers */
  2179.     SetHiliteHandler(MITEM102_CB_SERVICE, mmi_msg_highlight_cb_mode);
  2180.     SetHintHandler(MITEM102_CB_SERVICE, mmi_msg_hint_cb_mode);
  2181.     SetHiliteHandler(MITEM102_CB_READ_MESSAGE, mmi_msg_highlight_cb_read_message);
  2182.     SetHiliteHandler(MITEM102_CB_LANGUAGE, mmi_msg_highlight_cb_language);
  2183.     SetHiliteHandler(MITEM102_CB_CHANNELS, mmi_msg_highlight_cb_channel_settings);
  2184.     SetHiliteHandler(MITEM104_CB_CHANNEL_ADD, mmi_msg_highlight_cb_channel_add);
  2185.     SetHiliteHandler(MITEM104_CB_CHANNEL_EDIT, mmi_msg_highlight_cb_channel_edit);
  2186.     SetHiliteHandler(MITEM104_CB_CHANNEL_DELETE, mmi_msg_highlight_cb_channel_delete);
  2187.     SetHiliteHandler(MITEM104_CB_CHANNEL_SELECT, mmi_msg_highlight_cb_channel_select);
  2188. }
  2189. /*****************************************************************************
  2190.  * FUNCTION
  2191.  *  ResetCBInfoStructs
  2192.  * DESCRIPTION
  2193.  *  Reset Cb info structures
  2194.  * PARAMETERS
  2195.  *  void
  2196.  * RETURNS
  2197.  *  void
  2198.  *****************************************************************************/
  2199. void ResetCBInfoStructs(void)
  2200. {
  2201.     /*----------------------------------------------------------------*/
  2202.     /* Local Variables                                                */
  2203.     /*----------------------------------------------------------------*/
  2204.     /*----------------------------------------------------------------*/
  2205.     /* Code Body                                                      */
  2206.     /*----------------------------------------------------------------*/
  2207.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[CellBroadcast.c] ResetCBInfoStructs*n"));
  2208.     memset(&cbNvramStruct, 0, sizeof(msg_cb_channel_nvram_struct));
  2209.     memset(&cbMsgInfo, 0, sizeof(msg_cb_msg_info_struct));
  2210.     memset(&cbMsgContent, 0, sizeof(msg_cb_msg_content_struct) * MAX_CB_MSG_TOTAL_PAGE * NVRAM_SMS_CB_SMS_PAGE_SIZE);
  2211.     memset(&cbMsgIndex, 0, sizeof(msg_cb_msg_index_struct));
  2212. #ifndef MMI_ON_HARDWARE_P
  2213.     cb_info.mode = TRUE;
  2214.     pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_ON));
  2215. #endif /* MMI_ON_HARDWARE_P */ 
  2216. }
  2217. /*****************************************************************************
  2218.  * FUNCTION
  2219.  *  DeInitCellBroadcastApp
  2220.  * DESCRIPTION
  2221.  *  Deinit Cb applications: reset data structures, write CB message to NVRAM
  2222.  * PARAMETERS
  2223.  *  void
  2224.  * RETURNS
  2225.  *  void
  2226.  *****************************************************************************/
  2227. void DeInitCellBroadcastApp(void)
  2228. {
  2229.     /*----------------------------------------------------------------*/
  2230.     /* Local Variables                                                */
  2231.     /*----------------------------------------------------------------*/
  2232.     /*----------------------------------------------------------------*/
  2233.     /* Code Body                                                      */
  2234.     /*----------------------------------------------------------------*/
  2235.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] DeInitCellBroadcastApp ---*n"));
  2236.     WriteCBMessageInfoToNvram();
  2237.     memset(&cbNvramStruct, 0, sizeof(msg_cb_channel_nvram_struct));
  2238.     memset(&cbMsgIndex, 0, sizeof(msg_cb_msg_info_struct));
  2239.     memset(&cbMsgContent, 0, sizeof(msg_cb_msg_content_struct) * MAX_CB_MSG_TOTAL_PAGE * NVRAM_SMS_CB_SMS_PAGE_SIZE);
  2240.     memset(&cbMsgIndex, 0, sizeof(msg_cb_msg_index_struct));
  2241. }
  2242. #endif /* __MOD_SMSAL__ */ 
  2243. ////////////////////////////////////////////////////////////////////////////////////
  2244. ////////////////////////////////////////////////////////////////////////////////////