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);
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();
+ }
+ return true;
+}
Dialog * createGuiCompare(GuiView & lv) { return new GuiCompare(lv); }
///
bool isValid();
///
- bool initialiseParams(std::string const &) { return true; }
+ bool initialiseParams(std::string const &);
///
bool isBufferDependent() const { return false; }
///
if (!buffer->lyxvc().prepareFileRevision(rev2, f2))
break;
}
- // FIXME We need to call comparison feature here.
- // This is quick and dirty code for testing VC.
- // We need that comparison feature has some LFUN_COMPARE <FLAG> file1 file1
- // where <FLAG> specifies whether we want GUI dialog or just launch
- // running with defaults.
- /*
- FileName initpath(lyxrc.document_path);
- Buffer * dest = newUnnamedFile(initpath, to_utf8(_("differences")));
- CompareOptions options;
- Compare * compare = new Compare(loadIfNeeded(FileName(f1)), loadIfNeeded(FileName(f2)), dest, options);
- compare->start(QThread::LowPriority);
- Sleep::millisec(200);
- lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest->absFileName()));
- */
+ string par = "compare run " + f1 + " " + f2;
+ lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, par));
break;
}