Diffstat (limited to 'noncore/net/mail/libmailwrapper/mboxwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index bc496f7..97f301e 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -1,36 +1,36 @@ | |||
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 <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
9 | const QString MBOXwrapper::wrapperType="MBOX"; | 9 | const QString MBOXwrapper::wrapperType="MBOX"; |
10 | 10 | ||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir) | 12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
13 | { | 13 | { |
14 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
15 | if (!dir.exists()) { | 15 | if (!dir.exists()) { |
16 | dir.mkdir(MBOXPath); | 16 | dir.mkdir(MBOXPath); |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | MBOXwrapper::~MBOXwrapper() | 20 | MBOXwrapper::~MBOXwrapper() |
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | 24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) |
25 | { | 25 | { |
26 | mailstorage*storage = mailstorage_new(NULL); | 26 | mailstorage*storage = mailstorage_new(NULL); |
27 | QString p = MBOXPath+"/"; | 27 | QString p = MBOXPath+"/"; |
28 | p+=mailbox; | 28 | p+=mailbox; |
29 | 29 | ||
30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
31 | mailfolder*folder; | 31 | mailfolder*folder; |
32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
33 | r = mailfolder_connect(folder); | 33 | r = mailfolder_connect(folder); |
34 | if (r != MAIL_NO_ERROR) { | 34 | if (r != MAIL_NO_ERROR) { |
35 | qDebug("Error initializing mbox"); | 35 | qDebug("Error initializing mbox"); |
36 | mailfolder_free(folder); | 36 | mailfolder_free(folder); |
@@ -309,24 +309,29 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
309 | mailfolder*folder = 0; | 309 | mailfolder*folder = 0; |
310 | mailstorage*storage = mailstorage_new(NULL); | 310 | mailstorage*storage = mailstorage_new(NULL); |
311 | target_stat.message_count = 0; | 311 | target_stat.message_count = 0; |
312 | target_stat.message_unseen = 0; | 312 | target_stat.message_unseen = 0; |
313 | target_stat.message_recent = 0; | 313 | target_stat.message_recent = 0; |
314 | QString p = MBOXPath+"/"+mailbox; | 314 | QString p = MBOXPath+"/"+mailbox; |
315 | QFile fi(p); | 315 | QFile fi(p); |
316 | if (!fi.exists()) { | 316 | if (!fi.exists()) { |
317 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 317 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
318 | return; | 318 | return; |
319 | } | 319 | } |
320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
322 | r = mailfolder_connect(folder); | 322 | r = mailfolder_connect(folder); |
323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, | 323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, |
324 | &target_stat.message_recent,&target_stat.message_unseen); | 324 | &target_stat.message_recent,&target_stat.message_unseen); |
325 | if (folder) mailfolder_free(folder); | 325 | if (folder) mailfolder_free(folder); |
326 | if (storage) mailstorage_free(storage); | 326 | if (storage) mailstorage_free(storage); |
327 | } | 327 | } |
328 | 328 | ||
329 | const QString&MBOXwrapper::getType()const | 329 | const QString&MBOXwrapper::getType()const |
330 | { | 330 | { |
331 | return wrapperType; | 331 | return wrapperType; |
332 | } | 332 | } |
333 | |||
334 | const QString&MBOXwrapper::getName()const | ||
335 | { | ||
336 | return MBOXName; | ||
337 | } | ||