author | zautrix <zautrix> | 2004-11-01 14:15:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-01 14:15:56 (UTC) |
commit | 3320af5e47cdb4b54c4185c91d0332c013d90818 (patch) (unidiff) | |
tree | 9d7db42d4350616d315c5f95e1ac0aed00ed1314 /kmicromail | |
parent | 56845a3ee7013af8a2db26a89aa151ee482ef0ed (diff) | |
download | kdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.zip kdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.tar.gz kdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.tar.bz2 |
ompi fixes
-rw-r--r-- | kmicromail/libetpan/mime/mailmime_decode.c | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.cpp | 13 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 3 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 11 |
5 files changed, 24 insertions, 13 deletions
diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c index e48ec19..dbaeb68 100644 --- a/kmicromail/libetpan/mime/mailmime_decode.c +++ b/kmicromail/libetpan/mime/mailmime_decode.c | |||
@@ -197,25 +197,26 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode, | |||
197 | case MAIL_CHARCONV_ERROR_CONV: | 197 | case MAIL_CHARCONV_ERROR_CONV: |
198 | free(raw_word); | 198 | free(raw_word); |
199 | res = MAILIMF_ERROR_PARSE; | 199 | res = MAILIMF_ERROR_PARSE; |
200 | goto free; | 200 | goto free; |
201 | } | 201 | } |
202 | 202 | ||
203 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | 203 | if (mmap_string_append(gphrase, wordutf8) == NULL) { |
204 | free(wordutf8); | 204 | free(wordutf8); |
205 | free(raw_word); | 205 | free(raw_word); |
206 | res = MAILIMF_ERROR_MEMORY; | 206 | res = MAILIMF_ERROR_MEMORY; |
207 | goto free; | 207 | goto free; |
208 | } | 208 | } |
209 | 209 | // LUTZ fix | |
210 | free(wordutf8); | ||
210 | free(raw_word); | 211 | free(raw_word); |
211 | first = FALSE; | 212 | first = FALSE; |
212 | } | 213 | } |
213 | else if (r == MAILIMF_ERROR_PARSE) { | 214 | else if (r == MAILIMF_ERROR_PARSE) { |
214 | break; | 215 | break; |
215 | } | 216 | } |
216 | else { | 217 | else { |
217 | res = r; | 218 | res = r; |
218 | goto free; | 219 | goto free; |
219 | } | 220 | } |
220 | } | 221 | } |
221 | } | 222 | } |
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 49315ba..32311d7 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | #include "generatemail.h" | 1 | #include "generatemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | 3 | ||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | 5 | ||
6 | //#include <qt.h> | 6 | //#include <qt.h> |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfileinfo.h> | 9 | #include <qfileinfo.h> |
10 | 10 | ||
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | const char* Generatemail::USER_AGENT="OpieMail v0.6"; | 12 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; |
13 | 13 | ||
14 | Generatemail::Generatemail() | 14 | Generatemail::Generatemail() |
15 | { | 15 | { |
16 | } | 16 | } |
17 | 17 | ||
18 | Generatemail::~Generatemail() | 18 | Generatemail::~Generatemail() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { | 22 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
23 | clistiter *it, *it2; | 23 | clistiter *it, *it2; |
24 | 24 | ||
@@ -123,25 +123,24 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) { | |||
123 | } | 123 | } |
124 | return addresses; | 124 | return addresses; |
125 | } | 125 | } |
126 | 126 | ||
127 | mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { | 127 | mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { |
128 | mailmime * filePart = 0; | 128 | mailmime * filePart = 0; |
129 | mailmime_fields * fields = 0; | 129 | mailmime_fields * fields = 0; |
130 | mailmime_content * content = 0; | 130 | mailmime_content * content = 0; |
131 | mailmime_parameter * param = 0; | 131 | mailmime_parameter * param = 0; |
132 | char*name = 0; | 132 | char*name = 0; |
133 | char*file = 0; | 133 | char*file = 0; |
134 | int err; | 134 | int err; |
135 | |||
136 | int pos = filename.findRev( '/' ); | 135 | int pos = filename.findRev( '/' ); |
137 | 136 | ||
138 | if (filename.length()>0) { | 137 | if (filename.length()>0) { |
139 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); | 138 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); |
140 | name = strdup( tmp.latin1() ); // just filename | 139 | name = strdup( tmp.latin1() ); // just filename |
141 | file = strdup( filename.latin1() ); // full name with path | 140 | file = strdup( filename.latin1() ); // full name with path |
142 | } | 141 | } |
143 | 142 | ||
144 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 143 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
145 | int mechanism = MAILMIME_MECHANISM_BASE64; | 144 | int mechanism = MAILMIME_MECHANISM_BASE64; |
146 | 145 | ||
147 | if ( mimetype.startsWith( "text/" ) ) { | 146 | if ( mimetype.startsWith( "text/" ) ) { |
@@ -162,25 +161,25 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
162 | if (filename.length()>0) { | 161 | if (filename.length()>0) { |
163 | QFileInfo f(filename); | 162 | QFileInfo f(filename); |
164 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); | 163 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); |
165 | clist_append(content->ct_parameters,param); | 164 | clist_append(content->ct_parameters,param); |
166 | param = 0; | 165 | param = 0; |
167 | } | 166 | } |
168 | filePart = mailmime_new_empty( content, fields ); | 167 | filePart = mailmime_new_empty( content, fields ); |
169 | } | 168 | } |
170 | if (filePart) { | 169 | if (filePart) { |
171 | if (filename.length()>0) { | 170 | if (filename.length()>0) { |
172 | err = mailmime_set_body_file( filePart, file ); | 171 | err = mailmime_set_body_file( filePart, file ); |
173 | } else { | 172 | } else { |
174 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); | 173 | err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); |
175 | } | 174 | } |
176 | if (err != MAILIMF_NO_ERROR) { | 175 | if (err != MAILIMF_NO_ERROR) { |
177 | qDebug("Error setting body with file "); | 176 | qDebug("Error setting body with file "); |
178 | mailmime_free( filePart ); | 177 | mailmime_free( filePart ); |
179 | filePart = 0; | 178 | filePart = 0; |
180 | } | 179 | } |
181 | } | 180 | } |
182 | 181 | ||
183 | if (!filePart) { | 182 | if (!filePart) { |
184 | if ( param != NULL ) { | 183 | if ( param != NULL ) { |
185 | mailmime_parameter_free( param ); | 184 | mailmime_parameter_free( param ); |
186 | } | 185 | } |
@@ -218,47 +217,49 @@ void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files | |||
218 | if ( err != MAILIMF_NO_ERROR ) { | 217 | if ( err != MAILIMF_NO_ERROR ) { |
219 | mailmime_free( filePart ); | 218 | mailmime_free( filePart ); |
220 | } | 219 | } |
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
224 | mailmime *Generatemail::buildTxtPart(const QString&str ) { | 223 | mailmime *Generatemail::buildTxtPart(const QString&str ) { |
225 | mailmime *txtPart; | 224 | mailmime *txtPart; |
226 | mailmime_fields *fields; | 225 | mailmime_fields *fields; |
227 | mailmime_content *content; | 226 | mailmime_content *content; |
228 | mailmime_parameter *param; | 227 | mailmime_parameter *param; |
229 | int err; | 228 | int err; |
230 | 229 | QCString __str; | |
231 | param = mailmime_parameter_new( strdup( "charset" ), | 230 | param = mailmime_parameter_new( strdup( "charset" ), |
232 | strdup( "iso-8859-1" ) ); | 231 | strdup( "iso-8859-1" ) ); |
233 | if ( param == NULL ) | 232 | if ( param == NULL ) |
234 | goto err_free; | 233 | goto err_free; |
235 | 234 | ||
236 | content = mailmime_content_new_with_str( "text/plain" ); | 235 | content = mailmime_content_new_with_str( "text/plain" ); |
237 | if ( content == NULL ) | 236 | if ( content == NULL ) |
238 | goto err_free_param; | 237 | goto err_free_param; |
239 | 238 | ||
240 | err = clist_append( content->ct_parameters, param ); | 239 | err = clist_append( content->ct_parameters, param ); |
241 | if ( err != MAILIMF_NO_ERROR ) | 240 | if ( err != MAILIMF_NO_ERROR ) |
242 | goto err_free_content; | 241 | goto err_free_content; |
243 | 242 | ||
244 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); | 243 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
245 | if ( fields == NULL ) | 244 | if ( fields == NULL ) |
246 | goto err_free_content; | 245 | goto err_free_content; |
247 | 246 | ||
248 | txtPart = mailmime_new_empty( content, fields ); | 247 | txtPart = mailmime_new_empty( content, fields ); |
249 | if ( txtPart == NULL ) | 248 | if ( txtPart == NULL ) |
250 | goto err_free_fields; | 249 | goto err_free_fields; |
251 | 250 | { | |
252 | err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); | 251 | __str = str.utf8(); |
252 | err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); | ||
253 | } | ||
253 | if ( err != MAILIMF_NO_ERROR ) | 254 | if ( err != MAILIMF_NO_ERROR ) |
254 | goto err_free_txtPart; | 255 | goto err_free_txtPart; |
255 | 256 | ||
256 | return txtPart; // Success :) | 257 | return txtPart; // Success :) |
257 | 258 | ||
258 | err_free_txtPart: | 259 | err_free_txtPart: |
259 | mailmime_free( txtPart ); | 260 | mailmime_free( txtPart ); |
260 | err_free_fields: | 261 | err_free_fields: |
261 | mailmime_fields_free( fields ); | 262 | mailmime_fields_free( fields ); |
262 | err_free_content: | 263 | err_free_content: |
263 | mailmime_content_free( content ); | 264 | mailmime_content_free( content ); |
264 | err_free_param: | 265 | err_free_param: |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index ae667ec..d90a8d2 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -66,25 +66,25 @@ void IMAPwrapper::progress( QString m ) | |||
66 | } | 66 | } |
67 | QString mess; | 67 | QString mess; |
68 | //qDebug("progress "); | 68 | //qDebug("progress "); |
69 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); | 69 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); |
70 | else mess = mProgrMess +i18n(" message %1").arg( mCurrent++); | 70 | else mess = mProgrMess +i18n(" message %1").arg( mCurrent++); |
71 | Global::statusMessage(mess); | 71 | Global::statusMessage(mess); |
72 | //qDebug("Progress %s %s", mess.latin1(), m.latin1()); | 72 | //qDebug("Progress %s %s", mess.latin1(), m.latin1()); |
73 | qApp->processEvents(); | 73 | qApp->processEvents(); |
74 | } | 74 | } |
75 | bool IMAPwrapper::start_tls(bool force_tls) | 75 | bool IMAPwrapper::start_tls(bool force_tls) |
76 | { | 76 | { |
77 | int err; | 77 | int err; |
78 | bool try_tls; | 78 | bool try_tls = force_tls; |
79 | mailimap_capability_data * cap_data = 0; | 79 | mailimap_capability_data * cap_data = 0; |
80 | 80 | ||
81 | err = mailimap_capability(m_imap,&cap_data); | 81 | err = mailimap_capability(m_imap,&cap_data); |
82 | if (err != MAILIMAP_NO_ERROR) { | 82 | if (err != MAILIMAP_NO_ERROR) { |
83 | Global::statusMessage("error getting capabilities!"); | 83 | Global::statusMessage("error getting capabilities!"); |
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | clistiter * cur; | 86 | clistiter * cur; |
87 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { | 87 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { |
88 | struct mailimap_capability * cap; | 88 | struct mailimap_capability * cap; |
89 | cap = (struct mailimap_capability *)clist_content(cur); | 89 | cap = (struct mailimap_capability *)clist_content(cur); |
90 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { | 90 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { |
@@ -469,43 +469,44 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
469 | } | 469 | } |
470 | } | 470 | } |
471 | continue; | 471 | continue; |
472 | } | 472 | } |
473 | if ( item->att_data.att_static == NULL ) | 473 | if ( item->att_data.att_static == NULL ) |
474 | continue; | 474 | continue; |
475 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 475 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
476 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 476 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
477 | if ( head == NULL ) | 477 | if ( head == NULL ) |
478 | continue; | 478 | continue; |
479 | if ( head->env_date != NULL ) { | 479 | if ( head->env_date != NULL ) { |
480 | m->setDate(head->env_date); | 480 | m->setDate(head->env_date); |
481 | struct mailimf_date_time result; | 481 | //struct mailimf_date_time result; |
482 | struct mailimf_date_time* date = &result; | 482 | struct mailimf_date_time* date;// = &result; |
483 | struct mailimf_date_time **re = &date; | 483 | struct mailimf_date_time **re = &date; |
484 | size_t length = m->getDate().length(); | 484 | size_t length = m->getDate().length(); |
485 | size_t index = 0; | 485 | size_t index = 0; |
486 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 486 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
487 | QDateTime dt = Genericwrapper::parseDateTime( date ); | 487 | QDateTime dt = Genericwrapper::parseDateTime( date ); |
488 | QString ret; | 488 | QString ret; |
489 | if ( dt.date() == QDate::currentDate () ) | 489 | if ( dt.date() == QDate::currentDate () ) |
490 | ret = KGlobal::locale()->formatTime( dt.time(),true); | 490 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
491 | else { | 491 | else { |
492 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | 492 | ret = KGlobal::locale()->formatDateTime( dt,true,true); |
493 | } | 493 | } |
494 | m->setDate( ret ); | 494 | m->setDate( ret ); |
495 | char tmp[20]; | 495 | char tmp[20]; |
496 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | 496 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", |
497 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | 497 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); |
498 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); | 498 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); |
499 | m->setIsoDate( QString( tmp ) ); | 499 | m->setIsoDate( QString( tmp ) ); |
500 | mailimf_date_time_free ( date ); | ||
500 | } else { | 501 | } else { |
501 | m->setIsoDate(head->env_date); | 502 | m->setIsoDate(head->env_date); |
502 | } | 503 | } |
503 | } | 504 | } |
504 | if ( head->env_subject != NULL ) | 505 | if ( head->env_subject != NULL ) |
505 | m->setSubject(convert_String((const char*)head->env_subject)); | 506 | m->setSubject(convert_String((const char*)head->env_subject)); |
506 | //m->setSubject(head->env_subject); | 507 | //m->setSubject(head->env_subject); |
507 | if (head->env_from!=NULL) { | 508 | if (head->env_from!=NULL) { |
508 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 509 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
509 | if (addresslist.count()) { | 510 | if (addresslist.count()) { |
510 | m->setFrom(addresslist.first()); | 511 | m->setFrom(addresslist.first()); |
511 | } | 512 | } |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 5d2c0ad..04afe7c 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -11,25 +11,26 @@ | |||
11 | #define IMAP_PORT "143" | 11 | #define IMAP_PORT "143" |
12 | #define IMAP_SSL_PORT "993" | 12 | #define IMAP_SSL_PORT "993" |
13 | #define SMTP_PORT "25" | 13 | #define SMTP_PORT "25" |
14 | #define SMTP_SSL_PORT "465" | 14 | #define SMTP_SSL_PORT "465" |
15 | #define POP3_PORT "110" | 15 | #define POP3_PORT "110" |
16 | #define POP3_SSL_PORT "995" | 16 | #define POP3_SSL_PORT "995" |
17 | #define NNTP_PORT "119" | 17 | #define NNTP_PORT "119" |
18 | #define NNTP_SSL_PORT "563" | 18 | #define NNTP_SSL_PORT "563" |
19 | 19 | ||
20 | 20 | ||
21 | Settings::Settings() | 21 | Settings::Settings() |
22 | : QObject() | 22 | : QObject() |
23 | { | 23 | { |
24 | accounts.setAutoDelete( true ); ; | ||
24 | updateAccounts(); | 25 | updateAccounts(); |
25 | //qDebug("++++++++++++++++++new settings "); | 26 | //qDebug("++++++++++++++++++new settings "); |
26 | } | 27 | } |
27 | 28 | ||
28 | void Settings::checkDirectory() | 29 | void Settings::checkDirectory() |
29 | { | 30 | { |
30 | return; | 31 | return; |
31 | locateLocal("data", "kopiemail" ); | 32 | locateLocal("data", "kopiemail" ); |
32 | /* | 33 | /* |
33 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 34 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
34 | system( "mkdir -p $HOME/Applications/opiemail" ); | 35 | system( "mkdir -p $HOME/Applications/opiemail" ); |
35 | qDebug("$HOME/Applications/opiemail created "); | 36 | qDebug("$HOME/Applications/opiemail created "); |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 8d16ae7..af5376f 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -14,24 +14,25 @@ | |||
14 | #include "composemail.h" | 14 | #include "composemail.h" |
15 | #include "mailistviewitem.h" | 15 | #include "mailistviewitem.h" |
16 | #include "viewmail.h" | 16 | #include "viewmail.h" |
17 | #include "selectstore.h" | 17 | #include "selectstore.h" |
18 | #include "selectsmtp.h" | 18 | #include "selectsmtp.h" |
19 | #include "accountitem.h" | 19 | #include "accountitem.h" |
20 | #include "klocale.h" | 20 | #include "klocale.h" |
21 | 21 | ||
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qpe/global.h> | ||
26 | 27 | ||
27 | #ifdef DESKTOP_VERSION | 28 | #ifdef DESKTOP_VERSION |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #else | 30 | #else |
30 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
31 | #endif | 32 | #endif |
32 | #include <libmailwrapper/smtpwrapper.h> | 33 | #include <libmailwrapper/smtpwrapper.h> |
33 | #include <libmailwrapper/mailtypes.h> | 34 | #include <libmailwrapper/mailtypes.h> |
34 | #include <libmailwrapper/abstractmail.h> | 35 | #include <libmailwrapper/abstractmail.h> |
35 | 36 | ||
36 | //using namespace Opie::Core; | 37 | //using namespace Opie::Core; |
37 | 38 | ||
@@ -180,50 +181,55 @@ void OpieMail::slotSendQueued() | |||
180 | { | 181 | { |
181 | if ( it->getType() == MAILLIB::A_SMTP ) | 182 | if ( it->getType() == MAILLIB::A_SMTP ) |
182 | { | 183 | { |
183 | smtp = static_cast<SMTPaccount *>(it); | 184 | smtp = static_cast<SMTPaccount *>(it); |
184 | smtpList.append(smtp); | 185 | smtpList.append(smtp); |
185 | } | 186 | } |
186 | } | 187 | } |
187 | if (smtpList.count()==0) | 188 | if (smtpList.count()==0) |
188 | { | 189 | { |
189 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); | 190 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); |
190 | return; | 191 | return; |
191 | } | 192 | } |
193 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | ||
194 | return; | ||
192 | if (smtpList.count()==1) | 195 | if (smtpList.count()==1) |
193 | { | 196 | { |
194 | smtp = smtpList.at(0); | 197 | smtp = smtpList.at(0); |
195 | } | 198 | } |
196 | else | 199 | else |
197 | { | 200 | { |
198 | smtp = 0; | 201 | smtp = 0; |
199 | selectsmtp selsmtp; | 202 | selectsmtp selsmtp; |
200 | selsmtp.setSelectionlist(&smtpList); | 203 | selsmtp.setSelectionlist(&smtpList); |
201 | #ifndef DESKTOP_VERSION | 204 | #ifndef DESKTOP_VERSION |
202 | selsmtp.showMaximized(); | 205 | selsmtp.showMaximized(); |
203 | #endif | 206 | #endif |
204 | if ( selsmtp.exec() == QDialog::Accepted ) | 207 | if ( selsmtp.exec() == QDialog::Accepted ) |
205 | { | 208 | { |
206 | smtp = selsmtp.selected_smtp(); | 209 | smtp = selsmtp.selected_smtp(); |
207 | } | 210 | } |
208 | } | 211 | } |
209 | if (smtp) | 212 | if (smtp) |
210 | { | 213 | { |
214 | |||
215 | Global::statusMessage("Sending mails...!"); | ||
211 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 216 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
212 | if ( wrap->flushOutbox() ) | 217 | if ( wrap->flushOutbox() ) |
213 | { | 218 | { |
214 | QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); | 219 | Global::statusMessage("Mails sent!"); |
215 | } | 220 | } |
216 | delete wrap; | 221 | delete wrap; |
217 | } | 222 | } |
223 | // pending refresh list view, if outgoing is displayed | ||
218 | } | 224 | } |
219 | 225 | ||
220 | void OpieMail::slotSearchMails() | 226 | void OpieMail::slotSearchMails() |
221 | { | 227 | { |
222 | qDebug("OpieMail::slotSearchMails():not implemented "); | 228 | qDebug("OpieMail::slotSearchMails():not implemented "); |
223 | } | 229 | } |
224 | 230 | ||
225 | void OpieMail::slotEditSettings() | 231 | void OpieMail::slotEditSettings() |
226 | { | 232 | { |
227 | 233 | ||
228 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 234 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
229 | #ifndef DESKTOP_VERSION | 235 | #ifndef DESKTOP_VERSION |
@@ -421,24 +427,25 @@ void OpieMail::slotShowFolders( bool show ) | |||
421 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 427 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
422 | { | 428 | { |
423 | MailListViewItem*item = 0; | 429 | MailListViewItem*item = 0; |
424 | mailView->clear(); | 430 | mailView->clear(); |
425 | 431 | ||
426 | QValueList<RecMailP>::ConstIterator it; | 432 | QValueList<RecMailP>::ConstIterator it; |
427 | for (it = list.begin(); it != list.end();++it) | 433 | for (it = list.begin(); it != list.end();++it) |
428 | { | 434 | { |
429 | item = new MailListViewItem(mailView,item); | 435 | item = new MailListViewItem(mailView,item); |
430 | item->storeData((*it)); | 436 | item->storeData((*it)); |
431 | item->showEntry(); | 437 | item->showEntry(); |
432 | } | 438 | } |
439 | mailView->setSorting ( 4, false ); | ||
433 | } | 440 | } |
434 | 441 | ||
435 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 442 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
436 | { | 443 | { |
437 | mailView->clearSelection(); | 444 | mailView->clearSelection(); |
438 | /* just LEFT button - or tap with stylus on pda */ | 445 | /* just LEFT button - or tap with stylus on pda */ |
439 | //if (button!=1) return; | 446 | //if (button!=1) return; |
440 | if (!item) return; | 447 | if (!item) return; |
441 | if (folderView->currentisDraft()) { | 448 | if (folderView->currentisDraft()) { |
442 | reEditMail(); | 449 | reEditMail(); |
443 | } else { | 450 | } else { |
444 | displayMail(); | 451 | displayMail(); |