summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
authorzautrix <zautrix>2004-10-23 19:32:41 (UTC)
committer zautrix <zautrix>2004-10-23 19:32:41 (UTC)
commit94df6192e59b7d4c69e2fb43ef2c39db08bb1c39 (patch) (unidiff)
tree28956adbf73a61010d98deb27d83b324cb285471 /kmicromail/libmailwrapper
parent52b6fc17c0dcd1f13f701f698e0305440f26fc3e (diff)
downloadkdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.zip
kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.gz
kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.bz2
compile fixes
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp22
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp58
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.cpp29
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp21
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp59
5 files changed, 96 insertions, 93 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 2d7533c..8ee112c 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -8,13 +8,13 @@
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#include <qmessagebox.h>
14 14#include <klocale.h>
15#include <kdecore/kstandarddirs.h> 15#include <kdecore/kstandarddirs.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <stdlib.h> 18#include <stdlib.h>
19#include <libetpan/mailmime_content.h> 19#include <libetpan/mailmime_content.h>
20#include <libetpan/mailmime.h> 20#include <libetpan/mailmime.h>
@@ -144,16 +144,16 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
144{ 144{
145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
146 // this is currently re-implemented in pop3wrapper and imapwrapper 146 // this is currently re-implemented in pop3wrapper and imapwrapper
147 int iii = 0; 147 int iii = 0;
148 int count = target.count(); 148 int count = target.count();
149 QProgressBar wid ( count ); 149 QProgressBar wid ( count );
150 wid.setCaption( tr("Deleting ...")); 150 wid.setCaption( i18n("Deleting ..."));
151 wid.show(); 151 wid.show();
152 while (iii < count ) { 152 while (iii < count ) {
153 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 153 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
154 wid.setProgress( iii ); 154 wid.setProgress( iii );
155 wid.raise(); 155 wid.raise();
156 qApp->processEvents(); 156 qApp->processEvents();
157 RecMailP mail = (*target.at( iii )); 157 RecMailP mail = (*target.at( iii ));
158 deleteMail(mail); 158 deleteMail(mail);
159 ++iii; 159 ++iii;
@@ -169,21 +169,21 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe
169 QString lfName = acc->getLocalFolder(); 169 QString lfName = acc->getLocalFolder();
170 if ( lfName.isEmpty() ) 170 if ( lfName.isEmpty() )
171 lfName = acc->getAccountName(); 171 lfName = acc->getAccountName();
172 // create local folder 172 // create local folder
173 if ( !targetMail->createMbox(lfName)) 173 if ( !targetMail->createMbox(lfName))
174 { 174 {
175 QMessageBox::critical(0,tr("Error creating new Folder"), 175 QMessageBox::critical(0,i18n("Error creating new Folder"),
176 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); 176 i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
177 return; 177 return;
178 } 178 }
179 QValueList<RecMailP> t; 179 QValueList<RecMailP> t;
180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); 180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
181 if ( t.count() == 0 ) { 181 if ( t.count() == 0 ) {
182 qDebug("There are no new messages %s", fromFolder->getName().latin1()); 182 qDebug("There are no new messages %s", fromFolder->getName().latin1());
183 Global::statusMessage(tr("There are no new messages")); 183 Global::statusMessage(i18n("There are no new messages"));
184 return; 184 return;
185 } 185 }
186 QValueList<RecMailP> e; 186 QValueList<RecMailP> e;
187 targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); 187 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
188 //qDebug("target has mails %d ", e.count()); 188 //qDebug("target has mails %d ", e.count());
189 QValueList<RecMailP> n; 189 QValueList<RecMailP> n;
@@ -207,17 +207,17 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe
207 n.append( r ); 207 n.append( r );
208 } 208 }
209 ++iii; 209 ++iii;
210 } 210 }
211 qDebug("Downloaded %d messages ",n.count() ); 211 qDebug("Downloaded %d messages ",n.count() );
212 if ( n.count() == 0 ) { 212 if ( n.count() == 0 ) {
213 Global::statusMessage(tr("There are no new messages")); 213 Global::statusMessage(i18n("There are no new messages"));
214 return; 214 return;
215 } 215 }
216 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); 216 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
217 Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); 217 Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count()));
218 218
219#if 0 219#if 0
220 QValueList<RecMailP> t; 220 QValueList<RecMailP> t;
221 listMessages(fromFolder->getName(),t, maxSizeInKb); 221 listMessages(fromFolder->getName(),t, maxSizeInKb);
222 mvcpMailList( t,targetFolder,targetWrapper,moveit); 222 mvcpMailList( t,targetFolder,targetWrapper,moveit);
223#endif 223#endif
@@ -237,19 +237,19 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
237 encodedString*st = 0; 237 encodedString*st = 0;
238 int iii = 0; 238 int iii = 0;
239 int count = t.count(); 239 int count = t.count();
240 if ( count == 0 ) 240 if ( count == 0 )
241 return; 241 return;
242 // wel, processevents is qite strange, we need a widget for getting 242 // wel, processevents is qite strange, we need a widget for getting
243 // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye 243 // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye
244 244
245 QProgressBar wid ( count ); 245 QProgressBar wid ( count );
246 wid.setCaption( tr("Copying ...")); 246 wid.setCaption( i18n("Copying..."));
247 wid.show(); 247 wid.show();
248 while (iii < count ) { 248 while (iii < count ) {
249 Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); 249 Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count));
250 wid.setProgress( iii ); 250 wid.setProgress( iii );
251 wid.raise(); 251 wid.raise();
252 qApp->processEvents(); 252 qApp->processEvents();
253 RecMailP r = (*t.at( iii )); 253 RecMailP r = (*t.at( iii ));
254 st = fetchRawBody(r); 254 st = fetchRawBody(r);
255 if (st) { 255 if (st) {
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 8150453..3aec13d 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -45,13 +45,13 @@ int IMAPwrapper::selectMbox(const QString&mbox)
45 return err; 45 return err;
46} 46}
47 47
48void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 48void IMAPwrapper::imap_progress( size_t current, size_t maximum )
49{ 49{
50 //qDebug("imap progress %d of %d ",current,maximum ); 50 //qDebug("imap progress %d of %d ",current,maximum );
51 //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); 51 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
52 //qApp->processEvents() 52 //qApp->processEvents()
53 static int last = 0; 53 static int last = 0;
54 if ( last != current ) 54 if ( last != current )
55 IMAPwrapper::progress(); 55 IMAPwrapper::progress();
56 last = current; 56 last = current;
57} 57}
@@ -63,14 +63,14 @@ void IMAPwrapper::progress( QString m )
63 mProgrMess = m; 63 mProgrMess = m;
64 mCurrent = 1; 64 mCurrent = 1;
65 return; 65 return;
66 } 66 }
67 QString mess; 67 QString mess;
68 //qDebug("progress "); 68 //qDebug("progress ");
69 if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); 69 if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax);
70 else mess = mProgrMess +tr(" message %1").arg( mCurrent++); 70 else mess = mProgrMess +i18n(" message %1").arg( mCurrent++);
71 Global::statusMessage(mess); 71 Global::statusMessage(mess);
72 //qDebug("Progress %s %s", mess.latin1(), m.latin1()); 72 //qDebug("Progress %s %s", mess.latin1(), m.latin1());
73 qApp->processEvents(); 73 qApp->processEvents();
74} 74}
75bool IMAPwrapper::start_tls(bool force_tls) 75bool IMAPwrapper::start_tls(bool force_tls)
76{ 76{
@@ -97,13 +97,13 @@ bool IMAPwrapper::start_tls(bool force_tls)
97 if (cap_data) { 97 if (cap_data) {
98 mailimap_capability_data_free(cap_data); 98 mailimap_capability_data_free(cap_data);
99 } 99 }
100 if (try_tls) { 100 if (try_tls) {
101 err = mailimap_starttls(m_imap); 101 err = mailimap_starttls(m_imap);
102 if (err != MAILIMAP_NO_ERROR && force_tls) { 102 if (err != MAILIMAP_NO_ERROR && force_tls) {
103 Global::statusMessage(tr("Server has no TLS support!")); 103 Global::statusMessage(i18n("Server has no TLS support!"));
104 try_tls = false; 104 try_tls = false;
105 } else { 105 } else {
106 mailstream_low * low; 106 mailstream_low * low;
107 mailstream_low * new_low; 107 mailstream_low * new_low;
108 low = mailstream_get_low(m_imap->imap_stream); 108 low = mailstream_get_low(m_imap->imap_stream);
109 if (!low) { 109 if (!low) {
@@ -185,35 +185,35 @@ void IMAPwrapper::login()
185 QString failure = ""; 185 QString failure = "";
186 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 186 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
187 failure="Connection refused"; 187 failure="Connection refused";
188 } else { 188 } else {
189 failure="Unknown failure"; 189 failure="Unknown failure";
190 } 190 }
191 Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); 191 Global::statusMessage(i18n("error connecting imap server: %1").arg(failure));
192 mailimap_free( m_imap ); 192 mailimap_free( m_imap );
193 m_imap = 0; 193 m_imap = 0;
194 return; 194 return;
195 } 195 }
196 196
197 if (!ssl) { 197 if (!ssl) {
198 try_tls = start_tls(force_tls); 198 try_tls = start_tls(force_tls);
199 } 199 }
200 200
201 bool ok = true; 201 bool ok = true;
202 if (force_tls && !try_tls) { 202 if (force_tls && !try_tls) {
203 Global::statusMessage(tr("Server has no TLS support!")); 203 Global::statusMessage(i18n("Server has no TLS support!"));
204 ok = false; 204 ok = false;
205 } 205 }
206 206
207 207
208 /* login */ 208 /* login */
209 209
210 if (ok) { 210 if (ok) {
211 err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); 211 err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() );
212 if ( err != MAILIMAP_NO_ERROR ) { 212 if ( err != MAILIMAP_NO_ERROR ) {
213 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 213 Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response));
214 ok = false; 214 ok = false;
215 } 215 }
216 } 216 }
217 if (!ok) { 217 if (!ok) {
218 err = mailimap_close( m_imap ); 218 err = mailimap_close( m_imap );
219 mailimap_free( m_imap ); 219 mailimap_free( m_imap );
@@ -253,20 +253,20 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
253 return; 253 return;
254 } 254 }
255 255
256 int last = m_imap->imap_selection_info->sel_exists; 256 int last = m_imap->imap_selection_info->sel_exists;
257 257
258 if (last == 0) { 258 if (last == 0) {
259 Global::statusMessage(tr("Mailbox has no mails")); 259 Global::statusMessage(i18n("Mailbox has no mails"));
260 return; 260 return;
261 } else { 261 } else {
262 } 262 }
263 progress( tr("Fetch ")); 263 progress( i18n("Fetch "));
264 mMax = last; 264 mMax = last;
265 //qDebug("last %d ", last); 265 //qDebug("last %d ", last);
266 Global::statusMessage(tr("Fetching header list")); 266 Global::statusMessage(i18n("Fetching header list"));
267 qApp->processEvents(); 267 qApp->processEvents();
268 /* the range has to start at 1!!! not with 0!!!! */ 268 /* the range has to start at 1!!! not with 0!!!! */
269 //LR the access to web.de imap server is no working with value 1 269 //LR the access to web.de imap server is no working with value 1
270 //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); 270 //qDebug("interval %d - %d ", tryAgain, last-1+tryAgain );
271 set = mailimap_set_new_interval( tryAgain, last ); 271 set = mailimap_set_new_interval( tryAgain, last );
272 fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); 272 fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
@@ -296,18 +296,18 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
296 m->setMbox(mailbox); 296 m->setMbox(mailbox);
297 m->setWrapper(this); 297 m->setWrapper(this);
298 target.append(m); 298 target.append(m);
299 } 299 }
300 } 300 }
301 } 301 }
302 Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); 302 Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count()));
303 } else { 303 } else {
304 --tryAgain; 304 --tryAgain;
305 --tryAgain;//disabled tryagain by adding this line 305 --tryAgain;//disabled tryagain by adding this line
306 if ( tryAgain < 0 ) 306 if ( tryAgain < 0 )
307 Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); 307 Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response));
308 else 308 else
309 qDebug("try again... "); 309 qDebug("try again... ");
310 } 310 }
311 311
312 if (result) mailimap_fetch_list_free(result); 312 if (result) mailimap_fetch_list_free(result);
313 } 313 }
@@ -330,13 +330,13 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
330 330
331/* 331/*
332 * First we have to check for INBOX 'cause it sometimes it's not inside the path. 332 * First we have to check for INBOX 'cause it sometimes it's not inside the path.
333 * We must not forget to filter them out in next loop! 333 * We must not forget to filter them out in next loop!
334 * it seems like ugly code. and yes - it is ugly code. but the best way. 334 * it seems like ugly code. and yes - it is ugly code. but the best way.
335 */ 335 */
336 Global::statusMessage(tr("Fetching folder list")); 336 Global::statusMessage(i18n("Fetching folder list"));
337 qApp->processEvents(); 337 qApp->processEvents();
338 QString temp; 338 QString temp;
339 mask = "INBOX" ; 339 mask = "INBOX" ;
340 mailimap_mailbox_list *list; 340 mailimap_mailbox_list *list;
341 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); 341 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
342 QString del; 342 QString del;
@@ -966,19 +966,19 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
966 int iii = 0; 966 int iii = 0;
967 int count = target.count(); 967 int count = target.count();
968 // qDebug("imap remove count %d ", count); 968 // qDebug("imap remove count %d ", count);
969 969
970 970
971 mMax = count; 971 mMax = count;
972 progress( tr("Delete")); 972 progress( i18n("Delete"));
973 973
974 QProgressBar wid ( count ); 974 QProgressBar wid ( count );
975 wid.setCaption( tr("Deleting ...")); 975 wid.setCaption( i18n("Deleting ..."));
976 wid.show(); 976 wid.show();
977 while (iii < count ) { 977 while (iii < count ) {
978 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 978 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
979 wid.setProgress( iii ); 979 wid.setProgress( iii );
980 wid.raise(); 980 wid.raise();
981 qApp->processEvents(); 981 qApp->processEvents();
982 RecMailP mail = (*target.at( iii )); 982 RecMailP mail = (*target.at( iii ));
983 //#if 0 983 //#if 0
984 //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); 984 //qDebug("IMAP remove %d %d ", iii, mail->getNumber() );
@@ -1000,22 +1000,22 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
1000 } 1000 }
1001 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; 1001 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
1002 /* should we realy do that at this moment? */ 1002 /* should we realy do that at this moment? */
1003 1003
1004 // err = mailimap_expunge(m_imap); 1004 // err = mailimap_expunge(m_imap);
1005 //if (err != MAILIMAP_NO_ERROR) { 1005 //if (err != MAILIMAP_NO_ERROR) {
1006 // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); 1006 // Global::statusMessage(i18n("Error deleting mails: %s").arg(m_imap->imap_response));
1007 // } 1007 // }
1008 //#endif 1008 //#endif
1009 //deleteMail( mail); 1009 //deleteMail( mail);
1010 ++iii; 1010 ++iii;
1011 } 1011 }
1012 //qDebug("Deleting imap mails... "); 1012 //qDebug("Deleting imap mails... ");
1013 err = mailimap_expunge(m_imap); 1013 err = mailimap_expunge(m_imap);
1014 if (err != MAILIMAP_NO_ERROR) { 1014 if (err != MAILIMAP_NO_ERROR) {
1015 Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); 1015 Global::statusMessage(i18n("Error deleting mails: %s").arg(m_imap->imap_response));
1016 } 1016 }
1017} 1017}
1018void IMAPwrapper::deleteMail(const RecMailP&mail) 1018void IMAPwrapper::deleteMail(const RecMailP&mail)
1019{ 1019{
1020 mailimap_flag_list*flist; 1020 mailimap_flag_list*flist;
1021 mailimap_set *set; 1021 mailimap_set *set;
@@ -1043,13 +1043,13 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
1043 } 1043 }
1044 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; 1044 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
1045 /* should we realy do that at this moment? */ 1045 /* should we realy do that at this moment? */
1046 1046
1047 err = mailimap_expunge(m_imap); 1047 err = mailimap_expunge(m_imap);
1048 if (err != MAILIMAP_NO_ERROR) { 1048 if (err != MAILIMAP_NO_ERROR) {
1049 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 1049 Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response));
1050 } 1050 }
1051 //qDebug("IMAPwrapper::deleteMail 2"); 1051 //qDebug("IMAPwrapper::deleteMail 2");
1052 1052
1053} 1053}
1054 1054
1055void IMAPwrapper::answeredMail(const RecMailP&mail) 1055void IMAPwrapper::answeredMail(const RecMailP&mail)
@@ -1126,31 +1126,31 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
1126 if ( err != MAILIMAP_NO_ERROR ) { 1126 if ( err != MAILIMAP_NO_ERROR ) {
1127 return 0; 1127 return 0;
1128 } 1128 }
1129 1129
1130 int last = m_imap->imap_selection_info->sel_exists; 1130 int last = m_imap->imap_selection_info->sel_exists;
1131 if (last == 0) { 1131 if (last == 0) {
1132 Global::statusMessage(tr("Mailbox has no mails!")); 1132 Global::statusMessage(i18n("Mailbox has no mails!"));
1133 return 0; 1133 return 0;
1134 } 1134 }
1135 flist = mailimap_flag_list_new_empty(); 1135 flist = mailimap_flag_list_new_empty();
1136 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 1136 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
1137 store_flags = mailimap_store_att_flags_new_set_flags(flist); 1137 store_flags = mailimap_store_att_flags_new_set_flags(flist);
1138 set = mailimap_set_new_interval( 1, last ); 1138 set = mailimap_set_new_interval( 1, last );
1139 err = mailimap_store(m_imap,set,store_flags); 1139 err = mailimap_store(m_imap,set,store_flags);
1140 mailimap_set_free( set ); 1140 mailimap_set_free( set );
1141 mailimap_store_att_flags_free(store_flags); 1141 mailimap_store_att_flags_free(store_flags);
1142 if (err != MAILIMAP_NO_ERROR) { 1142 if (err != MAILIMAP_NO_ERROR) {
1143 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 1143 Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response));
1144 return 0; 1144 return 0;
1145 } 1145 }
1146 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; 1146 // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
1147 /* should we realy do that at this moment? */ 1147 /* should we realy do that at this moment? */
1148 err = mailimap_expunge(m_imap); 1148 err = mailimap_expunge(m_imap);
1149 if (err != MAILIMAP_NO_ERROR) { 1149 if (err != MAILIMAP_NO_ERROR) {
1150 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 1150 Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response));
1151 return 0; 1151 return 0;
1152 } 1152 }
1153 // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; 1153 // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
1154 return 1; 1154 return 1;
1155} 1155}
1156 1156
@@ -1168,33 +1168,33 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
1168 } 1168 }
1169 pre+=folder; 1169 pre+=folder;
1170 if (getsubfolder) { 1170 if (getsubfolder) {
1171 if (delemiter.length()>0) { 1171 if (delemiter.length()>0) {
1172 pre+=delemiter; 1172 pre+=delemiter;
1173 } else { 1173 } else {
1174 Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); 1174 Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre));
1175 return 0; 1175 return 0;
1176 } 1176 }
1177 } 1177 }
1178 // odebug << "Creating " << pre.latin1() << "" << oendl; 1178 // odebug << "Creating " << pre.latin1() << "" << oendl;
1179 int res = mailimap_create(m_imap,pre.latin1()); 1179 int res = mailimap_create(m_imap,pre.latin1());
1180 if (res != MAILIMAP_NO_ERROR) { 1180 if (res != MAILIMAP_NO_ERROR) {
1181 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1181 Global::statusMessage(i18n("%1").arg(m_imap->imap_response));
1182 return 0; 1182 return 0;
1183 } 1183 }
1184 return 1; 1184 return 1;
1185} 1185}
1186 1186
1187int IMAPwrapper::deleteMbox(const FolderP&folder) 1187int IMAPwrapper::deleteMbox(const FolderP&folder)
1188{ 1188{
1189 if (!folder) return 0; 1189 if (!folder) return 0;
1190 login(); 1190 login();
1191 if (!m_imap) {return 0;} 1191 if (!m_imap) {return 0;}
1192 int res = mailimap_delete(m_imap,folder->getName()); 1192 int res = mailimap_delete(m_imap,folder->getName());
1193 if (res != MAILIMAP_NO_ERROR) { 1193 if (res != MAILIMAP_NO_ERROR) {
1194 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1194 Global::statusMessage(i18n("%1").arg(m_imap->imap_response));
1195 return 0; 1195 return 0;
1196 } 1196 }
1197 return 1; 1197 return 1;
1198} 1198}
1199 1199
1200void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 1200void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
@@ -1271,13 +1271,13 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
1271 1271
1272void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, 1272void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
1273 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 1273 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
1274{ 1274{
1275 if (targetWrapper != this || maxSizeInKb > 0 ) { 1275 if (targetWrapper != this || maxSizeInKb > 0 ) {
1276 mMax = 0; 1276 mMax = 0;
1277 progress( tr("Copy")); 1277 progress( i18n("Copy"));
1278 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); 1278 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb);
1279 //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); 1279 //qDebug("IMAPwrapper::mvcpAllMails::Using generic");
1280 // odebug << "Using generic" << oendl; 1280 // odebug << "Using generic" << oendl;
1281 return; 1281 return;
1282 } 1282 }
1283 mailimap_set *set = 0; 1283 mailimap_set *set = 0;
@@ -1286,19 +1286,19 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
1286 return; 1286 return;
1287 } 1287 }
1288 int err = selectMbox(fromFolder->getName()); 1288 int err = selectMbox(fromFolder->getName());
1289 if ( err != MAILIMAP_NO_ERROR ) { 1289 if ( err != MAILIMAP_NO_ERROR ) {
1290 return; 1290 return;
1291 } 1291 }
1292 Global::statusMessage( tr("Copying mails on server...") ); 1292 Global::statusMessage( i18n("Copying mails on server...") );
1293 int last = m_imap->imap_selection_info->sel_exists; 1293 int last = m_imap->imap_selection_info->sel_exists;
1294 set = mailimap_set_new_interval( 1, last ); 1294 set = mailimap_set_new_interval( 1, last );
1295 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1295 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1296 mailimap_set_free( set ); 1296 mailimap_set_free( set );
1297 if ( err != MAILIMAP_NO_ERROR ) { 1297 if ( err != MAILIMAP_NO_ERROR ) {
1298 QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); 1298 QString error_msg = i18n("Error copy mails: %1").arg(m_imap->imap_response);
1299 Global::statusMessage(error_msg); 1299 Global::statusMessage(error_msg);
1300 // odebug << error_msg << oendl; 1300 // odebug << error_msg << oendl;
1301 return; 1301 return;
1302 } 1302 }
1303 if (moveit) { 1303 if (moveit) {
1304 deleteAllMail(fromFolder); 1304 deleteAllMail(fromFolder);
@@ -1322,13 +1322,13 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra
1322 return; 1322 return;
1323 } 1323 }
1324 set = mailimap_set_new_single(mail->getNumber()); 1324 set = mailimap_set_new_single(mail->getNumber());
1325 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1325 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1326 mailimap_set_free( set ); 1326 mailimap_set_free( set );
1327 if ( err != MAILIMAP_NO_ERROR ) { 1327 if ( err != MAILIMAP_NO_ERROR ) {
1328 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); 1328 QString error_msg = i18n("error copy mail: %1").arg(m_imap->imap_response);
1329 Global::statusMessage(error_msg); 1329 Global::statusMessage(error_msg);
1330 // odebug << error_msg << oendl; 1330 // odebug << error_msg << oendl;
1331 return; 1331 return;
1332 } 1332 }
1333 if (moveit) { 1333 if (moveit) {
1334 deleteMail(mail); 1334 deleteMail(mail);
diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp
index 39dd156..0cdbae4 100644
--- a/kmicromail/libmailwrapper/mboxwrapper.cpp
+++ b/kmicromail/libmailwrapper/mboxwrapper.cpp
@@ -1,12 +1,13 @@
1#include "mboxwrapper.h" 1#include "mboxwrapper.h"
2#include "mailtypes.h" 2#include "mailtypes.h"
3#include "mailwrapper.h" 3#include "mailwrapper.h"
4#include <libetpan/libetpan.h> 4#include <libetpan/libetpan.h>
5#include <qdir.h> 5#include <qdir.h>
6#include <stdlib.h> 6#include <stdlib.h>
7#include <klocale.h>
7 8
8 9
9#include <qpe/global.h> 10#include <qpe/global.h>
10 11
11using namespace Opie::Core; 12using namespace Opie::Core;
12MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) 13MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
@@ -41,13 +42,13 @@ void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &ta
41 42
42 parseList(target,folder->fld_session,mailbox); 43 parseList(target,folder->fld_session,mailbox);
43 44
44 mailfolder_disconnect(folder); 45 mailfolder_disconnect(folder);
45 mailfolder_free(folder); 46 mailfolder_free(folder);
46 mailstorage_free(storage); 47 mailstorage_free(storage);
47 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 48 Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
48} 49}
49 50
50QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() 51QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
51{ 52{
52 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 53 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
53 QDir dir(MBOXPath); 54 QDir dir(MBOXPath);
@@ -140,18 +141,18 @@ void MBOXwrapper::mbox_progress( size_t current, size_t maximum )
140int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) 141int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool )
141{ 142{
142 QString p = MBOXPath+"/"; 143 QString p = MBOXPath+"/";
143 p+=folder; 144 p+=folder;
144 QFileInfo fi(p); 145 QFileInfo fi(p);
145 if (fi.exists()) { 146 if (fi.exists()) {
146 Global::statusMessage(tr("Mailbox exists.")); 147 Global::statusMessage(i18n("Mailbox exists."));
147 return 0; 148 return 0;
148 } 149 }
149 mailmbox_folder*f = 0; 150 mailmbox_folder*f = 0;
150 if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { 151 if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) {
151 Global::statusMessage(tr("Error init folder")); 152 Global::statusMessage(i18n("Error init folder"));
152 return 0; 153 return 0;
153 } 154 }
154 if (f) mailmbox_done(f); 155 if (f) mailmbox_done(f);
155 return 1; 156 return 1;
156} 157}
157 158
@@ -159,18 +160,18 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde
159{ 160{
160 QString p = MBOXPath+"/"; 161 QString p = MBOXPath+"/";
161 p+=folder; 162 p+=folder;
162 mailmbox_folder*f = 0; 163 mailmbox_folder*f = 0;
163 int r = mailmbox_init(p.latin1(),0,1,0,&f); 164 int r = mailmbox_init(p.latin1(),0,1,0,&f);
164 if (r != MAIL_NO_ERROR) { 165 if (r != MAIL_NO_ERROR) {
165 Global::statusMessage(tr("Error init folder")); 166 Global::statusMessage(i18n("Error init folder"));
166 return; 167 return;
167 } 168 }
168 r = mailmbox_append_message(f,msg,length); 169 r = mailmbox_append_message(f,msg,length);
169 if (r != MAIL_NO_ERROR) { 170 if (r != MAIL_NO_ERROR) {
170 Global::statusMessage(tr("Error writing to message folder")); 171 Global::statusMessage(i18n("Error writing to message folder"));
171 } 172 }
172 mailmbox_done(f); 173 mailmbox_done(f);
173} 174}
174 175
175encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail) 176encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
176{ 177{
@@ -184,27 +185,27 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
184 185
185 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 186 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
186 mailfolder*folder; 187 mailfolder*folder;
187 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 188 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
188 r = mailfolder_connect(folder); 189 r = mailfolder_connect(folder);
189 if (r != MAIL_NO_ERROR) { 190 if (r != MAIL_NO_ERROR) {
190 Global::statusMessage(tr("Error initializing mbox")); 191 Global::statusMessage(i18n("Error initializing mbox"));
191 mailfolder_free(folder); 192 mailfolder_free(folder);
192 mailstorage_free(storage); 193 mailstorage_free(storage);
193 return 0; 194 return 0;
194 } 195 }
195 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); 196 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
196 if (r != MAIL_NO_ERROR) { 197 if (r != MAIL_NO_ERROR) {
197 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 198 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
198 mailfolder_free(folder); 199 mailfolder_free(folder);
199 mailstorage_free(storage); 200 mailstorage_free(storage);
200 return 0; 201 return 0;
201 } 202 }
202 r = mailmessage_fetch(msg,&data,&size); 203 r = mailmessage_fetch(msg,&data,&size);
203 if (r != MAIL_NO_ERROR) { 204 if (r != MAIL_NO_ERROR) {
204 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 205 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
205 mailfolder_free(folder); 206 mailfolder_free(folder);
206 mailstorage_free(storage); 207 mailstorage_free(storage);
207 mailmessage_free(msg); 208 mailmessage_free(msg);
208 return 0; 209 return 0;
209 } 210 }
210 encodedString*result = new encodedString(data,size); 211 encodedString*result = new encodedString(data,size);
@@ -254,20 +255,20 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
254 255
255 mailfolder*folder = 0; 256 mailfolder*folder = 0;
256 mailmessage_list*l=0; 257 mailmessage_list*l=0;
257 mailstorage*storage = mailstorage_new(NULL); 258 mailstorage*storage = mailstorage_new(NULL);
258 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 259 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
259 if (r != MAIL_NO_ERROR) { 260 if (r != MAIL_NO_ERROR) {
260 Global::statusMessage(tr("Error initializing mbox")); 261 Global::statusMessage(i18n("Error initializing mbox"));
261 res = 0; 262 res = 0;
262 } 263 }
263 if (res) { 264 if (res) {
264 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 265 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
265 r = mailfolder_connect(folder); 266 r = mailfolder_connect(folder);
266 if (r != MAIL_NO_ERROR) { 267 if (r != MAIL_NO_ERROR) {
267 Global::statusMessage(tr("Error initializing mbox")); 268 Global::statusMessage(i18n("Error initializing mbox"));
268 res = 0; 269 res = 0;
269 } 270 }
270 } 271 }
271 if (res) { 272 if (res) {
272 r = mailsession_get_messages_list(folder->fld_session,&l); 273 r = mailsession_get_messages_list(folder->fld_session,&l);
273 if (r != MAIL_NO_ERROR) { 274 if (r != MAIL_NO_ERROR) {
@@ -275,13 +276,13 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
275 res=0; 276 res=0;
276 } 277 }
277 } 278 }
278 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 279 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
279 r = mailsession_remove_message(folder->fld_session,i+1); 280 r = mailsession_remove_message(folder->fld_session,i+1);
280 if (r != MAIL_NO_ERROR) { 281 if (r != MAIL_NO_ERROR) {
281 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 282 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
282 res = 0; 283 res = 0;
283 break; 284 break;
284 } 285 }
285 } 286 }
286 if (l) mailmessage_list_free(l); 287 if (l) mailmessage_list_free(l);
287 if (folder) mailfolder_free(folder); 288 if (folder) mailfolder_free(folder);
@@ -292,17 +293,17 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
292int MBOXwrapper::deleteMbox(const FolderP&tfolder) 293int MBOXwrapper::deleteMbox(const FolderP&tfolder)
293{ 294{
294 if (!tfolder) return 0; 295 if (!tfolder) return 0;
295 QString p = MBOXPath+"/"+tfolder->getDisplayName(); 296 QString p = MBOXPath+"/"+tfolder->getDisplayName();
296 QFile fi(p); 297 QFile fi(p);
297 if (!fi.exists()) { 298 if (!fi.exists()) {
298 Global::statusMessage(tr("Mailbox doesn't exist.")); 299 Global::statusMessage(i18n("Mailbox doesn't exist."));
299 return 0; 300 return 0;
300 } 301 }
301 if (!fi.remove()) { 302 if (!fi.remove()) {
302 Global::statusMessage(tr("Error deleting Mailbox.")); 303 Global::statusMessage(i18n("Error deleting Mailbox."));
303 return 0; 304 return 0;
304 } 305 }
305 return 1; 306 return 1;
306} 307}
307 308
308void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 309void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
@@ -312,13 +313,13 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
312 target_stat.message_count = 0; 313 target_stat.message_count = 0;
313 target_stat.message_unseen = 0; 314 target_stat.message_unseen = 0;
314 target_stat.message_recent = 0; 315 target_stat.message_recent = 0;
315 QString p = MBOXPath+"/"+mailbox; 316 QString p = MBOXPath+"/"+mailbox;
316 QFile fi(p); 317 QFile fi(p);
317 if (!fi.exists()) { 318 if (!fi.exists()) {
318 Global::statusMessage(tr("Mailbox doesn't exist.")); 319 Global::statusMessage(i18n("Mailbox doesn't exist."));
319 return; 320 return;
320 } 321 }
321 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 322 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
322 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 323 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
323 r = mailfolder_connect(folder); 324 r = mailfolder_connect(folder);
324 r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, 325 r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count,
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 9d52f52..2888f7c 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -2,12 +2,13 @@
2#include <stdlib.h> 2#include <stdlib.h>
3#include "pop3wrapper.h" 3#include "pop3wrapper.h"
4#include "mailtypes.h" 4#include "mailtypes.h"
5#include "logindialog.h" 5#include "logindialog.h"
6#include <libetpan/libetpan.h> 6#include <libetpan/libetpan.h>
7 7
8#include <klocale.h>
8 9
9#include <qpe/global.h> 10#include <qpe/global.h>
10#include <qfile.h> 11#include <qfile.h>
11#include <qprogressbar.h> 12#include <qprogressbar.h>
12#include <qapplication.h> 13#include <qapplication.h>
13 14
@@ -104,13 +105,13 @@ void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPoi
104 login(); 105 login();
105 if (!m_pop3) 106 if (!m_pop3)
106 return; 107 return;
107 uint32_t res_messages,res_recent,res_unseen; 108 uint32_t res_messages,res_recent,res_unseen;
108 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); 109 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
109 parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); 110 parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
110 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); 111 Global::statusMessage( i18n("Mailbox contains %1 mail(s)").arg(res_messages));
111} 112}
112 113
113void POP3wrapper::login() 114void POP3wrapper::login()
114{ 115{
115 if (account->getOffline()) 116 if (account->getOffline())
116 return; 117 return;
@@ -162,13 +163,13 @@ void POP3wrapper::login()
162 pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 163 pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
163 (char*)user.latin1(),(char*)pass.latin1(),0,0,0); 164 (char*)user.latin1(),(char*)pass.latin1(),0,0,0);
164 165
165 err = mailstorage_connect(m_pop3); 166 err = mailstorage_connect(m_pop3);
166 if (err != MAIL_NO_ERROR) { 167 if (err != MAIL_NO_ERROR) {
167 ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; 168 ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
168 Global::statusMessage(tr("Error %1 initializing folder").arg( err )); 169 Global::statusMessage(i18n("Error %1 initializing folder").arg( err ));
169 mailstorage_free(m_pop3); 170 mailstorage_free(m_pop3);
170 m_pop3 = 0; 171 m_pop3 = 0;
171 } else { 172 } else {
172 mailsession * session = m_pop3->sto_session; 173 mailsession * session = m_pop3->sto_session;
173 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; 174 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
174 if (mail) { 175 if (mail) {
@@ -199,35 +200,35 @@ void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
199 if (!m_pop3) 200 if (!m_pop3)
200 return; 201 return;
201 int iii = 0; 202 int iii = 0;
202 int count = target.count(); 203 int count = target.count();
203 204
204 QProgressBar wid ( count ); 205 QProgressBar wid ( count );
205 wid.setCaption( tr("Deleting ...")); 206 wid.setCaption( i18n("Deleting ..."));
206 wid.show(); 207 wid.show();
207 while (iii < count ) { 208 while (iii < count ) {
208 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 209 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
209 wid.setProgress( iii ); 210 wid.setProgress( iii );
210 wid.raise(); 211 wid.raise();
211 qApp->processEvents(); 212 qApp->processEvents();
212 //qDebug("delete "); 213 //qDebug("delete ");
213 RecMailP mail = (*target.at( iii )); 214 RecMailP mail = (*target.at( iii ));
214 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); 215 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
215 if (err != MAIL_NO_ERROR) { 216 if (err != MAIL_NO_ERROR) {
216 Global::statusMessage(tr("Error deleting mail")); 217 Global::statusMessage(i18n("Error deleting mail"));
217 } 218 }
218 ++iii; 219 ++iii;
219 } 220 }
220} 221}
221void POP3wrapper::deleteMail(const RecMailP&mail) { 222void POP3wrapper::deleteMail(const RecMailP&mail) {
222 login(); 223 login();
223 if (!m_pop3) 224 if (!m_pop3)
224 return; 225 return;
225 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); 226 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
226 if (err != MAIL_NO_ERROR) { 227 if (err != MAIL_NO_ERROR) {
227 Global::statusMessage(tr("error deleting mail")); 228 Global::statusMessage(i18n("error deleting mail"));
228 } 229 }
229} 230}
230 231
231void POP3wrapper::answeredMail(const RecMailP&) {} 232void POP3wrapper::answeredMail(const RecMailP&) {}
232 233
233int POP3wrapper::deleteAllMail(const FolderP&) { 234int POP3wrapper::deleteAllMail(const FolderP&) {
@@ -236,30 +237,30 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
236 return 0; 237 return 0;
237 int res = 1; 238 int res = 1;
238 239
239 uint32_t result = 0; 240 uint32_t result = 0;
240 int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); 241 int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
241 if (err != MAIL_NO_ERROR) { 242 if (err != MAIL_NO_ERROR) {
242 Global::statusMessage(tr("Error getting folder info")); 243 Global::statusMessage(i18n("Error getting folder info"));
243 return 0; 244 return 0;
244 } 245 }
245 246
246 247
247 248
248 QProgressBar wid ( result ); 249 QProgressBar wid ( result );
249 wid.setCaption( tr("Deleting ...")); 250 wid.setCaption( i18n("Deleting ..."));
250 wid.show(); 251 wid.show();
251 for (unsigned int i = 0; i < result; ++i) { 252 for (unsigned int i = 0; i < result; ++i) {
252 Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result)); 253 Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result));
253 wid.setProgress( i ); 254 wid.setProgress( i );
254 wid.raise(); 255 wid.raise();
255 qApp->processEvents(); 256 qApp->processEvents();
256 257
257 err = mailsession_remove_message(m_pop3->sto_session,i+1); 258 err = mailsession_remove_message(m_pop3->sto_session,i+1);
258 if (err != MAIL_NO_ERROR) { 259 if (err != MAIL_NO_ERROR) {
259 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 260 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
260 res=0; 261 res=0;
261 } 262 }
262 break; 263 break;
263 } 264 }
264 return res; 265 return res;
265} 266}
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index d5a528c..dee1477 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -11,12 +11,13 @@
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <stdlib.h> 12#include <stdlib.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qpe/qcopenvelope_qws.h> 14#include <qpe/qcopenvelope_qws.h>
15 15
16#include <libetpan/libetpan.h> 16#include <libetpan/libetpan.h>
17#include <klocale.h>
17 18
18 19
19using namespace Opie::Core; 20using namespace Opie::Core;
20progressMailSend*SMTPwrapper::sendProgress = 0; 21progressMailSend*SMTPwrapper::sendProgress = 0;
21 22
22SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 23SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
@@ -41,49 +42,49 @@ void SMTPwrapper::emitQCop( int queued ) {
41 env << queued; 42 env << queued;
42} 43}
43 44
44QString SMTPwrapper::mailsmtpError( int errnum ) { 45QString SMTPwrapper::mailsmtpError( int errnum ) {
45 switch ( errnum ) { 46 switch ( errnum ) {
46 case MAILSMTP_NO_ERROR: 47 case MAILSMTP_NO_ERROR:
47 return tr( "No error" ); 48 return i18n( "No error" );
48 case MAILSMTP_ERROR_UNEXPECTED_CODE: 49 case MAILSMTP_ERROR_UNEXPECTED_CODE:
49 return tr( "Unexpected error code" ); 50 return i18n( "Unexpected error code" );
50 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 51 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
51 return tr( "Service not available" ); 52 return i18n( "Service not available" );
52 case MAILSMTP_ERROR_STREAM: 53 case MAILSMTP_ERROR_STREAM:
53 return tr( "Stream error" ); 54 return i18n( "Stream error" );
54 case MAILSMTP_ERROR_HOSTNAME: 55 case MAILSMTP_ERROR_HOSTNAME:
55 return tr( "gethostname() failed" ); 56 return i18n( "gethostname() failed" );
56 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 57 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
57 return tr( "Not implemented" ); 58 return i18n( "Not implemented" );
58 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 59 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
59 return tr( "Error, action not taken" ); 60 return i18n( "Error, action not taken" );
60 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 61 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
61 return tr( "Data exceeds storage allocation" ); 62 return i18n( "Data exceeds storage allocation" );
62 case MAILSMTP_ERROR_IN_PROCESSING: 63 case MAILSMTP_ERROR_IN_PROCESSING:
63 return tr( "Error in processing" ); 64 return i18n( "Error in processing" );
64 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 65 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
65 return tr( "Starttls not supported" ); 66 return i18n( "Starttls not supported" );
66 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 67 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
67 // return tr( "Insufficient system storage" ); 68 // return i18n( "Insufficient system storage" );
68 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 69 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
69 return tr( "Mailbox unavailable" ); 70 return i18n( "Mailbox unavailable" );
70 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 71 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
71 return tr( "Mailbox name not allowed" ); 72 return i18n( "Mailbox name not allowed" );
72 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 73 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
73 return tr( "Bad command sequence" ); 74 return i18n( "Bad command sequence" );
74 case MAILSMTP_ERROR_USER_NOT_LOCAL: 75 case MAILSMTP_ERROR_USER_NOT_LOCAL:
75 return tr( "User not local" ); 76 return i18n( "User not local" );
76 case MAILSMTP_ERROR_TRANSACTION_FAILED: 77 case MAILSMTP_ERROR_TRANSACTION_FAILED:
77 return tr( "Transaction failed" ); 78 return i18n( "Transaction failed" );
78 case MAILSMTP_ERROR_MEMORY: 79 case MAILSMTP_ERROR_MEMORY:
79 return tr( "Memory error" ); 80 return i18n( "Memory error" );
80 case MAILSMTP_ERROR_CONNECTION_REFUSED: 81 case MAILSMTP_ERROR_CONNECTION_REFUSED:
81 return tr( "Connection refused" ); 82 return i18n( "Connection refused" );
82 default: 83 default:
83 return tr( "Unknown error code" ); 84 return i18n( "Unknown error code" );
84 } 85 }
85} 86}
86 87
87 88
88void SMTPwrapper::progress( size_t current, size_t maximum ) { 89void SMTPwrapper::progress( size_t current, size_t maximum ) {
89 if (SMTPwrapper::sendProgress) { 90 if (SMTPwrapper::sendProgress) {
@@ -149,14 +150,14 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
149void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 150void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
150{ 151{
151 if (data) { 152 if (data) {
152 storeMail(data,size,"Sendfailed"); 153 storeMail(data,size,"Sendfailed");
153 } 154 }
154 if (failuremessage) { 155 if (failuremessage) {
155 QMessageBox::critical(0,tr("Error sending mail"), 156 QMessageBox::critical(0,i18n("Error sending mail"),
156 tr("<center>%1</center>").arg(failuremessage)); 157 i18n("<center>%1</center>").arg(failuremessage));
157 } 158 }
158} 159}
159 160
160int SMTPwrapper::start_smtp_tls() 161int SMTPwrapper::start_smtp_tls()
161{ 162{
162 if (!m_smtp) { 163 if (!m_smtp) {
@@ -218,22 +219,22 @@ void SMTPwrapper::connect_server()
218 } else { 219 } else {
219 ; // odebug << "No SSL session" << oendl; 220 ; // odebug << "No SSL session" << oendl;
220 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 221 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
221 } 222 }
222 if ( err != MAILSMTP_NO_ERROR ) { 223 if ( err != MAILSMTP_NO_ERROR ) {
223 ; // odebug << "Error init connection" << oendl; 224 ; // odebug << "Error init connection" << oendl;
224 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 225 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
225 result = 0; 226 result = 0;
226 } 227 }
227 228
228 /* switch to tls after init 'cause there it will send the ehlo */ 229 /* switch to tls after init 'cause there it will send the ehlo */
229 if (result) { 230 if (result) {
230 err = mailsmtp_init( m_smtp ); 231 err = mailsmtp_init( m_smtp );
231 if (err != MAILSMTP_NO_ERROR) { 232 if (err != MAILSMTP_NO_ERROR) {
232 result = 0; 233 result = 0;
233 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 234 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
234 } 235 }
235 } 236 }
236 237
237 if (try_tls) { 238 if (try_tls) {
238 err = start_smtp_tls(); 239 err = start_smtp_tls();
239 if (err != MAILSMTP_NO_ERROR) { 240 if (err != MAILSMTP_NO_ERROR) {
@@ -242,13 +243,13 @@ void SMTPwrapper::connect_server()
242 err = mailesmtp_ehlo(m_smtp); 243 err = mailesmtp_ehlo(m_smtp);
243 } 244 }
244 } 245 }
245 246
246 if (!try_tls && force_tls) { 247 if (!try_tls && force_tls) {
247 result = 0; 248 result = 0;
248 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); 249 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err));
249 } 250 }
250 251
251 if (result==1 && m_SmtpAccount->getLogin() ) { 252 if (result==1 && m_SmtpAccount->getLogin() ) {
252 ; // odebug << "smtp with auth" << oendl; 253 ; // odebug << "smtp with auth" << oendl;
253 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 254 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
254 // get'em 255 // get'em
@@ -258,25 +259,25 @@ void SMTPwrapper::connect_server()
258 if ( QDialog::Accepted == login.exec() ) { 259 if ( QDialog::Accepted == login.exec() ) {
259 // ok 260 // ok
260 user = login.getUser(); 261 user = login.getUser();
261 pass = login.getPassword(); 262 pass = login.getPassword();
262 } else { 263 } else {
263 result = 0; 264 result = 0;
264 failuretext=tr("Login aborted - storing mail to localfolder"); 265 failuretext=i18n("Login aborted - storing mail to localfolder");
265 } 266 }
266 } else { 267 } else {
267 user = m_SmtpAccount->getUser(); 268 user = m_SmtpAccount->getUser();
268 pass = m_SmtpAccount->getPassword(); 269 pass = m_SmtpAccount->getPassword();
269 } 270 }
270 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; 271 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
271 if (result) { 272 if (result) {
272 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); 273 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
273 if ( err == MAILSMTP_NO_ERROR ) { 274 if ( err == MAILSMTP_NO_ERROR ) {
274 ; // odebug << "auth ok" << oendl; 275 ; // odebug << "auth ok" << oendl;
275 } else { 276 } else {
276 failuretext = tr("Authentification failed"); 277 failuretext = i18n("Authentification failed");
277 result = 0; 278 result = 0;
278 } 279 }
279 } 280 }
280 } 281 }
281} 282}
282 283
@@ -297,13 +298,13 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
297 connect_server(); 298 connect_server();
298 299
299 result = 1; 300 result = 1;
300 if (m_smtp) { 301 if (m_smtp) {
301 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 302 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
302 if ( err != MAILSMTP_NO_ERROR ) { 303 if ( err != MAILSMTP_NO_ERROR ) {
303 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); 304 failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err));
304 result = 0; 305 result = 0;
305 } 306 }
306 } else { 307 } else {
307 result = 0; 308 result = 0;
308 } 309 }
309 310
@@ -430,14 +431,14 @@ bool SMTPwrapper::flushOutbox() {
430 sendProgress = new progressMailSend(); 431 sendProgress = new progressMailSend();
431 sendProgress->show(); 432 sendProgress->show();
432 sendProgress->setMaxMails(mailsToSend.count()); 433 sendProgress->setMaxMails(mailsToSend.count());
433 434
434 while (mailsToSend.count()>0) { 435 while (mailsToSend.count()>0) {
435 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 436 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
436 QMessageBox::critical(0,tr("Error sending mail"), 437 QMessageBox::critical(0,i18n("Error sending mail"),
437 tr("Error sending queued mail - breaking")); 438 i18n("Error sending queued mail - breaking"));
438 returnValue = false; 439 returnValue = false;
439 break; 440 break;
440 } 441 }
441 mailsToRemove.append((*mailsToSend.begin())); 442 mailsToRemove.append((*mailsToSend.begin()));
442 mailsToSend.remove(mailsToSend.begin()); 443 mailsToSend.remove(mailsToSend.begin());
443 sendProgress->setCurrentMails(mailsToRemove.count()); 444 sendProgress->setCurrentMails(mailsToRemove.count());