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