Diffstat (limited to 'noncore/net/mail/libmailwrapper/mhwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 179bd34..560eab0 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -1,36 +1,34 @@ | |||
1 | #include "mhwrapper.h" | 1 | #include "mhwrapper.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 <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | #include <opie2/oprocess.h> | 9 | #include <opie2/oprocess.h> |
10 | 10 | ||
11 | const MAILLIB::ATYPE MHwrapper::wrapperType=MAILLIB::A_MH; | ||
12 | |||
13 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 11 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
14 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 12 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
15 | { | 13 | { |
16 | if (MHPath.length()>0) { | 14 | if (MHPath.length()>0) { |
17 | if (MHPath[MHPath.length()-1]=='/') { | 15 | if (MHPath[MHPath.length()-1]=='/') { |
18 | MHPath=MHPath.left(MHPath.length()-1); | 16 | MHPath=MHPath.left(MHPath.length()-1); |
19 | } | 17 | } |
20 | qDebug(MHPath); | 18 | qDebug(MHPath); |
21 | QDir dir(MHPath); | 19 | QDir dir(MHPath); |
22 | if (!dir.exists()) { | 20 | if (!dir.exists()) { |
23 | dir.mkdir(MHPath); | 21 | dir.mkdir(MHPath); |
24 | } | 22 | } |
25 | init_storage(); | 23 | init_storage(); |
26 | } | 24 | } |
27 | } | 25 | } |
28 | 26 | ||
29 | void MHwrapper::init_storage() | 27 | void MHwrapper::init_storage() |
30 | { | 28 | { |
31 | int r; | 29 | int r; |
32 | QString pre = MHPath; | 30 | QString pre = MHPath; |
33 | if (!m_storage) { | 31 | if (!m_storage) { |
34 | m_storage = mailstorage_new(NULL); | 32 | m_storage = mailstorage_new(NULL); |
35 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); | 33 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); |
36 | if (r != MAIL_NO_ERROR) { | 34 | if (r != MAIL_NO_ERROR) { |
@@ -347,49 +345,49 @@ void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) | |||
347 | QString lineStr = buffer; | 345 | QString lineStr = buffer; |
348 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); | 346 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); |
349 | removeMboxfailed = true; | 347 | removeMboxfailed = true; |
350 | } | 348 | } |
351 | 349 | ||
352 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 350 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
353 | { | 351 | { |
354 | init_storage(); | 352 | init_storage(); |
355 | if (!m_storage) { | 353 | if (!m_storage) { |
356 | return; | 354 | return; |
357 | } | 355 | } |
358 | target_stat.message_count = 0; | 356 | target_stat.message_count = 0; |
359 | target_stat.message_unseen = 0; | 357 | target_stat.message_unseen = 0; |
360 | target_stat.message_recent = 0; | 358 | target_stat.message_recent = 0; |
361 | QString f = buildPath(mailbox); | 359 | QString f = buildPath(mailbox); |
362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, | 360 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, |
363 | &target_stat.message_recent,&target_stat.message_unseen); | 361 | &target_stat.message_recent,&target_stat.message_unseen); |
364 | if (r != MAIL_NO_ERROR) { | 362 | if (r != MAIL_NO_ERROR) { |
365 | Global::statusMessage(tr("Error retrieving status")); | 363 | Global::statusMessage(tr("Error retrieving status")); |
366 | } | 364 | } |
367 | } | 365 | } |
368 | 366 | ||
369 | MAILLIB::ATYPE MHwrapper::getType()const | 367 | MAILLIB::ATYPE MHwrapper::getType()const |
370 | { | 368 | { |
371 | return wrapperType; | 369 | return MAILLIB::A_MH; |
372 | } | 370 | } |
373 | 371 | ||
374 | const QString&MHwrapper::getName()const | 372 | const QString&MHwrapper::getName()const |
375 | { | 373 | { |
376 | return MHName; | 374 | return MHName; |
377 | } | 375 | } |
378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 376 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
379 | { | 377 | { |
380 | init_storage(); | 378 | init_storage(); |
381 | if (!m_storage) { | 379 | if (!m_storage) { |
382 | return; | 380 | return; |
383 | } | 381 | } |
384 | if (targetWrapper != this) { | 382 | if (targetWrapper != this) { |
385 | qDebug("Using generic"); | 383 | qDebug("Using generic"); |
386 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 384 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
387 | return; | 385 | return; |
388 | } | 386 | } |
389 | qDebug("Using internal routines for move/copy"); | 387 | qDebug("Using internal routines for move/copy"); |
390 | QString tf = buildPath(targetFolder); | 388 | QString tf = buildPath(targetFolder); |
391 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); | 389 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); |
392 | if (r != MAIL_NO_ERROR) { | 390 | if (r != MAIL_NO_ERROR) { |
393 | qDebug("Error selecting source mailbox"); | 391 | qDebug("Error selecting source mailbox"); |
394 | return; | 392 | return; |
395 | } | 393 | } |