#include "mailinset.h"
#include "inset.h"
#include "BufferView.h"
-#include "debug.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
+#include "support/LAssert.h"
#include "Lsstream.h"
-void MailInset::showDialog() const
+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;
- }
-
+ lyx::Assert(bv);
bv->owner()->getDialogs().show(name(), inset2string(), &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());
+ lyx::Assert(bv);
+ if(bv->owner()->getDialogs().visible(name()))
+ bv->owner()->getDialogs().update(name(), inset2string());
}
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());
}