-
-void GuiDialog::updateData(string const & data)
-{
- if (isBufferDependent() && !isBufferAvailable())
- return;
-
- if (!initialiseParams(data)) {
- lyxerr << "Dialog \"" << name_
- << "\" could not be initialized" << std::endl;
- return;
- }
-
- bc().setReadOnly(isBufferReadonly());
- updateView();
- // The widgets may not be valid, so refresh the button controller
- bc().refresh();
-}
-
-
-void GuiDialog::hide()
-{
- if (!isVisibleView())
- return;
-
- clearParams();
- hideView();
- Dialog::disconnect(name_);
-}
-
-
-void GuiDialog::apply()
-{
- if (isBufferDependent()) {
- if (!isBufferAvailable() ||
- (isBufferReadonly() && !canApplyToReadOnly()))
- return;
- }
-
- applyView();
- dispatchParams();
-
- if (disconnectOnApply() && !is_closing_) {
- Dialog::disconnect(name_);
- initialiseParams(string());
- updateView();
- }
-}
-
-
-void GuiDialog::showEvent(QShowEvent * e)
-{
- QSettings settings;
- string key = name_ + "/geometry";
- restoreGeometry(settings.value(key.c_str()).toByteArray());
- QDialog::showEvent(e);
-}
-
-
-void GuiDialog::closeEvent(QCloseEvent * e)
-{
- QSettings settings;
- string key = name_ + "/geometry";
- settings.setValue(key.c_str(), saveGeometry());
- QDialog::closeEvent(e);
-}
-
-} // namespace frontend
-} // namespace lyx
-
-
-/////////////////////////////////////////////////////////////////////
-//
-// Command based dialogs
-//
-/////////////////////////////////////////////////////////////////////
-
-#include "FuncRequest.h"
-#include "insets/InsetCommand.h"
-
-
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-GuiCommand::GuiCommand(LyXView & lv, string const & name)
- : GuiDialog(lv, name), params_(insetCode(name)), lfun_name_(name)
-{
-}
-
-
-bool GuiCommand::initialiseParams(string const & data)
-{
- // The name passed with LFUN_INSET_APPLY is also the name
- // used to identify the mailer.
- InsetCommandMailer::string2params(lfun_name_, data, params_);
- return true;
-}
-
-
-void GuiCommand::dispatchParams()
-{
- if (lfun_name_.empty())
- return;
-
- string const lfun =
- InsetCommandMailer::params2string(lfun_name_, params_);
- dispatch(FuncRequest(getLfun(), lfun));