Exemplo n.º 1
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());
}
Exemplo n.º 2
0
/*****************************************************************************
 * FUNCTION
 *  mmi_rmgr_populate_drm_info_aux
 * DESCRIPTION
 *  
 * PARAMETERS
 *  rights          [?]         
 *  permission      [IN]        
 *  data            [?]         
 * RETURNS
 *  
 *****************************************************************************/
kal_bool mmi_rmgr_populate_drm_info_aux(kal_wchar *path, kal_uint8 app_perm, kal_uint8 *data, kal_int32 ref)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE input = FS_ERROR_RESERVED;
    kal_int32 start = 0, end = 0, cons_ret = DRM_RESULT_NON_DRM;
    kal_bool ret = KAL_FALSE, flag = KAL_TRUE;
    kal_uint8 permission;
    drm_method_enum method;
        
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* permission's incorrect, but ok here*/
    if (app_perm == DRM_PERMISSION_ALL)
         permission = DRM_PERMISSION_PLAY;
    else
        permission = app_perm;
    
    if(ref < 0)
    {
        input = DRM_open_file(path, FS_READ_ONLY, permission);

        if (input < FS_NO_ERROR)
            return ret;
        
        method = DRM_get_object_method(input, NULL);    
    }
    else
    {
        method = DRM_get_object_method_by_ref(ref);
    }
    
    if (method != DRM_METHOD_NONE)
    {
        if (ref < 0)
        {
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_RIGHT));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_PROTECTED));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
        }
    }
    else
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_RIGHT));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNPROTECTED));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");

        if (ref < 0)
        {
            DRM_close_file(input);
        }
        else
        {
            DRM_free_ro_detail();
        }
        return ret;
    }

#ifdef __DRM_V02__
    if (ref < 0)
    {
        kal_wchar *sepa = kal_wstrrchr(path, (kal_int32) '\\');
    
        if (DRM_is_archive(input, NULL) && sepa && kal_wstrncmp(sepa - 4, L".odf\\", 5) != 0)
        {
            /* Multi Part ODF */
            mmi_ucs2cat((PS8) data, (PS8) L" ");
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_MULTI_PART));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
            return ret;
        }
    }
