*
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ControlCommand.h"
-#include "Kernel.h"
#include "funcrequest.h"
#include "insets/insetcommand.h"
-ControlCommand::ControlCommand(Dialog & dialog, kb_action ac)
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
: Dialog::Controller(dialog),
- action_(ac)
+ lfun_name_(lfun_name)
{}
-void ControlCommand::initialiseParams(string const & data)
+bool ControlCommand::initialiseParams(string const & data)
{
- InsetCommandMailer::string2params(data, params_);
+ // 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 ControlCommand::clearParams()
{
- params_.setCmdName(string());
- params_.setOptions(string());
- params_.setContents(string());
+ params_ = InsetCommandParams();
}
void ControlCommand::dispatchParams()
{
- if (action_ == LFUN_NOACTION)
+ if (lfun_name_.empty())
return;
- FuncRequest fr(action_, InsetCommandMailer::params2string(params_));
- kernel().dispatch(fr);
+ string const lfun = InsetCommandMailer::params2string(lfun_name_,
+ params_);
+ kernel().dispatch(FuncRequest(getLfun(), lfun));
}
+
+} // namespace frontend
+} // namespace lyx