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)
30 : QDialog(&lv), Dialog(lv, name), is_closing_(false)
34 void GuiDialog::setViewTitle(docstring const & title)
36 setWindowTitle("LyX: " + toqstr(title));
40 void GuiDialog::setButtonsValid(bool valid)
46 void GuiDialog::slotApply()
53 void GuiDialog::slotOK()
63 void GuiDialog::slotClose()
70 void GuiDialog::slotRestore()
72 // Tell the controller that a request to refresh the dialog's contents
73 // has been received. It's up to the controller to supply the necessary
74 // info by calling GuiDialog::updateView().
80 void GuiDialog::changed()
84 bc().setValid(isValid());
88 void GuiDialog::enableView(bool enable)
90 bc().setReadOnly(!enable);
91 bc().setValid(enable);
92 Dialog::enableView(enable);
96 void GuiDialog::updateView()
98 setUpdatesEnabled(false);
100 bc().setReadOnly(isBufferReadonly());
101 // protect the BC from unwarranted state transitions
105 // The widgets may not be valid, so refresh the button controller
108 setUpdatesEnabled(true);
111 } // namespace frontend
115 /////////////////////////////////////////////////////////////////////
117 // Command based dialogs
119 /////////////////////////////////////////////////////////////////////
121 #include "FuncRequest.h"
122 #include "insets/InsetCommand.h"
129 GuiCommand::GuiCommand(GuiView & lv, string const & name)
130 : GuiDialog(lv, name), params_(insetCode(name)), lfun_name_(name)
135 bool GuiCommand::initialiseParams(string const & data)
137 // The name passed with LFUN_INSET_APPLY is also the name
138 // used to identify the mailer.
139 InsetCommandMailer::string2params(lfun_name_, data, params_);
144 void GuiCommand::dispatchParams()
146 if (lfun_name_.empty())
150 InsetCommandMailer::params2string(lfun_name_, params_);
151 dispatch(FuncRequest(getLfun(), lfun));
154 } // namespace frontend
157 #include "GuiDialog_moc.cpp"