Add wxFileType::GetExpandedCommand()

This new method allows to get the command expanded with the given file name
for commands other than "Open" and "Print".

Closes #17367.
This commit is contained in:
Troels Knakkergaard
2016-03-05 03:09:59 +01:00
committed by Vadim Zeitlin
parent 6ea8ba1e9c
commit cda7209101
10 changed files with 69 additions and 28 deletions

View File

@@ -338,33 +338,19 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
return command;
}
bool
wxFileTypeImpl::GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters& params)
const
wxString
wxFileTypeImpl::GetExpandedCommand(const wxString & verb,
const wxFileType::MessageParameters& params) const
{
wxString cmd = GetCommand(wxT("open"));
wxString cmd = GetCommand(verb);
// Some viewers don't define the "open" verb but do define "show" one, try
// to use it as a fallback.
if ( cmd.empty() )
if ( cmd.empty() && (verb == wxT("open")) )
cmd = GetCommand(wxT("show"));
*openCmd = wxFileType::ExpandCommand(cmd, params);
return !openCmd->empty();
}
bool
wxFileTypeImpl::GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters& params)
const
{
wxString cmd = GetCommand(wxT("print"));
*printCmd = wxFileType::ExpandCommand(cmd, params);
return !printCmd->empty();
return wxFileType::ExpandCommand(cmd, params);
}
// ----------------------------------------------------------------------------