summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/composer.cpp28
-rw-r--r--noncore/unsupported/mail2/composer.h5
-rw-r--r--noncore/unsupported/mail2/mainwindow.cpp26
-rw-r--r--noncore/unsupported/mail2/searchdiag.cpp6
-rw-r--r--noncore/unsupported/mail2/viewmail.cpp44
-rw-r--r--noncore/unsupported/mail2/viewmail.h5
6 files changed, 88 insertions, 26 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp
index 82ed117..7f65dba 100644
--- a/noncore/unsupported/mail2/composer.cpp
+++ b/noncore/unsupported/mail2/composer.cpp
@@ -6,6 +6,7 @@
#include <qaction.h>
#include <qtimer.h>
#include <qlabel.h>
+#include <qapplication.h>
#include <qpe/resource.h>
@@ -25,7 +26,7 @@ AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment)
}
Composer::Composer(QWidget *parent, const char *name, WFlags fl)
- : ComposerBase(parent, name, fl)
+ : ComposerBase(parent, name, fl), _inLoop(false)
{
abort->setEnabled(false);
to->setFocus();
@@ -43,6 +44,31 @@ Composer::Composer(QWidget *parent, const char *name, WFlags fl)
QTimer::singleShot(0, this, SLOT(slotResizing()));
}
+Composer::~Composer()
+{
+ hide();
+}
+
+void Composer::hide()
+{
+ QWidget::hide();
+
+ if (_inLoop) {
+ _inLoop = false;
+ qApp->exit_loop();
+ }
+}
+
+void Composer::exec()
+{
+ show();
+
+ if (!_inLoop) {
+ _inLoop = true;
+ qApp->enter_loop();
+ }
+}
+
void Composer::setSendMail(SendMail &sendMail)
{
to->setText(sendMail.to());
diff --git a/noncore/unsupported/mail2/composer.h b/noncore/unsupported/mail2/composer.h
index a1af121..2640d7e 100644
--- a/noncore/unsupported/mail2/composer.h
+++ b/noncore/unsupported/mail2/composer.h
@@ -26,6 +26,10 @@ class Composer : public ComposerBase
public:
Composer(QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal);
+ ~Composer();
+
+ void hide();
+ void exec();
void setSendMail(SendMail &sendMail);
@@ -45,6 +49,7 @@ protected:
QValueList<Account> accountsLoaded;
private:
+ bool _inLoop;
QString _inReplyTo;
};
diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp
index 4d15e23..2230dc0 100644
--- a/noncore/unsupported/mail2/mainwindow.cpp
+++ b/noncore/unsupported/mail2/mainwindow.cpp
@@ -36,30 +36,30 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
void MainWindow::slotCompose()
{
- Composer *composer = new Composer();
- composer->showMaximized();
- composer->show();
+ Composer composer(this, 0, true);
+ composer.showMaximized();
+ composer.exec();
}
void MainWindow::slotSearch()
{
- SearchDiag *searchDiag = new SearchDiag(this, 0, true);
- searchDiag->showMaximized();
- searchDiag->show();
+ SearchDiag searchDiag(this, 0, true);
+ searchDiag.showMaximized();
+ searchDiag.exec();
}
void MainWindow::slotConfigure()
{
- ConfigDiag *configDiag = new ConfigDiag(this, 0, true);
- configDiag->showMaximized();
- configDiag->show();
+ ConfigDiag configDiag(this, 0, true);
+ configDiag.showMaximized();
+ configDiag.exec();
- connect(configDiag, SIGNAL(changed()), folderView, SLOT(update()));
+ connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update()));
}
void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler)
{
- ViewMail *viewMail = new ViewMail(mail, handler);
- viewMail->showMaximized();
- viewMail->show();
+ ViewMail viewMail(mail, handler, this, 0, true);
+ viewMail.showMaximized();
+ viewMail.exec();
}
diff --git a/noncore/unsupported/mail2/searchdiag.cpp b/noncore/unsupported/mail2/searchdiag.cpp
index 33b8afb..907f6ff 100644
--- a/noncore/unsupported/mail2/searchdiag.cpp
+++ b/noncore/unsupported/mail2/searchdiag.cpp
@@ -112,9 +112,9 @@ void SearchDiag::slotIMAPFetch(IMAPResponse &response)
void SearchDiag::slotMailClicked(IMAPResponseFETCH fetch, IMAPHandler *)
{
- ViewMail *viewMail = new ViewMail(fetch, _folder.topFolder().handler());
- viewMail->showMaximized();
- viewMail->show();
+ ViewMail viewMail(fetch, _folder.topFolder().handler(), this, 0, true);
+ viewMail.showMaximized();
+ viewMail.exec();
}
void SearchDiag::slotInItemActivated(int index)
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)
diff --git a/noncore/unsupported/mail2/viewmail.h b/noncore/unsupported/mail2/viewmail.h
index a013e43..efc2300 100644
--- a/noncore/unsupported/mail2/viewmail.h
+++ b/noncore/unsupported/mail2/viewmail.h
@@ -43,6 +43,10 @@ class ViewMail : public ViewMailBase
public:
ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal);
+ ~ViewMail();
+
+ void hide();
+ void exec();
protected:
// void fillList(IMAPResponseBODYSTRUCTURE &structure);
@@ -55,6 +59,7 @@ protected slots:
void slotIMAPUid(IMAPResponse &response);
private:
+ bool _inLoop;
IMAPResponseFETCH _mail;
IMAPHandler *_handler;
QString _mailHtml;