-/*
- * Copyright (c) 2000, Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * A copy of the GNU General Public License can be found at
- * http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@cygnus.com>
- *
- */
-
-/* The purpose of this file is to get the network configuration
- information from the user. */
-
-#if 0
-static const char *cvsid =
- "\n%%% $Id$\n";
-#endif
-
-#include "win32.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "dialog.h"
-#include "resource.h"
-#include "state.h"
-#include "msg.h"
-#include "log.h"
-
-#include "net.h"
-#include "propsheet.h"
-#include "threebar.h"
-extern ThreeBarProgressPage Progress;
-
-static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 };
-
-void
-NetPage::CheckIfEnableNext ()
-{
- int e = 0, p = 0, pu = 0;
- DWORD ButtonFlags = PSWIZB_BACK;
-
- if (net_method == IDC_NET_IE5)
- pu = 1;
- if (net_method == IDC_NET_IE5 || net_method == IDC_NET_DIRECT)
- e = 1;
- else if (net_method == IDC_NET_PROXY)
- {
- p = pu = 1;
- if (net_proxy_host && net_proxy_port)
- e = 1;
- }
- if (e)
- {
- // There's something in the proxy and port boxes, enable "Next".
- ButtonFlags |= PSWIZB_NEXT;
- }
-
- GetOwner ()->SetButtons (ButtonFlags);
-
- EnableWindow (GetDlgItem (IDC_PROXY_HOST), p);
- EnableWindow (GetDlgItem (IDC_PROXY_PORT), p);
-}
-
-static void
-load_dialog (HWND h)
-{
- rbset (h, rb, net_method);
- eset (h, IDC_PROXY_HOST, net_proxy_host);
- if (net_proxy_port == 0)
- net_proxy_port = 80;
- eset (h, IDC_PROXY_PORT, net_proxy_port);
-}
-
-static void
-save_dialog (HWND h)
-{
- net_method = rbget (h, rb);
- net_proxy_host = eget (h, IDC_PROXY_HOST, net_proxy_host);
- net_proxy_port = eget (h, IDC_PROXY_PORT);
-}
-
-bool
-NetPage::Create ()
-{
- return PropertyPage::Create (IDD_NET);
-}
-
-void
-NetPage::OnInit ()
-{
- HWND h = GetHWND ();
-
- net_method = IDC_NET_DIRECT;
- load_dialog (h);
- CheckIfEnableNext();
-
- // Check to see if any radio buttons are selected. If not, select a default.
- if ((!SendMessage (GetDlgItem (IDC_NET_IE5), BM_GETCHECK, 0, 0) ==
- BST_CHECKED)
- && (!SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0)
- == BST_CHECKED))
- {
- SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_CLICK, 0, 0);
- }
-}
-
-long
-NetPage::OnNext ()
-{
- save_dialog (GetHWND ());
-
- log (LOG_PLAIN, String ("net: ") +
- ((net_method == IDC_NET_IE5) ? "IE5" :
- (net_method == IDC_NET_DIRECT) ? "Direct" : "Proxy"));
-
- Progress.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD);
- return IDD_INSTATUS;
-}
-
-long
-NetPage::OnUnattended()
-{
- return OnNext ();
-}
-
-long
-NetPage::OnBack ()
-{
- save_dialog (GetHWND ());
- return 0;
-}
-
-bool
-NetPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
-{
- switch (id)
- {
- case IDC_NET_IE5:
- case IDC_NET_DIRECT:
- case IDC_NET_PROXY:
- case IDC_PROXY_HOST:
- case IDC_PROXY_PORT:
- save_dialog (GetHWND());
- CheckIfEnableNext ();
- break;
-
- default:
- // Wasn't recognized or handled.
- return false;
- }
-
- // Was handled since we never got to default above.
- return true;
-}
+/*\r
+ * Copyright (c) 2000, Red Hat, Inc.\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * A copy of the GNU General Public License can be found at\r
+ * http://www.gnu.org/\r
+ *\r
+ * Written by DJ Delorie <dj@cygnus.com>\r
+ *\r
+ */\r
+\r
+/* The purpose of this file is to get the network configuration\r
+ information from the user. */\r
+\r
+#if 0\r
+static const char *cvsid =\r
+ "\n%%% $Id$\n";\r
+#endif\r
+\r
+#include "win32.h"\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include "dialog.h"\r
+#include "resource.h"\r
+#include "state.h"\r
+#include "msg.h"\r
+#include "log.h"\r
+\r
+#include "net.h"\r
+#include "propsheet.h"\r
+#include "threebar.h"\r
+#include "ConnectionSetting.h"\r
+extern ThreeBarProgressPage Progress;\r
+\r
+static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 };\r
+static ConnectionSetting theSetting;\r
+\r
+void\r
+NetPage::CheckIfEnableNext ()\r
+{\r
+ int e = 0, p = 0, pu = 0;\r
+ DWORD ButtonFlags = PSWIZB_BACK;\r
+\r
+ if (net_method == IDC_NET_IE5)\r
+ pu = 1;\r
+ if (net_method == IDC_NET_IE5 || net_method == IDC_NET_DIRECT)\r
+ e = 1;\r
+ else if (net_method == IDC_NET_PROXY)\r
+ {\r
+ p = pu = 1;\r
+ if (net_proxy_host && net_proxy_port)\r
+ e = 1;\r
+ }\r
+ if (e)\r
+ {\r
+ // There's something in the proxy and port boxes, enable "Next".\r
+ ButtonFlags |= PSWIZB_NEXT;\r
+ }\r
+\r
+ GetOwner ()->SetButtons (ButtonFlags);\r
+\r
+ EnableWindow (GetDlgItem (IDC_PROXY_HOST), p);\r
+ EnableWindow (GetDlgItem (IDC_PROXY_PORT), p);\r
+}\r
+\r
+static void\r
+load_dialog (HWND h)\r
+{\r
+ rbset (h, rb, net_method);\r
+ eset (h, IDC_PROXY_HOST, net_proxy_host);\r
+ if (net_proxy_port == 0)\r
+ net_proxy_port = 80;\r
+ eset (h, IDC_PROXY_PORT, net_proxy_port);\r
+}\r
+\r
+static void\r
+save_dialog (HWND h)\r
+{\r
+ net_method = rbget (h, rb);\r
+ net_proxy_host = eget (h, IDC_PROXY_HOST, net_proxy_host);\r
+ net_proxy_port = eget (h, IDC_PROXY_PORT);\r
+}\r
+\r
+bool\r
+NetPage::Create ()\r
+{\r
+ return PropertyPage::Create (IDD_NET);\r
+}\r
+\r
+void\r
+NetPage::OnInit ()\r
+{\r
+ HWND h = GetHWND ();\r
+\r
+ if (!net_method)\r
+ net_method = IDC_NET_DIRECT;\r
+ load_dialog (h);\r
+ CheckIfEnableNext();\r
+\r
+ // Check to see if any radio buttons are selected. If not, select a default.\r
+ if ((!SendMessage (GetDlgItem (IDC_NET_IE5), BM_GETCHECK, 0, 0) ==\r
+ BST_CHECKED)\r
+ && (!SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0)\r
+ == BST_CHECKED))\r
+ {\r
+ SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_CLICK, 0, 0);\r
+ }\r
+}\r
+\r
+long\r
+NetPage::OnNext ()\r
+{\r
+ save_dialog (GetHWND ());\r
+\r
+ log (LOG_PLAIN, String ("net: ") +\r
+ ((net_method == IDC_NET_IE5) ? "IE5" :\r
+ (net_method == IDC_NET_DIRECT) ? "Direct" : "Proxy"));\r
+\r
+ Progress.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD);\r
+ return IDD_INSTATUS;\r
+}\r
+\r
+long\r
+NetPage::OnUnattended()\r
+{\r
+ return OnNext ();\r
+}\r
+\r
+long\r
+NetPage::OnBack ()\r
+{\r
+ save_dialog (GetHWND ());\r
+ return 0;\r
+}\r
+\r
+bool\r
+NetPage::OnMessageCmd (int id, HWND hwndctl, UINT code)\r
+{\r
+ switch (id)\r
+ {\r
+ case IDC_NET_IE5:\r
+ case IDC_NET_DIRECT:\r
+ case IDC_NET_PROXY:\r
+ case IDC_PROXY_HOST:\r
+ case IDC_PROXY_PORT:\r
+ save_dialog (GetHWND());\r
+ CheckIfEnableNext ();\r
+ break;\r
+\r
+ default:\r
+ // Wasn't recognized or handled.\r
+ return false;\r
+ }\r
+\r
+ // Was handled since we never got to default above.\r
+ return true;\r
+}\r