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