3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
17 #include "ControlExternal.h"
20 #include <qlineedit.h>
21 #include <qpushbutton.h>
22 #include <qcombobox.h>
23 #include <qtextview.h>
25 #include "QExternalDialog.h"
26 #include "QExternal.h"
31 typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class;
34 QExternal::QExternal()
35 : base_class(_("External"))
40 void QExternal::build_dialog()
42 dialog_.reset(new QExternalDialog(this));
44 bc().setOK(dialog_->okPB);
45 bc().setApply(dialog_->applyPB);
46 bc().setCancel(dialog_->closePB);
47 bc().addReadOnly(dialog_->externalCO);
48 bc().addReadOnly(dialog_->fileED);
49 bc().addReadOnly(dialog_->browsePB);
51 std::vector<string> templates(controller().getTemplates());
53 for (std::vector<string>::const_iterator cit = templates.begin();
54 cit != templates.end(); ++cit) {
55 dialog_->externalCO->insertItem(cit->c_str(), -1);
60 void QExternal::update_contents()
62 InsetExternal::Params const & params = controller().params();
64 dialog_->fileED->setText(params.filename.c_str());
65 dialog_->paramsED->setText(params.parameters.c_str());
67 dialog_->externalCO->setCurrentItem(controller().getTemplateNumber(params.templ.lyxName));
68 dialog_->externalTV->setText(params.templ.helpText.c_str());
73 string const & QExternal::helpText()
75 InsetExternal::Params & params = controller().params();
77 params.templ = controller().getTemplate(dialog_->externalCO->currentItem());
78 return params.templ.helpText;
82 void QExternal::apply()
84 InsetExternal::Params & params = controller().params();
86 params.filename = dialog_->fileED->text().latin1();
87 params.parameters = dialog_->paramsED->text().latin1();
89 params.templ = controller().getTemplate(dialog_->externalCO->currentItem());