author | zautrix <zautrix> | 2004-09-11 15:41:30 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 15:41:30 (UTC) |
commit | 32f9963a39236d08718a36d5adad2a0c5c4e2602 (patch) (unidiff) | |
tree | 8856a90d505df8dc3afa0d72541f27cb68913a0d /kmicromail | |
parent | d7a273f40838f56205c1377ed0bcc5457bd46ea3 (diff) | |
download | kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.zip kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.gz kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.bz2 |
Mail enhancements
-rw-r--r-- | kmicromail/accountitem.cpp | 22 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 67 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.h | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 64 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 18 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mboxwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 7 |
17 files changed, 207 insertions, 21 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 1698b40..7b9b881 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -92,11 +92,12 @@ QPopupMenu * POP3viewItem::getContextMenu() | |||
92 | { | 92 | { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
94 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),1); |
95 | m->insertItem(QObject::tr("Download messages",contextName),2); | 95 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); |
96 | } | 96 | } |
97 | else | 97 | else |
98 | { | 98 | { |
99 | m->insertItem(QObject::tr("Set online",contextName),1); | 99 | m->insertItem(QObject::tr("Set online",contextName),1); |
100 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); | ||
100 | } | 101 | } |
101 | } | 102 | } |
102 | return m; | 103 | return m; |
@@ -137,6 +138,8 @@ void POP3viewItem::contextMenuSelected(int which) | |||
137 | setOnOffline(); | 138 | setOnOffline(); |
138 | break; | 139 | break; |
139 | case 2: // daunlood | 140 | case 2: // daunlood |
141 | if (account->getOffline()) | ||
142 | setOnOffline(); | ||
140 | AccountView*bl = accountView(); | 143 | AccountView*bl = accountView(); |
141 | if (!bl) return; | 144 | if (!bl) return; |
142 | AccountViewItem* in = findSubItem( "inbox" , 0); | 145 | AccountViewItem* in = findSubItem( "inbox" , 0); |
@@ -513,10 +516,14 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
513 | m->insertSeparator(); | 516 | m->insertSeparator(); |
514 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 517 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
515 | m->insertItem(QObject::tr("Set offline",contextName),3); | 518 | m->insertItem(QObject::tr("Set offline",contextName),3); |
519 | m->insertSeparator(); | ||
520 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); | ||
516 | } | 521 | } |
517 | else | 522 | else |
518 | { | 523 | { |
519 | m->insertItem(QObject::tr("Set online",contextName),3); | 524 | m->insertItem(QObject::tr("Set online",contextName),3); |
525 | m->insertSeparator(); | ||
526 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); | ||
520 | } | 527 | } |
521 | } | 528 | } |
522 | return m; | 529 | return m; |
@@ -570,6 +577,19 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
570 | SETPIX(PIXMAP_IMAPFOLDER); | 577 | SETPIX(PIXMAP_IMAPFOLDER); |
571 | refreshFolders(false); | 578 | refreshFolders(false); |
572 | break; | 579 | break; |
580 | case 4: // daunlood | ||
581 | { | ||
582 | if (account->getOffline()) { | ||
583 | contextMenuSelected( 3 ); | ||
584 | } | ||
585 | AccountView*bl = accountView(); | ||
586 | if (!bl) return; | ||
587 | AccountViewItem* in = findSubItem( "inbox" , 0); | ||
588 | if ( ! in ) | ||
589 | return; | ||
590 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | ||
591 | } | ||
592 | break; | ||
573 | default: | 593 | default: |
574 | break; | 594 | break; |
575 | } | 595 | } |
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 85523b1..de8c5bb 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -141,6 +141,7 @@ void AccountView::setupFolderselect(Selectstore*sels) | |||
141 | } | 141 | } |
142 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | 142 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) |
143 | { | 143 | { |
144 | #if 0 | ||
144 | AbstractMail*targetMail = 0; | 145 | AbstractMail*targetMail = 0; |
145 | QString targetFolder = ""; | 146 | QString targetFolder = ""; |
146 | Selectstore sels; | 147 | Selectstore sels; |
@@ -162,9 +163,11 @@ void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromW | |||
162 | int maxsize = 0; | 163 | int maxsize = 0; |
163 | if ( sels.useSize->isChecked()) | 164 | if ( sels.useSize->isChecked()) |
164 | maxsize = sels.sizeSpinBox->value(); | 165 | maxsize = sels.sizeSpinBox->value(); |
165 | |||
166 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 166 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
167 | #endif | ||
168 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); | ||
167 | refreshCurrent(); | 169 | refreshCurrent(); |
170 | |||
168 | } | 171 | } |
169 | 172 | ||
170 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 173 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index f876235..374d606 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qmessagebox.h> | ||
13 | 14 | ||
14 | #include <kdecore/kstandarddirs.h> | 15 | #include <kdecore/kstandarddirs.h> |
15 | #include <qfile.h> | 16 | #include <qfile.h> |
@@ -158,6 +159,72 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | |||
158 | ++iii; | 159 | ++iii; |
159 | } | 160 | } |
160 | } | 161 | } |
162 | |||
163 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) | ||
164 | { | ||
165 | qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); | ||
166 | // get local folder | ||
167 | Account * acc = getAccount(); | ||
168 | if ( !acc ) return; | ||
169 | QString lfName = acc->getLocalFolder(); | ||
170 | if ( lfName.isEmpty() ) | ||
171 | lfName = acc->getAccountName(); | ||
172 | // create local folder | ||
173 | if ( !targetMail->createMbox(lfName)) | ||
174 | { | ||
175 | QMessageBox::critical(0,tr("Error creating new Folder"), | ||
176 | tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); | ||
177 | return; | ||
178 | } | ||
179 | QValueList<RecMailP> t; | ||
180 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); | ||
181 | if ( t.count() == 0 ) { | ||
182 | Global::statusMessage(tr("There are no new messages")); | ||
183 | return; | ||
184 | } | ||
185 | QValueList<RecMailP> e; | ||
186 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); | ||
187 | qDebug("target has mails %d ", e.count()); | ||
188 | QValueList<RecMailP> n; | ||
189 | int iii = 0; | ||
190 | int count = t.count(); | ||
191 | while (iii < count ) { | ||
192 | RecMailP r = (*t.at( iii )); | ||
193 | bool found = false; | ||
194 | int jjj = 0; | ||
195 | int countE = e.count(); | ||
196 | while (jjj < countE ) { | ||
197 | RecMailP re = (*e.at( jjj )); | ||
198 | if ( re->isEqual(r) ) { | ||
199 | found = true; | ||
200 | break; | ||
201 | } | ||
202 | ++jjj; | ||
203 | } | ||
204 | if ( found ) | ||
205 | qDebug("found "); | ||
206 | else | ||
207 | qDebug("NOT found "); | ||
208 | |||
209 | if ( !found ) { | ||
210 | n.append( r ); | ||
211 | } | ||
212 | ++iii; | ||
213 | } | ||
214 | if ( n.count() == 0 ) { | ||
215 | Global::statusMessage(tr("There are no new messages")); | ||
216 | return; | ||
217 | } | ||
218 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | ||
219 | |||
220 | |||
221 | #if 0 | ||
222 | QValueList<RecMailP> t; | ||
223 | listMessages(fromFolder->getName(),t, maxSizeInKb); | ||
224 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | ||
225 | #endif | ||
226 | |||
227 | } | ||
161 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 228 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
162 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 229 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
163 | { | 230 | { |
diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h index cae83f4..2069ca1 100644 --- a/kmicromail/libmailwrapper/abstractmail.h +++ b/kmicromail/libmailwrapper/abstractmail.h | |||
@@ -10,6 +10,9 @@ | |||
10 | #include <opie2/osmartpointer.h> | 10 | #include <opie2/osmartpointer.h> |
11 | #include "mailtypes.h" | 11 | #include "mailtypes.h" |
12 | 12 | ||
13 | |||
14 | #include "mailwrapper.h" | ||
15 | |||
13 | class IMAPwrapper; | 16 | class IMAPwrapper; |
14 | class POP3wrapper; | 17 | class POP3wrapper; |
15 | class Folder; | 18 | class Folder; |
@@ -38,7 +41,7 @@ public: | |||
38 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); | 41 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); |
39 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; | 42 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; |
40 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
41 | 44 | void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper ); | |
42 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 45 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
43 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); | 46 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); |
44 | virtual void mvcpMailList(const QValueList<RecMailP>& t, | 47 | virtual void mvcpMailList(const QValueList<RecMailP>& t, |
@@ -55,6 +58,8 @@ public: | |||
55 | const QString& delemiter="/",bool getsubfolder=false); | 58 | const QString& delemiter="/",bool getsubfolder=false); |
56 | virtual void logout()=0; | 59 | virtual void logout()=0; |
57 | 60 | ||
61 | virtual Account* getAccount() = 0; | ||
62 | |||
58 | static AbstractMail* getWrapper(IMAPaccount *a); | 63 | static AbstractMail* getWrapper(IMAPaccount *a); |
59 | static AbstractMail* getWrapper(POP3account *a); | 64 | static AbstractMail* getWrapper(POP3account *a); |
60 | static AbstractMail* getWrapper(NNTPaccount *a); | 65 | static AbstractMail* getWrapper(NNTPaccount *a); |
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 9614d53..2b04847 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp | |||
@@ -3,6 +3,9 @@ | |||
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
5 | 5 | ||
6 | #include <kconfig.h> | ||
7 | #include <kglobal.h> | ||
8 | #include <kstandarddirs.h> | ||
6 | 9 | ||
7 | 10 | ||
8 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
@@ -24,6 +27,48 @@ Genericwrapper::~Genericwrapper() | |||
24 | } | 27 | } |
25 | cleanMimeCache(); | 28 | cleanMimeCache(); |
26 | } | 29 | } |
30 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | ||
31 | { | ||
32 | static bool init = false ; | ||
33 | if ( ! init ) { | ||
34 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); | ||
35 | kon.setGroup("Locale"); | ||
36 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); | ||
37 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); | ||
38 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); | ||
39 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | ||
40 | kon.setGroup("Time & Date"); | ||
41 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), | ||
42 | kon.readNumEntry( "DaylightsavingStart", 90), | ||
43 | kon.readNumEntry( "DaylightsavingEnd",304) ); | ||
44 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); | ||
45 | |||
46 | init = true; | ||
47 | |||
48 | } | ||
49 | QDateTime dt (QDate(date->dt_year,date->dt_month, date->dt_day ),QTime(date->dt_hour, date->dt_min, date->dt_sec ) ); | ||
50 | int off = KGlobal::locale()->localTimeOffset( dt ); | ||
51 | dt = dt.addSecs( off*60 ); | ||
52 | QString ret = KGlobal::locale()->formatDateTime( dt,true,true); | ||
53 | if ( off < 0 ) | ||
54 | ret += " -"; | ||
55 | else | ||
56 | ret += " +"; | ||
57 | ret += QString::number( off / 60 ); | ||
58 | ret += "h"; | ||
59 | #if 0 | ||
60 | char tmp[23]; | ||
61 | |||
62 | // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | ||
63 | // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
64 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", | ||
65 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
66 | |||
67 | |||
68 | return QString( tmp ); | ||
69 | #endif | ||
70 | return ret; | ||
71 | } | ||
27 | 72 | ||
28 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) | 73 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) |
29 | { | 74 | { |
@@ -242,17 +287,6 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg ) | |||
242 | return body; | 287 | return body; |
243 | } | 288 | } |
244 | 289 | ||
245 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | ||
246 | { | ||
247 | char tmp[23]; | ||
248 | |||
249 | // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | ||
250 | // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
251 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", | ||
252 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
253 | |||
254 | return QString( tmp ); | ||
255 | } | ||
256 | 290 | ||
257 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | 291 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) |
258 | { | 292 | { |
@@ -448,8 +482,14 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
448 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 482 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
449 | if (single_fields.fld_bcc) | 483 | if (single_fields.fld_bcc) |
450 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 484 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
451 | if (single_fields.fld_orig_date) | 485 | if (single_fields.fld_orig_date) { |
452 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 486 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
487 | char tmp[23]; | ||
488 | struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time; | ||
489 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | ||
490 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
491 | mail->setIsoDate( QString( tmp ) ); | ||
492 | } | ||
453 | // crashes when accessing pop3 account? | 493 | // crashes when accessing pop3 account? |
454 | if (single_fields.fld_message_id) { | 494 | if (single_fields.fld_message_id) { |
455 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 495 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 235e116..244212f 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h | |||
@@ -42,6 +42,7 @@ public: | |||
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 | 46 | ||
46 | protected: | 47 | protected: |
47 | RecBodyP parseMail( mailmessage * msg ); | 48 | RecBodyP parseMail( mailmessage * msg ); |
@@ -49,7 +50,6 @@ protected: | |||
49 | QString parseMailbox( mailimf_mailbox *box ); | 50 | QString parseMailbox( mailimf_mailbox *box ); |
50 | QString parseGroup( mailimf_group *group ); | 51 | QString parseGroup( mailimf_group *group ); |
51 | QString parseAddressList( mailimf_address_list *list ); | 52 | QString parseAddressList( mailimf_address_list *list ); |
52 | QString parseDateTime( mailimf_date_time *date ); | ||
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); |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 6faa524..5441a9b 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -7,6 +7,7 @@ | |||
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 | 11 | ||
11 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
12 | int IMAPwrapper::mMax = 0; | 13 | int IMAPwrapper::mMax = 0; |
@@ -456,8 +457,23 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
456 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 457 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
457 | if ( head == NULL ) | 458 | if ( head == NULL ) |
458 | continue; | 459 | continue; |
459 | if ( head->env_date != NULL ) | 460 | if ( head->env_date != NULL ) { |
460 | m->setDate(head->env_date); | 461 | m->setDate(head->env_date); |
462 | struct mailimf_date_time result; | ||
463 | struct mailimf_date_time* date = &result; | ||
464 | struct mailimf_date_time **re = &date; | ||
465 | size_t length = m->getDate().length(); | ||
466 | size_t index = 0; | ||
467 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | ||
468 | m->setDate( Genericwrapper::parseDateTime( date ) ); | ||
469 | char tmp[23]; | ||
470 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | ||
471 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
472 | m->setIsoDate( QString( tmp ) ); | ||
473 | } else { | ||
474 | m->setIsoDate(head->env_date); | ||
475 | } | ||
476 | } | ||
461 | if ( head->env_subject != NULL ) | 477 | if ( head->env_subject != NULL ) |
462 | m->setSubject(convert_String((const char*)head->env_subject)); | 478 | m->setSubject(convert_String((const char*)head->env_subject)); |
463 | //m->setSubject(head->env_subject); | 479 | //m->setSubject(head->env_subject); |
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index db8ab5b..5535d8d 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h | |||
@@ -52,6 +52,7 @@ public: | |||
52 | virtual void logout(); | 52 | virtual void logout(); |
53 | virtual MAILLIB::ATYPE getType()const; | 53 | virtual MAILLIB::ATYPE getType()const; |
54 | virtual const QString&getName()const; | 54 | virtual const QString&getName()const; |
55 | virtual Account* getAccount() { return account; }; | ||
55 | 56 | ||
56 | protected: | 57 | protected: |
57 | RecMail*parse_list_result(mailimap_msg_att*); | 58 | RecMail*parse_list_result(mailimap_msg_att*); |
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index d43bdc6..1a4ffd1 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -23,7 +23,30 @@ RecMail::~RecMail() | |||
23 | { | 23 | { |
24 | wrapper = 0; | 24 | wrapper = 0; |
25 | } | 25 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | ||
27 | { | ||
28 | if ( s1.isEmpty() && s2.isEmpty() ) | ||
29 | return true; | ||
30 | return s1 == s2; | ||
31 | } | ||
32 | |||
33 | bool RecMail::isEqual( RecMail* r1 ) | ||
34 | { | ||
35 | if ( !stringCompareRec( isodate, r1->isodate ) ) { | ||
36 | // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | ||
37 | return false; | ||
38 | } | ||
39 | if ( !stringCompareRec( from, r1->from ) ) { | ||
40 | //qDebug("from *%s* *%s* ", from.latin1(), r1->from.latin1()); | ||
41 | return false; | ||
42 | } | ||
43 | if ( !stringCompareRec( subject, r1->subject ) ) { | ||
44 | //qDebug("sub "); | ||
45 | return false; | ||
46 | } | ||
26 | 47 | ||
48 | return true; | ||
49 | } | ||
27 | void RecMail::copy_old(const RecMail&old) | 50 | void RecMail::copy_old(const RecMail&old) |
28 | { | 51 | { |
29 | subject = old.subject; | 52 | subject = old.subject; |
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index c317880..020278d 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h | |||
@@ -35,11 +35,14 @@ public: | |||
35 | RecMail(); | 35 | RecMail(); |
36 | RecMail(const RecMail&old); | 36 | RecMail(const RecMail&old); |
37 | virtual ~RecMail(); | 37 | virtual ~RecMail(); |
38 | bool isEqual( RecMail* r1 ); | ||
38 | 39 | ||
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 | const QString&getDate()const{ return date; } |
42 | void setDate( const QString&a ) { date = a; } | 43 | void setDate( const QString&a ) { date = a; } |
44 | const QString&getIsoDate()const{ return isodate; } | ||
45 | void setIsoDate( const QString&a ) { isodate = a; } | ||
43 | const QString&getFrom()const{ return from; } | 46 | const QString&getFrom()const{ return from; } |
44 | void setFrom( const QString&a ) { from = a; } | 47 | void setFrom( const QString&a ) { from = a; } |
45 | const QString&getSubject()const { return subject; } | 48 | const QString&getSubject()const { return subject; } |
@@ -72,7 +75,7 @@ public: | |||
72 | AbstractMail* Wrapper(); | 75 | AbstractMail* Wrapper(); |
73 | 76 | ||
74 | protected: | 77 | protected: |
75 | QString subject,date,from,mbox,msg_id,replyto; | 78 | QString subject,date,isodate,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; |
78 | QStringList to,cc,bcc,in_reply_to,references; | 81 | QStringList to,cc,bcc,in_reply_to,references; |
diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h index 9731b85..d03940f 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.h +++ b/kmicromail/libmailwrapper/mboxwrapper.h | |||
@@ -36,6 +36,7 @@ public: | |||
36 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 36 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
37 | virtual MAILLIB::ATYPE getType()const; | 37 | virtual MAILLIB::ATYPE getType()const; |
38 | virtual const QString&getName()const; | 38 | virtual const QString&getName()const; |
39 | virtual Account* getAccount() { return 0; }; | ||
39 | 40 | ||
40 | protected: | 41 | protected: |
41 | static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); | 42 | static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); |
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index cbc52d9..962dac0 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp | |||
@@ -65,6 +65,7 @@ MHwrapper::~MHwrapper() | |||
65 | 65 | ||
66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
67 | { | 67 | { |
68 | qDebug("MHwrapper::listMessages "); | ||
68 | init_storage(); | 69 | init_storage(); |
69 | if (!m_storage) { | 70 | if (!m_storage) { |
70 | return; | 71 | return; |
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index 550824d..d1b7d1f 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h | |||
@@ -42,6 +42,7 @@ public: | |||
42 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 42 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
43 | virtual MAILLIB::ATYPE getType()const; | 43 | virtual MAILLIB::ATYPE getType()const; |
44 | virtual const QString&getName()const; | 44 | virtual const QString&getName()const; |
45 | virtual Account* getAccount() { return 0; }; | ||
45 | 46 | ||
46 | public slots: | 47 | public slots: |
47 | /* for deleting maildirs we are using a system call */ | 48 | /* for deleting maildirs we are using a system call */ |
diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h index 5d4e5ce..8c54f12 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.h +++ b/kmicromail/libmailwrapper/nntpwrapper.h | |||
@@ -37,6 +37,7 @@ public: | |||
37 | virtual MAILLIB::ATYPE getType()const; | 37 | virtual MAILLIB::ATYPE getType()const; |
38 | virtual const QString&getName()const; | 38 | virtual const QString&getName()const; |
39 | static void nntp_progress( size_t current, size_t maximum ); | 39 | static void nntp_progress( size_t current, size_t maximum ); |
40 | virtual Account* getAccount() { return account; }; | ||
40 | 41 | ||
41 | protected: | 42 | protected: |
42 | void login(); | 43 | void login(); |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index 7c70942..ebc2fc7 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h | |||
@@ -34,7 +34,7 @@ public: | |||
34 | virtual MAILLIB::ATYPE getType()const; | 34 | virtual MAILLIB::ATYPE getType()const; |
35 | virtual const QString&getName()const; | 35 | virtual const QString&getName()const; |
36 | static void pop3_progress( size_t current, size_t maximum ); | 36 | static void pop3_progress( size_t current, size_t maximum ); |
37 | 37 | virtual Account* getAccount() { return account; }; | |
38 | protected: | 38 | protected: |
39 | void login(); | 39 | void login(); |
40 | POP3account *account; | 40 | POP3account *account; |
diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index 105cbf5..ec42b56 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h | |||
@@ -27,6 +27,7 @@ public: | |||
27 | bool flushOutbox(); | 27 | bool flushOutbox(); |
28 | 28 | ||
29 | static progressMailSend*sendProgress; | 29 | static progressMailSend*sendProgress; |
30 | virtual Account* getAccount() { return m_SmtpAccount; }; | ||
30 | 31 | ||
31 | signals: | 32 | signals: |
32 | void queuedMails( int ); | 33 | void queuedMails( int ); |
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b92b0cf..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -53,11 +53,11 @@ void MailListViewItem::showEntry() | |||
53 | //setText(3, "kB" + fsort ); // test only | 53 | //setText(3, "kB" + fsort ); // test only |
54 | } else { | 54 | } else { |
55 | //setText(3, fsize + "MB"); | 55 | //setText(3, fsize + "MB"); |
56 | mKeyMap.insert(4, "M" +fsort ); | 56 | mKeyMap.insert(3, "M" +fsort ); |
57 | } | 57 | } |
58 | setText(1,mail_data->getSubject()); | 58 | setText(1,mail_data->getSubject()); |
59 | setText(2,mail_data->getFrom()); | 59 | setText(2,mail_data->getFrom()); |
60 | 60 | #if 0 | |
61 | QString date = mail_data->getDate(); | 61 | QString date = mail_data->getDate(); |
62 | 62 | ||
63 | int kom = date.find( ",")+2; | 63 | int kom = date.find( ",")+2; |
@@ -98,9 +98,12 @@ void MailListViewItem::showEntry() | |||
98 | so = "12"; | 98 | so = "12"; |
99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); | 99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); |
100 | } | 100 | } |
101 | //qDebug("insert Date %s ", date.latin1()); | ||
101 | // if ( date.left(1) != "1" || date.left(1) != "2" ) | 102 | // if ( date.left(1) != "1" || date.left(1) != "2" ) |
102 | // date = date.mid(5); | 103 | // date = date.mid(5); |
103 | mKeyMap.insert(4,date); | 104 | mKeyMap.insert(4,date); |
105 | #endif | ||
106 | mKeyMap.insert(4,mail_data->getIsoDate()); | ||
104 | setText(4,mail_data->getDate()); | 107 | setText(4,mail_data->getDate()); |
105 | } | 108 | } |
106 | 109 | ||