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

📄 plxbrowsetting.c

📁 mtk wap和mms代码。。适应mtk 25。26平台
💻 C
📖 第 1 页 / 共 5 页
字号:
}


/****************************************************************************
* Function	CacheResetOK
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CacheResetOK(void)
{	
	int		nRet = WAP_ERR_NOERR;
	BOOL bOldUsed = glBrowSet.bCacheUsed;
	int     nOldSize = glBrowSet.nCacheSize;
	
	GoBack2TheHistory();
	ResetCacheSetting();
	if(glBrowSet.bCacheUsed != bOldUsed|| glBrowSet.nCacheSize != nOldSize)
	{
		nRet = WriteSetting();
	}
	bIsSettingChanged = FALSE;
	if(WAP_ERR_NOERR == nRet)
		PLIB_MessageBox(PMBTYPE_SUCCESS, NULL, (const WCHAR *)get_string(STR_GLOBAL_DONE), UI_POPUP_NOTIFYDURATION_TIME);
	
}


/****************************************************************************
* Function	CacheSavedOK
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CacheSavedOK(void)
{
	int		nRet = WAP_ERR_NOERR;

//	DeleteUptoScrID (SCR_ID_PLX_BROW_ADVSET);
	GoBackToHistory(SCR_ID_PLX_BROW_ADVSET);
	if(glBrowSet.bCacheUsed != (BOOL) iYesNo || glBrowSet.nCacheSize != (iSize + 1)*10 *1024)
	{
		glBrowSet.bCacheUsed = (BOOL)iYesNo;
		glBrowSet.nCacheSize = (iSize + 1) * 10 * 1024;
		nRet = WriteSetting();
	}
	bIsSettingChanged = FALSE;
	if(WAP_ERR_NOERR == nRet)
		PLIB_MessageBox(PMBTYPE_SUCCESS, NULL, (const WCHAR *)get_string(STR_GLOBAL_DONE), UI_POPUP_NOTIFYDURATION_TIME);
}


/****************************************************************************
* Function	ClearCacheFile
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void ClearCacheFile(void)
{
	int	nToneID = WARNING_TONE;

#ifdef __PLXBROW_SUPPORT_HOTPLUG_
	if(PMSDC_OK != PlxBrowIsMemCardPluged())
	{
		if(TRUE ==IsScreenPresent(SCR_ID_PLX_BROW_CACHESET))
			GoBackToHistory(SCR_ID_PLX_BROW_CACHESET);
        if ( PMSDC_NONE == PlxBrowIsMemCardPluged())
    		PLIB_MessageBox(PMBTYPE_WARNING, NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_INSERTCARD), UI_POPUP_NOTIFYDURATION_TIME);
        else
            PLIB_NotifyMSDCWrong();
		return;
    }

#endif //__PLXBROW_SUPPORT_HOTPLUG_

	bIsSettingChanged = FALSE;
	GoBackHistory();
	PLIB_ConfirmBox(NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_DELETE_CONFIRM), NULL,NULL,NULL,0, (void *)&nToneID, 0,DeleteCacheFileComfirmCB);
	SetKeyHandler(SettingKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}


/****************************************************************************
* Function	DeleteCacheFileComfirmCB
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void DeleteCacheFileComfirmCB(PLIBEVENT event)
{
	if(PEVENT_POSITIVE == event)
		DeleteCacheFileOK();
	else if(PEVENT_NEGTIVE == event)
		DeleteCacheFileBack();
}


/****************************************************************************
* Function	DeleteCacheFileOK
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void DeleteCacheFileOK(void)
{
	char  szWideName[PLXBROW_MAX_PATH * 2];
//	int	nRet;
	
#ifdef __PLXBROW_SUPPORT_HOTPLUG_
	if(PMSDC_OK != PlxBrowIsMemCardPluged())
	{
		if(TRUE ==IsScreenPresent(SCR_ID_PLX_BROW_CACHESET))
			GoBackToHistory(SCR_ID_PLX_BROW_CACHESET);
        if ( PMSDC_NONE == PlxBrowIsMemCardPluged() )
		    PLIB_MessageBox(PMBTYPE_WARNING, NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_INSERTCARD), UI_POPUP_NOTIFYDURATION_TIME);
        else
            PLIB_NotifyMSDCWrong();
		return;
	}
#endif //__PLXBROW_SUPPORT_HOTPLUG_

	GoBack2TheHistory();
	AnsiiToUnicodeString((S8 *)szWideName, (S8 *)GetPBUICacheFilePath());
//	if(NULL != PlxBrowGetBrowserHandle())//the browser handler can be NULL
	PWBE_SetCACOOption(PlxBrowGetBrowserHandle(),  WBCACHE_CLEAR, (void *)NULL,0);
	PLIB_MessageBox(PMBTYPE_SUCCESS,NULL, (const WCHAR *)get_string(STR_GLOBAL_DONE), UI_POPUP_NOTIFYDURATION_TIME);
	
	FS_Delete((const WCHAR *)szWideName);
/*	if(FS_NO_ERROR == nRet ||FS_FILE_NOT_FOUND == nRet )
	{
	}
	else 
	{
		PLIB_MessageBox(PMBTYPE_ERROR,NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_DELETE_ERR_FAIL), UI_POPUP_NOTIFYDURATION_TIME);
	}
*/
}


