HandleFunc.c
上传用户:duwei1288
上传日期:2009-12-27
资源大小:451k
文件大小:7k
源码类别:

BREW编程

开发平台:

Visual C++

  1. #include "HandleFunc.h"
  2. #include "ISettingFile.h"
  3. #include "WindowStack.h"
  4. #include "IInputWindow.h"
  5. #include "AEEAppGen.h"
  6. #include "Menulist_res.h"
  7. #include "IBookMark.h"
  8. //set response function declare
  9. static boolean WAPSetHdl_SetGatewayIPResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  10. static boolean WAPSetHdl_SetGatewayPortResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  11. static boolean WAPSetHdl_SetGatewayUSERResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  12. static boolean WAPSetHdl_SetGatewayPASSWORDResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  13. static boolean WAPSetHdl_SetDefHomePageNameResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  14. static boolean WAPSetHdl_SetDefHomePageUrlResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  15. static boolean WAPSetHdl_OpenUrlResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK);
  16. //Set function define
  17. boolean WAPSetHdl_SetConnectTypeWSPCO()
  18. {
  19. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_WSP_CO);
  20. }
  21. boolean WAPSetHdl_SetConnectTypeWSPCL()
  22. {
  23. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_WSP_CL);
  24. }
  25. boolean WAPSetHdl_SetConnectTypeWSPCOWTLS()
  26. {
  27. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_WSP_CO_WTLS);
  28. }
  29. boolean WAPSetHdl_SetConnectTypeHTTP()
  30. {
  31. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_HTTP);
  32. }
  33. boolean WAPSetHdl_SetConnectTypeHTTPSECURITY()
  34. {
  35. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_HTTP_SECURITY);
  36. }
  37. boolean WAPSetHdl_SetConnectTypeWSPCLWTLS()
  38. {
  39. return ISETTINGFILE_SetInt(WAP_CONNECTSET,CONNECTION_TYPE_WSP_CL_WTLS);
  40. }
  41. boolean WAPSetHdl_SetBookMark()
  42. {
  43. return IWINSTACK_OpenWindow(WAPWINID_BOOKMARK,NULL);
  44. }
  45. boolean WAPSetHdl_SetOpenUrl()
  46. {
  47. AECHAR pUrl[8];
  48. InputTextInfo Info;
  49. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  50. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_URL,pUrl,sizeof(pUrl));
  51. Info.m_inputType=IT_TEXT;
  52. Info.m_pText=ISETTINGFILE_GetStr(WAP_OPENURL);
  53. Info.m_pTitle=pUrl;
  54. return NewTextInputDialog(&Info,NULL,WAPSetHdl_OpenUrlResponse);
  55. }
  56. boolean WAPSetHdl_SetDefHomePageName()
  57. {
  58. AECHAR pName[8];
  59. InputTextInfo Info;
  60. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  61. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_DEFAULTHOMEPAGENAME,pName,sizeof(pName));
  62. Info.m_inputType=IT_TEXT;
  63. Info.m_pText=ISETTINGFILE_GetStr(WAP_DEFHOMEPAGENAME);
  64. Info.m_pTitle=pName;
  65. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetDefHomePageNameResponse);
  66. }
  67. boolean WAPSetHdl_SetDefHomePageUrl()
  68. {
  69. AECHAR pUrl[8];
  70. InputTextInfo Info;
  71. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  72. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_DEFAULTHOMEPAGEURL,pUrl,sizeof(pUrl));
  73. Info.m_inputType=IT_TEXT;
  74. Info.m_pText=ISETTINGFILE_GetStr(WAP_DEFHOMEPAGEURL);
  75. Info.m_pTitle=pUrl;
  76. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetDefHomePageUrlResponse);
  77. }
  78. boolean WAPSetHdl_SetGatewayIP()
  79. {
  80. AECHAR pIP[8];
  81. InputTextInfo Info;
  82. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  83. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_IP,pIP,sizeof(pIP));
  84. Info.m_inputType=IT_TEXT;
  85. Info.m_pText=ISETTINGFILE_GetStr(WAP_GATEWAYIP);
  86. Info.m_pTitle=pIP;
  87. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetGatewayIPResponse);
  88. }
  89. boolean WAPSetHdl_SetGatewayPort()
  90. {
  91. AECHAR pPort[8];
  92. InputTextInfo Info;
  93. int nPort;
  94. char pBuffer[16];
  95. AECHAR  DestWChar[32];
  96. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  97. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_PORT,pPort,sizeof(pPort));
  98. Info.m_inputType=IT_TEXT;
  99. nPort = ISETTINGFILE_GetInt(WAP_GATEWAPPORT);
  100.        SPRINTF(pBuffer,"%d",nPort);
  101. STRTOWSTR(pBuffer,DestWChar,sizeof(DestWChar));
  102. Info.m_pText= DestWChar;
  103. Info.m_pTitle=pPort;
  104. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetGatewayPortResponse);
  105. //return ISETTINGFILE_SetInt(WAP_GATEWAPPORT,16);
  106. }
  107. boolean WAPSetHdl_SetGatewayUSER()
  108. {
  109. AECHAR pUser[16];
  110. InputTextInfo Info;
  111. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  112. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_USER,pUser,sizeof(pUser));
  113. Info.m_inputType=IT_TEXT;
  114. Info.m_pText=ISETTINGFILE_GetStr(WAP_GATEWAPUSER);
  115. Info.m_pTitle=pUser;
  116. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetGatewayUSERResponse);
  117. }
  118. boolean WAPSetHdl_SetGatewayPassword()
  119. {
  120. AECHAR pPassword[16];
  121. InputTextInfo Info;
  122. AEEApplet* pApp=(AEEApplet*)GETAPPINSTANCE();
  123. ISHELL_LoadResString(pApp->m_pIShell,MENULIST_RES_FILE, IDS_PASSWORD,pPassword,sizeof(pPassword));
  124. Info.m_inputType=IT_PASSWORD;
  125. Info.m_pText=ISETTINGFILE_GetStr(WAP_GATEWAPPASSWORD);
  126. Info.m_pTitle=pPassword;
  127. return NewTextInputDialog(&Info,NULL,WAPSetHdl_SetGatewayPASSWORDResponse);
  128. }
  129. static boolean WAPSetHdl_OpenUrlResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  130. {
  131. if(response1)
  132. return ISETTINGFILE_SetStr(WAP_OPENURL,(AECHAR*)response1);
  133. else
  134. return FALSE;
  135. }
  136. static boolean WAPSetHdl_SetDefHomePageUrlResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  137. {
  138. if(response1)
  139. return ISETTINGFILE_SetStr(WAP_DEFHOMEPAGEURL,(AECHAR*)response1);
  140. else
  141. return FALSE;
  142. }
  143. static boolean WAPSetHdl_SetDefHomePageNameResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  144. {
  145. if(response1)
  146. return ISETTINGFILE_SetStr(WAP_DEFHOMEPAGENAME,(AECHAR*)response1);
  147. else
  148. return FALSE;
  149. }
  150. //set response function define
  151. static boolean WAPSetHdl_SetGatewayIPResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  152. {
  153. if(response1)
  154. return ISETTINGFILE_SetStr(WAP_GATEWAYIP,(AECHAR*)response1);
  155. else
  156. return FALSE;
  157. }
  158. static boolean WAPSetHdl_SetGatewayPortResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  159. {
  160.        char    tmpstr[40];
  161. int       Port;  
  162. WSTRTOUTF8(response1, WSTRLEN(response1), (byte*)tmpstr, 40);
  163.        Port = ATOI(tmpstr);
  164. Port=(Port<65535)?Port:0;
  165. if(response1)
  166. return ISETTINGFILE_SetInt(WAP_GATEWAPPORT,Port);
  167. else
  168. return FALSE;
  169. }
  170. static boolean WAPSetHdl_SetGatewayUSERResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  171. {
  172. if(response1)
  173. return ISETTINGFILE_SetStr(WAP_GATEWAPUSER,(AECHAR*)response1);
  174. else
  175. return FALSE;
  176. }
  177. static boolean WAPSetHdl_SetGatewayPASSWORDResponse(const AECHAR *response1, const AECHAR *response2, boolean bOK)
  178. {
  179. if(response1)
  180. return ISETTINGFILE_SetStr(WAP_GATEWAPPASSWORD,(AECHAR*)response1);
  181. else
  182. return FALSE;
  183. }