示例#1
0
/*!
 * \brief Creates the GUI for the message status dialog.
 *
 * \param propItem The current message properties.
 * \param
 * \return TRUE if the operation was successful, otherwise FALSE.
 *****************************************************************************/
MSF_BOOL meaCreateMvStatusView(U32 str_id, U8 ntt, U8 quota)
{
    ctk_screen_handle	scrid;
    ctk_string_id       titleid;
    kal_uint8 			*text, *str;
    int                 text_size;

    if (0 != meaMvStatusView.formHandle)
    {
        return FALSE;
    }
    memset(&meaMvStatusView, 0, sizeof(MeaMvPropView));

    text_size = 300;
    text = MEA_ALLOC(text_size);
    str = MEA_ALLOC(3);
    widget_utf8_to_ucs2_string(text, text_size, (kal_uint8*) "");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_STATUS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)" ");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, str_id);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");



    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_NEXT_TRANS_TIME);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)": ");
    sprintf((S8 *)str,"%d", ntt);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)str);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)" ");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_MINS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_REMAIN_QUOTA);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)": ");
    sprintf((S8 *)str,"%d", quota);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)str);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Create widow */
    titleid = MEA_STR_ID_SHOW_STATUS;
    meaMvStatusView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text, titleid , 0);
    MEA_FREE(text);
    MEA_FREE(str);
    meaAddWidgetList(meaMvStatusView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvStatusView.formHandle);

    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvStatusViewGoBack, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvStatusViewGoBack, KAL_TRUE);

    return meaDisplayWindow(meaMvStatusView.formHandle, meaGetPosLeftTop());

}
示例#2
0
文件: msf_sas.c 项目: 12019/mtktest
static void
msf_sas_update_progressbar(msf_sas_handle_t* handle, msf_sas_op_t *op)
{
    char buffer[36], buffer2[36], buffer3[128];
    kal_uint8 *buf, *filename;
    static int percent;
    int dealloc_required = 0;
    int a, b, len;

    if (op->download_size < 1024)
    {
        sprintf(buffer, "%dBytes", op->download_size);
    }
    else if (op->download_size < 1024 * 1024)  /* display in (kb) */
    {
        a = op->download_size / 1024;
        sprintf(buffer, "%dKB", a);
    }
    else
    {
        a = op->download_size / (1024 * 1024);
        b = ((op->download_size * 10) / (1024 * 1024)) % 10;
        sprintf(buffer, "%d.%dMB", a, b);
    }

    if(op->data_len > 0)
    {
        if (op->data_len < 1024)
        {
            sprintf(buffer2, "%dBytes", (int)op->data_len);
        }
        else if (op->data_len < 1024 * 1024)  /* display in (kb) */
        {
            a = op->data_len / 1024;
            sprintf(buffer2, "%dKB", a);
        }
        else
        {
            a = op->data_len / (1024 * 1024);
            b = ((op->data_len * 10) / (1024 * 1024)) % 10;
            sprintf(buffer2, "%d.%dMB", a, b);
        }
        sprintf(buffer3, "%s / %s", buffer, buffer2);
    }
    else
    {
        strcpy(buffer3, buffer);
    }

    if (op->download_size > 0)
    {
        len = widget_utf8_to_ucs2_length_in_bytes((const kal_uint8 *)buffer3) + ENCODING_LENGTH;
        buf = MSF_MEM_ALLOC(handle->modid, len);
        widget_utf8_to_ucs2_string(buf, len, (const kal_uint8*)buffer3);
        dealloc_required = TRUE;
    }
    else
    {
        buf = (kal_uint8*) HDIa_widgetExtStringGetPredefinedUCS2buffer(MEA_STR_ID_CONNECTING);
    }

    if (op->data_len > 0 && op->download_size <= op->data_len)
    {
        percent = op->download_size * 100 / op->data_len;
    }
    else if (op->download_size == 0)
    {
        percent = 0;
    }
    else
    {
        percent += 20;
        if(percent > 100)
            percent = 0;
    }

    len = widget_utf8_to_ucs2_length_in_bytes((const kal_uint8 *)op->dst_posix) + ENCODING_LENGTH;
    filename = MSF_MEM_ALLOC(handle->modid, len);
    widget_utf8_to_ucs2_string(filename, len, (const kal_uint8*)op->dst_posix);

    HDIa_widgetExtSetProgressPercentage(
        op->window->handle,
        percent,
        filename,
        buf);
    MSF_MEM_FREE(handle->modid, filename);

    if(dealloc_required)
    {
        MSF_MEM_FREE(handle->modid, buf);
    }
}
示例#3
0
/*!
* \brief Creates the GUI for read or delivery reports.
*
* \param titleStrId The form title.
* \param from The from address.
* \param subject The subject.
* \param statusStrId The status of the message.
* \param date The date of the message
* \return TRUE if successful, otherwise FALSE.
*****************************************************************************/
MSF_BOOL meaCreateMvRrDrView(MSF_UINT32 titleStrId, const char *from, const char *subject,
                             MSF_UINT32 statusStrId, MmsTimeSec rDate)
{
    ctk_screen_handle	scrid;
    kal_uint8 			*text;
    int					text_size;
    MYTIME time;
    MSF_UINT16* dateOrTimeString;
    MeaAddrType addrType;
    char *name = NULL;

    if (0 != meaMvRrDrView.formHandle)
    {
        /* Delete the GUI so that all resources are de-allocated */
        meaDeleteMvRrDrView();
    }
    memset(&meaMvRrDrView, 0, sizeof(meaMvRrDrView));

    /* Prepare text */
    text_size = 150; /* The default size. widget_ucs2str_append_* will realloc the buffer on necessary */
    text = MEA_ALLOC(text_size);
    widget_utf8_to_ucs2_string(text, text_size, (kal_uint8*) "");

    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)titleStrId);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n\n");

    /* To */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_TO);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");

    if (MEA_ADDR_TYPE_PLMN == (addrType = meaGetAddrType(from)))
    {
        name = meaLookupNameFromPHB((char *)from);
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)name);
    }
    else
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)from);
    }

    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Subject */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_SUBJECT);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");
    if (subject)
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)subject);
    }
    else
    {
        text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_NO_SUBJECT);
    }
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Date */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_DATE);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    dateOrTimeString = MEA_ALLOC(MEA_MAX_DATE_SIZE);
    rDate += (HDIa_timeGetTimeZone() * 60);
    mmi_dt_utc_sec_2_mytime((kal_int32)rDate, &time, KAL_TRUE);
    date_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    time_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    MEA_FREE(dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Status */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_STATUS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)statusStrId);

    /* Create widow */
    meaMvRrDrView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text,
                               (MSF_UINT16)titleStrId, 0);

    MEA_FREE(text);
    meaAddWidgetList(meaMvRrDrView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvRrDrView.formHandle);

