blob: 3e03cb8a1ceff0869af5ff7c78b7bee8b9b4aaee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#include <unistd.h>
#include <wx/msgdlg.h>
#include "dialog.h"
#ifdef __WINDOWS__
#include <windows.h>
#endif
Dialog::Dialog(wxWindow *parent)
: DialogUI(parent)
{
RefreshDrives();
}
void Dialog::RefreshDrives(void)
{
#ifdef __WINDOWS__
// SetErrorMode(SEM_NOOPENFILEERRORBOX);
wchar_t drives[256], *pdrv = drives;
memset(drives, 0, sizeof(drives));
GetLogicalDriveStrings(sizeof(drives), drives);
m_target->Clear();
while(pdrv[0] != '\0') {
// if (GetDriveType(pdrv) == DRIVE_REMOVABLE) {
m_target->Append(pdrv);
// }
pdrv += lstrlen(pdrv) + 1;
}
#else
m_target->Clear();
m_target->Append(wxT("~/tmp/alpine"));
#endif
if (!m_target->IsEmpty())
m_target->SetSelection(0);
}
void Dialog::OnRefreshDrives(wxCommandEvent &event)
{
RefreshDrives();
UpdateStartButton();
}
void Dialog::OnStartButton(wxCommandEvent &event)
{
wxMessageBox(wxT("To be implemented"));
}
void Dialog::OnCancelButton(wxCommandEvent &event)
{
Close();
}
void Dialog::UpdateStartButton(void)
{
if ((m_target->GetSelection() != wxNOT_FOUND)
&& wxFileExists(m_iso_picker->GetPath())) {
m_start_button->Enable();
} else {
m_start_button->Disable();
}
}
void Dialog::OnIsoChange(wxFileDirPickerEvent &event)
{
UpdateStartButton();
}
void Dialog::OnTargetChange(wxCommandEvent &event)
{
UpdateStartButton();
}
|