X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiInclude.cpp;h=6120d669ef5072096cfa3fb346a249d58fc38025;hb=29a8097c3c14aad871c7e396a59542fe47e39ea1;hp=61a9a55570d974fa77fefa82f7f325ca3532e95f;hpb=1ba785f2c6ed0c2dc70b4f046571c425d3eb3e49;p=lyx.git diff --git a/src/frontends/qt/GuiInclude.cpp b/src/frontends/qt/GuiInclude.cpp index 61a9a55570..6120d669ef 100644 --- a/src/frontends/qt/GuiInclude.cpp +++ b/src/frontends/qt/GuiInclude.cpp @@ -84,7 +84,9 @@ GuiInclude::GuiInclude(GuiView & lv) bc().addReadOnly(typeCO); bc().addReadOnly(listingsED); - bc().addCheckedLineEdit(filenameED, filenameLA); + // FIXME does not make sense, as we do not have a validator + // for this widget + //bc().addCheckedLineEdit(filenameED, filenameLA); } @@ -315,19 +317,22 @@ bool GuiInclude::isValid() int const item = typeCO->currentIndex(); // Are we inputting or including a LyX file? if (item != 0 && item != 1) { - okbutton->setText(qt_("OK")); + okbutton->setText(qt_("&OK")); return true; } - // Do we have a LyX filename? - if (!isLyXFileName(fromqstr(fname))) { - okbutton->setText(qt_("OK")); - return false; - } + string const bpath = buffer().filePath(); // Path might be relative to current Buffer, so make absolute FileName const absfname = support::makeAbsPath(fromqstr(fname), bpath); + + // Do we have a LyX filename? + if (!isLyXFileName(fromqstr(fname))) { + okbutton->setText(qt_("&OK")); + return absfname.exists(); + } + // Set OK button text according to whether file already exists - okbutton->setText(absfname.exists() ? qt_("OK") : qt_("Create")); + okbutton->setText(absfname.exists() ? qt_("&OK") : qt_("&Create")); // enable edit button iff file is open in some Buffer editPB->setEnabled(theBufferList().getBuffer(absfname)); return true; @@ -393,9 +398,6 @@ void GuiInclude::dispatchParams() } -Dialog * createGuiInclude(GuiView & lv) { return new GuiInclude(lv); } - - } // namespace frontend } // namespace lyx