author | leseb <leseb> | 2002-06-16 16:15:47 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-16 16:15:47 (UTC) |
commit | ea69cfbbde29fef2f792d1eab702699aada088bf (patch) (side-by-side diff) | |
tree | 1b908b905a16deaba7331d2f0b0c844f94235da0 /noncore/unsupported/mail2/viewmail.cpp | |
parent | d4414131cdf32677e8d54a18827f2e772718c3f7 (diff) | |
download | opie-ea69cfbbde29fef2f792d1eab702699aada088bf.zip opie-ea69cfbbde29fef2f792d1eab702699aada088bf.tar.gz opie-ea69cfbbde29fef2f792d1eab702699aada088bf.tar.bz2 |
Fix memory leaks
Diffstat (limited to 'noncore/unsupported/mail2/viewmail.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/viewmail.cpp | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/noncore/unsupported/mail2/viewmail.cpp b/noncore/unsupported/mail2/viewmail.cpp index ae1f5f3..3c88d99 100644 --- a/noncore/unsupported/mail2/viewmail.cpp +++ b/noncore/unsupported/mail2/viewmail.cpp @@ -1,6 +1,7 @@ #include <qtextbrowser.h> #include <qmessagebox.h> #include <qaction.h> +#include <qapplication.h> #include "mailfactory.h" #include "composer.h" @@ -23,7 +24,7 @@ AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) } ViewMail::ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *parent, const char *name, WFlags fl) - : ViewMailBase(parent, name, fl), _mail(mail), _handler(handler) + : ViewMailBase(parent, name, fl), _inLoop(false), _mail(mail), _handler(handler) { setCaption(caption().arg(mail.envelope().from()[0].name())); @@ -61,6 +62,31 @@ ViewMail::ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *paren connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); } +ViewMail::~ViewMail() +{ + hide(); +} + +void ViewMail::hide() +{ + QWidget::hide(); + + if (_inLoop) { + _inLoop = false; + qApp->exit_loop(); + } +} + +void ViewMail::exec() +{ + show(); + + if (!_inLoop) { + _inLoop = true; + qApp->enter_loop(); + } +} + QString ViewMail::deHtml(const QString &string) { QString string_ = string; @@ -101,10 +127,10 @@ void ViewMail::slotReply() sendMail.setInReplyTo(_mail.envelope().messageId()); sendMail.setMessage(rtext); - Composer *composer = new Composer(0, 0, Qt::WType_Modal); - composer->setSendMail(sendMail); - composer->showMaximized(); - composer->show(); + Composer composer(this, 0, true); + composer.setSendMail(sendMail); + composer.showMaximized(); + composer.exec(); } void ViewMail::slotForward() @@ -145,10 +171,10 @@ void ViewMail::slotForward() sendMail.setSubject("Fwd: " + _mail.envelope().subject()); sendMail.setMessage(ftext); - Composer *composer = new Composer(0, 0, Qt::WType_Modal); - composer->setSendMail(sendMail); - composer->showMaximized(); - composer->show(); + Composer composer(this, 0, true); + composer.setSendMail(sendMail); + composer.showMaximized(); + composer.exec(); } void ViewMail::slotIMAPUid(IMAPResponse &response) |