⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 themearchiver.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
 * FUNCTION
 *  mmi_ta_handle_abort_req
 * DESCRIPTION
 *  handle download abort request from JAS
 * PARAMETERS
 *  inMsg_p     [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ta_handle_abort_req(void *inMsg_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* For future use */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ta_parse_url_extract_file_name
 * DESCRIPTION
 *  extract file name from URL for non-oma
 * PARAMETERS
 *  path        [?]     
 * RETURNS
 *  true if successfully parsed otherwise false
 *****************************************************************************/
PS8 mmi_ta_parse_url_extract_file_name(S8 *path)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 i, length;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    length = pfnUnicodeStrlen(path) * 2;
    i = length - 1;

    while (i > 0)
    {
        if (path[i - 1] == '\\' && path[i] == 0 && (i != length - ENCODING_LENGTH))
        {
            break;
        }
        i -= 2;
    }

    if (i < 0)
    {
        return NULL;
    }

    return &path[i + 1];
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ta_delete_intermediate_dlt_files
 * DESCRIPTION
 *  To delete intermediate downloaded files.
 * PARAMETERS
 *  file_path_p     [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ta_delete_intermediate_dlt_files(U16 *file_path_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE fd;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* if file exists. Delete it. */
    fd = FS_Open((WCHAR*) file_path_p, FS_READ_WRITE);
    if (fd >= 0)
    {
        FS_Close(fd);
        FS_Delete((WCHAR*) file_path_p);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ta_check_if_file_alrdy_exist_in_fm
 * DESCRIPTION
 *  Check if file Already exists in File manager.
 * PARAMETERS
 *  file_path       [IN]        
 *  file_name       [IN]        
 *  PS8 file name and file path(?)
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ta_check_if_file_alrdy_exist_in_fm(PS8 file_path, PS8 file_name)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE fd;
    U8 file_count = 0;
    S8 tempStr[6];
    S8 ucs2_dup_file_rename[12];
    U8 len;
    S8 file_ext_buf[(FMGR_MAX_EXT_LEN + 1) * ENCODING_LENGTH];
    S8 *file_ext_p;
    S8 temp_file_name[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(temp_file_name, 0, (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH);
    pfnUnicodeStrncpy(temp_file_name, file_name, FMGR_MAX_FILE_LEN * ENCODING_LENGTH);

    while (file_count < 65535)
    {
        memset(hintData, 0, (FMGR_MAX_PATH_LEN + FMGR_MAX_FILE_LEN) * ENCODING_LENGTH);
        pfnUnicodeStrncpy((PS8) hintData, file_path, FMGR_PATH_BUFFER_SIZE - ENCODING_LENGTH);
        pfnUnicodeStrncat((PS8) hintData, temp_file_name, (FMGR_MAX_FILE_LEN) * ENCODING_LENGTH);
        file_count++;
        fd = FS_Open((WCHAR*) hintData, FS_READ_ONLY);
        if (fd >= 0)
        {
            FS_Close(fd);
            sprintf(tempStr, "%d", file_count);
            AnsiiToUnicodeString(ucs2_dup_file_rename, tempStr);

            memset(temp_file_name, 0, (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH);
            pfnUnicodeStrncpy(temp_file_name, file_name, FMGR_MAX_FILE_LEN * ENCODING_LENGTH);

            file_ext_p = (S8*) mmi_fmgr_extract_ext_file_name(temp_file_name);
            pfnUnicodeStrcpy(file_ext_buf, file_ext_p);
            mmi_ta_thmgr_hide_ext_name(temp_file_name);

            len = FMGR_MAX_INPUT_FILE_LEN - pfnUnicodeStrlen(temp_file_name);

            if (len >= pfnUnicodeStrlen(ucs2_dup_file_rename))
            {
                pfnUnicodeStrcat(temp_file_name, ucs2_dup_file_rename);
            }
            else
            {
                memset(temp_file_name + (FMGR_MAX_INPUT_FILE_LEN - 6) * ENCODING_LENGTH, 0, 12);
                AnsiiToUnicodeString(tempStr, "~");
                pfnUnicodeStrcat(temp_file_name, tempStr);
                pfnUnicodeStrcat(temp_file_name, ucs2_dup_file_rename);
            }
            AnsiiToUnicodeString(tempStr, ".");
            pfnUnicodeStrcat(temp_file_name, tempStr);
            pfnUnicodeStrcat(temp_file_name, file_ext_buf);
        }
        else
        {
            pfnUnicodeStrcpy(file_name, temp_file_name);
            break;
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ta_thmgr_hide_ext_name
 * DESCRIPTION
 *  hide extension file name
 * PARAMETERS
 *  file_name_p     [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ta_thmgr_hide_ext_name(S8 *file_name_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    /* find ext name - by finding "." */
    S32 str_len;
    S32 index;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    str_len = pfnUnicodeStrlen(file_name_p);
    index = (str_len - 1) * ENCODING_LENGTH;

    while (index > 0)
    {
        if (pfnUnicodeStrncmp((PS8) & file_name_p[index], (PS8) L".", 1) == 0)
        {
            file_name_p[index] = '\0';
            file_name_p[index + 1] = '\0';
            break;
        }

        file_name_p[index] = '\0';
        file_name_p[index + 1] = '\0';
        index -= 2;
    }
}



/*****************************************************************************
 * FUNCTION
 *  mmi_ta_parse_lcd_size
 * DESCRIPTION
 *  It parses the lcd height and lcd width string given in dd file
 * PARAMETERS
 *  lcd_size_string_p       [IN]        
 *  lcd_height_p            [IN]        
 *  lcd_width_p             [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ta_parse_lcd_size(const S8 *lcd_size_string_p, S8 *lcd_height_p, S8 *lcd_width_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int count1 = 0, count2 = 0;
    S8 lcd_size_param[MAX_LCD_STRING_SIZE];
    S8 temp_ch;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(lcd_size_param, 0, MAX_LCD_STRING_SIZE);

    while (*lcd_size_string_p != '\0')
    {
        temp_ch = (S8) * lcd_size_string_p;

        if (temp_ch != ':' && temp_ch != (S8) ';' && temp_ch != ' ' && temp_ch != '\t')
        {
            lcd_size_param[count1] = temp_ch;
            ++count1;
        }
        else if (*lcd_size_string_p == ':')
        {
            lcd_size_param[count1] = 0;
            count1 = 0;
            count2 = 0;

            while (temp_ch == ':' || temp_ch == ';' || temp_ch == ' ' || temp_ch == '\t')
            {
                ++(lcd_size_string_p);
                temp_ch = (S8) * lcd_size_string_p;
            }

            while (temp_ch != '\0' && temp_ch != ':' && temp_ch != ';' && temp_ch != ' ' && temp_ch != '\t')
            {
                if (!strcmp(lcd_size_param, g_ta_theme_descriptor_tags_p[6]))
                {
                    lcd_height_p[count2] = temp_ch;
                    ++count2;
                }
                else if (!strcmp(lcd_size_param, g_ta_theme_descriptor_tags_p[7]))
                {
                    lcd_width_p[count2] = temp_ch;
                    ++count2;
                }
                ++(lcd_size_string_p);
                temp_ch = (S8) * lcd_size_string_p;
            }
            if (!strcmp(lcd_size_param, g_ta_theme_descriptor_tags_p[6]))
            {
                lcd_height_p[count2] = 0;
            }
            else if (!strcmp(lcd_size_param, g_ta_theme_descriptor_tags_p[7]))
            {
                lcd_width_p[count2] = 0;
            }
        }

        ++(lcd_size_string_p);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ta_da_oma_install_check_hdlr
 * DESCRIPTION
 *  Its a OMA download callback function and called by download agent for validating the
 *  theme descriptor file
 * PARAMETERS
 *  dd_file     [IN]        
 * RETURNS
 *  TRUE                   if descriptor file contains valid info
 *  FALSE                  if descriptor file contains in-valid info
 *****************************************************************************/
BOOL mmi_ta_da_oma_install_check_hdlr(mmi_da_oma_dd_struct *dd_file)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FLOAT theme_version;
    U16 err_status;
    S8 lcd_height_p[MAX_LCD_STRING_SIZE];
    S8 lcd_width_p[MAX_LCD_STRING_SIZE];

    memset(lcd_height_p, 0, MAX_LCD_STRING_SIZE);
    memset(lcd_width_p, 0, MAX_LCD_STRING_SIZE);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Checking theme type compatibility */
    if (!mmi_ta_check_theme_type_compatibility(dd_file->type[0]))
    {
        return FALSE;
    }

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif

    /* Checking theme type compatibility */
    mmi_ta_parse_lcd_size(dd_file->installParam, (S8*) lcd_height_p, (S8*) lcd_width_p);
    err_status = mmi_ta_check_theme_file_lcd_dim_compatibiltiy(
                    (U32) atof((const char*)lcd_width_p),
                    (U32) atof((const char*)lcd_height_p));
    if (!err_status)
    {
        return FALSE;
    }

    return TRUE;
}

#endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ // #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
#endif /* _MMI_THEME_ARCHIVER_C */ // #ifndef _MMI_THEME_ARCHIVER_C

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -