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 #include "ConnectionSetting.h"
37 extern ThreeBarProgressPage Progress
;
39 static int rb
[] = { IDC_NET_IE5
, IDC_NET_DIRECT
, IDC_NET_PROXY
, 0 };
40 static ConnectionSetting theSetting
;
43 NetPage::CheckIfEnableNext ()
45 int e
= 0, p
= 0, pu
= 0;
46 DWORD ButtonFlags
= PSWIZB_BACK
;
48 if (net_method
== IDC_NET_IE5
)
50 if (net_method
== IDC_NET_IE5
|| net_method
== IDC_NET_DIRECT
)
52 else if (net_method
== IDC_NET_PROXY
)
55 if (net_proxy_host
&& net_proxy_port
)
60 // There's something in the proxy and port boxes, enable "Next".
61 ButtonFlags
|= PSWIZB_NEXT
;
64 GetOwner ()->SetButtons (ButtonFlags
);
66 EnableWindow (GetDlgItem (IDC_PROXY_HOST
), p
);
67 EnableWindow (GetDlgItem (IDC_PROXY_PORT
), p
);
73 rbset (h
, rb
, net_method
);
74 eset (h
, IDC_PROXY_HOST
, net_proxy_host
);
75 if (net_proxy_port
== 0)
77 eset (h
, IDC_PROXY_PORT
, net_proxy_port
);
83 net_method
= rbget (h
, rb
);
84 net_proxy_host
= eget (h
, IDC_PROXY_HOST
, net_proxy_host
);
85 net_proxy_port
= eget (h
, IDC_PROXY_PORT
);
91 return PropertyPage::Create (IDD_NET
);
100 net_method
= IDC_NET_DIRECT
;
104 // Check to see if any radio buttons are selected. If not, select a default.
105 if ((!SendMessage (GetDlgItem (IDC_NET_IE5
), BM_GETCHECK
, 0, 0) ==
107 && (!SendMessage (GetDlgItem (IDC_NET_PROXY
), BM_GETCHECK
, 0, 0)
110 SendMessage (GetDlgItem (IDC_NET_DIRECT
), BM_CLICK
, 0, 0);
117 save_dialog (GetHWND ());
119 log (LOG_PLAIN
, String ("net: ") +
120 ((net_method
== IDC_NET_IE5
) ? "IE5" :
121 (net_method
== IDC_NET_DIRECT
) ? "Direct" : "Proxy"));
123 Progress
.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD
);
128 NetPage::OnUnattended()
136 save_dialog (GetHWND ());
141 NetPage::OnMessageCmd (int id
, HWND hwndctl
, UINT code
)
150 save_dialog (GetHWND());
151 CheckIfEnableNext ();
155 // Wasn't recognized or handled.
159 // Was handled since we never got to default above.