3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
13 #include "GuiDialog.h"
16 #include "qt_helpers.h"
18 #include "support/debug.h"
20 #include <QCloseEvent>
21 #include <QDialogButtonBox>
28 GuiDialog::GuiDialog(GuiView & lv, QString const & name, QString const & title)
29 : QDialog(&lv), Dialog(lv, name, title), updating_(false),
32 connect(&lv, SIGNAL(bufferViewChanged()),
33 this, SLOT(onBufferViewChanged()));
35 // remove question marks from Windows dialogs
36 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
40 void GuiDialog::closeEvent(QCloseEvent * ev)
47 void GuiDialog::setButtonsValid(bool valid)
53 void GuiDialog::slotApply()
60 void GuiDialog::slotAutoApply()
67 void GuiDialog::slotOK()
77 void GuiDialog::slotClose()
84 void GuiDialog::slotRestore()
86 // Tell the controller that a request to refresh the dialog's contents
87 // has been received. It's up to the controller to supply the necessary
88 // info by calling GuiDialog::updateView().
94 void GuiDialog::slotButtonBox(QAbstractButton * button)
96 QDialogButtonBox * bbox = qobject_cast<QDialogButtonBox*>(sender());
97 switch (bbox->standardButton(button)) {
98 case QDialogButtonBox::Ok:
101 case QDialogButtonBox::Apply:
104 case QDialogButtonBox::Cancel:
105 case QDialogButtonBox::Close:
108 case QDialogButtonBox::Reset:
111 case QDialogButtonBox::RestoreDefaults:
112 slotRestoreDefaults();
120 void GuiDialog::changed()
124 bc().setValid(isValid());
128 void GuiDialog::enableView(bool enable)
131 bc().setReadOnly(true);
132 bc().setValid(false);
134 Dialog::enableView(enable);
138 void GuiDialog::updateView()
140 setUpdatesEnabled(false);
142 bc().setReadOnly(isBufferReadonly());
143 // protect the BC from unwarranted state transitions
147 // The widgets may not be valid, so refresh the button controller
150 setUpdatesEnabled(true);
153 } // namespace frontend
156 #include "moc_GuiDialog.cpp"