summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2005-01-24 18:05:48 (UTC)
committer zautrix <zautrix>2005-01-24 18:05:48 (UTC)
commit77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (side-by-side diff)
tree31f28656062c899b5368f13ab594ff6fa5c657fa /kmicromail/opiemail.cpp
parent6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff)
downloadkdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2
mail fixes
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 6e54bf4..760e3b0 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -21,6 +21,7 @@
#include "selectstore.h"
#include "selectsmtp.h"
#include "accountitem.h"
+#include "accountview.h"
#include "klocale.h"
#include <qmessagebox.h>
@@ -313,7 +314,42 @@ void OpieMail::closeViewMail(ViewMail * vm)
void OpieMail::slotDownloadMail( )
{
- qDebug("slotDownloadMail( ) ");
+ QListViewItem*item = mailView->currentItem();
+ if (!item ) {
+ Global::statusMessage("Error: No item slected!");
+ return;
+ }
+ RecMailP mail = ((MailListViewItem*)item)->data();
+ Account * acc = mail->Wrapper()->getAccount();
+ if ( !acc ) {
+ Global::statusMessage("Mail is already stored locally!");
+ return;
+ }
+ QString lfName = acc->getLocalFolder();
+ //qDebug("local folder " + lfName );
+ if ( lfName.isEmpty() )
+ lfName = acc->getAccountName();
+ AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
+ //qDebug("target %d %d ",targetMail,mail->Wrapper() );
+ if ( targetMail == mail->Wrapper() ) {
+ Global::statusMessage("Mail is already locally stored!");
+ return;
+ }
+ if ( !targetMail->createMbox(lfName)) {
+ Global::statusMessage("Error creating folder!");
+ return;
+ }
+ Global::statusMessage("Fetching mail...please wait!");
+ qApp->processEvents();
+ encodedString*st = 0;
+ st = mail->Wrapper()->fetchRawBody(mail);
+ if ( st ) {
+ targetMail->storeMessage(st->Content(),st->Length(),lfName);
+ Global::statusMessage("Mail stored in "+ lfName);
+ delete st;
+ } else {
+ Global::statusMessage("Error: Cannot fetch mail!");
+ }
}