mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Centralize use of "all files" wildcard in dialogs so it's consistent.
This commit is contained in:
parent
a1df561db4
commit
c6a190d480
@ -2831,7 +2831,7 @@ void GuiView::openDocuments(string const & fname, int origin)
|
||||
QStringList const filter({
|
||||
qt_("LyX Documents (*.lyx)"),
|
||||
qt_("LyX Document Backups (*.lyx~)"),
|
||||
qt_("All Files (*.*)")
|
||||
qt_("All Files") + " " + wildcardAllFiles()
|
||||
});
|
||||
FileDialog::Results results =
|
||||
dlg.openMulti(toqstr(initpath), filter);
|
||||
@ -4581,7 +4581,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
FileDialog dlg(qt_("Select file to insert"));
|
||||
|
||||
FileDialog::Result result = dlg.open(toqstr(bv->buffer().filePath()),
|
||||
QStringList(qt_("All Files (*)")));
|
||||
QStringList(qt_("All Files")+ " " + wildcardAllFiles()));
|
||||
|
||||
if (result.first == FileDialog::Later || result.second.isEmpty()) {
|
||||
dr.setMessage(_("Canceled."));
|
||||
|
@ -601,18 +601,12 @@ struct FileFilterList
|
||||
std::vector<Filter> filters_;
|
||||
};
|
||||
|
||||
|
||||
FileFilterList::FileFilterList(docstring const & qt_style_filter)
|
||||
{
|
||||
// FIXME UNICODE
|
||||
string const filter = to_utf8(qt_style_filter)
|
||||
+ (qt_style_filter.empty() ? string() : ";;")
|
||||
+ to_utf8(_("All Files "))
|
||||
#if defined(_WIN32)
|
||||
+ ("(*.*)");
|
||||
#else
|
||||
+ ("(*)");
|
||||
#endif
|
||||
+ to_utf8(_("All Files")) + " " + fromqstr(wildcardAllFiles());
|
||||
|
||||
// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
|
||||
// into individual filters.
|
||||
@ -657,6 +651,16 @@ void FileFilterList::parse_filter(string const & filter)
|
||||
}
|
||||
|
||||
|
||||
QString wildcardAllFiles()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return "(*.*)";
|
||||
#else
|
||||
return "(*)";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** \returns the equivalent of the string passed in
|
||||
* although any brace expressions are expanded.
|
||||
* (E.g. "*.{png,jpg}" -> "*.png *.jpg")
|
||||
|
@ -184,6 +184,8 @@ QString internalPath(QString const &);
|
||||
QString onlyFileName(QString const & str);
|
||||
QString onlyPath(QString const & str);
|
||||
QStringList fileFilters(QString const & description);
|
||||
/// all files wildcard for filter in qt dialogs (crossplatform)
|
||||
QString wildcardAllFiles();
|
||||
|
||||
/// Remove the extension from \p name
|
||||
QString removeExtension(QString const & name);
|
||||
|
Loading…
Reference in New Issue
Block a user