#include "support/FileName.h"
#include "support/gettext.h"
+#include <QDialogButtonBox>
#include <QThread>
setupUi(this);
setModal(Qt::WindowModal);
- connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()), this, SLOT(slotCancel()));
+ connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+ this, SLOT(slotButtonBox(QAbstractButton *)));
connect(newFilePB, SIGNAL(clicked()), this, SLOT(selectNewFile()));
connect(oldFilePB, SIGNAL(clicked()), this, SLOT(selectOldFile()));
this, SLOT(changeAdaptor()));
newSettingsRB->setChecked(true);
+ trackingCB->setChecked(true);
- progressBar->setValue(0);
- progressBar->setEnabled(false);
-
- closePB->setCursor(Qt::ArrowCursor);
+ buttonBox->button(QDialogButtonBox::Ok)->setCursor(Qt::ArrowCursor);
bc().setPolicy(ButtonPolicy::OkApplyCancelPolicy);
- bc().setOK(okPB);
+ bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
}
GuiCompare::~GuiCompare()
void GuiCompare::closeEvent(QCloseEvent *)
{
- slotCancel();
+ slotCancel();
}
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);
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,
- qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+ filename = browseRelToParent(in_name, path, title, filters, false,
+ qt_("D&ocuments"), toqstr(lyxrc.document_path));
} else {
QString path = toqstr(lyxrc.document_path);
- QString rel_filename = browseRelFile(in_name, path, title, filters, false,
- qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+ QString rel_filename = browseRelToParent(in_name, path, title, filters, false,
+ qt_("D&ocuments"), toqstr(lyxrc.document_path));
filename = makeAbsPath(rel_filename, path);
}
- return filename;
+ return filename;
}
oldFileLA->setEnabled(enable);
oldFilePB->setEnabled(enable);
oldFileCB->setEnabled(enable);
- okPB->setEnabled(enable);
+ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
groupBox->setEnabled(enable);
progressBar->setEnabled(!enable);
if (enable)
- closePB->setText(qt_("Close"));
+ buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("Close"));
else
- closePB->setText(qt_("Cancel"));
+ buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("Cancel"));
}
delete compare_;
compare_ = 0;
}
-
+
if (aborted) {
if (dest_buffer_) {
dest_buffer_->markClean();
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);
}
}
+void GuiCompare::slotButtonBox(QAbstractButton * button)
+{
+ switch (buttonBox->standardButton(button)) {
+ case QDialogButtonBox::Ok:
+ slotOK();
+ break;
+ case QDialogButtonBox::Cancel:
+ slotCancel();
+ break;
+ default:
+ break;
+ }
+}
+
+
Buffer const * GuiCompare::bufferFromFileName(string const & file) const
{
FileName fname;
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); }