X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiCompare.cpp;h=4ea7f3578440668e2a052a964f5b50d553db86f9;hb=b7f6b979d0f889f08e735f35378bb20ba3788b4b;hp=09139597469be938ccc75fe36574e6d08d32897f;hpb=413e5da3e00cb2ea6c3268411aac44cd0d5ec5ec;p=lyx.git diff --git a/src/frontends/qt4/GuiCompare.cpp b/src/frontends/qt4/GuiCompare.cpp index 0913959746..4ea7f35784 100644 --- a/src/frontends/qt4/GuiCompare.cpp +++ b/src/frontends/qt4/GuiCompare.cpp @@ -62,9 +62,7 @@ GuiCompare::GuiCompare(GuiView & lv) this, SLOT(changeAdaptor())); newSettingsRB->setChecked(true); - - progressBar->setValue(0); - progressBar->setEnabled(false); + trackingCB->setChecked(true); closePB->setCursor(Qt::ArrowCursor); @@ -80,7 +78,7 @@ GuiCompare::~GuiCompare() void GuiCompare::closeEvent(QCloseEvent *) { - slotCancel(); + slotCancel(); } @@ -116,10 +114,10 @@ void GuiCompare::updateContents() newFileCB->addItem(filename); oldFileCB->addItem(filename); } - if (lyxview().documentBufferView()) - newFileCB->setEditText(toqstr(buffer().absFileName())); - else + if (!restore_filename1.isEmpty()) newFileCB->setEditText(restore_filename1); + else if (lyxview().documentBufferView()) + newFileCB->setEditText(toqstr(buffer().absFileName())); if (!restore_filename2.isEmpty()) oldFileCB->setEditText(restore_filename2); @@ -156,19 +154,19 @@ QString GuiCompare::browse(QString const & in_name) const QString const title = qt_("Select document"); QStringList const & filters = fileFilters(qt_("LyX Documents (*.lyx)")); - + QString filename; if (lyxview().documentBufferView()) { - QString path = bufferFilepath(); - filename = browseRelFile(in_name, path, title, filters, false, + QString path = bufferFilePath(); + filename = browseRelToParent(in_name, path, title, filters, false, qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); } else { QString path = toqstr(lyxrc.document_path); - QString rel_filename = browseRelFile(in_name, path, title, filters, false, + QString rel_filename = browseRelToParent(in_name, path, title, filters, false, qt_("Documents|#o#O"), toqstr(lyxrc.document_path)); filename = makeAbsPath(rel_filename, path); } - return filename; + return filename; } @@ -209,7 +207,7 @@ void GuiCompare::finished(bool aborted) delete compare_; compare_ = 0; } - + if (aborted) { if (dest_buffer_) { dest_buffer_->markClean(); @@ -223,6 +221,10 @@ void GuiCompare::finished(bool aborted) if (dest_buffer_) { dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest_buffer_->absFileName())); + if (trackingCB->isChecked()) { + dispatch(FuncRequest(LFUN_CHANGES_OUTPUT)); + dispatch(FuncRequest(LFUN_CHANGES_TRACK)); + } } statusBar->showMessage(qt_("Finished"), 5000); } @@ -274,7 +276,7 @@ Buffer const * GuiCompare::bufferFromFileName(string const & file) const if (FileName::isAbsolute(file)) fname.set(file); else if (lyxview().documentBufferView()) - fname = support::makeAbsPath(file, fromqstr(bufferFilepath())); + fname = support::makeAbsPath(file, fromqstr(bufferFilePath())); if (fname.empty() || (!fname.exists() && !theBufferList().getBuffer(fname))) { @@ -318,6 +320,22 @@ int GuiCompare::run() return 1; } +bool GuiCompare::initialiseParams(std::string const &par) +{ + //just for the sake of parsing arguments + FuncRequest cmd(LFUN_UNKNOWN_ACTION, par); + if (cmd.getArg(0) == "run") { + oldFileCB->setEditText(toqstr(cmd.getArg(1))); + newFileCB->setEditText(toqstr(cmd.getArg(2))); + slotOK(); + } + + progressBar->setValue(0); + progressBar->setEnabled(false); + progressBar->setMaximum(1); + + return true; +} Dialog * createGuiCompare(GuiView & lv) { return new GuiCompare(lv); }