]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDialog.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiDialog.cpp
index f62754b2e640c40f4dc5d2d399697799623fadc5..53a132d5ff987a300eea9908fe3fb81dee4f257f 100644 (file)
@@ -13,6 +13,9 @@
 #include "GuiDialog.h"
 #include "GuiView.h"
 #include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
 
 #include "support/debug.h"
 
 #include <QSettings>
 #include <QShowEvent>
 
-using std::string;
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiDialog::GuiDialog(GuiView & lv, std::string const & name)
-       : DialogView(lv, name), is_closing_(false)
+GuiDialog::GuiDialog(GuiView & lv, QString const & name, QString const & title)
+       :  QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false)
 {}
 
 
+void GuiDialog::closeEvent(QCloseEvent * ev)
+{
+       slotClose();
+       ev->accept();
+}
+
+
 void GuiDialog::setButtonsValid(bool valid)
 {
        bc().setValid(valid);
@@ -39,7 +49,7 @@ void GuiDialog::setButtonsValid(bool valid)
 
 void GuiDialog::slotApply()
 {
-       applyView();
+       apply();
        bc().apply();
 }
 
@@ -47,16 +57,16 @@ void GuiDialog::slotApply()
 void GuiDialog::slotOK()
 {
        is_closing_ = true;
-       applyView();
+       apply();
        is_closing_ = false;
-       QDialog::hide();
+       hideView();
        bc().ok();
 }
 
 
 void GuiDialog::slotClose()
 {
-       QDialog::hide();
+       hideView();
        bc().cancel();
 }
 
@@ -83,7 +93,7 @@ void GuiDialog::enableView(bool enable)
 {
        bc().setReadOnly(!enable);
        bc().setValid(enable);
-       DialogView::enableView(enable);
+       Dialog::enableView(enable);
 }
 
 
@@ -102,9 +112,6 @@ void GuiDialog::updateView()
        setUpdatesEnabled(true);
 }
 
-} // namespace frontend
-} // namespace lyx
-
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -112,17 +119,11 @@ void GuiDialog::updateView()
 //
 /////////////////////////////////////////////////////////////////////
 
-#include "FuncRequest.h"
-#include "insets/InsetCommand.h"
-
-
-using std::string;
-
-namespace lyx {
-namespace frontend {
 
-GuiCommand::GuiCommand(GuiView & lv, string const & name)
-       : GuiDialog(lv, name), params_(insetCode(name)), lfun_name_(name)
+GuiCommand::GuiCommand(GuiView & lv, QString const & name,
+       QString const & title)
+       : GuiDialog(lv, name, title), params_(insetCode(fromqstr(name))),
+               lfun_name_(fromqstr(name))
 {
 }
 
@@ -131,7 +132,7 @@ 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_);
+       InsetCommand::string2params(lfun_name_, data, params_);
        return true;
 }
 
@@ -141,8 +142,7 @@ void GuiCommand::dispatchParams()
        if (lfun_name_.empty())
                return;
 
-       string const lfun = 
-               InsetCommandMailer::params2string(lfun_name_, params_);
+       string const lfun = InsetCommand::params2string(lfun_name_, params_);
        dispatch(FuncRequest(getLfun(), lfun));
 }