summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/mailstatics.cpp25
-rw-r--r--noncore/net/mail/libmailwrapper/mailstatics.h4
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp28
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h11
-rw-r--r--noncore/net/mail/mailistviewitem.cpp20
-rw-r--r--noncore/net/mail/mailistviewitem.h1
-rw-r--r--noncore/net/mail/mainwindow.cpp17
-rw-r--r--noncore/net/mail/viewmail.cpp6
10 files changed, 81 insertions, 46 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 703235d..0ac842d 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -385,5 +385,5 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
385void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) 385void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
386{ 386{
387 int r; 387 int r,toffset;
388 mailmessage_list * env_list = 0; 388 mailmessage_list * env_list = 0;
389 r = mailsession_get_messages_list(session,&env_list); 389 r = mailsession_get_messages_list(session,&env_list);
@@ -438,11 +438,11 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
438 if (single_fields.fld_bcc) 438 if (single_fields.fld_bcc)
439 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 439 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
440 if (single_fields.fld_orig_date) 440 if (single_fields.fld_orig_date) {
441 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 441 QDateTime d = parseDateTime( single_fields.fld_orig_date->dt_date_time,toffset);
442 // crashes when accessing pop3 account? 442 mail->setDate( d,toffset );
443 }
443 if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) { 444 if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) {
444 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 445 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
445 } 446 }
446
447 if (single_fields.fld_reply_to) { 447 if (single_fields.fld_reply_to) {
448 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); 448 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 56efa0b..8e5212b 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -373,5 +373,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
373 mailimap_msg_att_dynamic*flist; 373 mailimap_msg_att_dynamic*flist;
374 mailimap_flag_fetch*cflag; 374 mailimap_flag_fetch*cflag;
375 int size; 375 int size,toffset;
376 QBitArray mFlags(7); 376 QBitArray mFlags(7);
377 QStringList addresslist; 377 QStringList addresslist;
@@ -425,5 +425,6 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
425 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { 425 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
426 mailimap_envelope * head = item->att_data.att_static->att_data.att_env; 426 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
427 m->setDate(parseDateTime(head->env_date)); 427 QDateTime d = parseDateTime(head->env_date,toffset);
428 m->setDate(d,toffset);
428 m->setSubject(convert_String((const char*)head->env_subject)); 429 m->setSubject(convert_String((const char*)head->env_subject));
429 if (head->env_from!=NULL) { 430 if (head->env_from!=NULL) {
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.cpp b/noncore/net/mail/libmailwrapper/mailstatics.cpp
index 4878dc9..033ec28 100644
--- a/noncore/net/mail/libmailwrapper/mailstatics.cpp
+++ b/noncore/net/mail/libmailwrapper/mailstatics.cpp
@@ -1,25 +1,26 @@
1#include "mailstatics.h" 1#include "mailstatics.h"
2#include <libetpan/libetpan.h> 2#include <libetpan/libetpan.h>
3#include <qpe/timestring.h> 3//#include <qpe/timestring.h>
4 4
5QString MailStatics::parseDateTime(const mailimf_date_time *date ) 5QDateTime MailStatics::parseDateTime(const mailimf_date_time *date,int&offset )
6{ 6{
7 if (!date) return ""; 7 offset = 0;
8 if (!date) {
9 return QDateTime();
10 }
8 QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); 11 QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
9 QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; 12 offset = date->dt_zone;
10 timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; 13 return da;
11 timestring.sprintf(timestring+" %+05i",date->dt_zone);
12 return timestring;
13} 14}
14 15
15QString MailStatics::parseDateTime(const char*date) 16QDateTime MailStatics::parseDateTime(const char*date,int&offset)
16{ 17{
17 mailimf_date_time * date_time; 18 mailimf_date_time * date_time=0;
18 QString d = ""; 19 QDateTime d;
19 size_t cur_tok = 0; 20 size_t cur_tok = 0;
20 if (!date) return d; 21 if (!date) return d;
21 int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); 22 int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time);
22 if (r==MAILIMF_NO_ERROR) { 23 if (r==MAILIMF_NO_ERROR) {
23 d = parseDateTime(date_time); 24 d = parseDateTime(date_time,offset);
24 } 25 }
25 if (date_time) { 26 if (date_time) {
@@ -27,3 +28,3 @@ QString MailStatics::parseDateTime(const char*date)
27 } 28 }
28 return d; 29 return d;
29} \ No newline at end of file 30}
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.h b/noncore/net/mail/libmailwrapper/mailstatics.h
index 841d14d..c714ead 100644
--- a/noncore/net/mail/libmailwrapper/mailstatics.h
+++ b/noncore/net/mail/libmailwrapper/mailstatics.h
@@ -10,6 +10,6 @@ class MailStatics
10{ 10{
11protected: 11protected:
12 static QString parseDateTime(const mailimf_date_time * date); 12 static QDateTime parseDateTime(const mailimf_date_time * date,int&offset);
13 static QString parseDateTime(const char*date); 13 static QDateTime parseDateTime(const char*date,int&offset);
14 MailStatics(){}; 14 MailStatics(){};
15 virtual ~MailStatics(){}; 15 virtual ~MailStatics(){};
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index d4395a2..b009b75 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -2,4 +2,5 @@
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4#include <qpe/timestring.h>
4 5
5#include <stdlib.h> 6#include <stdlib.h>
@@ -7,5 +8,5 @@
7using namespace Opie::Core; 8using namespace Opie::Core;
8RecMail::RecMail() 9RecMail::RecMail()
9 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) 10 :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7),maildate(),date("")
10{ 11{
11 init(); 12 init();
@@ -13,9 +14,9 @@ RecMail::RecMail()
13 14
14RecMail::RecMail(const RecMail&old) 15RecMail::RecMail(const RecMail&old)
15 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) 16 :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7),maildate(),date("")
16{ 17{
17 init(); 18 init();
18 copy_old(old); 19 copy_old(old);
19 odebug << "Copy constructor RecMail" << oendl; 20 odebug << "Copy constructor RecMail" << oendl;
20} 21}
21 22
@@ -28,4 +29,5 @@ void RecMail::copy_old(const RecMail&old)
28{ 29{
29 subject = old.subject; 30 subject = old.subject;
31 maildate = old.maildate;
30 date = old.date; 32 date = old.date;
31 mbox = old.mbox; 33 mbox = old.mbox;
@@ -54,4 +56,15 @@ void RecMail::init()
54} 56}
55 57
58void RecMail::setDate( const QDateTime&a,int offset)
59{
60 QString timestring = TimeString::numberDateString(a.date())+" ";
61 timestring+=TimeString::timeString(a.time());
62 if (offset > 0) {
63 timestring.sprintf(timestring+" %+05i",offset);
64 }
65 date = timestring;
66 maildate = a;
67}
68
56void RecMail::setWrapper(AbstractMail*awrapper) 69void RecMail::setWrapper(AbstractMail*awrapper)
57{ 70{
@@ -135,5 +148,5 @@ RecPart::RecPart(const RecPart&old)
135 m_Parameters = old.m_Parameters; 148 m_Parameters = old.m_Parameters;
136 m_poslist = old.m_poslist; 149 m_poslist = old.m_poslist;
137 odebug << "RecPart copy constructor" << oendl; 150 odebug << "RecPart copy constructor" << oendl;
138} 151}
139 152
@@ -259,5 +272,5 @@ RecBody::RecBody(const RecBody&old)
259 m_PartsList = old.m_PartsList; 272 m_PartsList = old.m_PartsList;
260 m_description = old.m_description; 273 m_description = old.m_description;
261 odebug << "Recbody copy constructor" << oendl; 274 odebug << "Recbody copy constructor" << oendl;
262} 275}
263 276
@@ -324,5 +337,5 @@ encodedString::encodedString(const encodedString&old)
324 init(); 337 init();
325 copy_old(old); 338 copy_old(old);
326 odebug << "encodedeString: copy constructor!" << oendl; 339 odebug << "encodedeString: copy constructor!" << oendl;
327} 340}
328 341
@@ -331,5 +344,5 @@ encodedString& encodedString::operator=(const encodedString&old)
331 init(); 344 init();
332 copy_old(old); 345 copy_old(old);
333 odebug << "encodedString: assign operator!" << oendl; 346 odebug << "encodedString: assign operator!" << oendl;
334 return *this; 347 return *this;
335} 348}
@@ -397,3 +410,2 @@ folderStat&folderStat::operator=(const folderStat&old)
397 return *this; 410 return *this;
398} 411}
399
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index c317880..272514c 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -16,4 +16,5 @@
16#include <qmap.h> 16#include <qmap.h>
17#include <qvaluelist.h> 17#include <qvaluelist.h>
18#include <qdatetime.h>
18 19
19class AbstractMail; 20class AbstractMail;
@@ -39,6 +40,4 @@ public:
39 const unsigned int getNumber()const{return msg_number;} 40 const unsigned int getNumber()const{return msg_number;}
40 void setNumber(unsigned int number){msg_number=number;} 41 void setNumber(unsigned int number){msg_number=number;}
41 const QString&getDate()const{ return date; }
42 void setDate( const QString&a ) { date = a; }
43 const QString&getFrom()const{ return from; } 42 const QString&getFrom()const{ return from; }
44 void setFrom( const QString&a ) { from = a; } 43 void setFrom( const QString&a ) { from = a; }
@@ -72,6 +71,10 @@ public:
72 AbstractMail* Wrapper(); 71 AbstractMail* Wrapper();
73 72
73 const QDateTime&getDate()const{ return maildate; }
74 const QString&getStringDate()const{return date;}
75 void setDate( const QDateTime&a,int offset=0 );
76
74protected: 77protected:
75 QString subject,date,from,mbox,msg_id,replyto; 78 QString subject,from,mbox,msg_id,replyto;
76 unsigned int msg_number,msg_size; 79 unsigned int msg_number,msg_size;
77 QBitArray msg_flags; 80 QBitArray msg_flags;
@@ -80,4 +83,6 @@ protected:
80 void init(); 83 void init();
81 void copy_old(const RecMail&old); 84 void copy_old(const RecMail&old);
85 QDateTime maildate;
86 QString date;
82}; 87};
83 88
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
index 0b926da..d3a0723 100644
--- a/noncore/net/mail/mailistviewitem.cpp
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -3,4 +3,5 @@
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/timestring.h>
5 6
6MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 7MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
@@ -14,5 +15,5 @@ void MailListViewItem::showEntry()
14 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); 15 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
15 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 16 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
16 /* I think it looks nicer if there are not such a log of icons but only on mails 17 /* I think it looks nicer if there are not such a lot of icons but only on mails
17 replied or new - Alwin*/ 18 replied or new - Alwin*/
18 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); 19 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
@@ -49,9 +50,22 @@ void MailListViewItem::showEntry()
49 o << s << " " << q << "Byte"; 50 o << s << " " << q << "Byte";
50 } 51 }
51
52 setText(1,mail_data->getSubject()); 52 setText(1,mail_data->getSubject());
53 setText(2,mail_data->getFrom()); 53 setText(2,mail_data->getFrom());
54 setText(3,fsize); 54 setText(3,fsize);
55 setText(4,mail_data->getDate()); 55 setText(4,mail_data->getStringDate());
56}
57
58QString MailListViewItem::key(int col,bool) const
59{
60 QString temp;
61 if (col == 4) {
62 temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate()));
63 return temp;
64 }
65 if (col == 3) {
66 temp.sprintf( "%020d",mail_data->Msgsize());
67 return temp;
68 }
69 return text(col);
56} 70}
57 71
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h
index d953d83..ce64ca9 100644
--- a/noncore/net/mail/mailistviewitem.h
+++ b/noncore/net/mail/mailistviewitem.h
@@ -17,4 +17,5 @@ public:
17 MAILLIB::ATYPE wrapperType(); 17 MAILLIB::ATYPE wrapperType();
18 18
19 virtual QString key(int col,bool) const;
19protected: 20protected:
20 RecMailP mail_data; 21 RecMailP mail_data;
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 6252fc2..c115b32 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -104,5 +104,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
104 mailView->addColumn( tr( "Date" )); 104 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 105 mailView->setAllColumnsShowFocus(true);
106 mailView->setSorting(-1); 106 mailView->setShowSortIndicator(true);
107 mailView->setSorting(4,false);
107 108
108 statusWidget = new StatusWidget( wrapperBox ); 109 statusWidget = new StatusWidget( wrapperBox );
@@ -144,5 +145,5 @@ MainWindow::~MainWindow()
144void MainWindow::appMessage(const QCString &, const QByteArray &) 145void MainWindow::appMessage(const QCString &, const QByteArray &)
145{ 146{
146 odebug << "appMessage not reached" << oendl; 147 odebug << "appMessage not reached" << oendl;
147} 148}
148 149
@@ -178,30 +179,30 @@ void MainWindow::slotEditSettings()
178void MainWindow::slotShowFolders( bool ) 179void MainWindow::slotShowFolders( bool )
179{ 180{
180 odebug << "slotShowFolders not reached" << oendl; 181 odebug << "slotShowFolders not reached" << oendl;
181} 182}
182 183
183void MainWindow::refreshMailView(const QValueList<RecMailP>&) 184void MainWindow::refreshMailView(const QValueList<RecMailP>&)
184{ 185{
185 odebug << "refreshMailView not reached" << oendl; 186 odebug << "refreshMailView not reached" << oendl;
186} 187}
187 188
188void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 189void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
189{ 190{
190 odebug << "mailLeftClicked not reached" << oendl; 191 odebug << "mailLeftClicked not reached" << oendl;
191} 192}
192 193
193void MainWindow::displayMail() 194void MainWindow::displayMail()
194{ 195{
195 odebug << "displayMail not reached" << oendl; 196 odebug << "displayMail not reached" << oendl;
196} 197}
197 198
198void MainWindow::slotDeleteMail() 199void MainWindow::slotDeleteMail()
199{ 200{
200 odebug << "deleteMail not reached" << oendl; 201 odebug << "deleteMail not reached" << oendl;
201} 202}
202 203
203void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 204void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
204{ 205{
205 odebug << "mailHold not reached" << oendl; 206 odebug << "mailHold not reached" << oendl;
206} 207}
207 208
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index ce694d5..d5f9b7f 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -145,5 +145,5 @@ void ViewMail::setBody(const RecBodyP&body )
145 for (;it!=body->Parts()[i]->Parameters().end();++it) 145 for (;it!=body->Parts()[i]->Parameters().end();++it)
146 { 146 {
147 odebug << it.key() << oendl; 147 odebug << it.key() << oendl;
148 if (it.key().lower()=="name") 148 if (it.key().lower()=="name")
149 { 149 {
@@ -248,5 +248,5 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
248 break ; 248 break ;
249 249
250 case 2: 250 case 2:
251 { 251 {
252 QString tmpfile = "/tmp/opiemail-image"; 252 QString tmpfile = "/tmp/opiemail-image";
@@ -290,5 +290,5 @@ void ViewMail::setMail(const RecMailP&mail )
290 m_mail[0] = mail->getFrom(); 290 m_mail[0] = mail->getFrom();
291 m_mail[1] = mail->getSubject(); 291 m_mail[1] = mail->getSubject();
292 m_mail[3] = mail->getDate(); 292 m_mail[3] = mail->getStringDate();
293 m_mail[4] = mail->Msgid(); 293 m_mail[4] = mail->Msgid();
294 294