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

@@ -353,6 +353,9 @@ public:
// dtor (not virtual, shouldn't be derived from)
~wxFileType();
wxString
GetExpandedCommand(const wxString& verb,
const wxFileType::MessageParameters& params) const;
private:
// default ctor is private because the user code never creates us
wxFileType();

View File

@@ -42,9 +42,18 @@ public:
bool GetIcon(wxIconLocation *iconLoc) const;
bool GetDescription(wxString *desc) const;
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters& params) const;
const wxFileType::MessageParameters& params) const
{
*openCmd = GetExpandedCommand(wxS("open"), params);
return !openCmd->empty();
}
bool GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters& params) const;
const wxFileType::MessageParameters& params) const
{
*printCmd = GetExpandedCommand(wxS("print"), params);
return !printCmd->empty();
}
size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
const wxFileType::MessageParameters& params) const;
@@ -76,6 +85,9 @@ public:
// explicitly.
void MSWSuppressNotifications(bool supress);
wxString
GetExpandedCommand(const wxString& verb,
const wxFileType::MessageParameters& params) const;
private:
// helper function: reads the command corresponding to the specified verb
// from the registry (returns an empty string if not found)

View File

@@ -105,6 +105,9 @@ public:
bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
bool Unassociate(wxFileType *ft);
wxString
GetExpandedCommand(const wxString& verb,
const wxFileType::MessageParameters& params) const;
private:
// All that is needed to query type info - UTI and pointer to the manager

View File

@@ -157,11 +157,10 @@ public:
bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true);
bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
private:
wxString
GetExpandedCommand(const wxString & verb,
const wxFileType::MessageParameters& params) const;
private:
wxMimeTypesManagerImpl *m_manager;
wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays
};