#ifdef __UNIFIED_MSG_SUPPORT__
    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_addLSK_UA(scrid, MEA_STR_ID_OPTIONS, IMG_GLOBAL_OK, NULL, handleMvPropOptionAction, KAL_TRUE);
#else
    ctk_screen_addLSK_UA(scrid, STR_GLOBAL_OK, IMG_GLOBAL_OK, NULL, meaMvDrViewOk, KAL_TRUE);
    //ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
#endif

    return meaDisplayWindow(meaMvRrDrView.formHandle, meaGetPosLeftTop());
}
示例#4
0
文件: das_msg.c 项目: 12019/mtktest
void das_send_file_dl_ind(das_job_t *job)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int len;
    kal_uint16 length;
    ilm_struct *ilm_ptr = NULL;
    wap_mmi_file_dl_ind_struct *p;
    peer_buff_struct *peer_buff_ptr = NULL;
    wap_mmi_file_dl_var_struct var = {0};

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    p = (wap_mmi_file_dl_ind_struct*) construct_local_para(sizeof(wap_mmi_file_dl_ind_struct), TD_RESET);
    p->session_id = job->id;

    memset(p->url, 0, WAP_DL_MAX_URL_LEN);
    if(job->url)
    {
        len = strlen(job->url);
        strncpy((char *)p->url, job->url, len > WAP_DL_MAX_URL_LEN ? WAP_DL_MAX_URL_LEN : len);
    }

    memset(p->mime_type, 0, WAP_DL_MAX_MIME_TYPE_LEN);
    if(job->mime_type)
    {
        len = strlen(job->mime_type);
        strncpy((char *)p->mime_type, job->mime_type, len > WAP_DL_MAX_MIME_TYPE_LEN ? WAP_DL_MAX_MIME_TYPE_LEN : len);
    }
    
    memset(p->file_name, 0, WAP_DL_MAX_FILE_NAME_LEN);
    widget_utf8_to_ucs2_string(p->file_name, WAP_DL_MAX_FILE_NAME_LEN, (const kal_uint8 *)job->file_name);

    p->file_length = job->total_size;


    if (job->header)
    {
        var.header_len = strlen(job->header);
        var.header = (kal_uint8*) job->header;
    }
    else
    {
        var.header_len = 0;
    }

    if (job->buffer_tail > 0)
    {
        var.content_len = job->buffer_tail;
        var.content = (kal_uint8*) job->buffer;
    }
    else
    {
        var.content_len = 0;
    }

    len = wps_pun_var_part(WPS_PUN_SIZE, MSG_ID_WAP_MMI_FILE_DL_IND, (void*)&var, NULL);
    if (len > 0)
    {
        peer_buff_ptr = construct_peer_buff(len, 0, 0, TD_RESET);
        if (wps_pun_var_part
            (WPS_PUN_PACK, MSG_ID_WAP_MMI_FILE_DL_IND, (void*)&var, get_pdu_ptr(peer_buff_ptr, &length)) != len)
        {
            free_peer_buff(peer_buff_ptr);
            peer_buff_ptr = NULL;
        }
    }

    ilm_ptr = allocate_ilm(MOD_WAP);

    ilm_ptr->msg_id = (kal_uint16) MSG_ID_WAP_MMI_FILE_DL_IND;  /* Set the message id */
    ilm_ptr->peer_buff_ptr = peer_buff_ptr;
    ilm_ptr->local_para_ptr = (local_para_struct*) p;
    SEND_ILM(MOD_WAP, MOD_MMI, WAP_MMI_SAP, ilm_ptr);

}