]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/qt_helpers.cpp
No need (any longer?) to create a new view for lyxfiles-open
[lyx.git] / src / frontends / qt / qt_helpers.cpp
index bf2dd6fecd2d53266ecc687337b3442a511a0e1e..37e5ed5ba6b3897c2939af58263b3f108b3de4bb 100644 (file)
@@ -299,10 +299,11 @@ void showDirectory(FileName const & directory)
 
 void showTarget(string const & target_in, Buffer const & buf)
 {
-       LYXERR(Debug::INSETS, "Showtarget:" << target_in << "\n");
+       LYXERR(Debug::INSETS, "Showtarget: " << target_in << "\n");
 
        string target = target_in;
        string const & docpath = buf.absFileName();
+       vector<string> targets;
 
        bool const is_external = prefixIs(target, "EXTERNAL ");
        if (is_external) {
@@ -320,13 +321,19 @@ void showTarget(string const & target_in, Buffer const & buf)
                        return;
                }
                // lyxpaperview returns a \n-separated list of paths
-               vector<string> targets = getVectorFromString(rtrim(ret.result, "\n"), "\n");
+               targets = getVectorFromString(rtrim(ret.result, "\n"), "\n");
                if (targets.empty()) {
                        frontend::Alert::error(_("Could not open file"),
                                bformat(_("No file was found using the pattern `%1$s'."),
                                        from_utf8(tar)));
                        return;
                }
+       }
+       if (prefixIs(target, "file://")) {
+               // file might have a \n-separated list of paths
+               targets = getVectorFromString(target, "\n");
+       }
+       if (!targets.empty()) {
                if (targets.size() > 1) {
                        QStringList files;
                        for (auto const & t : targets)
@@ -347,10 +354,10 @@ void showTarget(string const & target_in, Buffer const & buf)
                QCheckBox * dontShowAgainCB = new QCheckBox();
                dontShowAgainCB->setText(qt_("&Trust this document and do not ask me again!"));
                dontShowAgainCB->setToolTip(qt_("If you check this, LyX will open all targets without asking for the given document in the future."));
-               docstring const warn = bformat(_("LyX wants to open the following target in an external application:\n"
-                                                "%1$s\n"
-                                                "Be aware that this might entail security infringements!\n"
-                                                "Only do this if you trust origin of the document and the target of the link!\n"
+               docstring const warn = bformat(_("LyX wants to open the following target in an external application:\n\n"
+                                                "%1$s\n\n"
+                                                "Be aware that this might entail security infringements!\n\n"
+                                                "Only do this if you trust the origin of the document and the target of the link!\n\n"
                                                 "How do you want to proceed?"), from_utf8(target));
                QMessageBox box(QMessageBox::Warning, qt_("Open external target?"), toqstr(warn),
                                QMessageBox::NoButton, qApp->focusWidget());