📄 plxbrowsetting.c
字号:
/***************************************************************************
*
* Pollex Mobile Platform
*
* Copyright (c) 2004 by Pollex Mobile Software Co., Ltd.
* All Rights Reserved
*
* Module :
*
* Purpose :
*
\**************************************************************************/
/* 11-22 modified for 06A */
#include "PlxConfig.h"
#if defined(PROJECT_BRANCH_06A)
#define __NEWSIMULATOR
#include "FileSystemDef.h"
#undef __NEWSIMULATOR
#else
#ifdef MMI_ON_WIN32
#include <windows.h>
#endif
#ifndef MMI_ON_WIN32
#include "kal_release.h"
#endif
#endif // defined(PROJECT_BRANCH_06A)
/* 11-22 modified for 06A end */
#include "fs_type.h"
#include "fs_func.h"
#include "fs_errcode.h"
#include "settingprot.h"
#include "gui.h"
#include "CommonScreens.h"
#include "wgui_categories_inputs.h"
#include "wgui_categories_popup.h"
//#include "DataAccount.h"
#include "SettingProfile.h"
#include "PWBE.h"
#include "stdlib.h"
#include "plxbrowPort.h"
#include "../public/plxpublic.h"
#include "../public/plxPubDefs.h"
#include "../public/plxUILib.h"
#include "plxBrowDefs.h"
#include "PlxBrowSetting.h"
#include "plxBrowPublic.h"
#include "plxbrow.h"
static BROWSET glBrowSet = {0};
typedef enum tagSettingChangedFlag_{
SETTING_FLAG_NOCHANGE,
SETTING_FLAG_NEEDRESTART,
SETTING_FLAG_CHANGEOPTION
}SettingChangedFlags;
static int g_SettingChangedFlags = SETTING_FLAG_NOCHANGE; // 0: no change 1: changed and no need to restart browser 2: changed and need to restart browser
static BOOL bIsSettingChanged = FALSE;
static BOOL bWaitSetExKeyEndFlag = FALSE;
HDMENU hSettingMainMenu = 0;
HDMENU hSetColorMenu = 0;
HDMENU hAdvSettingMenu = 0;
HDMENU hColorSettingMenu = 0;
HDMENU hCacheSettingMenu = 0;
HDMENU hCookieSettingMenu = 0;
static U8 colorR, colorG, colorB;
static unsigned long colorFlag;
static S32 iYesNo, iSize, iNum;
static U8 *pYesNo[2];
static U16 pDispSel[2];
static U8 pDispSelStat[2];
static unsigned int nNetAccountIndex;
static unsigned int ncurrHiliteItem;
static const U8 *pSize[]={
{(const U8*)"1\x00\x30\x00K\x00\x00\x00"},
{(const U8*)"2\x00\x30\x00K\x00\x00\x00"},
{(const U8*)"3\x00\x30\x00K\x00\x00\x00"},
{(const U8*)"4\x00\x30\x00K\x00\x00\x00"},
{(const U8*)"5\x00\x30\x00K\x00\x00\x00"}
};
static const U8 *pNum[] =
{
{(const U8*)"1\x00\x00\x00"},
{(const U8*)"2\x00\x00\x00"},
{(const U8*)"3\x00\x00\x00"},
{(const U8*)"4\x00\x00\x00"},
{(const U8*)"5\x00\x00\x00"}
};
//netsetting
static U8 strHomePage[PLXBROW_URL_NAME_LEN*2];//
static U8 strIP[4][8];
static U8 strPort[12];
/*static PU8 pNetAcc[] =
{
{(PU8)"G\x00S\x00M\x00\x00\x00"},
{(PU8)"G\x00P\x00R\x00S\x00\x00\x00"}
};
*/
static U8 strNetAccout[50];
static BOOL bNetworkSettingChanged = FALSE;
void EntryOfColorSetting(void);
void EntryOfColorSelectScreen(void);
void EntryOfAdvanceSetting(void);
void EntryOfCacheSetting(void);
void EntryOfCookieSetting(void);
void EntryOfDispSetting(void);
void EntryOfPushSetting(void);
void EntryOfNetworkSetting(void);
void EntryOfNetAccountSel(void);
void EntryOfColorSettingMenu(void);
void EntryOfCacheSettingMenu(void);
void EntryOfCookieSettingMenu(void);
static void CreateSettingMainMenu(void);
static int SettingMainMenuNty(HDMENU hDmenu, unsigned long id, unsigned long event);
static void CreateSetColorMenu(void);
static int ColorSettingNty(HDMENU hDMenu, unsigned long id, unsigned long event);
static void ColorSelDone(void);
//static void ColorSelBack(void);
//static void ColorBackConfirmCB(PLIBEVENT event);
static void ColorSettingSaved(void);
static void ColorSetConfirmOK(void);
#ifdef __PLXBROW_COLORDISP_CUSTOM_
extern S32 cat91_highlighted_slider;
extern UI_string_type cat91_red_string;
extern UI_string_type cat91_green_string;
extern UI_string_type cat91_blue_string;
extern void RedrawCategory91Screen();
extern void cat91_redraw_content_area(void);
static void ResetColorScreenHiliteItem(void);
static void ShowNextColorSlider(void);
static void ShowPreviousColorSlider(void);
#endif //__PLXBROW_COLORDISP_CUSTOM_
static void CreateAdvanceSettingMenu(void);
static int AdvanceSettingEntNty(HDMENU hDMenu, unsigned long id, unsigned long event);
static void ExitCacheSettingScreen(void);
static void CacheHiliteHandler(S32 item_index);
static void CacheSettingOK(void);
static void CacheSettingBack(void);
//static void CacheBackConfirmCB(PLIBEVENT event);
static void FillCacheSettingCtrlInfo(void);
static void FillCookieSettingCtrlInfo(void);
//static void CacheSettingYesNoHilight(S32 index);
//static void CacheSettingSizeHilight(S32 index);
static void CacheSavedOK(void);
static void CacheResetOK(void);
static void ClearCacheFile(void);
static void DeleteCacheFileComfirmCB(PLIBEVENT event);
static void DeleteCacheFileOK(void);
static void DeleteCacheFileBack(void);
static void ExitCookieSettingScreen(void);
static void CookieHiliteHandler(S32 item_index);
//static void CookieSettingYesNoHilight(S32 index);
//static void CookieSettingSizeHilight(S32 index);
//static void CookieSettingNumHilight(S32 index);
static void CookieResetOK(void);
static void CookieSavedOK(void);
static void ClearCookieFile(void);
static void DeleteCookieFileComfirmCB(PLIBEVENT event);
static void DeleteCookieFileOK(void);
static void DeleteCookieFileBack(void);
static void PushSettingHilight(S32 index);
static void CookieSettingOK(void);
static void CookieSettingBack(void);
//static void CookieBackConfirmCB(PLIBEVENT event);
static void EntryOfConfirmSaveDispSetting(void);
static void SaveDispSettingConfirmCB(PLIBEVENT event);
static void SetDispSelectState(void);
static void DispSettingHiliteHandler(S32 item_index);
static void DoSaveDispSetting(void);
static void DispSettingBack(void);
static void FillPushSettingCtrlInfo(void);
static void ExitPushSettingScreen(void);
static void PushHiliteHandler(S32 item_index);
static void PushSettingOK(void);
static void PushSettingBack(void);
static void PushSetSaved(void);
//static void PushBackSavedOK(void);
//static void PushBackConfirmCB(PLIBEVENT event);
static void FillNetSettingCtrlInfo(void);
static void InlineIP4CallbackFunc(PU8 pBuffer, PU8 ip1, PU8 ip2, PU8 ip3, PU8 ip4);
static void NetworkItemHilightHandler(S32 index);
//static void PortEmptyHandler(void);
//static void PortNoEmptyHandler(void);
static void NetworkSettingOK(void);
static void NetworkSettingBack(void);
static void NettingBackConfirmCB(PLIBEVENT event);
static BOOL IsGateWayOrPortChanged(void);
static BOOL IsNetworkSettingChanged(void);
//static void NetworkSettingCancel(void);
#if 0
static void NetworkSettingAccHilight(S32 index);
static pBOOL NetAccGetItemFunc(S32 item_index, UI_string_type str_buff, UI_image_type* img_buff_p, U8 str_img_mask);
static S32 NetAccGetHintFunc(S32 item_index, UI_string_type *hint_array);
static void NetAccSelHilightHandler(S32 index);
static void NetAccSel(void);
static void NetAccSelOK(void);
static void NetAccSelBack(void);
static void GetCurHiliteNetAccClassID(S32 item_index);
static pBOOL GetNextAccClassItem( S32 item_index, UI_string_type str_buff, UI_image_type* img_buff_p, U8 str_img_mask);
static void ExitNetAccClassScreen(void);
static void HomepageFullScreenEdit(void);
#endif
#ifdef __PLXBROW_DEBUG_
static void ReadSetting_Debug(int line);
static int WriteSetting_Debug(int line);
static void ResetSetting_Debug(int line);
#define ReadSetting() ReadSetting_Debug(__LINE__)
#define WriteSetting() WriteSetting_Debug(__LINE__)
#define ResetSetting() ResetSetting_Debug(__LINE__)
#else
static void ReadSetting(void);
static int WriteSetting(void);
static void ResetSetting(void);
#endif
static void ResetColorSetting(void);
static void ResetCacheSetting(void);
static void ResetCookieSetting(void);
static int ColorSettingMenuNty(HDMENU hDMenu, unsigned long id, unsigned long event);
static int CacheSettingMenuNty(HDMENU hDMenu, unsigned long id, unsigned long event);
static int CookieSettingMenuNty(HDMENU hDMenu, unsigned long id, unsigned long event);
static void GoBack2History(void);
static void EntryOfNetAccoutSetting(void);
static void NetAccountInfoCallback(void* info);
//static void EntryNetAccClassScreen(void);
static void ExitNetworkSettingScreen(void);
static U8 NetworkHistoryDelCB(void* param);
static void NetAccountCallback(void * info);
static void EntryNetworkSettingScreen(void);
static void EnterSaveHomePageInputOK (void);
static void SaveHomePageInputLskFunc (void);
static void SaveHomePageInputRskFunc (void);
static void SetKeyOfNetworkSettingScreen(S32 index);
static void SettingDestroyAllMenus(void);
static void SettingKeyEndHandler(void);
static void SettingKeyEndExitLskFunc(void);
//static void SettingKeyEndExitConfirmCB(PLIBEVENT event);
extern void ShowCategory91Screen(U16 title,U16 title_icon,U16 left_softkey,U16 left_softkey_icon,U16 right_softkey,U16 right_softkey_icon,U8 *R,U8 *G,U8 *B,U8* history_buffer);
//call the next func, to avoid to reset the softkey
extern void set_wgui_inline_list_menu_status(s32 status);
extern void multitap_input_key_down_no_draw(s32 key);
extern void handle_inline_text_edit_input(void);
extern void handle_inline_text_edit_complete(void);
extern void handle_inline_IP4_edit_complete(void);
#ifdef __PLXBROW_DEBUG_
extern void PlxTrace(const char * fmt,...);
extern void WAP_DataOut(const unsigned char * pData, unsigned short Length, const unsigned char * pName);
#define SET_DUMP_ALL 0xffff
#define SET_DUMP_VAR_DEFAULT 0x0001
#define SET_DUMP_VAR_CURRENT 0x0002
#define SET_DUMP_MODE_DATAOUT 0x0100
#define SET_DUMP_MODE_VALUE 0x0200
void DumpSetting(int dispflag, int line);
#endif
/****************************************************************************
* Function EntryOfSetting
* Purpose enter setting screen
* Params
* Return
* Remarks
\****************************************************************************/
void EntryOfSetting(void)
{
CreateSettingMainMenu();
if (NULL == hSettingMainMenu)
{
return;
}
PlxSetDMenuDispInfo(0, IMG_ID_PLX_BROW_SETTING, 0,0, 0,0);
PlxShowDMenu(hSettingMainMenu, SCR_ID_PLX_BROW_SETTING, STR_ID_PLX_BROW_SETTING, SettingMainMenuNty, EntryOfSetting);
// ClearKeyHandler(KEY_END,KEY_EVENT_DOWN);
SetKeyHandler(SettingKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}
/****************************************************************************
* Function CreateSettingMainMenu
* Purpose create the menu
* Params
* Return
* Remarks
\****************************************************************************/
static void CreateSettingMainMenu(void)
{
if (0 != hSettingMainMenu)
{
return;
}
hSettingMainMenu = PlxCreateDMenu(0);
if (NULL == hSettingMainMenu)
{
return;
}
PlxInsertDMenuItem(hSettingMainMenu, -1, 0, DMENU_ID_PLX_BROW_SETTING_NETWORK,
(const char *)GetString(STR_ID_PLX_BROW_NETWORKSETTING), IMG_GLOBAL_L1);
PlxInsertDMenuItem(hSettingMainMenu, -1, 0, DMENU_ID_PLX_BROW_SETTING_COLOR,
(const char *)GetString(STR_ID_PLX_BROW_COLORSETTING), IMG_GLOBAL_L2);
PlxInsertDMenuItem(hSettingMainMenu, -1, 0, DMENU_ID_PLX_BROW_SETTING_ADVANCE,
(const char *)GetString(STR_ID_PLX_BROW_ADVANCESETTING), IMG_GLOBAL_L3);
PlxInsertDMenuItem(hSettingMainMenu, -1, 0, DMENU_ID_PLX_BROW_SETTING_PUSH,
(const char *)GetString(STR_ID_PLX_BROW_PUSHBOX), IMG_GLOBAL_L4);
}
/****************************************************************************
* Function SettingMainMenuNty
* Purpose the notify func of setting main menu
* Params
* Return
* Remarks
\****************************************************************************/
static int SettingMainMenuNty(HDMENU hDmenu, unsigned long id, unsigned long event)
{
switch(event)
{
case ENT_LEFT:
case ENT_BACK:
if(TRUE == IsScreenPresent(SCR_ID_PLX_BROW_VIEW))
GoBackToHistory(SCR_ID_PLX_BROW_VIEW);
else
GoBackHistory();
SettingDestroyAllMenus();
break;
case ENT_RIGHT:
case ENT_OK:
switch(id)
{
case DMENU_ID_PLX_BROW_SETTING_NETWORK:
ncurrHiliteItem = 0;
bNetworkSettingChanged = FALSE;
EntryOfNetworkSetting();
break;
case DMENU_ID_PLX_BROW_SETTING_COLOR:
EntryOfColorSetting();
break;
case DMENU_ID_PLX_BROW_SETTING_ADVANCE:
EntryOfAdvanceSetting();
break;
case DMENU_ID_PLX_BROW_SETTING_PUSH:
EntryOfPushSetting();
break;
default:
return -2;
}
break;
default:
return -1;
}
return 0;
}
/****************************************************************************
* Function EntryOfColorSetting
* Purpose enter color setting screen
* Params
* Return
* Remarks
\****************************************************************************/
void EntryOfColorSetting(void)
{
CreateSetColorMenu();
if (NULL == hSetColorMenu)
{
return;
}
PlxSetDMenuDispInfo(0, IMG_ID_PLX_BROW_SETTING, STR_ID_PLX_BROW_OPTION,0, 0,0);
PlxShowDMenu(hSetColorMenu, SCR_ID_PLX_BROW_SETCOLOR, STR_ID_PLX_BROW_COLORSETTING, ColorSettingNty, EntryOfColorSetting);
MMI_hide_left_softkey();
ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION, IMG_GLOBAL_OK);
// ClearKeyHandler(KEY_END,KEY_EVENT_DOWN);
SetKeyHandler(SettingKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}
/****************************************************************************
* Function CreateSetColorMenu
* Purpose create color setting menu
* Params
* Return
* Remarks
\****************************************************************************/
static void CreateSetColorMenu(void)
{
if (NULL != hSetColorMenu)
{
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -