summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp13
-rw-r--r--kmicromail/libmailwrapper/sendmailprogress.cpp5
2 files changed, 10 insertions, 8 deletions
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index 641d4d9..f4133c0 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,22 +1,23 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "mhwrapper.h" 2#include "mhwrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6#include <qdir.h> 6#include <qdir.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <qpe/global.h> 9#include <qpe/global.h>
10#include <oprocess.h> 10#include <oprocess.h>
11#include <klocale.h>
11//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
12 13
13using namespace Opie::Core; 14using namespace Opie::Core;
14MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
15 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
16{ 17{
17 if (MHPath.length()>0) { 18 if (MHPath.length()>0) {
18 if (MHPath[MHPath.length()-1]=='/') { 19 if (MHPath[MHPath.length()-1]=='/') {
19 MHPath=MHPath.left(MHPath.length()-1); 20 MHPath=MHPath.left(MHPath.length()-1);
20 } 21 }
21 //odebug << MHPath << oendl; 22 //odebug << MHPath << oendl;
22 QDir dir(MHPath); 23 QDir dir(MHPath);
@@ -67,25 +68,25 @@ void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSm
67{ 68{
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(i18n("Mailbox has %1 mail(s)").arg(target.count()));
80} 81}
81 82
82QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() 83QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
83{ 84{
84 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 85 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
85 /* this is needed! */ 86 /* this is needed! */
86 if (m_storage) mailstorage_disconnect(m_storage); 87 if (m_storage) mailstorage_disconnect(m_storage);
87 init_storage(); 88 init_storage();
88 if (!m_storage) { 89 if (!m_storage) {
89 return folders; 90 return folders;
90 } 91 }
91 mail_list*flist = 0; 92 mail_list*flist = 0;
@@ -223,30 +224,30 @@ encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
223 return result; 224 return result;
224 } 225 }
225 mailmessage * msg = 0; 226 mailmessage * msg = 0;
226 char*data=0; 227 char*data=0;
227 size_t size; 228 size_t size;
228 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 229 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
229 if (r!=MAIL_NO_ERROR) { 230 if (r!=MAIL_NO_ERROR) {
230 qDebug("error selecting folder! "); 231 qDebug("error selecting folder! ");
231 return result; 232 return result;
232 } 233 }
233 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 234 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
234 if (r != MAIL_NO_ERROR) { 235 if (r != MAIL_NO_ERROR) {
235 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 236 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
236 return 0; 237 return 0;
237 } 238 }
238 r = mailmessage_fetch(msg,&data,&size); 239 r = mailmessage_fetch(msg,&data,&size);
239 if (r != MAIL_NO_ERROR) { 240 if (r != MAIL_NO_ERROR) {
240 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 241 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
241 if (msg) mailmessage_free(msg); 242 if (msg) mailmessage_free(msg);
242 return 0; 243 return 0;
243 } 244 }
244 result = new encodedString(data,size); 245 result = new encodedString(data,size);
245 if (msg) mailmessage_free(msg); 246 if (msg) mailmessage_free(msg);
246 return result; 247 return result;
247} 248}
248 249
249void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 250void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
250{ 251{
251 QString f = buildPath(mailbox); 252 QString f = buildPath(mailbox);
252 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 253 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
@@ -281,25 +282,25 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
281 r = mailsession_get_messages_list(m_storage->sto_session,&l); 282 r = mailsession_get_messages_list(m_storage->sto_session,&l);
282 if (r != MAIL_NO_ERROR) { 283 if (r != MAIL_NO_ERROR) {
283 qDebug("Error message list "); 284 qDebug("Error message list ");
284 res = 0; 285 res = 0;
285 } 286 }
286 unsigned j = 0; 287 unsigned j = 0;
287 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
288 mailmessage * msg; 289 mailmessage * msg;
289 msg = (mailmessage*)carray_get(l->msg_tab, i); 290 msg = (mailmessage*)carray_get(l->msg_tab, i);
290 j = msg->msg_index; 291 j = msg->msg_index;
291 r = mailsession_remove_message(m_storage->sto_session,j); 292 r = mailsession_remove_message(m_storage->sto_session,j);
292 if (r != MAIL_NO_ERROR) { 293 if (r != MAIL_NO_ERROR) {
293 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 294 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
294 res = 0; 295 res = 0;
295 break; 296 break;
296 } 297 }
297 } 298 }
298 if (l) mailmessage_list_free(l); 299 if (l) mailmessage_list_free(l);
299 return res; 300 return res;
300} 301}
301 302
302int MHwrapper::deleteMbox(const FolderP&tfolder) 303int MHwrapper::deleteMbox(const FolderP&tfolder)
303{ 304{
304 init_storage(); 305 init_storage();
305 if (!m_storage) { 306 if (!m_storage) {
@@ -335,42 +336,42 @@ int MHwrapper::deleteMbox(const FolderP&tfolder)
335 qDebug("mail box deleted "); 336 qDebug("mail box deleted ");
336 return 1; 337 return 1;
337} 338}
338 339
339void MHwrapper::processEnded(OProcess *p) 340void MHwrapper::processEnded(OProcess *p)
340{ 341{
341 if (p) delete p; 342 if (p) delete p;
342} 343}
343 344
344void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
345{ 346{
346 QString lineStr = buffer; 347 QString lineStr = buffer;
347 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 348 QMessageBox::warning( 0, i18n("Error"), lineStr ,i18n("Ok") );
348 removeMboxfailed = true; 349 removeMboxfailed = true;
349} 350}
350 351
351void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
352{ 353{
353 init_storage(); 354 init_storage();
354 if (!m_storage) { 355 if (!m_storage) {
355 return; 356 return;
356 } 357 }
357 target_stat.message_count = 0; 358 target_stat.message_count = 0;
358 target_stat.message_unseen = 0; 359 target_stat.message_unseen = 0;
359 target_stat.message_recent = 0; 360 target_stat.message_recent = 0;
360 QString f = buildPath(mailbox); 361 QString f = buildPath(mailbox);
361 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
362 &target_stat.message_recent,&target_stat.message_unseen); 363 &target_stat.message_recent,&target_stat.message_unseen);
363 if (r != MAIL_NO_ERROR) { 364 if (r != MAIL_NO_ERROR) {
364 Global::statusMessage(tr("Error retrieving status")); 365 Global::statusMessage(i18n("Error retrieving status"));
365 } 366 }
366} 367}
367 368
368MAILLIB::ATYPE MHwrapper::getType()const 369MAILLIB::ATYPE MHwrapper::getType()const
369{ 370{
370 return MAILLIB::A_MH; 371 return MAILLIB::A_MH;
371} 372}
372 373
373const QString&MHwrapper::getName()const 374const QString&MHwrapper::getName()const
374{ 375{
375 return MHName; 376 return MHName;
376} 377}
diff --git a/kmicromail/libmailwrapper/sendmailprogress.cpp b/kmicromail/libmailwrapper/sendmailprogress.cpp
index dc0c75a..20dfe9b 100644
--- a/kmicromail/libmailwrapper/sendmailprogress.cpp
+++ b/kmicromail/libmailwrapper/sendmailprogress.cpp
@@ -1,15 +1,16 @@
1#include "sendmailprogress.h" 1#include "sendmailprogress.h"
2#include <qprogressbar.h> 2#include <qprogressbar.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <klocale.h>
4 5
5progressMailSend::progressMailSend(QWidget*parent, const char * name) 6progressMailSend::progressMailSend(QWidget*parent, const char * name)
6 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) 7 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
7{ 8{
8} 9}
9 10
10progressMailSend::~progressMailSend() 11progressMailSend::~progressMailSend()
11{ 12{
12} 13}
13 14
14void progressMailSend::setMaxMails(unsigned int aMaxMails) 15void progressMailSend::setMaxMails(unsigned int aMaxMails)
15{ 16{
@@ -25,23 +26,23 @@ void progressMailSend::setCurrentMails(unsigned int aCurrent)
25 setMails(); 26 setMails();
26} 27}
27 28
28void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) 29void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
29{ 30{
30 m_current_single = aCurrent; 31 m_current_single = aCurrent;
31 m_max_single = aMax; 32 m_max_single = aMax;
32 setSingle(); 33 setSingle();
33} 34}
34 35
35void progressMailSend::setSingle() 36void progressMailSend::setSingle()
36{ 37{
37 QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); 38 QString text = QString(i18n("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
38 singleMailLabel->setText(text); 39 singleMailLabel->setText(text);
39 singleMailProgressBar->setTotalSteps(m_max_single); 40 singleMailProgressBar->setTotalSteps(m_max_single);
40 singleMailProgressBar->setProgress(m_current_single); 41 singleMailProgressBar->setProgress(m_current_single);
41} 42}
42 43
43void progressMailSend::setMails() 44void progressMailSend::setMails()
44{ 45{
45 QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); 46 QString text = QString(i18n("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail);
46 allMailLabel->setText(text); 47 allMailLabel->setText(text);
47} 48}