2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to get the network configuration
17 information from the user. */
20 static const char *cvsid
=
34 #include "propsheet.h"
36 extern ThreeBarProgressPage Progress
;
38 static int rb
[] = { IDC_NET_IE5
, IDC_NET_DIRECT
, IDC_NET_PROXY
, 0 };
41 NetPage::CheckIfEnableNext ()
43 int e
= 0, p
= 0, pu
= 0;
44 DWORD ButtonFlags
= PSWIZB_BACK
;
46 if (net_method
== IDC_NET_IE5
)
48 if (net_method
== IDC_NET_IE5
|| net_method
== IDC_NET_DIRECT
)
50 else if (net_method
== IDC_NET_PROXY
)
53 if (net_proxy_host
&& net_proxy_port
)
58 // There's something in the proxy and port boxes, enable "Next".
59 ButtonFlags
|= PSWIZB_NEXT
;
62 GetOwner ()->SetButtons (ButtonFlags
);
64 EnableWindow (GetDlgItem (IDC_PROXY_HOST
), p
);
65 EnableWindow (GetDlgItem (IDC_PROXY_PORT
), p
);
71 rbset (h
, rb
, net_method
);
72 eset (h
, IDC_PROXY_HOST
, net_proxy_host
);
73 if (net_proxy_port
== 0)
75 eset (h
, IDC_PROXY_PORT
, net_proxy_port
);
81 net_method
= rbget (h
, rb
);
82 net_proxy_host
= eget (h
, IDC_PROXY_HOST
, net_proxy_host
);
83 net_proxy_port
= eget (h
, IDC_PROXY_PORT
);
89 return PropertyPage::Create (IDD_NET
);
97 net_method
= IDC_NET_DIRECT
;
101 // Check to see if any radio buttons are selected. If not, select a default.
102 if ((!SendMessage (GetDlgItem (IDC_NET_IE5
), BM_GETCHECK
, 0, 0) ==
104 && (!SendMessage (GetDlgItem (IDC_NET_PROXY
), BM_GETCHECK
, 0, 0)
107 SendMessage (GetDlgItem (IDC_NET_DIRECT
), BM_CLICK
, 0, 0);
114 save_dialog (GetHWND ());
116 log (LOG_PLAIN
, String ("net: ") +
117 ((net_method
== IDC_NET_IE5
) ? "IE5" :
118 (net_method
== IDC_NET_DIRECT
) ? "Direct" : "Proxy"));
120 Progress
.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD
);
127 save_dialog (GetHWND ());
132 NetPage::OnMessageCmd (int id
, HWND hwndctl
, UINT code
)
141 save_dialog (GetHWND());
142 CheckIfEnableNext ();
146 // Wasn't recognized or handled.
150 // Was handled since we never got to default above.