-rw-r--r-- | kmicromail/accountitem.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 35 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 20 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 4 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 5 |
8 files changed, 63 insertions, 28 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 7795055..49d86fc 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -289,33 +289,33 @@ void NNTPviewItem::refresh() | |||
289 | 289 | ||
290 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 290 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
291 | { | 291 | { |
292 | 292 | ||
293 | return wrapper->fetchBody( mail ); | 293 | return wrapper->fetchBody( mail ); |
294 | } | 294 | } |
295 | 295 | ||
296 | QPopupMenu * NNTPviewItem::getContextMenu() | 296 | QPopupMenu * NNTPviewItem::getContextMenu() |
297 | { | 297 | { |
298 | QPopupMenu *m = new QPopupMenu(0); | 298 | QPopupMenu *m = new QPopupMenu(0); |
299 | if (m) | 299 | if (m) |
300 | { | 300 | { |
301 | if (!account->getOffline()) | 301 | if (!account->getOffline()) |
302 | { | 302 | { |
303 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 303 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
304 | m->insertItem(QObject::tr("Set offline",contextName),1); | 304 | m->insertItem(QObject::tr("Set offline",contextName),1); |
305 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 305 | //m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
306 | } | 306 | } |
307 | else | 307 | else |
308 | { | 308 | { |
309 | m->insertItem(QObject::tr("Set online",contextName),1); | 309 | m->insertItem(QObject::tr("Set online",contextName),1); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | return m; | 312 | return m; |
313 | } | 313 | } |
314 | 314 | ||
315 | void NNTPviewItem::subscribeGroups() | 315 | void NNTPviewItem::subscribeGroups() |
316 | { | 316 | { |
317 | NNTPGroupsDlg dlg(account); | 317 | NNTPGroupsDlg dlg(account); |
318 | dlg.showMaximized(); | 318 | dlg.showMaximized(); |
319 | if ( dlg.exec()== QDialog::Accepted ){ | 319 | if ( dlg.exec()== QDialog::Accepted ){ |
320 | refresh(); | 320 | refresh(); |
321 | } | 321 | } |
@@ -746,35 +746,34 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
746 | view->refreshCurrent(); | 746 | view->refreshCurrent(); |
747 | break; | 747 | break; |
748 | case 1: | 748 | case 1: |
749 | deleteAllMail(imap->getWrapper(),folder); | 749 | deleteAllMail(imap->getWrapper(),folder); |
750 | break; | 750 | break; |
751 | case 2: | 751 | case 2: |
752 | createNewFolder(); | 752 | createNewFolder(); |
753 | break; | 753 | break; |
754 | case 3: | 754 | case 3: |
755 | deleteFolder(); | 755 | deleteFolder(); |
756 | break; | 756 | break; |
757 | case 4: | 757 | case 4: |
758 | downloadMails(); | 758 | downloadMails(); |
759 | break; | 759 | break; |
760 | case GET_NEW_MAILS: // daunlood | 760 | case GET_NEW_MAILS: // daunlood |
761 | { | 761 | { |
762 | AccountView*bl = accountView(); | 762 | if (!view) return; |
763 | if (!bl) return; | 763 | view->downloadMailsInbox(getFolder(),imap->getWrapper()); |
764 | bl->downloadMailsInbox(getFolder(),imap->getWrapper()); | ||
765 | } | 764 | } |
766 | break; | 765 | break; |
767 | default: | 766 | default: |
768 | break; | 767 | break; |
769 | } | 768 | } |
770 | } | 769 | } |
771 | 770 | ||
772 | /** | 771 | /** |
773 | * MH Account stuff | 772 | * MH Account stuff |
774 | */ | 773 | */ |
775 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 774 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
776 | POP3 and MBOX */ | 775 | POP3 and MBOX */ |
777 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 776 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
778 | : AccountViewItem( parent ) | 777 | : AccountViewItem( parent ) |
779 | { | 778 | { |
780 | m_Path = aPath; | 779 | m_Path = aPath; |
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 8f67566..88545f8 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -191,32 +191,33 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe | |||
191 | int iii = 0; | 191 | int iii = 0; |
192 | int count = t.count(); | 192 | int count = t.count(); |
193 | while (iii < count ) { | 193 | while (iii < count ) { |
194 | RecMailP r = (*t.at( iii )); | 194 | RecMailP r = (*t.at( iii )); |
195 | bool found = false; | 195 | bool found = false; |
196 | int jjj = 0; | 196 | int jjj = 0; |
197 | int countE = e.count(); | 197 | int countE = e.count(); |
198 | while (jjj < countE ) { | 198 | while (jjj < countE ) { |
199 | RecMailP re = (*e.at( jjj )); | 199 | RecMailP re = (*e.at( jjj )); |
200 | if ( re->isEqual(r) ) { | 200 | if ( re->isEqual(r) ) { |
201 | found = true; | 201 | found = true; |
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | ++jjj; | 204 | ++jjj; |
205 | } | 205 | } |
206 | if ( !found ) { | 206 | if ( !found ) { |
207 | //qDebug("AAAdate *%s* ", r->isodate.latin1() ); | ||
207 | n.append( r ); | 208 | n.append( r ); |
208 | } | 209 | } |
209 | ++iii; | 210 | ++iii; |
210 | } | 211 | } |
211 | if ( n.count() == 0 ) { | 212 | if ( n.count() == 0 ) { |
212 | Global::statusMessage(tr("There are no new messages")); | 213 | Global::statusMessage(tr("There are no new messages")); |
213 | return; | 214 | return; |
214 | } | 215 | } |
215 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | 216 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); |
216 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); | 217 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); |
217 | 218 | ||
218 | #if 0 | 219 | #if 0 |
219 | QValueList<RecMailP> t; | 220 | QValueList<RecMailP> t; |
220 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 221 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
221 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 222 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
222 | #endif | 223 | #endif |
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index c3a1627..d99c6a3 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp | |||
@@ -14,85 +14,93 @@ Genericwrapper::Genericwrapper() | |||
14 | { | 14 | { |
15 | bodyCache.clear(); | 15 | bodyCache.clear(); |
16 | m_storage = 0; | 16 | m_storage = 0; |
17 | m_folder = 0; | 17 | m_folder = 0; |
18 | } | 18 | } |
19 | 19 | ||
20 | Genericwrapper::~Genericwrapper() | 20 | Genericwrapper::~Genericwrapper() |
21 | { | 21 | { |
22 | if (m_folder) { | 22 | if (m_folder) { |
23 | mailfolder_free(m_folder); | 23 | mailfolder_free(m_folder); |
24 | } | 24 | } |
25 | if (m_storage) { | 25 | if (m_storage) { |
26 | mailstorage_free(m_storage); | 26 | mailstorage_free(m_storage); |
27 | } | 27 | } |
28 | cleanMimeCache(); | 28 | cleanMimeCache(); |
29 | } | 29 | } |
30 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | 30 | const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date ) |
31 | { | 31 | { |
32 | static bool init = false ; | 32 | static bool init = false ; |
33 | if ( ! init ) { | 33 | if ( ! init ) { |
34 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); | 34 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); |
35 | kon.setGroup("Locale"); | 35 | kon.setGroup("Locale"); |
36 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); | 36 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); |
37 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); | 37 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); |
38 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); | 38 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); |
39 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 39 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
40 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); | 40 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); |
41 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 41 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
42 | kon.setGroup("Time & Date"); | 42 | kon.setGroup("Time & Date"); |
43 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), | 43 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), |
44 | kon.readNumEntry( "DaylightsavingStart", 90), | 44 | kon.readNumEntry( "DaylightsavingStart", 90), |
45 | kon.readNumEntry( "DaylightsavingEnd",304) ); | 45 | kon.readNumEntry( "DaylightsavingEnd",304) ); |
46 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); | 46 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); |
47 | 47 | ||
48 | init = true; | 48 | init = true; |
49 | 49 | ||
50 | } | 50 | } |
51 | QDate da (date->dt_year,date->dt_month, date->dt_day ); | 51 | QDate da (date->dt_year,date->dt_month, date->dt_day ); |
52 | QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); | 52 | QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); |
53 | QDateTime dt ( da ,ti ); | 53 | QDateTime dt ( da ,ti ); |
54 | int addsec = -date->dt_zone*36; | ||
55 | //qDebug("adsec1 %d ",addsec ); | ||
56 | dt = dt.addSecs( addsec ); | ||
54 | int off = KGlobal::locale()->localTimeOffset( dt ); | 57 | int off = KGlobal::locale()->localTimeOffset( dt ); |
55 | //dt = dt.addSecs( off*60 ); | 58 | //qDebug("adsec2 %d ",off*60 ); |
59 | |||
60 | dt = dt.addSecs( off*60 ); | ||
61 | return dt; | ||
62 | #if 0 | ||
56 | QString ret; | 63 | QString ret; |
57 | if ( da == QDate::currentDate () ) | 64 | if ( dt.date() == QDate::currentDate () ) |
58 | ret = KGlobal::locale()->formatTime( ti,true); | 65 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
59 | 66 | ||
60 | else { | 67 | else { |
61 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | 68 | ret = KGlobal::locale()->formatDateTime( dt,true,true); |
62 | } | 69 | } |
70 | #endif | ||
63 | #if 0 | 71 | #if 0 |
64 | if ( off < 0 ) | 72 | if ( off < 0 ) |
65 | ret += " -"; | 73 | ret += " -"; |
66 | else | 74 | else |
67 | ret += " +"; | 75 | ret += " +"; |
68 | ret += QString::number( off / 60 ); | 76 | ret += QString::number( off / 60 ); |
69 | ret += "h"; | 77 | ret += "h"; |
70 | #endif | 78 | #endif |
71 | #if 0 | 79 | #if 0 |
72 | char tmp[23]; | 80 | char tmp[23]; |
73 | 81 | ||
74 | // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | 82 | // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", |
75 | // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 83 | // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
76 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", | 84 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", |
77 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 85 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
78 | 86 | ||
79 | 87 | ||
80 | return QString( tmp ); | 88 | return QString( tmp ); |
81 | #endif | 89 | #endif |
82 | return ret; | 90 | //return ret; |
83 | } | 91 | } |
84 | 92 | ||
85 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) | 93 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) |
86 | { | 94 | { |
87 | if (!mime) { | 95 | if (!mime) { |
88 | return; | 96 | return; |
89 | } | 97 | } |
90 | mailmime_field*field = 0; | 98 | mailmime_field*field = 0; |
91 | mailmime_single_fields fields; | 99 | mailmime_single_fields fields; |
92 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 100 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
93 | if (mime->mm_mime_fields != NULL) { | 101 | if (mime->mm_mime_fields != NULL) { |
94 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | 102 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, |
95 | mime->mm_content_type); | 103 | mime->mm_content_type); |
96 | } | 104 | } |
97 | 105 | ||
98 | mailmime_content*type = fields.fld_content; | 106 | mailmime_content*type = fields.fld_content; |
@@ -482,37 +490,44 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
482 | mail->setNumber(msg->msg_index); | 490 | mail->setNumber(msg->msg_index); |
483 | if (single_fields.fld_subject) | 491 | if (single_fields.fld_subject) |
484 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 492 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
485 | if (single_fields.fld_from) | 493 | if (single_fields.fld_from) |
486 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 494 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
487 | if (!mbox_as_to) { | 495 | if (!mbox_as_to) { |
488 | if (single_fields.fld_to) | 496 | if (single_fields.fld_to) |
489 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 497 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
490 | } else { | 498 | } else { |
491 | mail->setTo(mailbox); | 499 | mail->setTo(mailbox); |
492 | } | 500 | } |
493 | if (single_fields.fld_cc) | 501 | if (single_fields.fld_cc) |
494 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 502 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
495 | if (single_fields.fld_bcc) | 503 | if (single_fields.fld_bcc) |
496 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 504 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
497 | if (single_fields.fld_orig_date) { | 505 | if (single_fields.fld_orig_date) { |
498 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 506 | QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); |
499 | char tmp[23]; | 507 | QString ret; |
500 | struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time; | 508 | if ( dt.date() == QDate::currentDate () ) |
501 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | 509 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
502 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 510 | else { |
511 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | ||
512 | } | ||
513 | mail->setDate( ret ); | ||
514 | char tmp[20]; | ||
515 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | ||
516 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | ||
517 | //qDebug(" iso %s ", tmp); | ||
503 | mail->setIsoDate( QString( tmp ) ); | 518 | mail->setIsoDate( QString( tmp ) ); |
504 | } | 519 | } |
505 | // crashes when accessing pop3 account? | 520 | // crashes when accessing pop3 account? |
506 | if (single_fields.fld_message_id) { | 521 | if (single_fields.fld_message_id) { |
507 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 522 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
508 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; | 523 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; |
509 | } | 524 | } |
510 | if (single_fields.fld_reply_to) { | 525 | if (single_fields.fld_reply_to) { |
511 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 526 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |
512 | if (t.count()>0) { | 527 | if (t.count()>0) { |
513 | mail->setReplyto(t[0]); | 528 | mail->setReplyto(t[0]); |
514 | } | 529 | } |
515 | } | 530 | } |
516 | #if 0 | 531 | #if 0 |
517 | refs = single_fields.fld_references; | 532 | refs = single_fields.fld_references; |
518 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 533 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 244212f..c35a6da 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h | |||
@@ -29,33 +29,33 @@ struct mailimf_in_reply_to; | |||
29 | * it is not desigend to make a instance of it! | 29 | * it is not desigend to make a instance of it! |
30 | */ | 30 | */ |
31 | class Genericwrapper : public AbstractMail | 31 | class Genericwrapper : public AbstractMail |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | public: | 34 | public: |
35 | Genericwrapper(); | 35 | Genericwrapper(); |
36 | virtual ~Genericwrapper(); | 36 | virtual ~Genericwrapper(); |
37 | 37 | ||
38 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); | 38 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
39 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 39 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
40 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); | 40 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
41 | virtual void cleanMimeCache(); | 41 | virtual void cleanMimeCache(); |
42 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} | 42 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} |
43 | virtual void logout(){}; | 43 | virtual void logout(){}; |
44 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | 44 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; |
45 | static QString parseDateTime( mailimf_date_time *date ); | 45 | static const QDateTime parseDateTime( mailimf_date_time *date ); |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | RecBodyP parseMail( mailmessage * msg ); | 48 | RecBodyP parseMail( mailmessage * msg ); |
49 | QString parseMailboxList( mailimf_mailbox_list *list ); | 49 | QString parseMailboxList( mailimf_mailbox_list *list ); |
50 | QString parseMailbox( mailimf_mailbox *box ); | 50 | QString parseMailbox( mailimf_mailbox *box ); |
51 | QString parseGroup( mailimf_group *group ); | 51 | QString parseGroup( mailimf_group *group ); |
52 | QString parseAddressList( mailimf_address_list *list ); | 52 | QString parseAddressList( mailimf_address_list *list ); |
53 | 53 | ||
54 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 54 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
55 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); | 55 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); |
56 | static void fillParameters(RecPartP&target,clist*parameters); | 56 | static void fillParameters(RecPartP&target,clist*parameters); |
57 | static QString getencoding(mailmime_mechanism*aEnc); | 57 | static QString getencoding(mailmime_mechanism*aEnc); |
58 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); | 58 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); |
59 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); | 59 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); |
60 | 60 | ||
61 | QString msgTempName; | 61 | QString msgTempName; |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d79df4f..b0dd1b8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,26 +1,27 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include "imapwrapper.h" | 6 | #include "imapwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include "logindialog.h" | 8 | #include "logindialog.h" |
9 | #include <qprogressbar.h> | 9 | #include <qprogressbar.h> |
10 | #include "genericwrapper.h" | 10 | #include "genericwrapper.h" |
11 | #include <kglobal.h> | ||
11 | 12 | ||
12 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
13 | int IMAPwrapper::mMax = 0; | 14 | int IMAPwrapper::mMax = 0; |
14 | int IMAPwrapper::mCurrent = 0; | 15 | int IMAPwrapper::mCurrent = 0; |
15 | 16 | ||
16 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 17 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
17 | : AbstractMail() | 18 | : AbstractMail() |
18 | { | 19 | { |
19 | account = a; | 20 | account = a; |
20 | m_imap = 0; | 21 | m_imap = 0; |
21 | m_Lastmbox = ""; | 22 | m_Lastmbox = ""; |
22 | mCurrent = 0; | 23 | mCurrent = 0; |
23 | mMax = 0; | 24 | mMax = 0; |
24 | } | 25 | } |
25 | 26 | ||
26 | IMAPwrapper::~IMAPwrapper() | 27 | IMAPwrapper::~IMAPwrapper() |
@@ -452,36 +453,44 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
452 | continue; | 453 | continue; |
453 | } | 454 | } |
454 | if ( item->att_data.att_static == NULL ) | 455 | if ( item->att_data.att_static == NULL ) |
455 | continue; | 456 | continue; |
456 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 457 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
457 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 458 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
458 | if ( head == NULL ) | 459 | if ( head == NULL ) |
459 | continue; | 460 | continue; |
460 | if ( head->env_date != NULL ) { | 461 | if ( head->env_date != NULL ) { |
461 | m->setDate(head->env_date); | 462 | m->setDate(head->env_date); |
462 | struct mailimf_date_time result; | 463 | struct mailimf_date_time result; |
463 | struct mailimf_date_time* date = &result; | 464 | struct mailimf_date_time* date = &result; |
464 | struct mailimf_date_time **re = &date; | 465 | struct mailimf_date_time **re = &date; |
465 | size_t length = m->getDate().length(); | 466 | size_t length = m->getDate().length(); |
466 | size_t index = 0; | 467 | size_t index = 0; |
467 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 468 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
468 | m->setDate( Genericwrapper::parseDateTime( date ) ); | 469 | QDateTime dt = Genericwrapper::parseDateTime( date ); |
469 | char tmp[23]; | 470 | QString ret; |
470 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | 471 | if ( dt.date() == QDate::currentDate () ) |
471 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 472 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
473 | else { | ||
474 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | ||
475 | } | ||
476 | m->setDate( ret ); | ||
477 | char tmp[20]; | ||
478 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | ||
479 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | ||
480 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); | ||
472 | m->setIsoDate( QString( tmp ) ); | 481 | m->setIsoDate( QString( tmp ) ); |
473 | } else { | 482 | } else { |
474 | m->setIsoDate(head->env_date); | 483 | m->setIsoDate(head->env_date); |
475 | } | 484 | } |
476 | } | 485 | } |
477 | if ( head->env_subject != NULL ) | 486 | if ( head->env_subject != NULL ) |
478 | m->setSubject(convert_String((const char*)head->env_subject)); | 487 | m->setSubject(convert_String((const char*)head->env_subject)); |
479 | //m->setSubject(head->env_subject); | 488 | //m->setSubject(head->env_subject); |
480 | if (head->env_from!=NULL) { | 489 | if (head->env_from!=NULL) { |
481 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 490 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
482 | if (addresslist.count()) { | 491 | if (addresslist.count()) { |
483 | m->setFrom(addresslist.first()); | 492 | m->setFrom(addresslist.first()); |
484 | } | 493 | } |
485 | } | 494 | } |
486 | if (head->env_to!=NULL) { | 495 | if (head->env_to!=NULL) { |
487 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 496 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 1a4ffd1..af3b9d0 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -20,42 +20,48 @@ RecMail::RecMail(const RecMail&old) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | RecMail::~RecMail() | 22 | RecMail::~RecMail() |
23 | { | 23 | { |
24 | wrapper = 0; | 24 | wrapper = 0; |
25 | } | 25 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) |
27 | { | 27 | { |
28 | if ( s1.isEmpty() && s2.isEmpty() ) | 28 | if ( s1.isEmpty() && s2.isEmpty() ) |
29 | return true; | 29 | return true; |
30 | return s1 == s2; | 30 | return s1 == s2; |
31 | } | 31 | } |
32 | 32 | ||
33 | bool RecMail::isEqual( RecMail* r1 ) | 33 | bool RecMail::isEqual( RecMail* r1 ) |
34 | { | 34 | { |
35 | if ( !stringCompareRec( isodate, r1->isodate ) ) { | 35 | if ( !stringCompareRec( isodate, r1->isodate ) ) { |
36 | // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 36 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | if ( !stringCompareRec( from, r1->from ) ) { | 39 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { |
40 | //qDebug("from *%s* *%s* ", from.latin1(), r1->from.latin1()); | 40 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); |
41 | return false; | 41 | return false; |
42 | } | 42 | } |
43 | if ( !stringCompareRec( subject, r1->subject ) ) { | 43 | |
44 | //qDebug("sub "); | 44 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
45 | return false; | 45 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { |
46 | if ( r1->from.find ( from ) < 0 ) { | ||
47 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { | ||
48 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); | ||
49 | return false; | ||
50 | } | ||
51 | } | ||
46 | } | 52 | } |
47 | 53 | ||
48 | return true; | 54 | return true; |
49 | } | 55 | } |
50 | void RecMail::copy_old(const RecMail&old) | 56 | void RecMail::copy_old(const RecMail&old) |
51 | { | 57 | { |
52 | subject = old.subject; | 58 | subject = old.subject; |
53 | date = old.date; | 59 | date = old.date; |
54 | mbox = old.mbox; | 60 | mbox = old.mbox; |
55 | msg_id = old.msg_id; | 61 | msg_id = old.msg_id; |
56 | msg_size = old.msg_size; | 62 | msg_size = old.msg_size; |
57 | msg_number = old.msg_number; | 63 | msg_number = old.msg_number; |
58 | from = old.from; | 64 | from = old.from; |
59 | msg_flags = old.msg_flags; | 65 | msg_flags = old.msg_flags; |
60 | to = old.to; | 66 | to = old.to; |
61 | cc = old.cc; | 67 | cc = old.cc; |
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index 020278d..c1c1a74 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h | |||
@@ -60,35 +60,37 @@ public: | |||
60 | void setTo(const QStringList&list); | 60 | void setTo(const QStringList&list); |
61 | const QStringList&To()const; | 61 | const QStringList&To()const; |
62 | void setCC(const QStringList&list); | 62 | void setCC(const QStringList&list); |
63 | const QStringList&CC()const; | 63 | const QStringList&CC()const; |
64 | void setBcc(const QStringList&list); | 64 | void setBcc(const QStringList&list); |
65 | const QStringList&Bcc()const; | 65 | const QStringList&Bcc()const; |
66 | void setInreply(const QStringList&list); | 66 | void setInreply(const QStringList&list); |
67 | const QStringList&Inreply()const; | 67 | const QStringList&Inreply()const; |
68 | void setReferences(const QStringList&list); | 68 | void setReferences(const QStringList&list); |
69 | const QStringList&References()const; | 69 | const QStringList&References()const; |
70 | 70 | ||
71 | const QBitArray&getFlags()const{return msg_flags;} | 71 | const QBitArray&getFlags()const{return msg_flags;} |
72 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 72 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
73 | 73 | ||
74 | void setWrapper(AbstractMail*wrapper); | 74 | void setWrapper(AbstractMail*wrapper); |
75 | AbstractMail* Wrapper(); | 75 | AbstractMail* Wrapper(); |
76 | // public for debugging | ||
77 | QString subject,date,isodate,from,mbox,msg_id,replyto; | ||
76 | 78 | ||
77 | protected: | 79 | protected: |
78 | QString subject,date,isodate,from,mbox,msg_id,replyto; | 80 | //QString subject,date,isodate,from,mbox,msg_id,replyto; |
79 | unsigned int msg_number,msg_size; | 81 | unsigned int msg_number,msg_size; |
80 | QBitArray msg_flags; | 82 | QBitArray msg_flags; |
81 | QStringList to,cc,bcc,in_reply_to,references; | 83 | QStringList to,cc,bcc,in_reply_to,references; |
82 | AbstractMail*wrapper; | 84 | AbstractMail*wrapper; |
83 | void init(); | 85 | void init(); |
84 | void copy_old(const RecMail&old); | 86 | void copy_old(const RecMail&old); |
85 | }; | 87 | }; |
86 | 88 | ||
87 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 89 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
88 | typedef QMap<QString,QString> part_plist_t; | 90 | typedef QMap<QString,QString> part_plist_t; |
89 | 91 | ||
90 | class RecPart:public Opie::Core::ORefCount | 92 | class RecPart:public Opie::Core::ORefCount |
91 | { | 93 | { |
92 | protected: | 94 | protected: |
93 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 95 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
94 | unsigned int m_lines,m_size; | 96 | unsigned int m_lines,m_size; |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 7ccfb65..3cbac8e 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -308,33 +308,36 @@ void OpieMail::clearSelection() | |||
308 | mailView->clearSelection(); | 308 | mailView->clearSelection(); |
309 | 309 | ||
310 | } | 310 | } |
311 | 311 | ||
312 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 312 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
313 | { | 313 | { |
314 | if (!mailView->currentItem()) return; | 314 | if (!mailView->currentItem()) return; |
315 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 315 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
316 | /* just the RIGHT button - or hold on pda */ | 316 | /* just the RIGHT button - or hold on pda */ |
317 | if (button!=2) {return;} | 317 | if (button!=2) {return;} |
318 | if (!item) return; | 318 | if (!item) return; |
319 | QPopupMenu *m = new QPopupMenu(0); | 319 | QPopupMenu *m = new QPopupMenu(0); |
320 | if (m) | 320 | if (m) |
321 | { | 321 | { |
322 | if (mailtype==MAILLIB::A_NNTP) { | 322 | if (mailtype==MAILLIB::A_NNTP) { |
323 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 323 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
324 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 324 | m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
325 | m->insertSeparator(); | ||
326 | m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | ||
327 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | ||
325 | } else { | 328 | } else { |
326 | if (folderView->currentisDraft()) { | 329 | if (folderView->currentisDraft()) { |
327 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 330 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
328 | } | 331 | } |
329 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 332 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
330 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 333 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
331 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 334 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
332 | m->insertSeparator(); | 335 | m->insertSeparator(); |
333 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 336 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
334 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 337 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
335 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 338 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
336 | } | 339 | } |
337 | m->setFocus(); | 340 | m->setFocus(); |
338 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 341 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
339 | delete m; | 342 | delete m; |
340 | } | 343 | } |