author | tille <tille> | 2002-06-18 13:49:13 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-18 13:49:13 (UTC) |
commit | 99cf287037a0d9f99e4fc035d1b9f6db08bb6583 (patch) (unidiff) | |
tree | 6c4707892003f6bfb1b4b088d57aba109ef63a4a /noncore | |
parent | 1e6635662a329dc8f7958b29044e1ce843ff7208 (diff) | |
download | opie-99cf287037a0d9f99e4fc035d1b9f6db08bb6583.zip opie-99cf287037a0d9f99e4fc035d1b9f6db08bb6583.tar.gz opie-99cf287037a0d9f99e4fc035d1b9f6db08bb6583.tar.bz2 |
added queue mail support
-rw-r--r-- | noncore/unsupported/mail2/composer.cpp | 150 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composer.h | 7 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/mail2/composerbase.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/mail2/mainwindowbase.h | 2 |
8 files changed, 173 insertions, 5 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp index c36d973..cabffe5 100644 --- a/noncore/unsupported/mail2/composer.cpp +++ b/noncore/unsupported/mail2/composer.cpp | |||
@@ -1,244 +1,390 @@ | |||
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 | #include <qapplication.h> |
10 | 10 | ||
11 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
12 | #include <qpe/config.h> | ||
12 | 13 | ||
13 | #include "addresspicker.h" | 14 | #include "addresspicker.h" |
14 | #include "listviewplus.h" | 15 | #include "listviewplus.h" |
15 | #include "smtphandler.h" | 16 | #include "smtphandler.h" |
16 | #include "attachdiag.h" | 17 | #include "attachdiag.h" |
17 | #include "composer.h" | 18 | #include "composer.h" |
18 | #include "rename.h" | 19 | #include "rename.h" |
19 | 20 | ||
20 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) | 21 | AttachViewItem::AttachViewItem(QListView *parent, Attachment &attachment) |
21 | : QListViewItem(parent), _attachment(attachment) | 22 | : QListViewItem(parent), _attachment(attachment) |
22 | { | 23 | { |
23 | setPixmap(0, _attachment.docLnk().pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk().pixmap()); | 24 | setPixmap(0, _attachment.docLnk().pixmap().isNull() ? Resource::loadPixmap("UnknownDocument-14") : _attachment.docLnk().pixmap()); |
24 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); | 25 | setText(0, _attachment.newName().isEmpty() ? _attachment.fileName() : _attachment.newName()); |
25 | setText(1, _attachment.description()); | 26 | setText(1, _attachment.description()); |
26 | } | 27 | } |
27 | 28 | ||
28 | Composer::Composer(QWidget *parent, const char *name, WFlags fl) | 29 | Composer::Composer(QWidget *parent, const char *name, WFlags fl, bool sendQueue) |
29 | : ComposerBase(parent, name, fl), _inLoop(false) | 30 | : ComposerBase(parent, name, fl), _inLoop(false) |
30 | { | 31 | { |
32 | _sendQueued = sendQueue; | ||
31 | abort->setEnabled(false); | 33 | abort->setEnabled(false); |
32 | to->setFocus(); | 34 | to->setFocus(); |
33 | 35 | ||
34 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); | 36 | connect(sendmail, SIGNAL(activated()), SLOT(slotSendMail())); |
37 | connect(queuemail, SIGNAL(activated()), SLOT(slotQueueMail())); | ||
35 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); | 38 | connect(addressbook, SIGNAL(activated()), SLOT(slotOpenAddressPicker())); |
36 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); | 39 | connect(addattach, SIGNAL(activated()), SLOT(slotAddAttach())); |
37 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); | 40 | connect(delattach, SIGNAL(activated()), SLOT(slotDelAttach())); |
38 | 41 | ||
39 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); | 42 | connect(from, SIGNAL(activated(int)), SLOT(slotFromChanged(int))); |
40 | 43 | ||
41 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); | 44 | connect(attachPopup, SIGNAL(activated(int)), SLOT(slotPopupHandler(int))); |
42 | 45 | ||
43 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); | 46 | QTimer::singleShot(0, this, SLOT(slotFillStuff())); |
44 | QTimer::singleShot(0, this, SLOT(slotResizing())); | 47 | QTimer::singleShot(0, this, SLOT(slotResizing())); |
48 | |||
45 | } | 49 | } |
46 | 50 | ||
47 | Composer::~Composer() | 51 | Composer::~Composer() |
48 | { | 52 | { |
49 | hide(); | 53 | hide(); |
50 | } | 54 | } |
51 | 55 | ||
52 | void Composer::hide() | 56 | void Composer::hide() |
53 | { | 57 | { |
54 | QWidget::hide(); | 58 | QWidget::hide(); |
55 | 59 | ||
56 | if (_inLoop) { | 60 | if (_inLoop) { |
57 | _inLoop = false; | 61 | _inLoop = false; |
58 | qApp->exit_loop(); | 62 | qApp->exit_loop(); |
59 | } | 63 | } |
60 | } | 64 | } |
61 | 65 | ||
62 | void Composer::exec() | 66 | void Composer::exec() |
63 | { | 67 | { |
64 | show(); | 68 | show(); |
65 | 69 | ||
66 | if (!_inLoop) { | 70 | if (!_inLoop) { |
67 | _inLoop = true; | 71 | _inLoop = true; |
68 | qApp->enter_loop(); | 72 | qApp->enter_loop(); |
69 | } | 73 | } |
70 | } | 74 | } |
71 | 75 | ||
72 | void Composer::setSendMail(SendMail &sendMail) | 76 | void Composer::setSendMail(SendMail &sendMail) |
73 | { | 77 | { |
74 | to->setText(sendMail.to()); | 78 | to->setText(sendMail.to()); |
75 | cc->setText(sendMail.cc()); | 79 | cc->setText(sendMail.cc()); |
76 | bcc->setText(sendMail.bcc()); | 80 | bcc->setText(sendMail.bcc()); |
77 | subject->setText(sendMail.subject()); | 81 | subject->setText(sendMail.subject()); |
78 | message->setText(sendMail.message()); | 82 | message->setText(sendMail.message()); |
79 | _inReplyTo = sendMail.inReplyTo(); | 83 | _inReplyTo = sendMail.inReplyTo(); |
80 | 84 | ||
81 | QValueList<Attachment> attachments = sendMail.attachments(); | 85 | QValueList<Attachment> attachments = sendMail.attachments(); |
82 | QValueList<Attachment>::Iterator it; | 86 | QValueList<Attachment>::Iterator it; |
83 | for (it = attachments.begin(); it != attachments.end(); it++) { | 87 | for (it = attachments.begin(); it != attachments.end(); it++) { |
84 | (void) new AttachViewItem(attachView, *it); | 88 | (void) new AttachViewItem(attachView, *it); |
85 | if (attachView->isHidden()) attachView->show(); | 89 | if (attachView->isHidden()) attachView->show(); |
86 | } | 90 | } |
87 | } | 91 | } |
88 | 92 | ||
89 | void Composer::slotResizing() | 93 | void Composer::slotResizing() |
90 | { | 94 | { |
91 | from->setMaximumWidth(width() - fromBox->width()); | 95 | from->setMaximumWidth(width() - fromBox->width()); |
92 | from->resize(width() - fromBox->width(), y()); | 96 | from->resize(width() - fromBox->width(), y()); |
97 | if (_sendQueued) | ||
98 | { | ||
99 | slotSendQueued(); | ||
100 | close(); | ||
101 | } | ||
93 | } | 102 | } |
94 | 103 | ||
95 | void Composer::slotPopupHandler(int itemid) | 104 | void Composer::slotPopupHandler(int itemid) |
96 | { | 105 | { |
97 | if (attachView->currentItem() == NULL) { | 106 | if (attachView->currentItem() == NULL) { |
98 | QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); | 107 | QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); |
99 | return; | 108 | return; |
100 | } | 109 | } |
101 | 110 | ||
102 | if (itemid == POPUP_ATTACH_RENAME) { | 111 | if (itemid == POPUP_ATTACH_RENAME) { |
103 | QString tmp = Rename::rename(attachView->currentItem()->text(0), this); | 112 | QString tmp = Rename::rename(attachView->currentItem()->text(0), this); |
104 | if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); | 113 | if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); |
105 | } else if (itemid == POPUP_ATTACH_DESC) { | 114 | } else if (itemid == POPUP_ATTACH_DESC) { |
106 | QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); | 115 | QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); |
107 | if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); | 116 | if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); |
108 | } else if (itemid == POPUP_ATTACH_REMOVE) { | 117 | } else if (itemid == POPUP_ATTACH_REMOVE) { |
109 | attachView->takeItem(attachView->currentItem()); | 118 | attachView->takeItem(attachView->currentItem()); |
110 | } | 119 | } |
111 | } | 120 | } |
112 | 121 | ||
113 | void Composer::slotSendMail() | 122 | void Composer::slotSendMail() |
114 | { | 123 | { |
115 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { | 124 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { |
116 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); | 125 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); |
117 | return; | 126 | return; |
118 | } | 127 | } |
119 | 128 | ||
120 | SendMail smail; | 129 | SendMail smail; |
121 | smail.setFrom(from->currentText()); | 130 | smail.setFrom(from->currentText()); |
122 | smail.setReplyTo(replyto->text()); | 131 | smail.setReplyTo(replyto->text()); |
123 | smail.setTo(to->text()); | 132 | smail.setTo(to->text()); |
124 | smail.setCc(cc->text()); | 133 | smail.setCc(cc->text()); |
125 | smail.setBcc(bcc->text()); | 134 | smail.setBcc(bcc->text()); |
126 | smail.setSubject(subject->text()); | 135 | smail.setSubject(subject->text()); |
127 | smail.setMessage(message->text()); | 136 | smail.setMessage(message->text()); |
128 | smail.setNeedsMime(attachView->childCount() == 0 ? false : true); | 137 | smail.setNeedsMime(attachView->childCount() == 0 ? false : true); |
129 | smail.setAccount(accountsLoaded[from->currentItem()]); | 138 | smail.setAccount(accountsLoaded[from->currentItem()]); |
130 | 139 | ||
131 | if (priority->currentItem() == POPUP_PRIO_LOW) { | 140 | if (priority->currentItem() == POPUP_PRIO_LOW) { |
132 | smail.setPriority("Low");// No i18n on purpose | 141 | smail.setPriority("Low");// No i18n on purpose |
133 | } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { | 142 | } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { |
134 | smail.setPriority("Normal");// No i18n on purpose | 143 | smail.setPriority("Normal");// No i18n on purpose |
135 | } else if (priority->currentItem() == POPUP_PRIO_HIGH) { | 144 | } else if (priority->currentItem() == POPUP_PRIO_HIGH) { |
136 | smail.setPriority("High");// No i18n on purpose | 145 | smail.setPriority("High");// No i18n on purpose |
137 | } | 146 | } |
138 | 147 | ||
139 | QValueList<Attachment> attachments; | 148 | QValueList<Attachment> attachments; |
140 | QListViewItem *item; | 149 | QListViewItem *item; |
141 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { | 150 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { |
142 | attachments.append(((AttachViewItem *)item)->attachment()); | 151 | attachments.append(((AttachViewItem *)item)->attachment()); |
143 | } | 152 | } |
144 | 153 | ||
145 | smail.setAttachments(attachments); | 154 | smail.setAttachments(attachments); |
146 | 155 | ||
147 | QString header, message; | 156 | QString header, message; |
148 | MailFactory::genMail(header, message, smail, this); | 157 | MailFactory::genMail(header, message, smail, this); |
149 | if (header.isNull() || message.isNull()) return;// Aborted. | 158 | if (header.isNull() || message.isNull()) return;// Aborted. |
150 | 159 | ||
151 | abort->setEnabled(true); | 160 | abort->setEnabled(true); |
152 | 161 | ||
153 | SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); | 162 | SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); |
154 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); | 163 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); |
155 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); | 164 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); |
156 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); | 165 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); |
157 | } | 166 | } |
158 | 167 | ||
168 | void Composer::slotSendQueued() | ||
169 | { | ||
170 | |||
171 | qDebug("Sending queued messages"); | ||
172 | Config cfg( "mailqueue", Config::User ); | ||
173 | cfg.setGroup( "Settings" ); | ||
174 | int count = cfg.readNumEntry( "count", 0 ); | ||
175 | // tille: should not be here | ||
176 | // but no error checking for the moment | ||
177 | cfg.writeEntry( "count", 0 ); | ||
178 | |||
179 | |||
180 | qDebug("%i messages to send", count); | ||
181 | QString str; | ||
182 | for (int i=1;i<=count;i++) | ||
183 | { | ||
184 | qDebug("sending message %i",i); | ||
185 | cfg.setGroup( "Mail_" + QString::number(i) ); | ||
186 | SendMail smail; | ||
187 | str = cfg.readEntry("from"); | ||
188 | qDebug("setFrom %s",str.latin1()); | ||
189 | smail.setFrom( str ); | ||
190 | str = cfg.readEntry("reply"); | ||
191 | qDebug("setReplyTo %s",str.latin1()); | ||
192 | smail.setReplyTo( str ); | ||
193 | QString toAdr = cfg.readEntry("to"); | ||
194 | qDebug("to %s",toAdr.latin1()); | ||
195 | smail.setTo( toAdr ); //to->text()); | ||
196 | str = cfg.readEntry("cc"); | ||
197 | qDebug("setCc %s",str.latin1()); | ||
198 | smail.setCc( str ); //cc->text()); | ||
199 | smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); | ||
200 | str = cfg.readEntry("subject"); | ||
201 | qDebug("setSubject %s",str.latin1()); | ||
202 | smail.setSubject( str ); //subject->text()); | ||
203 | str = cfg.readEntryCrypt("message"); | ||
204 | qDebug("setMessage %s",str.latin1()); | ||
205 | smail.setMessage( str ); //message->text()); | ||
206 | smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); | ||
207 | |||
208 | qDebug("setting account [%i]",cfg.readNumEntry("account")); | ||
209 | Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; | ||
210 | smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); | ||
211 | |||
212 | |||
213 | int prio = cfg.readNumEntry( "priority" ); | ||
214 | qDebug("setting priority %i",prio); | ||
215 | if (prio == POPUP_PRIO_LOW) { | ||
216 | smail.setPriority("Low");// No i18n on purpose | ||
217 | } else if (prio == POPUP_PRIO_NORMAL) { | ||
218 | smail.setPriority("Normal");// No i18n on purpose | ||
219 | } else if (prio == POPUP_PRIO_HIGH) { | ||
220 | smail.setPriority("High");// No i18n on purpose | ||
221 | } | ||
222 | |||
223 | QValueList<Attachment> attachments; | ||
224 | Attachment a; | ||
225 | QString an; | ||
226 | |||
227 | int ac = cfg.readNumEntry( "attachments", 0 ); | ||
228 | qDebug("%i Attachments",ac); | ||
229 | for (int j = 0; i < ac; ac++) { | ||
230 | an = "Attachment_" + QString::number( j ); | ||
231 | qDebug(an.latin1()); | ||
232 | a.setFileName(cfg.readEntry( an + "fileName" )); | ||
233 | a.setNewName(cfg.readEntry( an + "newName" )); | ||
234 | a.setDescription(cfg.readEntry( an + "description" )); | ||
235 | a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); | ||
236 | attachments.append( a ); | ||
237 | } | ||
238 | |||
239 | smail.setAttachments(attachments); | ||
240 | |||
241 | qDebug("putting mail together"); | ||
242 | |||
243 | QString header, message; | ||
244 | MailFactory::genMail(header, message, smail, this); | ||
245 | if (header.isNull() || message.isNull()) continue;//return;// Aborted. | ||
246 | |||
247 | // abort->setEnabled(true); | ||
248 | |||
249 | qDebug("Sending to %s",toAdr.latin1()); | ||
250 | SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); | ||
251 | |||
252 | connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); | ||
253 | connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); | ||
254 | connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); | ||
255 | |||
256 | qDebug("remove mail %i", i); | ||
257 | cfg.clearGroup(); | ||
258 | cfg.removeEntry( "Mail_" + QString::number(i) ); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | void Composer::slotQueueMail() | ||
263 | { | ||
264 | if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { | ||
265 | QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); | ||
266 | return; | ||
267 | } | ||
268 | |||
269 | Config cfg( "mailqueue", Config::User ); | ||
270 | |||
271 | cfg.setGroup( "Settings" ); | ||
272 | int count = cfg.readNumEntry( "count", 0 ); | ||
273 | count++; | ||
274 | cfg.writeEntry( "count", count ); | ||
275 | qDebug("queueing mail %i",count); | ||
276 | |||
277 | cfg.setGroup( "Mail_" + QString::number( count )); | ||
278 | cfg.writeEntry( "from", from->currentText() ); | ||
279 | cfg.writeEntry( "reply", replyto->text()); | ||
280 | cfg.writeEntry( "to", to->text()); | ||
281 | cfg.writeEntry( "cc", cc->text()); | ||
282 | cfg.writeEntry( "bcc", bcc->text()); | ||
283 | cfg.writeEntry( "subject", subject->text()); | ||
284 | cfg.writeEntryCrypt( "message", message->text()); | ||
285 | cfg.writeEntry( "mime", attachView->childCount() == 0 ); | ||
286 | cfg.writeEntry( "account", from->currentItem()); | ||
287 | cfg.writeEntry( "priority", priority->currentItem() ); | ||
288 | cfg.writeEntry( "attachments", attachView->childCount() ); | ||
289 | |||
290 | Attachment a; | ||
291 | QListViewItem *item; | ||
292 | QString an; | ||
293 | int i = 0; | ||
294 | for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { | ||
295 | a = ((AttachViewItem *)item)->attachment(); | ||
296 | an = "Attachment_" + QString::number( i++ ); | ||
297 | cfg.writeEntry( an + "fileName", a.fileName() ); | ||
298 | cfg.writeEntry( an + "newName", a.newName() ); | ||
299 | cfg.writeEntry( an + "description", a.description() ); | ||
300 | cfg.writeEntry( an + "docLnk", a.docLnk().file() ); | ||
301 | } | ||
302 | |||
303 | //cfg.close(); | ||
304 | } | ||
305 | |||
159 | void Composer::slotSendError(const QString &error) | 306 | void Composer::slotSendError(const QString &error) |
160 | { | 307 | { |
161 | status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); | 308 | status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); |
162 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); | 309 | QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); |
163 | } | 310 | } |
164 | 311 | ||
165 | void Composer::slotSendFinished() | 312 | void Composer::slotSendFinished() |
166 | { | 313 | { |
167 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); | 314 | QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); |
168 | 315 | ||
169 | status->setText(QString(0)); | 316 | status->setText(QString(0)); |
170 | abort->setEnabled(false); | 317 | abort->setEnabled(false); |
171 | } | 318 | } |
172 | 319 | ||
173 | void Composer::slotFillStuff() | 320 | void Composer::slotFillStuff() |
174 | { | 321 | { |
175 | QValueList<Account> accounts = ConfigFile::getAccounts(); | 322 | QValueList<Account> accounts = ConfigFile::getAccounts(); |
176 | int i = 0; | 323 | int i = 0; |
177 | 324 | ||
178 | QValueList<Account>::Iterator it; | 325 | QValueList<Account>::Iterator it; |
179 | for (it = accounts.begin(); it != accounts.end(); it++) { | 326 | for (it = accounts.begin(); it != accounts.end(); it++) { |
180 | if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { | 327 | if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { |
181 | if (!(*it).realName().isEmpty()) | 328 | if (!(*it).realName().isEmpty()) |
182 | from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); | 329 | from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); |
183 | else | 330 | else |
184 | from->insertItem((*it).email()); | 331 | from->insertItem((*it).email()); |
185 | 332 | ||
186 | accountsLoaded.append(*it); | 333 | accountsLoaded.append(*it); |
187 | i++; | 334 | i++; |
188 | } | 335 | } |
189 | } | 336 | } |
190 | } | 337 | } |
191 | 338 | ||
192 | void Composer::slotFromChanged(int id) | 339 | void Composer::slotFromChanged(int id) |
193 | { | 340 | { |
194 | Account account = accountsLoaded[id]; | 341 | Account account = accountsLoaded[id]; |
195 | 342 | ||
196 | if (account.defaultCc()) cc->setText(account.cc()); | 343 | if (account.defaultCc()) cc->setText(account.cc()); |
197 | if (account.defaultBcc()) bcc->setText(account.bcc()); | 344 | if (account.defaultBcc()) bcc->setText(account.bcc()); |
198 | if (account.defaultReplyTo()) replyto->setText(account.replyTo()); | 345 | if (account.defaultReplyTo()) replyto->setText(account.replyTo()); |
199 | if (!account.signature().isEmpty()) | 346 | if (!account.signature().isEmpty()) |
200 | message->setText(message->text() + "\n\n-- \n" + account.signature()); | 347 | message->setText(message->text() + "\n\n-- \n" + account.signature()); |
201 | } | 348 | } |
202 | 349 | ||
203 | void Composer::slotOpenAddressPicker() | 350 | void Composer::slotOpenAddressPicker() |
204 | { | 351 | { |
205 | if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) { | 352 | if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) { |
206 | if (to->text().isEmpty()) { | 353 | if (to->text().isEmpty()) { |
207 | to->setText(AddressPicker::getNames()); | 354 | to->setText(AddressPicker::getNames()); |
208 | } else { | 355 | } else { |
209 | to->setText(to->text() + ", " + AddressPicker::getNames()); | 356 | to->setText(to->text() + ", " + AddressPicker::getNames()); |
210 | } | 357 | } |
211 | } else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) { | 358 | } else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) { |
212 | if (cc->text().isEmpty()) { | 359 | if (cc->text().isEmpty()) { |
213 | cc->setText(AddressPicker::getNames()); | 360 | cc->setText(AddressPicker::getNames()); |
214 | } else { | 361 | } else { |
215 | cc->setText(cc->text() + ", " + AddressPicker::getNames()); | 362 | cc->setText(cc->text() + ", " + AddressPicker::getNames()); |
216 | } | 363 | } |
217 | } else if (to->isHidden() && cc->isHidden() && !bcc->isHidden()) { | 364 | } else if (to->isHidden() && cc->isHidden() && !bcc->isHidden()) { |
218 | if (bcc->text().isEmpty()) { | 365 | if (bcc->text().isEmpty()) { |
219 | bcc->setText(AddressPicker::getNames()); | 366 | bcc->setText(AddressPicker::getNames()); |
220 | } else { | 367 | } else { |
221 | bcc->setText(bcc->text() + ", " + AddressPicker::getNames()); | 368 | bcc->setText(bcc->text() + ", " + AddressPicker::getNames()); |
222 | } | 369 | } |
223 | } | 370 | } |
224 | } | 371 | } |
225 | 372 | ||
226 | void Composer::slotAddAttach() | 373 | void Composer::slotAddAttach() |
227 | { | 374 | { |
228 | DocLnk lnk = AttachDiag::getFile(this); | 375 | DocLnk lnk = AttachDiag::getFile(this); |
229 | if (lnk.name().isEmpty()) return; | 376 | if (lnk.name().isEmpty()) return; |
230 | 377 | ||
231 | Attachment attachment; | 378 | Attachment attachment; |
232 | attachment.setFileName(lnk.file()); | 379 | attachment.setFileName(lnk.file()); |
233 | attachment.setNewName(lnk.name()); | 380 | attachment.setNewName(lnk.name()); |
234 | attachment.setDocLnk(lnk); | 381 | attachment.setDocLnk(lnk); |
235 | 382 | ||
236 | (void) new AttachViewItem(attachView, attachment); | 383 | (void) new AttachViewItem(attachView, attachment); |
237 | } | 384 | } |
238 | 385 | ||
239 | void Composer::slotDelAttach() | 386 | void Composer::slotDelAttach() |
240 | { | 387 | { |
241 | if (attachView->currentItem() == NULL) return; | 388 | if (attachView->currentItem() == NULL) return; |
242 | attachView->takeItem(attachView->currentItem()); | 389 | attachView->takeItem(attachView->currentItem()); |
243 | } | 390 | } |
244 | |||
diff --git a/noncore/unsupported/mail2/composer.h b/noncore/unsupported/mail2/composer.h index 2640d7e..00235bf 100644 --- a/noncore/unsupported/mail2/composer.h +++ b/noncore/unsupported/mail2/composer.h | |||
@@ -1,57 +1,62 @@ | |||
1 | #ifndef COMPOSER_H | 1 | #ifndef COMPOSER_H |
2 | #define COMPOSER_H | 2 | #define COMPOSER_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qpe/applnk.h> | 5 | #include <qpe/applnk.h> |
6 | 6 | ||
7 | #include "mailfactory.h" | 7 | #include "mailfactory.h" |
8 | #include "composerbase.h" | 8 | #include "composerbase.h" |
9 | #include "configfile.h" | 9 | #include "configfile.h" |
10 | 10 | ||
11 | class AttachViewItem : public QListViewItem | 11 | class AttachViewItem : public QListViewItem |
12 | { | 12 | { |
13 | public: | 13 | public: |
14 | AttachViewItem(QListView *parent, Attachment &attachment); | 14 | AttachViewItem(QListView *parent, Attachment &attachment); |
15 | 15 | ||
16 | Attachment attachment() { return _attachment; } | 16 | Attachment attachment() { return _attachment; } |
17 | 17 | ||
18 | private: | 18 | private: |
19 | Attachment _attachment; | 19 | Attachment _attachment; |
20 | 20 | ||
21 | }; | 21 | }; |
22 | 22 | ||
23 | class Composer : public ComposerBase | 23 | class Composer : public ComposerBase |
24 | { | 24 | { |
25 | Q_OBJECT | 25 | Q_OBJECT |
26 | 26 | ||
27 | public: | 27 | public: |
28 | Composer(QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); | 28 | Composer(QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal, bool sendQueue = false); |
29 | ~Composer(); | 29 | ~Composer(); |
30 | 30 | ||
31 | void hide(); | 31 | void hide(); |
32 | void exec(); | 32 | void exec(); |
33 | 33 | ||
34 | void setSendMail(SendMail &sendMail); | 34 | void setSendMail(SendMail &sendMail); |
35 | 35 | ||
36 | public slots: | ||
37 | void slotSendQueued(); | ||
38 | |||
36 | protected slots: | 39 | protected slots: |
37 | void slotPopupHandler(int itemid); | 40 | void slotPopupHandler(int itemid); |
38 | void slotSendMail(); | 41 | void slotSendMail(); |
42 | void slotQueueMail(); | ||
39 | void slotSendError(const QString &); | 43 | void slotSendError(const QString &); |
40 | void slotSendFinished(); | 44 | void slotSendFinished(); |
41 | void slotResizing(); | 45 | void slotResizing(); |
42 | void slotFillStuff(); | 46 | void slotFillStuff(); |
43 | void slotFromChanged(int id); | 47 | void slotFromChanged(int id); |
44 | void slotOpenAddressPicker(); | 48 | void slotOpenAddressPicker(); |
45 | void slotAddAttach(); | 49 | void slotAddAttach(); |
46 | void slotDelAttach(); | 50 | void slotDelAttach(); |
47 | 51 | ||
48 | protected: | 52 | protected: |
49 | QValueList<Account> accountsLoaded; | 53 | QValueList<Account> accountsLoaded; |
50 | 54 | ||
51 | private: | 55 | private: |
56 | bool _sendQueued; | ||
52 | bool _inLoop; | 57 | bool _inLoop; |
53 | QString _inReplyTo; | 58 | QString _inReplyTo; |
54 | 59 | ||
55 | }; | 60 | }; |
56 | 61 | ||
57 | #endif | 62 | #endif |
diff --git a/noncore/unsupported/mail2/composerbase.cpp b/noncore/unsupported/mail2/composerbase.cpp index 10d567d..6627701 100644 --- a/noncore/unsupported/mail2/composerbase.cpp +++ b/noncore/unsupported/mail2/composerbase.cpp | |||
@@ -1,76 +1,79 @@ | |||
1 | #include <qmultilineedit.h> | 1 | #include <qmultilineedit.h> |
2 | #include <qpopupmenu.h> | 2 | #include <qpopupmenu.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qaction.h> | 6 | #include <qaction.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qvbox.h> | 8 | #include <qvbox.h> |
9 | 9 | ||
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
12 | 12 | ||
13 | #include "listviewplus.h" | 13 | #include "listviewplus.h" |
14 | #include "composerbase.h" | 14 | #include "composerbase.h" |
15 | 15 | ||
16 | ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) | 16 | ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl) |
17 | : QMainWindow(parent, name, fl) | 17 | : QMainWindow(parent, name, fl) |
18 | { | 18 | { |
19 | setCaption(tr("Compose Message")); | 19 | setCaption(tr("Compose Message")); |
20 | setToolBarsMovable(false); | 20 | setToolBarsMovable(false); |
21 | 21 | ||
22 | toolbar = new QPEToolBar(this); | 22 | toolbar = new QPEToolBar(this); |
23 | addToolBar(toolbar); | 23 | addToolBar(toolbar); |
24 | toolbar->setHorizontalStretchable(true); | 24 | toolbar->setHorizontalStretchable(true); |
25 | 25 | ||
26 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); | 26 | sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this); |
27 | sendmail->addTo(toolbar); | 27 | sendmail->addTo(toolbar); |
28 | 28 | ||
29 | queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this); | ||
30 | queuemail->addTo(toolbar); | ||
31 | |||
29 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); | 32 | attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); |
30 | attachfile->addTo(toolbar); | 33 | attachfile->addTo(toolbar); |
31 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); | 34 | connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool))); |
32 | 35 | ||
33 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); | 36 | addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this); |
34 | addressbook->addTo(toolbar); | 37 | addressbook->addTo(toolbar); |
35 | 38 | ||
36 | QLabel *spacer = new QLabel(toolbar); | 39 | QLabel *spacer = new QLabel(toolbar); |
37 | spacer->setBackgroundMode(QWidget::PaletteButton); | 40 | spacer->setBackgroundMode(QWidget::PaletteButton); |
38 | toolbar->setStretchableWidget(spacer); | 41 | toolbar->setStretchableWidget(spacer); |
39 | 42 | ||
40 | abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); | 43 | abort = new QAction(tr("Abort sending"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); |
41 | abort->addTo(toolbar); | 44 | abort->addTo(toolbar); |
42 | 45 | ||
43 | QWidget *main = new QWidget(this); | 46 | QWidget *main = new QWidget(this); |
44 | setCentralWidget(main); | 47 | setCentralWidget(main); |
45 | 48 | ||
46 | QGridLayout *layout = new QGridLayout(main); | 49 | QGridLayout *layout = new QGridLayout(main); |
47 | 50 | ||
48 | fromBox = new QComboBox(main); | 51 | fromBox = new QComboBox(main); |
49 | fromBox->insertItem(tr("From"), POPUP_FROM_FROM); | 52 | fromBox->insertItem(tr("From"), POPUP_FROM_FROM); |
50 | fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO); | 53 | fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO); |
51 | layout->addWidget(fromBox, 0, 0); | 54 | layout->addWidget(fromBox, 0, 0); |
52 | 55 | ||
53 | connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int))); | 56 | connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int))); |
54 | 57 | ||
55 | QHBoxLayout *fromLayout = new QHBoxLayout(); | 58 | QHBoxLayout *fromLayout = new QHBoxLayout(); |
56 | layout->addLayout(fromLayout, 0, 1); | 59 | layout->addLayout(fromLayout, 0, 1); |
57 | 60 | ||
58 | from = new QComboBox(main); | 61 | from = new QComboBox(main); |
59 | fromLayout->addWidget(from); | 62 | fromLayout->addWidget(from); |
60 | 63 | ||
61 | replyto = new QLineEdit(main); | 64 | replyto = new QLineEdit(main); |
62 | replyto->hide(); | 65 | replyto->hide(); |
63 | fromLayout->addWidget(replyto); | 66 | fromLayout->addWidget(replyto); |
64 | 67 | ||
65 | receiversBox = new QComboBox(main); | 68 | receiversBox = new QComboBox(main); |
66 | receiversBox->insertItem(tr("To"), POPUP_RECV_TO); | 69 | receiversBox->insertItem(tr("To"), POPUP_RECV_TO); |
67 | receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC); | 70 | receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC); |
68 | receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC); | 71 | receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC); |
69 | layout->addWidget(receiversBox, 1, 0); | 72 | layout->addWidget(receiversBox, 1, 0); |
70 | 73 | ||
71 | connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int))); | 74 | connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int))); |
72 | 75 | ||
73 | QHBoxLayout *receiverLayout = new QHBoxLayout(); | 76 | QHBoxLayout *receiverLayout = new QHBoxLayout(); |
74 | layout->addLayout(receiverLayout, 1, 1); | 77 | layout->addLayout(receiverLayout, 1, 1); |
75 | 78 | ||
76 | to = new QLineEdit(main); | 79 | to = new QLineEdit(main); |
diff --git a/noncore/unsupported/mail2/composerbase.h b/noncore/unsupported/mail2/composerbase.h index 75b77f4..9d3e4fc 100644 --- a/noncore/unsupported/mail2/composerbase.h +++ b/noncore/unsupported/mail2/composerbase.h | |||
@@ -1,55 +1,55 @@ | |||
1 | #ifndef COMPOSERBASE_H | 1 | #ifndef COMPOSERBASE_H |
2 | #define COMPOSERBASE_H | 2 | #define COMPOSERBASE_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | 5 | ||
6 | class QMultiLineEdit; | 6 | class QMultiLineEdit; |
7 | class ListViewPlus; | 7 | class ListViewPlus; |
8 | class QPopupMenu; | 8 | class QPopupMenu; |
9 | class QPEToolBar; | 9 | class QPEToolBar; |
10 | class QComboBox; | 10 | class QComboBox; |
11 | class QLineEdit; | 11 | class QLineEdit; |
12 | class QAction; | 12 | class QAction; |
13 | class QLabel; | 13 | class QLabel; |
14 | 14 | ||
15 | class ComposerBase : public QMainWindow | 15 | class ComposerBase : public QMainWindow |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | 18 | ||
19 | public: | 19 | public: |
20 | ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 20 | ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
21 | 21 | ||
22 | protected: | 22 | protected: |
23 | static const int POPUP_FROM_FROM = 0; | 23 | static const int POPUP_FROM_FROM = 0; |
24 | static const int POPUP_FROM_REPLYTO = 1; | 24 | static const int POPUP_FROM_REPLYTO = 1; |
25 | static const int POPUP_RECV_TO = 0; | 25 | static const int POPUP_RECV_TO = 0; |
26 | static const int POPUP_RECV_CC = 1; | 26 | static const int POPUP_RECV_CC = 1; |
27 | static const int POPUP_RECV_BCC = 2; | 27 | static const int POPUP_RECV_BCC = 2; |
28 | static const int POPUP_SUBJ_SUBJECT = 0; | 28 | static const int POPUP_SUBJ_SUBJECT = 0; |
29 | static const int POPUP_SUBJ_PRIORITY = 1; | 29 | static const int POPUP_SUBJ_PRIORITY = 1; |
30 | static const int POPUP_PRIO_LOW = 0; | 30 | static const int POPUP_PRIO_LOW = 0; |
31 | static const int POPUP_PRIO_NORMAL = 1; | 31 | static const int POPUP_PRIO_NORMAL = 1; |
32 | static const int POPUP_PRIO_HIGH = 2; | 32 | static const int POPUP_PRIO_HIGH = 2; |
33 | static const int POPUP_ATTACH_RENAME = 0; | 33 | static const int POPUP_ATTACH_RENAME = 0; |
34 | static const int POPUP_ATTACH_DESC = 1; | 34 | static const int POPUP_ATTACH_DESC = 1; |
35 | static const int POPUP_ATTACH_REMOVE = 2; | 35 | static const int POPUP_ATTACH_REMOVE = 2; |
36 | 36 | ||
37 | QMultiLineEdit *message; | 37 | QMultiLineEdit *message; |
38 | ListViewPlus *attachView; | 38 | ListViewPlus *attachView; |
39 | QMainWindow *attachWindow; | 39 | QMainWindow *attachWindow; |
40 | QPopupMenu *attachPopup; | 40 | QPopupMenu *attachPopup; |
41 | QPEToolBar *toolbar, *attachToolbar; | 41 | QPEToolBar *toolbar, *attachToolbar; |
42 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; | 42 | QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority; |
43 | QLineEdit *replyto, *to, *cc, *bcc, *subject; | 43 | QLineEdit *replyto, *to, *cc, *bcc, *subject; |
44 | QAction *sendmail, *attachfile, *addressbook, *abort, *addattach, *delattach; | 44 | QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach; |
45 | QLabel *fromLabel, *status; | 45 | QLabel *fromLabel, *status; |
46 | 46 | ||
47 | protected slots: | 47 | protected slots: |
48 | void slotAttachfileChanged(bool toggled); | 48 | void slotAttachfileChanged(bool toggled); |
49 | void slotFromMenuChanged(int id); | 49 | void slotFromMenuChanged(int id); |
50 | void slotReceiverMenuChanged(int id); | 50 | void slotReceiverMenuChanged(int id); |
51 | void slotSubjectMenuChanged(int id); | 51 | void slotSubjectMenuChanged(int id); |
52 | 52 | ||
53 | }; | 53 | }; |
54 | 54 | ||
55 | #endif | 55 | #endif |
diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp index 2230dc0..652db94 100644 --- a/noncore/unsupported/mail2/mainwindow.cpp +++ b/noncore/unsupported/mail2/mainwindow.cpp | |||
@@ -1,65 +1,75 @@ | |||
1 | #include <qprogressbar.h> | 1 | #include <qprogressbar.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | 5 | ||
6 | #include "folderwidget.h" | 6 | #include "folderwidget.h" |
7 | #include "mainwindow.h" | 7 | #include "mainwindow.h" |
8 | #include "configdiag.h" | 8 | #include "configdiag.h" |
9 | #include "configfile.h" | 9 | #include "configfile.h" |
10 | #include "searchdiag.h" | 10 | #include "searchdiag.h" |
11 | #include "mailtable.h" | 11 | #include "mailtable.h" |
12 | #include "composer.h" | 12 | #include "composer.h" |
13 | #include "viewmail.h" | 13 | #include "viewmail.h" |
14 | 14 | ||
15 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) | 15 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) |
16 | : MainWindowBase(parent, name, fl) | 16 | : MainWindowBase(parent, name, fl) |
17 | { | 17 | { |
18 | stop->setEnabled(false); | 18 | stop->setEnabled(false); |
19 | 19 | ||
20 | connect(folderView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); | 20 | connect(folderView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); |
21 | connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); | 21 | connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); |
22 | 22 | ||
23 | connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); | 23 | connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); |
24 | connect(mailView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); | 24 | connect(mailView, SIGNAL(status(const QString &)), statusLabel, SLOT(setText(const QString &))); |
25 | connect(mailView, SIGNAL(totalSteps(int)), statusProgress, SLOT(setTotalSteps(int))); | 25 | connect(mailView, SIGNAL(totalSteps(int)), statusProgress, SLOT(setTotalSteps(int))); |
26 | connect(mailView, SIGNAL(progress(int)), statusProgress, SLOT(setProgress(int))); | 26 | connect(mailView, SIGNAL(progress(int)), statusProgress, SLOT(setProgress(int))); |
27 | connect(mailView, SIGNAL(resetProgress()), statusProgress, SLOT(reset())); | 27 | connect(mailView, SIGNAL(resetProgress()), statusProgress, SLOT(reset())); |
28 | connect(mailView, SIGNAL(stopEnabled(bool)), stop, SLOT(setEnabled(bool))); | 28 | connect(mailView, SIGNAL(stopEnabled(bool)), stop, SLOT(setEnabled(bool))); |
29 | 29 | ||
30 | connect(stop, SIGNAL(activated()), mailView, SLOT(stop())); | 30 | connect(stop, SIGNAL(activated()), mailView, SLOT(stop())); |
31 | 31 | ||
32 | connect(compose, SIGNAL(activated()), SLOT(slotCompose())); | 32 | connect(compose, SIGNAL(activated()), SLOT(slotCompose())); |
33 | connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); | ||
33 | connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); | 34 | connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); |
34 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); | 35 | connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); |
35 | } | 36 | } |
36 | 37 | ||
37 | void MainWindow::slotCompose() | 38 | void MainWindow::slotCompose() |
38 | { | 39 | { |
39 | Composer composer(this, 0, true); | 40 | Composer composer(this, 0, true); |
40 | composer.showMaximized(); | 41 | composer.showMaximized(); |
41 | composer.exec(); | 42 | composer.exec(); |
42 | } | 43 | } |
43 | 44 | ||
45 | void MainWindow::slotSendQueued() | ||
46 | { | ||
47 | Composer composer(this, 0, true, true); | ||
48 | // composer.sendQueue(); | ||
49 | composer.showMaximized(); | ||
50 | composer.exec(); | ||
51 | //composer.close(); | ||
52 | } | ||
53 | |||
44 | void MainWindow::slotSearch() | 54 | void MainWindow::slotSearch() |
45 | { | 55 | { |
46 | SearchDiag searchDiag(this, 0, true); | 56 | SearchDiag searchDiag(this, 0, true); |
47 | searchDiag.showMaximized(); | 57 | searchDiag.showMaximized(); |
48 | searchDiag.exec(); | 58 | searchDiag.exec(); |
49 | } | 59 | } |
50 | 60 | ||
51 | void MainWindow::slotConfigure() | 61 | void MainWindow::slotConfigure() |
52 | { | 62 | { |
53 | ConfigDiag configDiag(this, 0, true); | 63 | ConfigDiag configDiag(this, 0, true); |
54 | configDiag.showMaximized(); | 64 | configDiag.showMaximized(); |
55 | configDiag.exec(); | 65 | configDiag.exec(); |
56 | 66 | ||
57 | connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); | 67 | connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); |
58 | } | 68 | } |
59 | 69 | ||
60 | void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler) | 70 | void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler) |
61 | { | 71 | { |
62 | ViewMail viewMail(mail, handler, this, 0, true); | 72 | ViewMail viewMail(mail, handler, this, 0, true); |
63 | viewMail.showMaximized(); | 73 | viewMail.showMaximized(); |
64 | viewMail.exec(); | 74 | viewMail.exec(); |
65 | } | 75 | } |
diff --git a/noncore/unsupported/mail2/mainwindow.h b/noncore/unsupported/mail2/mainwindow.h index 1edf10b..27b527d 100644 --- a/noncore/unsupported/mail2/mainwindow.h +++ b/noncore/unsupported/mail2/mainwindow.h | |||
@@ -1,24 +1,25 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include "mainwindowbase.h" | 4 | #include "mainwindowbase.h" |
5 | 5 | ||
6 | class IMAPHandler; | 6 | class IMAPHandler; |
7 | class IMAPResponseFETCH; | 7 | class IMAPResponseFETCH; |
8 | 8 | ||
9 | class MainWindow : public MainWindowBase | 9 | class MainWindow : public MainWindowBase |
10 | { | 10 | { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | MainWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 14 | MainWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
15 | 15 | ||
16 | protected slots: | 16 | protected slots: |
17 | void slotCompose(); | 17 | void slotCompose(); |
18 | void slotSendQueued(); | ||
18 | void slotSearch(); | 19 | void slotSearch(); |
19 | void slotConfigure(); | 20 | void slotConfigure(); |
20 | void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler); | 21 | void mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler); |
21 | 22 | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | #endif | 25 | #endif |
diff --git a/noncore/unsupported/mail2/mainwindowbase.cpp b/noncore/unsupported/mail2/mainwindowbase.cpp index c55bd90..24f030f 100644 --- a/noncore/unsupported/mail2/mainwindowbase.cpp +++ b/noncore/unsupported/mail2/mainwindowbase.cpp | |||
@@ -1,75 +1,78 @@ | |||
1 | #include <qprogressbar.h> | 1 | #include <qprogressbar.h> |
2 | #include <qtoolbutton.h> | 2 | #include <qtoolbutton.h> |
3 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | 8 | ||
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | #include "mainwindowbase.h" | 12 | #include "mainwindowbase.h" |
13 | #include "folderwidget.h" | 13 | #include "folderwidget.h" |
14 | #include "mailtable.h" | 14 | #include "mailtable.h" |
15 | 15 | ||
16 | MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) | 16 | MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl) |
17 | : QMainWindow(parent, name, fl) | 17 | : QMainWindow(parent, name, fl) |
18 | { | 18 | { |
19 | setCaption(tr("E-Mail")); | 19 | setCaption(tr("E-Mail")); |
20 | setToolBarsMovable(false); | 20 | setToolBarsMovable(false); |
21 | 21 | ||
22 | toolbar = new QPEToolBar(this); | 22 | toolbar = new QPEToolBar(this); |
23 | addToolBar(toolbar); | 23 | addToolBar(toolbar); |
24 | toolbar->setHorizontalStretchable(true); | 24 | toolbar->setHorizontalStretchable(true); |
25 | 25 | ||
26 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); | 26 | compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this); |
27 | compose->addTo(toolbar); | 27 | compose->addTo(toolbar); |
28 | 28 | ||
29 | sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this); | ||
30 | sendQueue->addTo(toolbar); | ||
31 | |||
29 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); | 32 | folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true); |
30 | folders->addTo(toolbar); | 33 | folders->addTo(toolbar); |
31 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); | 34 | connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool))); |
32 | 35 | ||
33 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); | 36 | findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); |
34 | findmails->addTo(toolbar); | 37 | findmails->addTo(toolbar); |
35 | 38 | ||
36 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); | 39 | configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this); |
37 | configure->addTo(toolbar); | 40 | configure->addTo(toolbar); |
38 | 41 | ||
39 | QLabel *spacer = new QLabel(toolbar); | 42 | QLabel *spacer = new QLabel(toolbar); |
40 | spacer->setBackgroundMode(QWidget::PaletteButton); | 43 | spacer->setBackgroundMode(QWidget::PaletteButton); |
41 | toolbar->setStretchableWidget(spacer); | 44 | toolbar->setStretchableWidget(spacer); |
42 | 45 | ||
43 | stop = new QAction(tr("Abort"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); | 46 | stop = new QAction(tr("Abort"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this); |
44 | stop->addTo(toolbar); | 47 | stop->addTo(toolbar); |
45 | 48 | ||
46 | QVBox *view = new QVBox(this); | 49 | QVBox *view = new QVBox(this); |
47 | setCentralWidget(view); | 50 | setCentralWidget(view); |
48 | 51 | ||
49 | folderView = new FolderWidget(view); | 52 | folderView = new FolderWidget(view); |
50 | folderView->setMinimumHeight(90); | 53 | folderView->setMinimumHeight(90); |
51 | folderView->setMaximumHeight(90); | 54 | folderView->setMaximumHeight(90); |
52 | folderView->hide(); | 55 | folderView->hide(); |
53 | 56 | ||
54 | mailView = new MailTable(view); | 57 | mailView = new MailTable(view); |
55 | mailView->setMinimumHeight(50); | 58 | mailView->setMinimumHeight(50); |
56 | 59 | ||
57 | QHBox *status = new QHBox(view); | 60 | QHBox *status = new QHBox(view); |
58 | 61 | ||
59 | statusLabel = new QLabel(status); | 62 | statusLabel = new QLabel(status); |
60 | QFont tmpFont = statusLabel->font(); | 63 | QFont tmpFont = statusLabel->font(); |
61 | tmpFont.setPixelSize(8); | 64 | tmpFont.setPixelSize(8); |
62 | statusLabel->setFont(tmpFont); | 65 | statusLabel->setFont(tmpFont); |
63 | 66 | ||
64 | statusProgress = new QProgressBar(status); | 67 | statusProgress = new QProgressBar(status); |
65 | statusProgress->setCenterIndicator(true); | 68 | statusProgress->setCenterIndicator(true); |
66 | statusProgress->setMaximumHeight(15); | 69 | statusProgress->setMaximumHeight(15); |
67 | statusProgress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | 70 | statusProgress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); |
68 | } | 71 | } |
69 | 72 | ||
70 | void MainWindowBase::slotFoldersToggled(bool toggled) | 73 | void MainWindowBase::slotFoldersToggled(bool toggled) |
71 | { | 74 | { |
72 | if (folderView->isHidden() && toggled) folderView->show(); | 75 | if (folderView->isHidden() && toggled) folderView->show(); |
73 | if (!folderView->isHidden() && !toggled) folderView->hide(); | 76 | if (!folderView->isHidden() && !toggled) folderView->hide(); |
74 | } | 77 | } |
75 | 78 | ||
diff --git a/noncore/unsupported/mail2/mainwindowbase.h b/noncore/unsupported/mail2/mainwindowbase.h index 0776f02..232d656 100644 --- a/noncore/unsupported/mail2/mainwindowbase.h +++ b/noncore/unsupported/mail2/mainwindowbase.h | |||
@@ -1,35 +1,35 @@ | |||
1 | #ifndef MAINWINDOWBASE_H | 1 | #ifndef MAINWINDOWBASE_H |
2 | #define MAINWINDOWBASE_H | 2 | #define MAINWINDOWBASE_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | 5 | ||
6 | class ServerConnection; | 6 | class ServerConnection; |
7 | class QProgressBar; | 7 | class QProgressBar; |
8 | class FolderWidget; | 8 | class FolderWidget; |
9 | class QPEToolBar; | 9 | class QPEToolBar; |
10 | class MailTable; | 10 | class MailTable; |
11 | class QAction; | 11 | class QAction; |
12 | class QLabel; | 12 | class QLabel; |
13 | 13 | ||
14 | class MainWindowBase : public QMainWindow | 14 | class MainWindowBase : public QMainWindow |
15 | { | 15 | { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 19 | MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
20 | 20 | ||
21 | protected slots: | 21 | protected slots: |
22 | void slotFoldersToggled(bool toggled); | 22 | void slotFoldersToggled(bool toggled); |
23 | 23 | ||
24 | protected: | 24 | protected: |
25 | ServerConnection *serverConnection; | 25 | ServerConnection *serverConnection; |
26 | QProgressBar *statusProgress; | 26 | QProgressBar *statusProgress; |
27 | FolderWidget *folderView; | 27 | FolderWidget *folderView; |
28 | QPEToolBar *toolbar; | 28 | QPEToolBar *toolbar; |
29 | MailTable *mailView; | 29 | MailTable *mailView; |
30 | QAction *compose, *folders, *findmails, *configure, *stop; | 30 | QAction *compose, *sendQueue, *folders, *findmails, *configure, *stop; |
31 | QLabel *statusLabel; | 31 | QLabel *statusLabel; |
32 | 32 | ||
33 | }; | 33 | }; |
34 | 34 | ||
35 | #endif | 35 | #endif |