From 77f93c632b66b5c8d92e4c63330362272ca1fc40 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 24 Jan 2005 18:05:48 +0000 Subject: mail fixes --- (limited to 'kmicromail/opiemail.cpp') 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 @@ -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!"); + } } -- cgit v0.9.0.2