return;
setWindowTitle(qt_("LyX: ") + wa->windowTitle());
setWindowIconText(wa->windowIconText());
+#if (QT_VERSION >= 0x040400)
+ // Sets the path for the window: this is used by OSX to
+ // allow a context click on the title bar showing a menu
+ // with the path up to the file
+ setWindowFilePath(toqstr(wa->bufferView().buffer().absFileName()));
+#endif
}
string filename;
if (fname.empty()) {
- FileDialog dlg(qt_("Select document to open"), LFUN_FILE_OPEN);
+ FileDialog dlg(qt_("Select document to open"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"),
toqstr(addPath(package().system_support().absFileName(), "examples")));
- QStringList filter(qt_("LyX Documents (*.lyx)"));
- filter << qt_("LyX-1.3.x Documents (*.lyx13)")
- << qt_("LyX-1.4.x Documents (*.lyx14)")
- << qt_("LyX-1.5.x Documents (*.lyx15)")
- << qt_("LyX-1.6.x Documents (*.lyx16)");
+ QStringList const filter(qt_("LyX Documents (*.lyx)"));
FileDialog::Result result =
dlg.open(toqstr(initpath), filter);
docstring const text = bformat(_("Select %1$s file to import"),
formats.prettyName(format));
- FileDialog dlg(toqstr(text), LFUN_BUFFER_IMPORT);
+ FileDialog dlg(toqstr(text));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"),
toqstr(addPath(package().system_support().absFileName(), "examples")));
// get absolute path of file
FileName const fullname(support::makeAbsPath(filename));
+ // Can happen if the user entered a path into the dialog
+ // (see bug #7437)
+ if (fullname.onlyFileName().empty()) {
+ docstring msg = bformat(_("The file name '%1$s' is invalid!\n"
+ "Aborting import."),
+ from_utf8(fullname.absFileName()));
+ frontend::Alert::error(_("File name error"), msg);
+ message(_("Canceled."));
+ return;
+ }
+
+
FileName const lyxfile(support::changeExtension(fullname.absFileName(), ".lyx"));
// Check if the document already is open
initpath = trypath;
// FIXME UNICODE
- FileDialog dlg(qt_("Select LyX document to insert"), LFUN_FILE_INSERT);
+ FileDialog dlg(qt_("Select LyX document to insert"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Examples|#E#e"),
toqstr(addPath(package().system_support().absFileName(),
// No argument? Ask user through dialog.
// FIXME UNICODE
- FileDialog dlg(qt_("Choose a filename to save document as"),
- LFUN_BUFFER_WRITE_AS);
+ FileDialog dlg(qt_("Choose a filename to save document as"));
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path));
case LFUN_FILE_INSERT_PLAINTEXT:
case LFUN_FILE_INSERT_PLAINTEXT_PARA: {
- bool const as_paragraph = (cmd.action() == LFUN_FILE_INSERT_PLAINTEXT_PARA);
string const fname = to_utf8(cmd.argument());
if (!fname.empty() && !FileName::isAbsolute(fname)) {
dr.setMessage(_("Absolute filename expected."));
FileName filename(fname);
if (fname.empty()) {
- FileDialog dlg(qt_("Select file to insert"), (as_paragraph ?
- LFUN_FILE_INSERT_PLAINTEXT_PARA : LFUN_FILE_INSERT_PLAINTEXT));
+ FileDialog dlg(qt_("Select file to insert"));
FileDialog::Result result = dlg.open(toqstr(bv->buffer().filePath()),
QStringList(qt_("All Files (*)")));