Diffstat (limited to 'kmicromail/libmailwrapper/pop3wrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index 2888f7c..ebeed71 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp | |||
@@ -6,14 +6,16 @@ | |||
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | 7 | ||
8 | #include <klocale.h> | 8 | #include <klocale.h> |
9 | 9 | ||
10 | #include <qpe/global.h> | 10 | #include <qpe/global.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qprogressbar.h> | 12 | #include <q3progressbar.h> |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | //Added by qt3to4: | ||
15 | #include <Q3ValueList> | ||
14 | 16 | ||
15 | /* we don't fetch messages larger than 5 MB */ | 17 | /* we don't fetch messages larger than 5 MB */ |
16 | #define HARD_MSG_SIZE_LIMIT 5242880 | 18 | #define HARD_MSG_SIZE_LIMIT 5242880 |
17 | 19 | ||
18 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
19 | POP3wrapper::POP3wrapper( POP3account *a ) | 21 | POP3wrapper::POP3wrapper( POP3account *a ) |
@@ -59,20 +61,20 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | |||
59 | cleanMimeCache(); | 61 | cleanMimeCache(); |
60 | 62 | ||
61 | if (mail->getNumber()!=last_msg_id) { | 63 | if (mail->getNumber()!=last_msg_id) { |
62 | if (msg_cache.exists()) { | 64 | if (msg_cache.exists()) { |
63 | msg_cache.remove(); | 65 | msg_cache.remove(); |
64 | } | 66 | } |
65 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 67 | msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate); |
66 | last_msg_id = mail->getNumber(); | 68 | last_msg_id = mail->getNumber(); |
67 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); | 69 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); |
68 | err = mailmessage_fetch(mailmsg,&message,&length); | 70 | err = mailmessage_fetch(mailmsg,&message,&length); |
69 | msg_cache.writeBlock(message,length); | 71 | msg_cache.writeBlock(message,length); |
70 | } else { | 72 | } else { |
71 | QString msg=""; | 73 | QString msg=""; |
72 | msg_cache.open(IO_ReadOnly); | 74 | msg_cache.open(QIODevice::ReadOnly); |
73 | message = new char[4096]; | 75 | message = new char[4096]; |
74 | memset(message,0,4096); | 76 | memset(message,0,4096); |
75 | while (msg_cache.readBlock(message,4095)>0) { | 77 | while (msg_cache.readBlock(message,4095)>0) { |
76 | msg+=message; | 78 | msg+=message; |
77 | memset(message,0,4096); | 79 | memset(message,0,4096); |
78 | } | 80 | } |
@@ -97,13 +99,13 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | |||
97 | if (message) | 99 | if (message) |
98 | free(message); | 100 | free(message); |
99 | 101 | ||
100 | return body; | 102 | return body; |
101 | } | 103 | } |
102 | 104 | ||
103 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 105 | void POP3wrapper::listMessages(const QString &, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
104 | { | 106 | { |
105 | login(); | 107 | login(); |
106 | if (!m_pop3) | 108 | if (!m_pop3) |
107 | return; | 109 | return; |
108 | uint32_t res_messages,res_recent,res_unseen; | 110 | uint32_t res_messages,res_recent,res_unseen; |
109 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 111 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
@@ -184,28 +186,28 @@ void POP3wrapper::logout() | |||
184 | return; | 186 | return; |
185 | mailstorage_free(m_pop3); | 187 | mailstorage_free(m_pop3); |
186 | m_pop3 = 0; | 188 | m_pop3 = 0; |
187 | } | 189 | } |
188 | 190 | ||
189 | 191 | ||
190 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | 192 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { |
191 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); | 193 | Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<FolderP>(); |
192 | FolderP inb=new Folder("INBOX","/"); | 194 | FolderP inb=new Folder("INBOX","/"); |
193 | folders->append(inb); | 195 | folders->append(inb); |
194 | return folders; | 196 | return folders; |
195 | } | 197 | } |
196 | 198 | ||
197 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) | 199 | void POP3wrapper::deleteMailList(const Q3ValueList<RecMailP>&target) |
198 | { | 200 | { |
199 | login(); | 201 | login(); |
200 | if (!m_pop3) | 202 | if (!m_pop3) |
201 | return; | 203 | return; |
202 | int iii = 0; | 204 | int iii = 0; |
203 | int count = target.count(); | 205 | int count = target.count(); |
204 | 206 | ||
205 | QProgressBar wid ( count ); | 207 | Q3ProgressBar wid ( count ); |
206 | wid.setCaption( i18n("Deleting ...")); | 208 | wid.setCaption( i18n("Deleting ...")); |
207 | wid.show(); | 209 | wid.show(); |
208 | while (iii < count ) { | 210 | while (iii < count ) { |
209 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); | 211 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); |
210 | wid.setProgress( iii ); | 212 | wid.setProgress( iii ); |
211 | wid.raise(); | 213 | wid.raise(); |
@@ -243,13 +245,13 @@ int POP3wrapper::deleteAllMail(const FolderP&) { | |||
243 | Global::statusMessage(i18n("Error getting folder info")); | 245 | Global::statusMessage(i18n("Error getting folder info")); |
244 | return 0; | 246 | return 0; |
245 | } | 247 | } |
246 | 248 | ||
247 | 249 | ||
248 | 250 | ||
249 | QProgressBar wid ( result ); | 251 | Q3ProgressBar wid ( result ); |
250 | wid.setCaption( i18n("Deleting ...")); | 252 | wid.setCaption( i18n("Deleting ...")); |
251 | wid.show(); | 253 | wid.show(); |
252 | for (unsigned int i = 0; i < result; ++i) { | 254 | for (unsigned int i = 0; i < result; ++i) { |
253 | Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result)); | 255 | Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result)); |
254 | wid.setProgress( i ); | 256 | wid.setProgress( i ); |
255 | wid.raise(); | 257 | wid.raise(); |