/****************************************************************************
* Function	DeleteCacheFileBack
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void DeleteCacheFileBack(void)
{
	GoBack2TheHistory();
}


/****************************************************************************
* Function	EntryOfCookieSetting
* Purpose	enter cookie setting screen
* Params	
* Return	
* Remarks	
\****************************************************************************/
void EntryOfCookieSetting(void)
{
    U8* guiBuffer;
    U16 CookieIcons[6]= {IMG_GLOBAL_L1, 0, IMG_GLOBAL_L2, 0, IMG_GLOBAL_L3, 0};

#ifdef __PLXBROW_SUPPORT_HOTPLUG_
	if(PMSDC_NONE == PlxBrowIsMemCardPluged())
	{
		PLIB_MessageBox(PMBTYPE_WARNING, NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_INSERTCARD), UI_POPUP_NOTIFYDURATION_TIME);
		return;
	}
    if ( PMSDC_WRONG == PlxBrowIsMemCardPluged() )
    {
        PLIB_NotifyMSDCWrong();
        return;
    }
#endif  //__PLXBROW_SUPPORT_HOTPLUG_

    EntryNewScreen(SCR_ID_PLX_BROW_COOKIESET, ExitCookieSettingScreen, NULL, NULL);
    
    guiBuffer = GetCurrGuiBuffer(SCR_ID_PLX_BROW_COOKIESET);
    
    InitializeCategory57Screen();
    FillCookieSettingCtrlInfo();
	RegisterHighlightHandler(CookieHiliteHandler);
    ShowCategory57Screen(STR_ID_PLX_BROW_COOKIESETTING, IMG_ID_PLX_BROW_SETTING, STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK,
        STR_GLOBAL_BACK, IMG_GLOBAL_BACK, 6, CookieIcons, wgui_inline_items, ncurrHiliteItem, guiBuffer);
	DisableCategory57ScreenDone();
//  SetCategory57LeftSoftkeyFunction(CacheSettingOK);
//  SetCategory57RightSoftkeyFunctions(CacheSettingBack, GoBackHistory);
//	set_wgui_inline_list_menu_status(1);
    ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
    SetLeftSoftkeyFunction(CookieSettingOK, KEY_EVENT_UP);
    SetRightSoftkeyFunction(CookieSettingBack, KEY_EVENT_UP);
//	ClearKeyHandler(KEY_END,KEY_EVENT_DOWN);
	SetKeyHandler(SettingKeyEndHandler,KEY_END,KEY_EVENT_DOWN);

}


/****************************************************************************
* Function	ExitCookieSettingScreen
* Purpose		
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void ExitCookieSettingScreen(void)
{
	history    ScrDA;	/* Variable to hold the history data*/
	S16 		nHistory=0;
	U16 		size;

	CloseCategory57Screen();

	ScrDA.scrnID = SCR_ID_PLX_BROW_COOKIESET;
	ScrDA.entryFuncPtr = EntryOfCookieSetting;

	pfnUnicodeStrcpy((S8*)ScrDA.inputBuffer,(S8*)&nHistory);
	GetCategoryHistory(ScrDA.guiBuffer);
	size = (U16)GetCategory57DataSize();
	GetCategory57Data ((U8*)ScrDA.inputBuffer );
	AddNHistory(ScrDA,size);
}