#endif    
    
    if (method == DRM_METHOD_FORWARD_LOCK)
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNLIMITED));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        
        if (ref < 0)
        {
            DRM_close_file(input);
        }
        else
        {
            DRM_free_ro_detail();
        }
        return ret;
    }

   
    do
    {
        if (permission & (DRM_PERMISSION_PLAY | DRM_PERMISSION_DISPLAY | DRM_PERMISSION_EXECUTE | DRM_PERMISSION_PRINT | DRM_PERMISSION_EXPORT))
        {
            drm_constraint_struct cons;
            if (ref < 0)
            {
                if (app_perm == DRM_PERMISSION_ALL && permission != DRM_PERMISSION_PLAY)
                {
                    input = DRM_open_file(path, FS_READ_ONLY, permission);

                    if (input < FS_NO_ERROR)
                        return KAL_FALSE;
                }
                
                cons_ret = DRM_get_constraint(input, NULL, permission, &cons);
            }
            else
            {
                cons_ret = DRM_get_constraint_by_ref(ref, permission, &cons);
            }
            
            if (cons_ret >= DRM_RESULT_OK && cons.status == DRM_STATUS_RIGHTS_PRESENT)
            {
                
                if (flag)
                {
                    mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
                    mmi_ucs2cat((PS8) data, (PS8) L"\n");
                    flag = KAL_FALSE;
                }

                switch(permission)
                {
                    case DRM_PERMISSION_PLAY:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_PLAY));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_DISPLAY:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_DISPLAY));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_EXECUTE:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_EXECUTE));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_PRINT:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_PRINT));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_EXPORT:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_EXPORT));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    default:
                        break;
                }

                if (((method & DRM_METHOD_COMBINED_DELIVERY) ||
                     (method & DRM_METHOD_SEPARATE_DELIVERY) || 
                     (method & DRM_METHOD_V2)) &&
                    (cons.status != DRM_STATUS_NO_RIGHTS))
                {
                
                    MYTIME t;
                    S8 buffer[20];
                    drm_constraint_struct *constraint;
                
                    constraint = &cons;
                    
                    if (constraint->type != DRM_CONSTRAINT_NONE)
                    {
                        if (constraint->type & DRM_CONSTRAINT_COUNT)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_COUNT));
                            sprintf((char*)buffer, "\n%d/%d", constraint->used_count, constraint->total_count);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }

                #ifdef __DRM_V02__
                        if (constraint->type & DRM_CONSTRAINT_ACCUMULATED)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_ACCUMULATED));
                            sprintf((char*)buffer, "\n%d ", constraint->accum_dur);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_SEC));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                    
                        if (constraint->type & DRM_CONSTRAINT_TIMEDCOUNT)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_TIMEDCOUNT));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            sprintf((char*)buffer, "%d ", constraint->timed_count);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_TIMEDCOUNT_TIME));
                            sprintf((char*)buffer, "%d ", constraint->period);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_SEC));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                #endif /* __DRM_V02__ */

                        if (constraint->type & DRM_CONSTRAINT_DATETIME)
                        {
                            if ((constraint->type & DRM_CONSTRAINT_INTERVAL) && constraint->start_intv != 0)
                            {
                                 /* date time contains interval -> show interval*/
                                 if (constraint->start_time <= constraint->start_intv &&
                                      constraint->end_time >= constraint->end_intv)
                                 {
                                          start = constraint->start_intv;
                                          end = constraint->end_intv;
                                 }
                                 /* interval contains date time -> show date time*/
                                 else if (constraint->start_intv <= constraint->start_time &&
                                      constraint->end_intv >= constraint->end_time)
                                 {
                                          start = constraint->start_time;
                                          end = constraint->end_time;
                                 }
                                 /* date time overlaps interval -> show overlap*/
                                 else if (constraint->start_intv <= constraint->start_time &&
                                      constraint->end_intv <= constraint->end_time && 
                                      constraint->start_time <= constraint->end_intv)
                                 {
                                          start = constraint->start_time;
                                          end = constraint->end_intv;
                                 }
                                 /* interval overlaps date time -> show overlap*/
                                 else if (constraint->start_time <= constraint->start_intv &&
                                      constraint->end_time <= constraint->end_intv &&
                                      constraint->start_intv <= constraint->end_time)
                                 {
                                      start = constraint->start_intv;
                                    end = constraint->end_time;
                                 }
                                 else
                                 {
                                          start = constraint->start_intv;
                                          end = constraint->end_intv;
                                 }
                            }
                            else
                            {
                                start = constraint->start_time;
                                end = constraint->end_time;
                            }
                        }
                        else if (constraint->type & DRM_CONSTRAINT_INTERVAL)
                        {
                            if (constraint->interval <= 0)
                            {
                                start = -1;
                                end = -1;
                            }
                            else
                            {
                                start = constraint->start_intv;
                                end = constraint->end_intv;
                            }
                        }
                        
                        if (start > 0)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_START));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            mmi_dt_utc_sec_2_mytime(start, &t, FALSE);
                            date_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L" ");
                            time_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                    
                        if (end > 0)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_END));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            mmi_dt_utc_sec_2_mytime(end, &t, FALSE);
                            date_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L" ");
                            time_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");                    
                        }
                    }
                    else
                    {
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNLIMITED));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                    }

                }
                
            }

            if (ref < 0)
            {
                DRM_close_file(input);
            }

        }

        permission = permission<<1;
    }
    while(permission < DRM_PERMISSION_ALL && app_perm == DRM_PERMISSION_ALL);
    
    if (flag)
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_GLOBAL_INVALID));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
    }

    return ret;
}