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 | |
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 | 9 |
17 files changed, 208 insertions, 22 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 1698b40..7b9b881 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -83,29 +83,30 @@ RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | |||
83 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
84 | } | 84 | } |
85 | 85 | ||
86 | QPopupMenu * POP3viewItem::getContextMenu() | 86 | QPopupMenu * POP3viewItem::getContextMenu() |
87 | { | 87 | { |
88 | QPopupMenu *m = new QPopupMenu(0); | 88 | QPopupMenu *m = new QPopupMenu(0); |
89 | if (m) | 89 | if (m) |
90 | { | 90 | { |
91 | if (!account->getOffline()) | 91 | if (!account->getOffline()) |
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; |
103 | } | 104 | } |
104 | 105 | ||
105 | void POP3viewItem::disconnect() | 106 | void POP3viewItem::disconnect() |
106 | { | 107 | { |
107 | QListViewItem *child = firstChild(); | 108 | QListViewItem *child = firstChild(); |
108 | while ( child ) | 109 | while ( child ) |
109 | { | 110 | { |
110 | QListViewItem *tmp = child; | 111 | QListViewItem *tmp = child; |
111 | child = child->nextSibling(); | 112 | child = child->nextSibling(); |
@@ -128,24 +129,26 @@ void POP3viewItem::setOnOffline() | |||
128 | 129 | ||
129 | void POP3viewItem::contextMenuSelected(int which) | 130 | void POP3viewItem::contextMenuSelected(int which) |
130 | { | 131 | { |
131 | switch (which) | 132 | switch (which) |
132 | { | 133 | { |
133 | case 0: | 134 | case 0: |
134 | disconnect(); | 135 | disconnect(); |
135 | break; | 136 | break; |
136 | case 1: | 137 | case 1: |
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); |
143 | if ( ! in ) | 146 | if ( ! in ) |
144 | return; | 147 | return; |
145 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 148 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
146 | setOnOffline(); | 149 | setOnOffline(); |
147 | break; | 150 | break; |
148 | } | 151 | } |
149 | } | 152 | } |
150 | 153 | ||
151 | POP3folderItem::~POP3folderItem() | 154 | POP3folderItem::~POP3folderItem() |
@@ -504,28 +507,32 @@ void IMAPviewItem::refreshFolders(bool force) | |||
504 | QPopupMenu * IMAPviewItem::getContextMenu() | 507 | QPopupMenu * IMAPviewItem::getContextMenu() |
505 | { | 508 | { |
506 | QPopupMenu *m = new QPopupMenu(0); | 509 | QPopupMenu *m = new QPopupMenu(0); |
507 | if (m) | 510 | if (m) |
508 | { | 511 | { |
509 | if (!account->getOffline()) | 512 | if (!account->getOffline()) |
510 | { | 513 | { |
511 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 514 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
512 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 515 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
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; |
523 | } | 530 | } |
524 | 531 | ||
525 | void IMAPviewItem::createNewFolder() | 532 | void IMAPviewItem::createNewFolder() |
526 | { | 533 | { |
527 | Newmdirdlg ndirdlg; | 534 | Newmdirdlg ndirdlg; |
528 | 535 | ||
529 | ndirdlg.showMaximized(); | 536 | ndirdlg.showMaximized(); |
530 | if ( ndirdlg.exec() ) | 537 | if ( ndirdlg.exec() ) |
531 | { | 538 | { |
@@ -561,24 +568,37 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
561 | break; | 568 | break; |
562 | case 3: | 569 | case 3: |
563 | if (account->getOffline()==false) | 570 | if (account->getOffline()==false) |
564 | { | 571 | { |
565 | removeChilds(); | 572 | removeChilds(); |
566 | wrapper->logout(); | 573 | wrapper->logout(); |
567 | } | 574 | } |
568 | account->setOffline(!account->getOffline()); | 575 | account->setOffline(!account->getOffline()); |
569 | account->save(); | 576 | account->save(); |
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 | } |
576 | } | 596 | } |
577 | 597 | ||
578 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 598 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
579 | { | 599 | { |
580 | return new RecBody(); | 600 | return new RecBody(); |
581 | } | 601 | } |
582 | 602 | ||
583 | bool IMAPviewItem::offline() | 603 | bool IMAPviewItem::offline() |
584 | { | 604 | { |
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 85523b1..de8c5bb 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -132,48 +132,51 @@ void AccountView::setupFolderselect(Selectstore*sels) | |||
132 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 132 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
133 | } | 133 | } |
134 | for (i=0; i < imapAccounts.count();++i) | 134 | for (i=0; i < imapAccounts.count();++i) |
135 | { | 135 | { |
136 | if (imapAccounts[i]->offline()) | 136 | if (imapAccounts[i]->offline()) |
137 | continue; | 137 | continue; |
138 | imapAccounts[i]->refreshFolders(false); | 138 | imapAccounts[i]->refreshFolders(false); |
139 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 139 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
140 | } | 140 | } |
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; |
147 | setupFolderselect(&sels); | 148 | setupFolderselect(&sels); |
148 | if (!sels.exec()) return; | 149 | if (!sels.exec()) return; |
149 | targetMail = sels.currentMail(); | 150 | targetMail = sels.currentMail(); |
150 | targetFolder = sels.currentFolder(); | 151 | targetFolder = sels.currentFolder(); |
151 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 152 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
152 | targetFolder.isEmpty()) | 153 | targetFolder.isEmpty()) |
153 | { | 154 | { |
154 | return; | 155 | return; |
155 | } | 156 | } |
156 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 157 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
157 | { | 158 | { |
158 | QMessageBox::critical(0,tr("Error creating new Folder"), | 159 | QMessageBox::critical(0,tr("Error creating new Folder"), |
159 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 160 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
160 | return; | 161 | return; |
161 | } | 162 | } |
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) |
171 | { | 174 | { |
172 | AbstractMail*targetMail = 0; | 175 | AbstractMail*targetMail = 0; |
173 | QString targetFolder = ""; | 176 | QString targetFolder = ""; |
174 | Selectstore sels; | 177 | Selectstore sels; |
175 | setupFolderselect(&sels); | 178 | setupFolderselect(&sels); |
176 | if (!sels.exec()) return; | 179 | if (!sels.exec()) return; |
177 | targetMail = sels.currentMail(); | 180 | targetMail = sels.currentMail(); |
178 | targetFolder = sels.currentFolder(); | 181 | targetFolder = sels.currentFolder(); |
179 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 182 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
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 | |||
@@ -1,24 +1,25 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "abstractmail.h" | 2 | #include "abstractmail.h" |
3 | #include "imapwrapper.h" | 3 | #include "imapwrapper.h" |
4 | #include "pop3wrapper.h" | 4 | #include "pop3wrapper.h" |
5 | #include "nntpwrapper.h" | 5 | #include "nntpwrapper.h" |
6 | #include "mhwrapper.h" | 6 | #include "mhwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | 9 | ||
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> |
16 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
17 | #include <stdlib.h> | 18 | #include <stdlib.h> |
18 | #include <libetpan/mailmime_content.h> | 19 | #include <libetpan/mailmime_content.h> |
19 | #include <libetpan/mailmime.h> | 20 | #include <libetpan/mailmime.h> |
20 | 21 | ||
21 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
22 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 23 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
23 | { | 24 | { |
24 | return new IMAPwrapper(a); | 25 | return new IMAPwrapper(a); |
@@ -149,24 +150,90 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | |||
149 | int count = target.count(); | 150 | int count = target.count(); |
150 | QWidget wid; | 151 | QWidget wid; |
151 | wid.show(); | 152 | wid.show(); |
152 | while (iii < count ) { | 153 | while (iii < count ) { |
153 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 154 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
154 | wid.raise(); | 155 | wid.raise(); |
155 | qApp->processEvents(); | 156 | qApp->processEvents(); |
156 | RecMailP mail = (*target.at( iii )); | 157 | RecMailP mail = (*target.at( iii )); |
157 | deleteMail(mail); | 158 | deleteMail(mail); |
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 | { |
164 | QValueList<RecMailP> t; | 231 | QValueList<RecMailP> t; |
165 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 232 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
166 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 233 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
167 | 234 | ||
168 | } | 235 | } |
169 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | 236 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, |
170 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 237 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
171 | { | 238 | { |
172 | encodedString*st = 0; | 239 | encodedString*st = 0; |
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 | |||
@@ -1,24 +1,27 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef __abstract_mail_ | 2 | #ifndef __abstract_mail_ |
3 | #define __abstract_mail_ | 3 | #define __abstract_mail_ |
4 | 4 | ||
5 | #include "maildefines.h" | 5 | #include "maildefines.h" |
6 | 6 | ||
7 | #include "settings.h" | 7 | #include "settings.h" |
8 | 8 | ||
9 | #include <qobject.h> | 9 | #include <qobject.h> |
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; |
16 | class encodedString; | 19 | class encodedString; |
17 | struct folderStat; | 20 | struct folderStat; |
18 | 21 | ||
19 | class AbstractMail:public QObject | 22 | class AbstractMail:public QObject |
20 | { | 23 | { |
21 | Q_OBJECT | 24 | Q_OBJECT |
22 | public: | 25 | public: |
23 | AbstractMail(){}; | 26 | AbstractMail(){}; |
24 | virtual ~AbstractMail(){} | 27 | virtual ~AbstractMail(){} |
@@ -29,41 +32,43 @@ public: | |||
29 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; | 32 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; |
30 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; | 33 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; |
31 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; | 34 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; |
32 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; | 35 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; |
33 | 36 | ||
34 | virtual void deleteMail(const RecMailP&mail)=0; | 37 | virtual void deleteMail(const RecMailP&mail)=0; |
35 | virtual void deleteMailList(const QValueList<RecMailP>&target); | 38 | virtual void deleteMailList(const QValueList<RecMailP>&target); |
36 | virtual void answeredMail(const RecMailP&mail)=0; | 39 | virtual void answeredMail(const RecMailP&mail)=0; |
37 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; | 40 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; |
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, |
45 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 48 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
46 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 49 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
47 | 50 | ||
48 | virtual void cleanMimeCache(){}; | 51 | virtual void cleanMimeCache(){}; |
49 | /* mail box methods */ | 52 | /* mail box methods */ |
50 | /* parameter is the box to create. | 53 | /* parameter is the box to create. |
51 | * if the implementing subclass has prefixes, | 54 | * if the implementing subclass has prefixes, |
52 | * them has to be appended automatic. | 55 | * them has to be appended automatic. |
53 | */ | 56 | */ |
54 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 57 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
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); |
61 | /* mbox only! */ | 66 | /* mbox only! */ |
62 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 67 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
63 | static AbstractMail* getWrapper(Account*a); | 68 | static AbstractMail* getWrapper(Account*a); |
64 | 69 | ||
65 | static QString defaultLocalfolder(); | 70 | static QString defaultLocalfolder(); |
66 | static QString draftFolder(); | 71 | static QString draftFolder(); |
67 | 72 | ||
68 | virtual MAILLIB::ATYPE getType()const=0; | 73 | virtual MAILLIB::ATYPE getType()const=0; |
69 | virtual const QString&getName()const=0; | 74 | virtual const QString&getName()const=0; |
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 | |||
@@ -1,38 +1,83 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "genericwrapper.h" | 2 | #include "genericwrapper.h" |
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; |
9 | Genericwrapper::Genericwrapper() | 12 | Genericwrapper::Genericwrapper() |
10 | : AbstractMail() | 13 | : AbstractMail() |
11 | { | 14 | { |
12 | bodyCache.clear(); | 15 | bodyCache.clear(); |
13 | m_storage = 0; | 16 | m_storage = 0; |
14 | m_folder = 0; | 17 | m_folder = 0; |
15 | } | 18 | } |
16 | 19 | ||
17 | Genericwrapper::~Genericwrapper() | 20 | Genericwrapper::~Genericwrapper() |
18 | { | 21 | { |
19 | if (m_folder) { | 22 | if (m_folder) { |
20 | mailfolder_free(m_folder); | 23 | mailfolder_free(m_folder); |
21 | } | 24 | } |
22 | if (m_storage) { | 25 | if (m_storage) { |
23 | mailstorage_free(m_storage); | 26 | mailstorage_free(m_storage); |
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 | { |
30 | if (!mime) { | 75 | if (!mime) { |
31 | return; | 76 | return; |
32 | } | 77 | } |
33 | mailmime_field*field = 0; | 78 | mailmime_field*field = 0; |
34 | mailmime_single_fields fields; | 79 | mailmime_single_fields fields; |
35 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 80 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
36 | if (mime->mm_mime_fields != NULL) { | 81 | if (mime->mm_mime_fields != NULL) { |
37 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | 82 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, |
38 | mime->mm_content_type); | 83 | mime->mm_content_type); |
@@ -233,35 +278,24 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg ) | |||
233 | int err = MAILIMF_NO_ERROR; | 278 | int err = MAILIMF_NO_ERROR; |
234 | mailmime_single_fields fields; | 279 | mailmime_single_fields fields; |
235 | /* is bound to msg and will be freed there */ | 280 | /* is bound to msg and will be freed there */ |
236 | mailmime * mime=0; | 281 | mailmime * mime=0; |
237 | RecBodyP body = new RecBody(); | 282 | RecBodyP body = new RecBody(); |
238 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 283 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
239 | err = mailmessage_get_bodystructure(msg,&mime); | 284 | err = mailmessage_get_bodystructure(msg,&mime); |
240 | QValueList<int>recList; | 285 | QValueList<int>recList; |
241 | traverseBody(body,msg,mime,recList); | 286 | traverseBody(body,msg,mime,recList); |
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 | { |
259 | QString result( "" ); | 293 | QString result( "" ); |
260 | 294 | ||
261 | bool first = true; | 295 | bool first = true; |
262 | if (list == 0) return result; | 296 | if (list == 0) return result; |
263 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | 297 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
264 | mailimf_address *addr = (mailimf_address *) current->data; | 298 | mailimf_address *addr = (mailimf_address *) current->data; |
265 | 299 | ||
266 | if ( !first ) { | 300 | if ( !first ) { |
267 | result.append( "," ); | 301 | result.append( "," ); |
@@ -439,26 +473,32 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
439 | if (single_fields.fld_from) | 473 | if (single_fields.fld_from) |
440 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 474 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
441 | if (!mbox_as_to) { | 475 | if (!mbox_as_to) { |
442 | if (single_fields.fld_to) | 476 | if (single_fields.fld_to) |
443 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 477 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
444 | } else { | 478 | } else { |
445 | mail->setTo(mailbox); | 479 | mail->setTo(mailbox); |
446 | } | 480 | } |
447 | if (single_fields.fld_cc) | 481 | if (single_fields.fld_cc) |
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)); |
456 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; | 496 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; |
457 | } | 497 | } |
458 | if (single_fields.fld_reply_to) { | 498 | if (single_fields.fld_reply_to) { |
459 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 499 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |
460 | if (t.count()>0) { | 500 | if (t.count()>0) { |
461 | mail->setReplyto(t[0]); | 501 | mail->setReplyto(t[0]); |
462 | } | 502 | } |
463 | } | 503 | } |
464 | #if 0 | 504 | #if 0 |
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 | |||
@@ -33,32 +33,32 @@ class Genericwrapper : public AbstractMail | |||
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 | 46 | ||
46 | protected: | 47 | protected: |
47 | RecBodyP parseMail( mailmessage * msg ); | 48 | RecBodyP parseMail( mailmessage * msg ); |
48 | QString parseMailboxList( mailimf_mailbox_list *list ); | 49 | QString parseMailboxList( mailimf_mailbox_list *list ); |
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); |
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; |
62 | unsigned int last_msg_id; | 62 | unsigned int last_msg_id; |
63 | QMap<QString,encodedString*> bodyCache; | 63 | QMap<QString,encodedString*> bodyCache; |
64 | mailstorage * m_storage; | 64 | mailstorage * m_storage; |
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 | |||
@@ -1,21 +1,22 @@ | |||
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 | 11 | ||
11 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
12 | int IMAPwrapper::mMax = 0; | 13 | int IMAPwrapper::mMax = 0; |
13 | int IMAPwrapper::mCurrent = 0; | 14 | int IMAPwrapper::mCurrent = 0; |
14 | 15 | ||
15 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 16 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
16 | : AbstractMail() | 17 | : AbstractMail() |
17 | { | 18 | { |
18 | account = a; | 19 | account = a; |
19 | m_imap = 0; | 20 | m_imap = 0; |
20 | m_Lastmbox = ""; | 21 | m_Lastmbox = ""; |
21 | mCurrent = 0; | 22 | mCurrent = 0; |
@@ -447,26 +448,41 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
447 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 448 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
448 | mFlags.setBit(FLAG_RECENT); | 449 | mFlags.setBit(FLAG_RECENT); |
449 | } | 450 | } |
450 | } | 451 | } |
451 | continue; | 452 | continue; |
452 | } | 453 | } |
453 | if ( item->att_data.att_static == NULL ) | 454 | if ( item->att_data.att_static == NULL ) |
454 | continue; | 455 | continue; |
455 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 456 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
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); |
464 | if (head->env_from!=NULL) { | 480 | if (head->env_from!=NULL) { |
465 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 481 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
466 | if (addresslist.count()) { | 482 | if (addresslist.count()) { |
467 | m->setFrom(addresslist.first()); | 483 | m->setFrom(addresslist.first()); |
468 | } | 484 | } |
469 | } | 485 | } |
470 | if (head->env_to!=NULL) { | 486 | if (head->env_to!=NULL) { |
471 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 487 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
472 | m->setTo(addresslist); | 488 | m->setTo(addresslist); |
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 | |||
@@ -43,24 +43,25 @@ public: | |||
43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
44 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 44 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
45 | 45 | ||
46 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 46 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
47 | const QString& delemiter="/",bool getsubfolder=false); | 47 | const QString& delemiter="/",bool getsubfolder=false); |
48 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); | 48 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); |
49 | 49 | ||
50 | static void imap_progress( size_t current, size_t maximum ); | 50 | static void imap_progress( size_t current, size_t maximum ); |
51 | 51 | ||
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*); |
58 | void login(); | 59 | void login(); |
59 | bool start_tls(bool force=true); | 60 | bool start_tls(bool force=true); |
60 | 61 | ||
61 | virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 62 | virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
62 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); | 63 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); |
63 | int selectMbox(const QString&mbox); | 64 | int selectMbox(const QString&mbox); |
64 | 65 | ||
65 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); | 66 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); |
66 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); | 67 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); |
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 | |||
@@ -14,25 +14,48 @@ RecMail::RecMail() | |||
14 | RecMail::RecMail(const RecMail&old) | 14 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
16 | { | 16 | { |
17 | init(); | 17 | init(); |
18 | copy_old(old); | 18 | copy_old(old); |
19 | // odebug << "Copy constructor RecMail" << oendl; | 19 | // odebug << "Copy constructor RecMail" << oendl; |
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 ) | ||
27 | { | ||
28 | if ( s1.isEmpty() && s2.isEmpty() ) | ||
29 | return true; | ||
30 | return s1 == s2; | ||
31 | } | ||
26 | 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 | } | ||
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; |
30 | date = old.date; | 53 | date = old.date; |
31 | mbox = old.mbox; | 54 | mbox = old.mbox; |
32 | msg_id = old.msg_id; | 55 | msg_id = old.msg_id; |
33 | msg_size = old.msg_size; | 56 | msg_size = old.msg_size; |
34 | msg_number = old.msg_number; | 57 | msg_number = old.msg_number; |
35 | from = old.from; | 58 | from = old.from; |
36 | msg_flags = old.msg_flags; | 59 | msg_flags = old.msg_flags; |
37 | to = old.to; | 60 | to = old.to; |
38 | cc = old.cc; | 61 | cc = old.cc; |
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 | |||
@@ -26,29 +26,32 @@ class AbstractMail; | |||
26 | needed from the mail-wrapper class direct from the server itself | 26 | needed from the mail-wrapper class direct from the server itself |
27 | (imap) or from a file-based cache (pop3?) | 27 | (imap) or from a file-based cache (pop3?) |
28 | So there is no interface "const QString&body()" but you should | 28 | So there is no interface "const QString&body()" but you should |
29 | make a request to the mailwrapper with this class as parameter to | 29 | make a request to the mailwrapper with this class as parameter to |
30 | get the body. Same words for the attachments. | 30 | get the body. Same words for the attachments. |
31 | */ | 31 | */ |
32 | class RecMail:public Opie::Core::ORefCount | 32 | class RecMail:public Opie::Core::ORefCount |
33 | { | 33 | { |
34 | public: | 34 | 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; } |
46 | void setSubject( const QString&s ) { subject = s; } | 49 | void setSubject( const QString&s ) { subject = s; } |
47 | const QString&getMbox()const{return mbox;} | 50 | const QString&getMbox()const{return mbox;} |
48 | void setMbox(const QString&box){mbox = box;} | 51 | void setMbox(const QString&box){mbox = box;} |
49 | void setMsgid(const QString&id){msg_id=id;} | 52 | void setMsgid(const QString&id){msg_id=id;} |
50 | const QString&Msgid()const{return msg_id;} | 53 | const QString&Msgid()const{return msg_id;} |
51 | void setReplyto(const QString&reply){replyto=reply;} | 54 | void setReplyto(const QString&reply){replyto=reply;} |
52 | const QString&Replyto()const{return replyto;} | 55 | const QString&Replyto()const{return replyto;} |
53 | void setMsgsize(unsigned int size){msg_size = size;} | 56 | void setMsgsize(unsigned int size){msg_size = size;} |
54 | const unsigned int Msgsize()const{return msg_size;} | 57 | const unsigned int Msgsize()const{return msg_size;} |
@@ -63,25 +66,25 @@ public: | |||
63 | void setInreply(const QStringList&list); | 66 | void setInreply(const QStringList&list); |
64 | const QStringList&Inreply()const; | 67 | const QStringList&Inreply()const; |
65 | void setReferences(const QStringList&list); | 68 | void setReferences(const QStringList&list); |
66 | const QStringList&References()const; | 69 | const QStringList&References()const; |
67 | 70 | ||
68 | const QBitArray&getFlags()const{return msg_flags;} | 71 | const QBitArray&getFlags()const{return msg_flags;} |
69 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 72 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
70 | 73 | ||
71 | void setWrapper(AbstractMail*wrapper); | 74 | void setWrapper(AbstractMail*wrapper); |
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; |
79 | AbstractMail*wrapper; | 82 | AbstractMail*wrapper; |
80 | void init(); | 83 | void init(); |
81 | void copy_old(const RecMail&old); | 84 | void copy_old(const RecMail&old); |
82 | }; | 85 | }; |
83 | 86 | ||
84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 87 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
85 | typedef QMap<QString,QString> part_plist_t; | 88 | typedef QMap<QString,QString> part_plist_t; |
86 | 89 | ||
87 | class RecPart:public Opie::Core::ORefCount | 90 | class RecPart:public Opie::Core::ORefCount |
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 | |||
@@ -27,20 +27,21 @@ public: | |||
27 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); | 27 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
28 | 28 | ||
29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
30 | 30 | ||
31 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 31 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
32 | static void mbox_progress( size_t current, size_t maximum ); | 32 | static void mbox_progress( size_t current, size_t maximum ); |
33 | 33 | ||
34 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
35 | virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); | 35 | virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); |
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); |
42 | QString MBOXPath; | 43 | QString MBOXPath; |
43 | QString MBOXName; | 44 | QString MBOXName; |
44 | }; | 45 | }; |
45 | 46 | ||
46 | #endif | 47 | #endif |
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 | |||
@@ -56,24 +56,25 @@ void MHwrapper::clean_storage() | |||
56 | mailstorage_free(m_storage); | 56 | mailstorage_free(m_storage); |
57 | m_storage = 0; | 57 | m_storage = 0; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | MHwrapper::~MHwrapper() | 61 | MHwrapper::~MHwrapper() |
62 | { | 62 | { |
63 | clean_storage(); | 63 | clean_storage(); |
64 | } | 64 | } |
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; |
71 | } | 72 | } |
72 | QString f = buildPath(mailbox); | 73 | QString f = buildPath(mailbox); |
73 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 74 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
74 | if (r!=MAIL_NO_ERROR) { | 75 | if (r!=MAIL_NO_ERROR) { |
75 | qDebug("listMessages: error selecting folder! "); | 76 | qDebug("listMessages: error selecting folder! "); |
76 | return; | 77 | return; |
77 | } | 78 | } |
78 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); | 79 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); |
79 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 80 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
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 | |||
@@ -33,24 +33,25 @@ public: | |||
33 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); | 33 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
34 | 34 | ||
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
36 | 36 | ||
37 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 37 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
38 | static void mbox_progress( size_t current, size_t maximum ); | 38 | static void mbox_progress( size_t current, size_t maximum ); |
39 | 39 | ||
40 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 40 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
41 | 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); |
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 */ |
48 | virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); | 49 | virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); |
49 | virtual void processEnded(Opie::Core::OProcess *); | 50 | virtual void processEnded(Opie::Core::OProcess *); |
50 | protected: | 51 | protected: |
51 | QString buildPath(const QString&p); | 52 | QString buildPath(const QString&p); |
52 | QString MHPath; | 53 | QString MHPath; |
53 | QString MHName; | 54 | QString MHName; |
54 | 55 | ||
55 | void init_storage(); | 56 | void init_storage(); |
56 | void clean_storage(); | 57 | void clean_storage(); |
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 | |||
@@ -28,22 +28,23 @@ public: | |||
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | QStringList listAllNewsgroups(const QString&mask = QString::null); | 29 | QStringList listAllNewsgroups(const QString&mask = QString::null); |
30 | virtual void deleteMail(const RecMailP&mail); | 30 | virtual void deleteMail(const RecMailP&mail); |
31 | virtual void answeredMail(const RecMailP&mail); | 31 | virtual void answeredMail(const RecMailP&mail); |
32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
33 | 33 | ||
34 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 34 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
35 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 35 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
36 | virtual void logout(); | 36 | virtual void logout(); |
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(); |
43 | NNTPaccount *account; | 44 | NNTPaccount *account; |
44 | mailstorage* m_nntp; | 45 | mailstorage* m_nntp; |
45 | 46 | ||
46 | 47 | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | #endif | 50 | #endif |
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 | |||
@@ -25,20 +25,20 @@ public: | |||
25 | 25 | ||
26 | virtual void deleteMail(const RecMailP&mail); | 26 | virtual void deleteMail(const RecMailP&mail); |
27 | virtual void deleteMailList(const QValueList<RecMailP>&target); | 27 | virtual void deleteMailList(const QValueList<RecMailP>&target); |
28 | virtual void answeredMail(const RecMailP&mail); | 28 | virtual void answeredMail(const RecMailP&mail); |
29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
30 | 30 | ||
31 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 31 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
32 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 32 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
33 | virtual void logout(); | 33 | virtual void logout(); |
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; |
41 | mailstorage*m_pop3; | 41 | mailstorage*m_pop3; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
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 | |||
@@ -18,24 +18,25 @@ class AbstractMail; | |||
18 | 18 | ||
19 | class SMTPwrapper : public Generatemail | 19 | class SMTPwrapper : public Generatemail |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | SMTPwrapper(SMTPaccount * aSmtp); | 24 | SMTPwrapper(SMTPaccount * aSmtp); |
25 | virtual ~SMTPwrapper(); | 25 | virtual ~SMTPwrapper(); |
26 | bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); | 26 | bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); |
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 ); |
33 | 34 | ||
34 | protected: | 35 | protected: |
35 | mailsmtp *m_smtp; | 36 | mailsmtp *m_smtp; |
36 | SMTPaccount * m_SmtpAccount; | 37 | SMTPaccount * m_SmtpAccount; |
37 | 38 | ||
38 | void connect_server(); | 39 | void connect_server(); |
39 | void disc_server(); | 40 | void disc_server(); |
40 | int start_smtp_tls(); | 41 | int start_smtp_tls(); |
41 | 42 | ||
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b92b0cf..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -44,29 +44,29 @@ void MailListViewItem::showEntry() | |||
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | fsort = fsize ; | 46 | fsort = fsize ; |
47 | break; | 47 | break; |
48 | 48 | ||
49 | } | 49 | } |
50 | if ( w == 0 ) { | 50 | if ( w == 0 ) { |
51 | setText(3, fsize + "kB" ); | 51 | setText(3, fsize + "kB" ); |
52 | mKeyMap.insert(3, "k" + fsort); | 52 | mKeyMap.insert(3, "k" + fsort); |
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; |
64 | if ( kom == 1 ) | 64 | if ( kom == 1 ) |
65 | kom = 0; | 65 | kom = 0; |
66 | if ( date.mid(kom,1) == " ") | 66 | if ( date.mid(kom,1) == " ") |
67 | ++kom; | 67 | ++kom; |
68 | if ( date.mid(kom+1,1) == " " ) | 68 | if ( date.mid(kom+1,1) == " " ) |
69 | date = "0" + date.mid( kom ); | 69 | date = "0" + date.mid( kom ); |
70 | else if ( kom ) | 70 | else if ( kom ) |
71 | date = date.mid( kom ); | 71 | date = date.mid( kom ); |
72 | if ( kom || date.mid(2,1 ) == " ") { | 72 | if ( kom || date.mid(2,1 ) == " ") { |
@@ -89,42 +89,45 @@ void MailListViewItem::showEntry() | |||
89 | else if ( mon == "Aug" ) | 89 | else if ( mon == "Aug" ) |
90 | so = "08"; | 90 | so = "08"; |
91 | else if ( mon == "Sep" ) | 91 | else if ( mon == "Sep" ) |
92 | so = "09"; | 92 | so = "09"; |
93 | else if ( mon == "Oct" ) | 93 | else if ( mon == "Oct" ) |
94 | so = "10"; | 94 | so = "10"; |
95 | else if ( mon == "Nov" ) | 95 | else if ( mon == "Nov" ) |
96 | so = "11"; | 96 | so = "11"; |
97 | else if ( mon == "Dec" ) | 97 | else if ( mon == "Dec" ) |
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 | ||
107 | void MailListViewItem::storeData(const RecMailP&data) | 110 | void MailListViewItem::storeData(const RecMailP&data) |
108 | { | 111 | { |
109 | mail_data = data; | 112 | mail_data = data; |
110 | } | 113 | } |
111 | void MailListViewItem::setSortKey(int column,const QString &key) | 114 | void MailListViewItem::setSortKey(int column,const QString &key) |
112 | { | 115 | { |
113 | mKeyMap.insert(column,key); | 116 | mKeyMap.insert(column,key); |
114 | } | 117 | } |
115 | QString MailListViewItem::key(int column, bool) const | 118 | QString MailListViewItem::key(int column, bool) const |
116 | { | 119 | { |
117 | // to make is fast, we use here special cases | 120 | // to make is fast, we use here special cases |
118 | if ( column == 3 || column == 4 ) { | 121 | if ( column == 3 || column == 4 ) { |
119 | return *mKeyMap.find(column); | 122 | return *mKeyMap.find(column); |
120 | } | 123 | } |
121 | if ( column == 1 ) { | 124 | if ( column == 1 ) { |
122 | if ( text(1).left(4).lower() == "re: " ) | 125 | if ( text(1).left(4).lower() == "re: " ) |
123 | return text(1).mid(4); | 126 | return text(1).mid(4); |
124 | 127 | ||
125 | } | 128 | } |
126 | return text(column); | 129 | return text(column); |
127 | /* | 130 | /* |
128 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 131 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
129 | if (it == mKeyMap.end()) return text(column); | 132 | if (it == mKeyMap.end()) return text(column); |
130 | else return *it; | 133 | else return *it; |