mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +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({
|
QStringList const filter({
|
||||||
qt_("LyX Documents (*.lyx)"),
|
qt_("LyX Documents (*.lyx)"),
|
||||||
qt_("LyX Document Backups (*.lyx~)"),
|
qt_("LyX Document Backups (*.lyx~)"),
|
||||||
qt_("All Files (*.*)")
|
qt_("All Files") + " " + wildcardAllFiles()
|
||||||
});
|
});
|
||||||
FileDialog::Results results =
|
FileDialog::Results results =
|
||||||
dlg.openMulti(toqstr(initpath), filter);
|
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 dlg(qt_("Select file to insert"));
|
||||||
|
|
||||||
FileDialog::Result result = dlg.open(toqstr(bv->buffer().filePath()),
|
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()) {
|
if (result.first == FileDialog::Later || result.second.isEmpty()) {
|
||||||
dr.setMessage(_("Canceled."));
|
dr.setMessage(_("Canceled."));
|
||||||
|
@ -601,18 +601,12 @@ struct FileFilterList
|
|||||||
std::vector<Filter> filters_;
|
std::vector<Filter> filters_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
FileFilterList::FileFilterList(docstring const & qt_style_filter)
|
FileFilterList::FileFilterList(docstring const & qt_style_filter)
|
||||||
{
|
{
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
string const filter = to_utf8(qt_style_filter)
|
string const filter = to_utf8(qt_style_filter)
|
||||||
+ (qt_style_filter.empty() ? string() : ";;")
|
+ (qt_style_filter.empty() ? string() : ";;")
|
||||||
+ to_utf8(_("All Files "))
|
+ to_utf8(_("All Files")) + " " + fromqstr(wildcardAllFiles());
|
||||||
#if defined(_WIN32)
|
|
||||||
+ ("(*.*)");
|
|
||||||
#else
|
|
||||||
+ ("(*)");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
|
// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
|
||||||
// into individual filters.
|
// 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
|
/** \returns the equivalent of the string passed in
|
||||||
* although any brace expressions are expanded.
|
* although any brace expressions are expanded.
|
||||||
* (E.g. "*.{png,jpg}" -> "*.png *.jpg")
|
* (E.g. "*.{png,jpg}" -> "*.png *.jpg")
|
||||||
|
@ -184,6 +184,8 @@ QString internalPath(QString const &);
|
|||||||
QString onlyFileName(QString const & str);
|
QString onlyFileName(QString const & str);
|
||||||
QString onlyPath(QString const & str);
|
QString onlyPath(QString const & str);
|
||||||
QStringList fileFilters(QString const & description);
|
QStringList fileFilters(QString const & description);
|
||||||
|
/// all files wildcard for filter in qt dialogs (crossplatform)
|
||||||
|
QString wildcardAllFiles();
|
||||||
|
|
||||||
/// Remove the extension from \p name
|
/// Remove the extension from \p name
|
||||||
QString removeExtension(QString const & name);
|
QString removeExtension(QString const & name);
|
||||||
|
Loading…
Reference in New Issue
Block a user