summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-05 22:21:41 (UTC)
committer alwin <alwin>2004-01-05 22:21:41 (UTC)
commitc8d0dd53a75b7142a5ce924e4afbea77b86e56b0 (patch) (unidiff)
tree2845e68c4a3ee0daa7f732a29fefd81d47c90f9d
parent07278dd6ba68e3ff55d22acc76a28956b06d5d9c (diff)
downloadopie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.zip
opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.gz
opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.bz2
bugfix in imapwrapper
storemail for all possible mail-accounts raw body fetch in all wrappers unified public interface dialog for selecting a target mailbox started
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp33
-rw-r--r--noncore/net/mail/accountview.h4
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h1
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp74
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h3
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp11
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h3
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp17
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
-rw-r--r--noncore/net/mail/mail.pro9
-rw-r--r--noncore/net/mail/selectstore.cpp19
-rw-r--r--noncore/net/mail/selectstore.h19
-rw-r--r--noncore/net/mail/selectstoreui.ui244
15 files changed, 400 insertions, 55 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 77fa706..faa6982 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -3,6 +3,7 @@
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include "defines.h" 4#include "defines.h"
5#include "newmaildir.h" 5#include "newmaildir.h"
6#include "selectstore.h"
6#include <qmessagebox.h> 7#include <qmessagebox.h>
7#include <qpopupmenu.h> 8#include <qpopupmenu.h>
8 9
@@ -90,20 +91,33 @@ QPopupMenu * POP3folderItem::getContextMenu()
90 if (m) { 91 if (m) {
91 m->insertItem(QObject::tr("Refresh header list",contextName),0); 92 m->insertItem(QObject::tr("Refresh header list",contextName),0);
92 m->insertItem(QObject::tr("Delete all mails",contextName),1); 93 m->insertItem(QObject::tr("Delete all mails",contextName),1);
94 m->insertItem(QObject::tr("Download all mails",contextName),2);
93 } 95 }
94 return m; 96 return m;
95} 97}
96 98
99void POP3folderItem::downloadMails()
100{
101 Selectstore sels;
102 sels.showMaximized();
103 sels.exec();
104}
105
97void POP3folderItem::contextMenuSelected(int which) 106void POP3folderItem::contextMenuSelected(int which)
98{ 107{
99 AccountView * view = (AccountView*)listView(); 108 AccountView * view = (AccountView*)listView();
100 switch (which) { 109 switch (which) {
101 case 0: 110 case 0:
111 /* must be 'cause pop3 lists are cached */
112 pop3->getWrapper()->logout();
102 view->refreshCurrent(); 113 view->refreshCurrent();
103 break; 114 break;
104 case 1: 115 case 1:
105 deleteAllMail(pop3->getWrapper(),folder); 116 deleteAllMail(pop3->getWrapper(),folder);
106 break; 117 break;
118 case 2:
119 downloadMails();
120 break;
107 default: 121 default:
108 break; 122 break;
109 } 123 }
@@ -158,11 +172,8 @@ void IMAPviewItem::refresh(QList<RecMail>&)
158 refreshFolders(false); 172 refreshFolders(false);
159} 173}
160 174
161void IMAPviewItem::refreshFolders(bool force) 175void IMAPviewItem::removeChilds()
162{ 176{
163 if (childCount()>0 && force==false) return;
164 QList<Folder> *folders = wrapper->listFolders();
165
166 QListViewItem *child = firstChild(); 177 QListViewItem *child = firstChild();
167 while ( child ) { 178 while ( child ) {
168 QListViewItem *tmp = child; 179 QListViewItem *tmp = child;
@@ -170,6 +181,16 @@ void IMAPviewItem::refreshFolders(bool force)
170 delete tmp; 181 delete tmp;
171 } 182 }
172 183
184}
185
186void IMAPviewItem::refreshFolders(bool force)
187{
188 if (childCount()>0 && force==false) return;
189
190 removeChilds();
191
192 QList<Folder> *folders = wrapper->listFolders();
193
173 Folder *it; 194 Folder *it;
174 QListViewItem*item = 0; 195 QListViewItem*item = 0;
175 QListViewItem*titem = 0; 196 QListViewItem*titem = 0;
@@ -246,6 +267,10 @@ void IMAPviewItem::contextMenuSelected(int id)
246 case 1: 267 case 1:
247 createNewFolder(); 268 createNewFolder();
248 break; 269 break;
270 case 2:
271 removeChilds();
272 wrapper->logout();
273 break;
249 default: 274 default:
250 break; 275 break;
251 } 276 }
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 1d2bf19..7131192 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -55,6 +55,9 @@ public:
55 virtual QPopupMenu * getContextMenu(); 55 virtual QPopupMenu * getContextMenu();
56 virtual void contextMenuSelected(int); 56 virtual void contextMenuSelected(int);
57 57
58protected:
59 void downloadMails();
60
58private: 61private:
59 Folder *folder; 62 Folder *folder;
60 POP3viewItem *pop3; 63 POP3viewItem *pop3;
@@ -78,6 +81,7 @@ protected:
78 IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); 81 IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0);
79 virtual void refreshFolders(bool force=false); 82 virtual void refreshFolders(bool force=false);
80 virtual void createNewFolder(); 83 virtual void createNewFolder();
84 virtual void removeChilds();
81 85
82private: 86private:
83 IMAPaccount *account; 87 IMAPaccount *account;
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 7c060db..9770991 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -26,6 +26,7 @@ public:
26 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; 26 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0;
27 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; 27 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0;
28 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; 28 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0;
29 virtual encodedString* fetchRawBody(const RecMail&mail)=0;
29 30
30 virtual void deleteMail(const RecMail&mail)=0; 31 virtual void deleteMail(const RecMail&mail)=0;
31 virtual void answeredMail(const RecMail&mail)=0; 32 virtual void answeredMail(const RecMail&mail)=0;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 95b317a..d252159 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -466,6 +466,10 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
466 mailimap_fetch_type *fetchType; 466 mailimap_fetch_type *fetchType;
467 mailimap_set *set; 467 mailimap_set *set;
468 clistcell*current,*cur; 468 clistcell*current,*cur;
469 mailimap_section_part * section_part = 0;
470 mailimap_section_spec * section_spec = 0;
471 mailimap_section * section = 0;
472 mailimap_fetch_att * fetch_att = 0;
469 473
470 login(); 474 login();
471 if (!m_imap) { 475 if (!m_imap) {
@@ -480,17 +484,24 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
480 } 484 }
481 } 485 }
482 set = mailimap_set_new_single(mail.getNumber()); 486 set = mailimap_set_new_single(mail.getNumber());
483 clist*id_list=clist_new();
484 for (unsigned j=0; j < path.count();++j) {
485 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
486 *p_id = path[j];
487 clist_append(id_list,p_id);
488 }
489 mailimap_section_part * section_part = mailimap_section_part_new(id_list);
490 mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
491 mailimap_section * section = mailimap_section_new(section_spec);
492 mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section);
493 487
488 clist*id_list = 0;
489
490 /* if path == empty then its a request for the whole rfc822 mail and generates
491 a "fetch <id> (body[])" statement on imap server */
492 if (path.count()>0 ) {
493 id_list = clist_new();
494 for (unsigned j=0; j < path.count();++j) {
495 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
496 *p_id = path[j];
497 clist_append(id_list,p_id);
498 }
499 section_part = mailimap_section_part_new(id_list);
500 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
501 }
502
503 section = mailimap_section_new(section_spec);
504 fetch_att = mailimap_fetch_att_new_body_section(section);
494 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); 505 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
495 506
496 clist*result = 0; 507 clist*result = 0;
@@ -955,24 +966,28 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
955 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); 966 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT);
956 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); 967 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN);
957 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); 968 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status);
958 for (cur = clist_begin(status->st_info_list); 969 if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) {
959 cur != NULL ; cur = clist_next(cur)) { 970 for (cur = clist_begin(status->st_info_list);
960 mailimap_status_info * status_info; 971 cur != NULL ; cur = clist_next(cur)) {
961 status_info = (mailimap_status_info *)clist_content(cur); 972 mailimap_status_info * status_info;
962 switch (status_info->st_att) { 973 status_info = (mailimap_status_info *)clist_content(cur);
963 case MAILIMAP_STATUS_ATT_MESSAGES: 974 switch (status_info->st_att) {
964 target_stat.message_count = status_info->st_value; 975 case MAILIMAP_STATUS_ATT_MESSAGES:
965 break; 976 target_stat.message_count = status_info->st_value;
966 case MAILIMAP_STATUS_ATT_RECENT: 977 break;
967 target_stat.message_recent = status_info->st_value; 978 case MAILIMAP_STATUS_ATT_RECENT:
968 break; 979 target_stat.message_recent = status_info->st_value;
969 case MAILIMAP_STATUS_ATT_UNSEEN: 980 break;
970 target_stat.message_unseen = status_info->st_value; 981 case MAILIMAP_STATUS_ATT_UNSEEN:
971 break; 982 target_stat.message_unseen = status_info->st_value;
983 break;
984 }
972 } 985 }
986 } else {
987 qDebug("Error retrieving status");
973 } 988 }
974 mailimap_mailbox_data_status_free(status); 989 if (status) mailimap_mailbox_data_status_free(status);
975 mailimap_status_att_list_free(att_list); 990 if (att_list) mailimap_status_att_list_free(att_list);
976} 991}
977 992
978void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 993void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
@@ -990,3 +1005,10 @@ const QString&IMAPwrapper::getType()const
990{ 1005{
991 return account->getType(); 1006 return account->getType();
992} 1007}
1008
1009encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
1010{
1011 // dummy
1012 QValueList<int> path;
1013 return fetchRawPart(mail,path,false);
1014}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 6a9c411..b246f58 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -36,6 +36,7 @@ public:
36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
37 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); 37 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part);
38 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); 38 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
39 virtual encodedString* fetchRawBody(const RecMail&mail);
39 40
40 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); 41 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
41 virtual int deleteMbox(const Folder*folder); 42 virtual int deleteMbox(const Folder*folder);
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index 60f7507..3a0b30a 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -172,7 +172,7 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde
172 mailmbox_done(f); 172 mailmbox_done(f);
173} 173}
174 174
175void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) 175encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail)
176{ 176{
177 RecBody body; 177 RecBody body;
178 mailstorage*storage = mailstorage_new(NULL); 178 mailstorage*storage = mailstorage_new(NULL);
@@ -190,14 +190,14 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length)
190 Global::statusMessage(tr("Error initializing mbox")); 190 Global::statusMessage(tr("Error initializing mbox"));
191 mailfolder_free(folder); 191 mailfolder_free(folder);
192 mailstorage_free(storage); 192 mailstorage_free(storage);
193 return; 193 return 0;
194 } 194 }
195 r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); 195 r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg);
196 if (r != MAIL_NO_ERROR) { 196 if (r != MAIL_NO_ERROR) {
197 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 197 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
198 mailfolder_free(folder); 198 mailfolder_free(folder);
199 mailstorage_free(storage); 199 mailstorage_free(storage);
200 return; 200 return 0;
201 } 201 }
202 r = mailmessage_fetch(msg,&data,&size); 202 r = mailmessage_fetch(msg,&data,&size);
203 if (r != MAIL_NO_ERROR) { 203 if (r != MAIL_NO_ERROR) {
@@ -205,13 +205,14 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length)
205 mailfolder_free(folder); 205 mailfolder_free(folder);
206 mailstorage_free(storage); 206 mailstorage_free(storage);
207 mailmessage_free(msg); 207 mailmessage_free(msg);
208 return; 208 return 0;
209 } 209 }
210 *target = data; 210 encodedString*result = new encodedString(data,size);
211 *length = size; 211
212 mailfolder_free(folder); 212 mailfolder_free(folder);
213 mailstorage_free(storage); 213 mailstorage_free(storage);
214 mailmessage_free(msg); 214 mailmessage_free(msg);
215 return result;
215} 216}
216 217
217void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) 218void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index f97fce2..2794014 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -6,6 +6,7 @@
6 6
7class RecMail; 7class RecMail;
8class RecBody; 8class RecBody;
9class encodedString;
9struct mailmbox_folder; 10struct mailmbox_folder;
10 11
11class MBOXwrapper : public Genericwrapper 12class MBOXwrapper : public Genericwrapper
@@ -30,7 +31,7 @@ public:
30 virtual RecBody fetchBody( const RecMail &mail ); 31 virtual RecBody fetchBody( const RecMail &mail );
31 static void mbox_progress( size_t current, size_t maximum ); 32 static void mbox_progress( size_t current, size_t maximum );
32 33
33 virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); 34 virtual encodedString* fetchRawBody(const RecMail&mail);
34 virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); 35 virtual void deleteMails(const QString & mailbox,QList<RecMail> &target);
35 virtual int deleteAllMail(const Folder*); 36 virtual int deleteAllMail(const Folder*);
36 virtual const QString&getType()const; 37 virtual const QString&getType()const;
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 45408dd..72c145b 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -228,12 +228,19 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&)
228 &target_stat.message_recent,&target_stat.message_unseen); 228 &target_stat.message_recent,&target_stat.message_unseen);
229} 229}
230 230
231void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) 231encodedString* POP3wrapper::fetchRawBody(const RecMail&mail)
232{ 232{
233 char*target=0;
234 size_t length=0;
235 encodedString*res = 0;
233 mailmessage * mailmsg = 0; 236 mailmessage * mailmsg = 0;
234 int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); 237 int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg);
235 err = mailmessage_fetch(mailmsg,target,length); 238 err = mailmessage_fetch(mailmsg,&target,&length);
236 if (mailmsg) mailmessage_free(mailmsg); 239 if (mailmsg) mailmessage_free(mailmsg);
240 if (target) {
241 res = new encodedString(target,length);
242 }
243 return res;
237} 244}
238 245
239const QString&POP3wrapper::getType()const 246const QString&POP3wrapper::getType()const
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index b7e8f27..f0307b6 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -5,6 +5,7 @@
5#include "genericwrapper.h" 5#include "genericwrapper.h"
6#include <qstring.h> 6#include <qstring.h>
7 7
8class encodedString;
8struct mailstorage; 9struct mailstorage;
9struct mailfolder; 10struct mailfolder;
10 11
@@ -26,7 +27,7 @@ public:
26 virtual int deleteAllMail(const Folder*); 27 virtual int deleteAllMail(const Folder*);
27 28
28 virtual RecBody fetchBody( const RecMail &mail ); 29 virtual RecBody fetchBody( const RecMail &mail );
29 virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); 30 virtual encodedString* fetchRawBody(const RecMail&mail);
30 virtual void logout(); 31 virtual void logout();
31 virtual const QString&getType()const; 32 virtual const QString&getType()const;
32 static void pop3_progress( size_t current, size_t maximum ); 33 static void pop3_progress( size_t current, size_t maximum );
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e054365..00181ff 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -485,7 +485,7 @@ void SMTPwrapper::progress( size_t current, size_t maximum )
485 } 485 }
486} 486}
487 487
488void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) 488void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
489{ 489{
490 if (!mail) return; 490 if (!mail) return;
491 QString localfolders = AbstractMail::defaultLocalfolder(); 491 QString localfolders = AbstractMail::defaultLocalfolder();
@@ -536,7 +536,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
536 if (rcpts) smtp_address_list_free( rcpts ); 536 if (rcpts) smtp_address_list_free( rcpts );
537} 537}
538 538
539int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) 539int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp )
540{ 540{
541 char *server, *user, *pass; 541 char *server, *user, *pass;
542 bool ssl; 542 bool ssl;
@@ -640,8 +640,6 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
640 640
641int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) 641int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
642{ 642{
643 char*data = 0;
644 size_t length = 0;
645 size_t curTok = 0; 643 size_t curTok = 0;
646 mailimf_fields *fields = 0; 644 mailimf_fields *fields = 0;
647 mailimf_field*ffrom = 0; 645 mailimf_field*ffrom = 0;
@@ -649,11 +647,11 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
649 char*from = 0; 647 char*from = 0;
650 int res = 0; 648 int res = 0;
651 649
652 wrap->fetchRawBody(*which,&data,&length); 650 encodedString * data = wrap->fetchRawBody(*which);
653 if (!data) return 0; 651 if (!data) return 0;
654 int err = mailimf_fields_parse( data, length, &curTok, &fields ); 652 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
655 if (err != MAILIMF_NO_ERROR) { 653 if (err != MAILIMF_NO_ERROR) {
656 free(data); 654 delete data;
657 delete wrap; 655 delete wrap;
658 return 0; 656 return 0;
659 } 657 }
@@ -662,16 +660,15 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
662 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 660 ffrom = getField(fields, MAILIMF_FIELD_FROM );
663 from = getFrom(ffrom); 661 from = getFrom(ffrom);
664 662
665 qDebug("Size: %i vs. %i",length,strlen(data));
666 if (rcpts && from) { 663 if (rcpts && from) {
667 res = smtpSend(from,rcpts,data,length,smtp ); 664 res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp );
668 } 665 }
669 if (fields) { 666 if (fields) {
670 mailimf_fields_free(fields); 667 mailimf_fields_free(fields);
671 fields = 0; 668 fields = 0;
672 } 669 }
673 if (data) { 670 if (data) {
674 free(data); 671 delete data;
675 } 672 }
676 if (from) { 673 if (from) {
677 free(from); 674 free(from);
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 4a4352f..04fc4b0 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -47,14 +47,14 @@ protected:
47 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); 47 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp );
48 clist *createRcptList( mailimf_fields *fields ); 48 clist *createRcptList( mailimf_fields *fields );
49 49
50 static void storeMail(char*mail, size_t length, const QString&box); 50 static void storeMail(const char*mail, size_t length, const QString&box);
51 static QString mailsmtpError( int err ); 51 static QString mailsmtpError( int err );
52 static void progress( size_t current, size_t maximum ); 52 static void progress( size_t current, size_t maximum );
53 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 53 static void addRcpts( clist *list, mailimf_address_list *addr_list );
54 static char *getFrom( mailmime *mail ); 54 static char *getFrom( mailmime *mail );
55 static char *getFrom( mailimf_field *ffrom); 55 static char *getFrom( mailimf_field *ffrom);
56 static mailimf_field *getField( mailimf_fields *fields, int type ); 56 static mailimf_field *getField( mailimf_fields *fields, int type );
57 int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ); 57 int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp );
58 58
59 void storeMail(mailmime*mail, const QString&box); 59 void storeMail(mailmime*mail, const QString&box);
60 Settings *settings; 60 Settings *settings;
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 96ffaa8..1abd2e8 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -11,7 +11,8 @@ HEADERS = defines.h \
11 mailistviewitem.h \ 11 mailistviewitem.h \
12 settingsdialog.h \ 12 settingsdialog.h \
13 statuswidget.h \ 13 statuswidget.h \
14 newmaildir.h 14 newmaildir.h \
15 selectstore.h
15 16
16SOURCES = main.cpp \ 17SOURCES = main.cpp \
17 opiemail.cpp \ 18 opiemail.cpp \
@@ -24,7 +25,8 @@ SOURCES = main.cpp \
24 viewmailbase.cpp \ 25 viewmailbase.cpp \
25 settingsdialog.cpp \ 26 settingsdialog.cpp \
26 statuswidget.cpp \ 27 statuswidget.cpp \
27 newmaildir.cpp 28 newmaildir.cpp \
29 selectstore.cpp
28 30
29INTERFACES = editaccountsui.ui \ 31INTERFACES = editaccountsui.ui \
30 selectmailtypeui.ui \ 32 selectmailtypeui.ui \
@@ -36,7 +38,8 @@ INTERFACES = editaccountsui.ui \
36 composemailui.ui \ 38 composemailui.ui \
37 settingsdialogui.ui \ 39 settingsdialogui.ui \
38 statuswidgetui.ui \ 40 statuswidgetui.ui \
39 newmaildirui.ui 41 newmaildirui.ui \
42 selectstoreui.ui
40 43
41 44
42INCLUDEPATH += $(OPIEDIR)/include 45INCLUDEPATH += $(OPIEDIR)/include
diff --git a/noncore/net/mail/selectstore.cpp b/noncore/net/mail/selectstore.cpp
new file mode 100644
index 0000000..28ab5a8
--- a/dev/null
+++ b/noncore/net/mail/selectstore.cpp
@@ -0,0 +1,19 @@
1#include "selectstore.h"
2
3Selectstore::Selectstore(QWidget* parent, const char* name)
4 :selectstoreui(parent,name,true)
5{
6
7}
8
9Selectstore::~Selectstore()
10{
11}
12
13void Selectstore::slotCreateNewFolder()
14{
15}
16
17void Selectstore::slotMoveMail()
18{
19}
diff --git a/noncore/net/mail/selectstore.h b/noncore/net/mail/selectstore.h
new file mode 100644
index 0000000..8b8e8ee
--- a/dev/null
+++ b/noncore/net/mail/selectstore.h
@@ -0,0 +1,19 @@
1#ifndef _SELECTSTORE_H
2#define _SELECTSTORE_H
3
4#include "selectstoreui.h"
5
6class Selectstore:public selectstoreui
7{
8 Q_OBJECT
9public:
10 Selectstore(QWidget* parent = 0, const char* name = 0);
11 virtual ~Selectstore();
12
13protected:
14 virtual void slotCreateNewFolder();
15 virtual void slotMoveMail();
16protected slots:
17
18};
19#endif
diff --git a/noncore/net/mail/selectstoreui.ui b/noncore/net/mail/selectstoreui.ui
new file mode 100644
index 0000000..3741b71
--- a/dev/null
+++ b/noncore/net/mail/selectstoreui.ui
@@ -0,0 +1,244 @@
1<!DOCTYPE UI><UI>
2<class>selectstoreui</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>selectstoreui</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>190</width>
15 <height>273</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Select target box</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>2</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>headlabel</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>&lt;b&gt;Store mail(s) to&lt;/b&gt;</string>
46 </property>
47 <property stdset="1">
48 <name>alignment</name>
49 <set>AlignCenter</set>
50 </property>
51 <property>
52 <name>hAlign</name>
53 </property>
54 </widget>
55 <widget>
56 <class>QLayoutWidget</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>Layout2</cstring>
60 </property>
61 <grid>
62 <property stdset="1">
63 <name>margin</name>
64 <number>0</number>
65 </property>
66 <property stdset="1">
67 <name>spacing</name>
68 <number>6</number>
69 </property>
70 <widget row="1" column="1" >
71 <class>QComboBox</class>
72 <property stdset="1">
73 <name>name</name>
74 <cstring>folderSelection</cstring>
75 </property>
76 <property stdset="1">
77 <name>sizePolicy</name>
78 <sizepolicy>
79 <hsizetype>3</hsizetype>
80 <vsizetype>0</vsizetype>
81 </sizepolicy>
82 </property>
83 </widget>
84 <widget row="1" column="0" >
85 <class>QLabel</class>
86 <property stdset="1">
87 <name>name</name>
88 <cstring>folderLabel</cstring>
89 </property>
90 <property stdset="1">
91 <name>text</name>
92 <string>Folder:</string>
93 </property>
94 <property stdset="1">
95 <name>alignment</name>
96 <set>AlignVCenter|AlignRight</set>
97 </property>
98 <property>
99 <name>hAlign</name>
100 </property>
101 </widget>
102 <widget row="0" column="1" >
103 <class>QComboBox</class>
104 <property stdset="1">
105 <name>name</name>
106 <cstring>accountSelection</cstring>
107 </property>
108 <property stdset="1">
109 <name>sizePolicy</name>
110 <sizepolicy>
111 <hsizetype>3</hsizetype>
112 <vsizetype>0</vsizetype>
113 </sizepolicy>
114 </property>
115 </widget>
116 <widget row="0" column="0" >
117 <class>QLabel</class>
118 <property stdset="1">
119 <name>name</name>
120 <cstring>accountlabel</cstring>
121 </property>
122 <property stdset="1">
123 <name>sizePolicy</name>
124 <sizepolicy>
125 <hsizetype>1</hsizetype>
126 <vsizetype>1</vsizetype>
127 </sizepolicy>
128 </property>
129 <property stdset="1">
130 <name>text</name>
131 <string>Account:</string>
132 </property>
133 <property stdset="1">
134 <name>alignment</name>
135 <set>AlignVCenter|AlignRight</set>
136 </property>
137 <property>
138 <name>hAlign</name>
139 </property>
140 </widget>
141 </grid>
142 </widget>
143 <widget>
144 <class>Line</class>
145 <property stdset="1">
146 <name>name</name>
147 <cstring>Line1</cstring>
148 </property>
149 <property stdset="1">
150 <name>orientation</name>
151 <enum>Horizontal</enum>
152 </property>
153 </widget>
154 <widget>
155 <class>QCheckBox</class>
156 <property stdset="1">
157 <name>name</name>
158 <cstring>newFoldersel</cstring>
159 </property>
160 <property stdset="1">
161 <name>text</name>
162 <string>Create new folder</string>
163 </property>
164 </widget>
165 <widget>
166 <class>QLineEdit</class>
167 <property stdset="1">
168 <name>name</name>
169 <cstring>newFolderedit</cstring>
170 </property>
171 <property stdset="1">
172 <name>enabled</name>
173 <bool>false</bool>
174 </property>
175 </widget>
176 <widget>
177 <class>Line</class>
178 <property stdset="1">
179 <name>name</name>
180 <cstring>Line2</cstring>
181 </property>
182 <property stdset="1">
183 <name>orientation</name>
184 <enum>Horizontal</enum>
185 </property>
186 </widget>
187 <widget>
188 <class>QCheckBox</class>
189 <property stdset="1">
190 <name>name</name>
191 <cstring>selMove</cstring>
192 </property>
193 <property stdset="1">
194 <name>text</name>
195 <string>Move mail(s)</string>
196 </property>
197 </widget>
198 <spacer>
199 <property>
200 <name>name</name>
201 <cstring>Spacer2</cstring>
202 </property>
203 <property stdset="1">
204 <name>orientation</name>
205 <enum>Vertical</enum>
206 </property>
207 <property stdset="1">
208 <name>sizeType</name>
209 <enum>Expanding</enum>
210 </property>
211 <property>
212 <name>sizeHint</name>
213 <size>
214 <width>20</width>
215 <height>20</height>
216 </size>
217 </property>
218 </spacer>
219 </vbox>
220</widget>
221<connections>
222 <connection>
223 <sender>selMove</sender>
224 <signal>clicked()</signal>
225 <receiver>selectstoreui</receiver>
226 <slot>slotMoveMail()</slot>
227 </connection>
228 <connection>
229 <sender>newFoldersel</sender>
230 <signal>clicked()</signal>
231 <receiver>selectstoreui</receiver>
232 <slot>slotCreateNewFolder()</slot>
233 </connection>
234 <slot access="protected">slotMoveMail()</slot>
235 <slot access="protected">slotCreateNewFolder()</slot>
236</connections>
237<tabstops>
238 <tabstop>accountSelection</tabstop>
239 <tabstop>folderSelection</tabstop>
240 <tabstop>newFoldersel</tabstop>
241 <tabstop>newFolderedit</tabstop>
242 <tabstop>selMove</tabstop>
243</tabstops>
244</UI>