X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiDialog.cpp;h=7d4bf582116f11ddffcabfd8692db2870270ee27;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=3dcd657238e19cd7d4b5f78803cadfb9ab08d831;hpb=ce7e4a4b78c70f0b7635c7a27fc4dc7ee483779a;p=lyx.git diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index 3dcd657238..7d4bf58211 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -11,30 +11,30 @@ #include #include "GuiDialog.h" + #include "GuiView.h" #include "qt_helpers.h" +#include "FuncRequest.h" #include "support/debug.h" #include -#include -#include -#include using namespace std; namespace lyx { namespace frontend { -GuiDialog::GuiDialog(GuiView & lv, string const & name, QString const & title) - : QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false) +GuiDialog::GuiDialog(GuiView & lv, QString const & name, QString const & title) + : QDialog(&lv), Dialog(lv, name, "LyX: " + title), updating_(false), + is_closing_(false) {} -void GuiDialog::closeEvent(QCloseEvent *e) +void GuiDialog::closeEvent(QCloseEvent * ev) { slotClose(); - e->accept(); + ev->accept(); } @@ -51,12 +51,19 @@ void GuiDialog::slotApply() } +void GuiDialog::slotAutoApply() +{ + apply(); + bc().autoApply(); +} + + void GuiDialog::slotOK() { is_closing_ = true; apply(); is_closing_ = false; - QDialog::hide(); + hideView(); bc().ok(); } @@ -88,8 +95,10 @@ void GuiDialog::changed() void GuiDialog::enableView(bool enable) { - bc().setReadOnly(!enable); - bc().setValid(enable); + if (!enable) { + bc().setReadOnly(true); + bc().setValid(false); + } Dialog::enableView(enable); } @@ -112,48 +121,4 @@ void GuiDialog::updateView() } // namespace frontend } // namespace lyx - -///////////////////////////////////////////////////////////////////// -// -// Command based dialogs -// -///////////////////////////////////////////////////////////////////// - -#include "FuncRequest.h" -#include "insets/InsetCommand.h" - -using namespace std; - -namespace lyx { -namespace frontend { - -GuiCommand::GuiCommand(GuiView & lv, string const & name, - QString const & title) - : GuiDialog(lv, name, title), 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)); -} - -} // namespace frontend -} // namespace lyx - -#include "GuiDialog_moc.cpp" +#include "moc_GuiDialog.cpp"