652
652
// File has changed, ask user what to do
654
wxTopLevelWindow* pTopWindow = (wxTopLevelWindow*)wxTheApp->GetTopWindow();
654
wxTopLevelWindow* pTopWindow = (wxTopLevelWindow*)wxTheApp->GetTopWindow();
655
655
if (pTopWindow && pTopWindow->IsIconized())
657
657
pTopWindow->RequestUserAttention(wxUSER_ATTENTION_INFO);
912
912
else if (command[0] == '1')
915
const wxString random = _T("5AC2EE515D18406aB77C2C60F1F88952.txt"); // Chosen by fair dice roll. Guaranteed to be random.
915
const wxString random = _T("5AC2EE515D18406 space aB77C2C60F1F88952.txt"); // Chosen by fair dice roll. Guaranteed to be random.
916
916
wxString command = GetSystemOpenCommand(random, program_exists);
917
917
if (command.empty() || !program_exists)
986
986
if (ext == _T(""))
989
wxFileType* pType = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
994
if (!pType->GetOpenCommand(&cmd, wxFileType::MessageParameters(file)))
991
wxFileType* pType = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
996
if (!pType->GetOpenCommand(&cmd, wxFileType::MessageParameters(file)))
1002
return wxEmptyString;
1004
program_exists = false;
1007
if (cmd.Left(7) == _T("WX_DDE#"))
1009
// See wxWidget's wxExecute in src/msw/utilsexc.cpp
1010
// WX_DDE#<command>#DDE_SERVER#DDE_TOPIC#DDE_COMMAND
1011
editor = cmd.Mid(7);
1012
int pos = editor.Find('#');
1015
editor = editor.Left(pos);
1021
if (!UnquoteCommand(editor, args) || editor.empty())
1024
if (!PathExpand(editor))
1027
if (ProgramExists(editor))
1028
program_exists = true;
1004
return wxEmptyString;
1006
program_exists = false;
1009
if (cmd.Left(7) == _T("WX_DDE#"))
1011
// See wxWidget's wxExecute in src/msw/utilsexc.cpp
1012
// WX_DDE#<command>#DDE_SERVER#DDE_TOPIC#DDE_COMMAND
1013
editor = cmd.Mid(7);
1014
int pos = editor.Find('#');
1017
editor = editor.Left(pos);
1023
if (!UnquoteCommand(editor, args) || editor.empty())
1026
if (!PathExpand(editor))
1029
if (ProgramExists(editor))
1030
program_exists = true;
1033
int pos = args.Find(file);
1034
if (pos != -1 && file.Find(' ') != -1 && file[0] != '\'' && file[0] != '"')
1036
// Might need to quote filename, wxWidgets doesn't do it
1037
if ((!pos || (args[pos - 1] != '\'' && args[pos - 1] != '"')) &&
1038
args[pos + file.Length()] != '\'' && args[pos + file.Length()] != '"')
1040
// Filename in command arguments isn't quoted. Repeat with quoted filename
1041
file = _T("\"") + file + _T("\"");
1049
return wxEmptyString;
1032
1052
wxString CEditHandler::GetCustomOpenCommand(const wxString& file, bool& program_exists)
1592
1616
void CNewAssociationDialog::SetCtrlState()
1594
const bool custom = XRCCTRL(*this, "ID_USE_CUSTOM", wxRadioButton)->GetValue();
1618
wxRadioButton* pCustom = wxDynamicCast(FindWindow(XRCID("ID_USE_CUSTOM")), wxRadioButton);
1621
// Return since it can get called before dialog got fully loaded
1625
const bool custom = pCustom->GetValue();
1596
1627
XRCCTRL(*this, "ID_CUSTOM", wxTextCtrl)->Enable(custom);
1597
1628
XRCCTRL(*this, "ID_BROWSE", wxButton)->Enable(custom);