3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 #include "qt_helpers.h"
18 #include "support/lstrings.h"
20 #include "controllers/ControlChanges.h"
22 #include <QPushButton>
23 #include <QCloseEvent>
24 #include <QTextBrowser>
26 using lyx::support::bformat;
32 /////////////////////////////////////////////////////////////////////
36 /////////////////////////////////////////////////////////////////////
38 QChangesDialog::QChangesDialog(QChanges * form)
42 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
43 connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed()));
44 connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectPressed()));
45 connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptPressed()));
49 void QChangesDialog::nextPressed()
55 void QChangesDialog::acceptPressed()
61 void QChangesDialog::rejectPressed()
67 void QChangesDialog::closeEvent(QCloseEvent *e)
75 /////////////////////////////////////////////////////////////////////
79 /////////////////////////////////////////////////////////////////////
81 typedef QController<ControlChanges, QView<QChangesDialog> > ChangesBase;
84 QChanges::QChanges(Dialog & parent)
85 : ChangesBase(parent, _("Merge Changes"))
90 void QChanges::build_dialog()
92 dialog_.reset(new QChangesDialog(this));
94 bcview().setCancel(dialog_->closePB);
95 bcview().addReadOnly(dialog_->acceptPB);
96 bcview().addReadOnly(dialog_->rejectPB);
100 void QChanges::update_contents()
103 docstring author = controller().getChangeAuthor();
104 docstring date = controller().getChangeDate();
107 text += bformat(_("Change by %1$s\n\n"), author);
109 text += bformat(_("Change made at %1$s\n"), date);
111 dialog_->changeTB->setPlainText(toqstr(text));
115 void QChanges::next()
121 void QChanges::accept()
123 controller().accept();
127 void QChanges::reject()
129 controller().reject();
132 } // namespace frontend
135 #include "QChanges_moc.cpp"