Diffstat (limited to 'noncore/unsupported/mail2/composer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/composer.cpp | 28 |
1 files changed, 27 insertions, 1 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 | |||
@@ -1,69 +1,95 @@ | |||
1 | #include <qmultilineedit.h> | 1 | #include <qmultilineedit.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qaction.h> | 6 | #include <qaction.h> |
7 | #include <qtimer.h> | 7 | #include <qtimer.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | #include <qapplication.h> | ||
9 | 10 | ||
10 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
11 | 12 | ||
12 | #include "addresspicker.h" | 13 | #include "addresspicker.h" |
13 | #include "listviewplus.h" | 14 | #include "listviewplus.h" |
14 | #include "smtphandler.h" | 15 | #include "smtphandler.h" |
15 | #include "attachdiag.h" | 16 | #include "attachdiag.h" |
16 | #include "composer.h" | 17 | #include "composer.h" |
17 | #include "rename.h" | 18 | #include "rename.h" |
18 | 19 | ||
19 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) | 20 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) |
20 | : QListViewItem(parent), _attachment(attachment) | 21 | : QListViewItem(parent), _attachment(attachment) |
21 | { | 22 | { |
22 | setPixmap(0, _attachment.docLnk()->pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk()->pixmap()); | 23 | setPixmap(0, _attachment.docLnk()->pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk()->pixmap()); |
23 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); | 24 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); |
24 | setText(1, _attachment.description()); | 25 | setText(1, _attachment.description()); |
25 | } | 26 | } |
26 | 27 | ||
27 | Composer::Composer(QWidget *parent, const char *name, WFlags fl) | 28 | Composer::Composer(QWidget *parent, const char *name, WFlags fl) |
28 | : ComposerBase(parent, name, fl) | 29 | : ComposerBase(parent, name, fl), _inLoop(false) |
29 | { | 30 | { |
30 | abort->setEnabled(false); | 31 | abort->setEnabled(false); |
31 | to->setFocus(); | 32 | to->setFocus(); |
32 | 33 | ||
33 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); | 34 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); |
34 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); | 35 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); |
35 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); | 36 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); |
36 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); | 37 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); |
37 | 38 | ||
38 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); | 39 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); |
39 | 40 | ||
40 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); | 41 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); |
41 | 42 | ||
42 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); | 43 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); |
43 | QTimer::singleShot(0, this, SLOT(slotResizing())); | 44 | QTimer::singleShot(0, this, SLOT(slotResizing())); |
44 | } | 45 | } |
45 | 46 | ||
47 | Composer::~Composer() | ||
48 | { | ||
49 | hide(); | ||
50 | } | ||
51 | |||
52 | void Composer::hide() | ||
53 | { | ||
54 | QWidget::hide(); | ||
55 | |||
56 | if (_inLoop) { | ||
57 | _inLoop = false; | ||
58 | qApp->exit_loop(); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | void Composer::exec() | ||
63 | { | ||
64 | show(); | ||
65 | |||
66 | if (!_inLoop) { | ||
67 | _inLoop = true; | ||
68 | qApp->enter_loop(); | ||
69 | } | ||
70 | } | ||
71 | |||
46 | void Composer::setSendMail(SendMail &sendMail) | 72 | void Composer::setSendMail(SendMail &sendMail) |
47 | { | 73 | { |
48 | to->setText(sendMail.to()); | 74 | to->setText(sendMail.to()); |
49 | cc->setText(sendMail.cc()); | 75 | cc->setText(sendMail.cc()); |
50 | bcc->setText(sendMail.bcc()); | 76 | bcc->setText(sendMail.bcc()); |
51 | subject->setText(sendMail.subject()); | 77 | subject->setText(sendMail.subject()); |
52 | message->setText(sendMail.message()); | 78 | message->setText(sendMail.message()); |
53 | _inReplyTo = sendMail.inReplyTo(); | 79 | _inReplyTo = sendMail.inReplyTo(); |
54 | 80 | ||
55 | QValueList<Attachment> attachments = sendMail.attachments(); | 81 | QValueList<Attachment> attachments = sendMail.attachments(); |
56 | QValueList<Attachment>::Iterator it; | 82 | QValueList<Attachment>::Iterator it; |
57 | for (it = attachments.begin(); it != attachments.end(); it++) { | 83 | for (it = attachments.begin(); it != attachments.end(); it++) { |
58 | (void) new AttachViewItem(attachView, *it); | 84 | (void) new AttachViewItem(attachView, *it); |
59 | if (attachView->isHidden()) attachView->show(); | 85 | if (attachView->isHidden()) attachView->show(); |
60 | } | 86 | } |
61 | } | 87 | } |
62 | 88 | ||
63 | void Composer::slotResizing() | 89 | void Composer::slotResizing() |
64 | { | 90 | { |
65 | from->setMaximumWidth(width() - fromBox->width()); | 91 | from->setMaximumWidth(width() - fromBox->width()); |
66 | from->resize(width() - fromBox->width(), y()); | 92 | from->resize(width() - fromBox->width(), y()); |
67 | } | 93 | } |
68 | 94 | ||
69 | void Composer::slotPopupHandler(int itemid) | 95 | void Composer::slotPopupHandler(int itemid) |