-// -*- C++ -*-
/**
* \file mailinset.C
* This file is part of LyX, the document processor.
*
* \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 "mailinset.h"
-#include "inset.h"
+
#include "BufferView.h"
#include "debug.h"
-#include "frontends/LyXView.h"
+
#include "frontends/Dialogs.h"
-#include "Lsstream.h"
-void MailInset::showDialog() const
+namespace lyx {
+
+using std::string;
+
+
+void MailInset::showDialog(BufferView * bv) const
{
- BufferView * bv = inset().view();
- if (!bv) {
- lyxerr << "MailInset::showDialog:\n"
- << "The BufferView has not been cached!"
- << std::endl;
- return;
- }
-
- bv->owner()->getDialogs().show(name(), inset2string(), &inset());
+ BOOST_ASSERT(bv);
+ bv->showInsetDialog(name(), inset2string(*bv->buffer()),
+ &inset());
}
-void MailInset::updateDialog() const
+void MailInset::updateDialog(BufferView * bv) const
{
- BufferView * bv = inset().view();
- if (!bv) {
- lyxerr << "MailInset::showDialog:\n"
- << "The BufferView has not been cached!"
- << std::endl;
- return;
- }
-
- bv->owner()->getDialogs().update(name(), inset2string());
+ BOOST_ASSERT(bv);
+ bv->updateDialog(name(), inset2string(*bv->buffer()));
}
void MailInset::hideDialog() const
{
- BufferView * bv = inset().view();
- if (!bv) {
- lyxerr << "MailInset::showDialog:\n"
- << "The BufferView has not been cached!"
- << std::endl;
- return;
- }
-
- InsetBase * cmp = bv->owner()->getDialogs().getOpenInset(name());
- if (cmp == &inset())
- bv->owner()->getDialogs().hide(name());
+ Dialogs::hide(name(), &inset());
}
+
+
+void print_mailer_error(string const & class_name,
+ string const & data, int arg_id, string const & arg)
+{
+ lyxerr << '\n' << class_name << "::string2params(" << data << ")\n"
+ << "Expected arg " << arg_id << " to be \"" << arg << "\"\n"
+ << std::endl;
+}
+
+
+} // namespace lyx