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 manage the dialog box that lets the
17 user choose the source of the install - from the net, from the
18 current directory, or to just download files. */
22 #include "LogSingleton.h"
30 #include "package_db.h"
32 #include "SourceSetting.h"
34 #include "getopt++/BoolOption.h"
36 static BoolOption
DownloadOption (false, 'D', "download", IDS_HELPTEXT_DOWNLOAD
);
37 static BoolOption
LocalOption (false, 'L', "local-install", IDS_HELPTEXT_LOCAL_INSTALL
);
40 { IDC_SOURCE_NETINST
, IDC_SOURCE_DOWNLOAD
, IDC_SOURCE_LOCALDIR
, 0 };
45 rbset (h
, rb
, source
);
51 source
= rbget (h
, rb
);
52 /* We mustn't construct any packagedb objects until after the root
53 directory has been selected, but setting the static data member
54 that records the mode we're running in is fine here (and conversely,
55 would be A Bad Thing if we did it again after the first time we
56 construct a packagedb object; see package_db.h for details). */
58 source
== IDC_SOURCE_DOWNLOAD
? PackageDB_Download
: PackageDB_Install
;
62 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
67 case IDC_SOURCE_DOWNLOAD
:
68 case IDC_SOURCE_NETINST
:
69 case IDC_SOURCE_LOCALDIR
:
82 return PropertyPage::Create (NULL
, dialog_cmd
, IDD_SOURCE
);
86 SourcePage::OnActivate ()
88 if (DownloadOption
&& LocalOption
)
89 source
= IDC_SOURCE_NETINST
;
90 else if (DownloadOption
)
91 source
= IDC_SOURCE_DOWNLOAD
;
93 source
= IDC_SOURCE_LOCALDIR
;
94 else if ((unattended_mode
!= attended
) || (!source
))
95 // default to IDC_SOURCE_NETINST if unattended, or source not already set
97 source
= IDC_SOURCE_NETINST
;
99 load_dialog (GetHWND ());
100 // Check to see if any radio buttons are selected. If not, select a default.
101 if (SendMessage (GetDlgItem (IDC_SOURCE_DOWNLOAD
), BM_GETCHECK
, 0, 0)
103 && SendMessage (GetDlgItem (IDC_SOURCE_LOCALDIR
), BM_GETCHECK
, 0, 0)
105 SendMessage (GetDlgItem (IDC_SOURCE_NETINST
), BM_SETCHECK
,
110 SourcePage::OnNext ()
119 SourcePage::OnBack ()
121 save_dialog (GetHWND ());
126 SourcePage::OnDeactivate ()
128 Log (LOG_PLAIN
) << "source: "
129 << ((source
== IDC_SOURCE_DOWNLOAD
) ? "download" :
130 (source
== IDC_SOURCE_NETINST
) ? "network install" : "from local dir")
135 SourcePage::OnUnattended ()