/****************************************************************************
* Function	CookieHiliteHandler
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieHiliteHandler(S32 item_index)
{
	ncurrHiliteItem = item_index;
	set_wgui_inline_list_menu_status(1);
	ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
	ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
	SetLeftSoftkeyFunction(CookieSettingOK, KEY_EVENT_UP);
	SetRightSoftkeyFunction(CookieSettingBack, KEY_EVENT_UP);
}


/****************************************************************************
* Function	FillCookieSettingCtrlInfo
* Purpose	fill the cookie setting inline edit info
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void FillCookieSettingCtrlInfo(void)
{
    SetInlineItemCaption(&wgui_inline_items[0],(U8 *)GetString(STR_ID_PLX_BROW_USECOOKIE));
	
    pYesNo[0] = (U8*)GetString( STR_GLOBAL_NO);
    pYesNo[1] = (U8*)GetString(STR_GLOBAL_YES);
    if(FALSE == bIsSettingChanged)
	    iYesNo = glBrowSet.bCookieUsed;
    SetInlineItemActivation(&(wgui_inline_items[1]),INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,0);	
    SetInlineItemSelect(&wgui_inline_items[1], 2, pYesNo, &iYesNo);
//  RegisterInlineSelectHighlightHandler(&wgui_inline_items[1], CookieSettingYesNoHilight);
	
    SetInlineItemCaption(&wgui_inline_items[2], (U8*)GetString(STR_ID_PLX_BROW_COOKIESIZE));
	
    if(FALSE == bIsSettingChanged)
		iSize = glBrowSet.nCookieSize / 1024 / 10 - 1;
    SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
    SetInlineItemSelect(&wgui_inline_items[3], 5, (U8**)pSize, &iSize);
//  RegisterInlineSelectHighlightHandler(&wgui_inline_items[3], CookieSettingSizeHilight);
	
    SetInlineItemCaption(&wgui_inline_items[4], (U8*)GetString(STR_ID_PLX_BROW_COOKIENUM));
	
    if(FALSE == bIsSettingChanged)
		iNum = glBrowSet.nCookieNum - 1;
    SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
    SetInlineItemSelect(&wgui_inline_items[5], 5, (U8**)pNum, &iNum);
//  RegisterInlineSelectHighlightHandler(&wgui_inline_items[5], CookieSettingNumHilight);
}

#if 0
/****************************************************************************
* Function	CookieSettingYesNoHilight
* Purpose	cookie setting yes-no highlight
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieSettingYesNoHilight(S32 index)
{
//  set_wgui_inline_list_menu_status(1);
    ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
    SetLeftSoftkeyFunction(CookieSettingOK, KEY_EVENT_UP);
    SetRightSoftkeyFunction(CookieSettingBack, KEY_EVENT_UP);
}

/****************************************************************************
* Function	CookieSettingSizeHilight
* Purpose	coookie setting size highlight
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieSettingSizeHilight(S32 index)
{
//  set_wgui_inline_list_menu_status(1);
    ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
    SetLeftSoftkeyFunction(CookieSettingOK, KEY_EVENT_UP);
    SetRightSoftkeyFunction(CookieSettingBack, KEY_EVENT_UP);
}

/****************************************************************************
* Function	CookieSettingNumHilight
* Purpose	cookie setting number highlight
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieSettingNumHilight(S32 index)
{
//  set_wgui_inline_list_menu_status(1);
    ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
    SetLeftSoftkeyFunction(CookieSettingOK, KEY_EVENT_UP);
    SetRightSoftkeyFunction(CookieSettingBack, KEY_EVENT_UP);
}

#endif
/****************************************************************************
* Function	CookieSettingOK
* Purpose	when cookie setting ok
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieSettingOK(void)
{
/*	glBrowSet.bCookieUsed = (BOOL)iYesNo;
	glBrowSet.nCookieSize = (iSize + 1) * 1024 * 10;
	glBrowSet.nCookieNum = iNum + 1;
	WriteSetting();
	GoBackHistory();
	CloseCategory57Screen();
*/
	EntryOfCookieSettingMenu();
}

/****************************************************************************
* Function	CookieSettingBack
* Purpose	when cookie setting back
* Params	
* Return	
* Remarks	
\****************************************************************************/
static void CookieSettingBack(void)
{
//	int  nToneId = WARNING_TONE;

	bIsSettingChanged = FALSE;
     CloseCategory57Screen();  
/*	if(glBrowSet.bCookieUsed != (BOOL)iYesNo ||
			glBrowSet.nCookieSize != (iSize + 1) * 1024 * 10 ||
			glBrowSet.nCookieNum != iNum + 1)
	{
		PLIB_ConfirmBox(NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_SAVE_SAVEORNOT_CONFIRM),NULL, NULL, NULL, 0, (void *)&nToneId,0, CookieBackConfirmCB);
	}
	else*/
		 GoBackHistory();
}


/****************************************************************************
* Function	CookieBackConfirmCB
* Purpose	
* Params	
* Return	
* Remarks	
\****************************************************************************/
/*
static void   CookieBackConfirmCB(PLIBEVENT event)
{
	if(PEVENT_POSITIVE == event)
		CookieSavedOK();
	else if(PEVENT_NEGTIVE == event)
		GoBack2TheHistory();
}
*/

/****************************************************************************
* Function	EntryOfCookieSettingMenu
* Purpose	enter cookie setting menu
* Params	
* Return	
* Remarks	
\****************************************************************************/
void EntryOfCookieSettingMenu(void)
{
	if (NULL == hCookieSettingMenu) 
	{
		hCookieSettingMenu = PlxCreateDMenu(0);
		if (NULL == hCookieSettingMenu) 
		{
			return;

⌨️ 快捷键说明

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