#include "BufferView.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
+#include "support/LAssert.h"
#include "Lsstream.h"
+using namespace lyx::support;
-void MailInset::showDialog() const
+void MailInset::showDialog(BufferView * bv) const
{
- BufferView * bv = inset().view();
- if (!bv)
- return;
-
- bv->owner()->getDialogs().show(name(), inset2string(), &inset());
+ Assert(bv);
+ bv->owner()->getDialogs().show(name(), inset2string(*bv->buffer()),
+ &inset());
}
-void MailInset::updateDialog() const
+void MailInset::updateDialog(BufferView * bv) const
{
- BufferView * bv = inset().view();
- if (!bv)
- return;
-
- bv->owner()->getDialogs().update(name(), inset2string());
+ Assert(bv);
+ if(bv->owner()->getDialogs().visible(name()))
+ bv->owner()->getDialogs().update(name(),
+ inset2string(*bv->buffer()));
}
void MailInset::hideDialog() const
{
- BufferView * bv = inset().view();
- if (!bv)
- return;
-
- InsetBase * cmp = bv->owner()->getDialogs().getOpenInset(name());
- if (cmp == &inset())
- bv->owner()->getDialogs().hide(name());
+ Dialogs::hide(name(), &inset());
}