#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"
/////////////////////////////////////////////////////////////////
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, "info", qt_("Info"))
+GuiInfo::GuiInfo(QWidget * parent) : InsetParamsWidget(parent)
{
setupUi(this);
for (int n = 0; info_types[n][0]; ++n)
typeCO->addItem(qt_(info_types_gui[n]));
typeCO->blockSignals(false);
-}
-
-void GuiInfo::on_newPB_clicked()
-{
- // FIXME: if we used a standard LFUN_INSET_INSERT command,
- // This slot could be transferred to InsetDialog.
- docstring const argument = dialogToParams();
- dispatch(FuncRequest(LFUN_INFO_INSERT, argument));
-}
-
-
-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()));
}
}
-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