]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiInfo.cpp
Correct early return position for if use_pixmap_cache_ check
[lyx.git] / src / frontends / qt4 / GuiInfo.cpp
index 89ebfd298b63efc8299c15aa8861ce63b2cc47f8..8994b9431e8fdb54fbe41fafb3b325a5356a2c1b 100644 (file)
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Cursor.h"
-#include "FuncRequest.h"
 
 #include "insets/InsetInfo.h"
 
 #include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
 
@@ -40,15 +40,14 @@ namespace frontend {
 /////////////////////////////////////////////////////////////////
 
 char const * info_types[] =
-{ "unknown", "shortcut", "shortcuts", "lyxrc", "package", "textclass", "menu", "icon", "buffer", "" };
+{ "unknown", "shortcut", "shortcuts", "lyxrc", "package", "textclass", "menu", "icon", "buffer", "lyxinfo", "" };
 
 char const * info_types_gui[] =
 { N_("unknown"), N_("shortcut"), N_("shortcuts"), N_("lyxrc"), N_("package"), N_("textclass"),
-  N_("menu"), N_("icon"), N_("buffer"), ""};
+  N_("menu"), N_("icon"), N_("buffer"), N_("lyxinfo"), ""};
 
 
-GuiInfo::GuiInfo(GuiView & lv)
-       : InsetDialog(lv, INFO_CODE, LFUN_INFO_INSERT, "info", "Info")
+GuiInfo::GuiInfo(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
 
@@ -56,18 +55,9 @@ GuiInfo::GuiInfo(GuiView & lv)
        for (int n = 0; info_types[n][0]; ++n)
                typeCO->addItem(qt_(info_types_gui[n]));
        typeCO->blockSignals(false);
-}
-
 
-void GuiInfo::on_typeCO_currentIndexChanged(int)
-{
-       applyView();
-}
-
-
-void GuiInfo::on_nameLE_textChanged(QString const &)
-{
-       applyView();
+       connect(typeCO, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+       connect(nameLE, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
 }
 
 
@@ -100,17 +90,16 @@ docstring GuiInfo::dialogToParams() const
 }
 
 
-void GuiInfo::enableView(bool enable)
+bool GuiInfo::checkWidgets(bool readonly) const
 {
-       typeCO->setEnabled(enable);
-       nameLE->setEnabled(enable);
-       newPB->setEnabled(!enable);
+       nameLE->setReadOnly(readonly);
+       typeCO->setEnabled(!readonly);
+       if (!InsetParamsWidget::checkWidgets())
+               return false;
+       return !nameLE->text().isEmpty();
 }
 
 
-Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
-
-
 } // namespace frontend
 } // namespace lyx