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"
15 #include "qt_helpers.h"
17 #include "support/debug.h"
19 #include <QCloseEvent>
20 #include <QMainWindow>
29 GuiDialog::GuiDialog(GuiView & lv, string const & name, QString const & title)
30 : QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false)
34 void GuiDialog::closeEvent(QCloseEvent *e)
41 void GuiDialog::setButtonsValid(bool valid)
47 void GuiDialog::slotApply()
54 void GuiDialog::slotOK()
64 void GuiDialog::slotClose()
71 void GuiDialog::slotRestore()
73 // Tell the controller that a request to refresh the dialog's contents
74 // has been received. It's up to the controller to supply the necessary
75 // info by calling GuiDialog::updateView().
81 void GuiDialog::changed()
85 bc().setValid(isValid());
89 void GuiDialog::enableView(bool enable)
91 bc().setReadOnly(!enable);
92 bc().setValid(enable);
93 Dialog::enableView(enable);
97 void GuiDialog::updateView()
99 setUpdatesEnabled(false);
101 bc().setReadOnly(isBufferReadonly());
102 // protect the BC from unwarranted state transitions
106 // The widgets may not be valid, so refresh the button controller
109 setUpdatesEnabled(true);
112 } // namespace frontend
116 /////////////////////////////////////////////////////////////////////
118 // Command based dialogs
120 /////////////////////////////////////////////////////////////////////
122 #include "FuncRequest.h"
123 #include "insets/InsetCommand.h"
130 GuiCommand::GuiCommand(GuiView & lv, string const & name,
131 QString const & title)
132 : GuiDialog(lv, name, title), params_(insetCode(name)), lfun_name_(name)
137 bool GuiCommand::initialiseParams(string const & data)
139 // The name passed with LFUN_INSET_APPLY is also the name
140 // used to identify the mailer.
141 InsetCommandMailer::string2params(lfun_name_, data, params_);
146 void GuiCommand::dispatchParams()
148 if (lfun_name_.empty())
152 InsetCommandMailer::params2string(lfun_name_, params_);
153 dispatch(FuncRequest(getLfun(), lfun));
156 } // namespace frontend
159 #include "GuiDialog_moc.cpp"