summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp40
-rw-r--r--noncore/net/mail/accountview.h1
-rw-r--r--noncore/net/mail/defines.h3
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp19
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h2
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp31
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h1
7 files changed, 83 insertions, 14 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index eea021f..b7de7b9 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -9,2 +9,3 @@
9 9
10#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
10/** 11/**
@@ -17,3 +18,10 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
17 wrapper = AbstractMail::getWrapper( account ); 18 wrapper = AbstractMail::getWrapper( account );
18 setPixmap( 0, PIXMAP_POP3FOLDER ); 19 SETPIX(PIXMAP_POP3FOLDER);
20#if 0
21 if (!account->getOffline()) {
22 setPixmap( 0, );
23 } else {
24 setPixmap( 0, PIXMAP_OFFLINE );
25 }
26#endif
19 setText( 0, account->getAccountName() ); 27 setText( 0, account->getAccountName() );
@@ -34,2 +42,7 @@ void POP3viewItem::refresh( QList<RecMail> & )
34{ 42{
43 refresh();
44}
45
46void POP3viewItem::refresh()
47{
35 if (account->getOffline()) return; 48 if (account->getOffline()) return;
@@ -91,2 +104,4 @@ void POP3viewItem::setOnOffline()
91 account->save(); 104 account->save();
105 SETPIX(PIXMAP_POP3FOLDER);
106 refresh();
92} 107}
@@ -180,3 +195,3 @@ IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
180 wrapper = AbstractMail::getWrapper( account ); 195 wrapper = AbstractMail::getWrapper( account );
181 setPixmap( 0, PIXMAP_IMAPFOLDER ); 196 SETPIX(PIXMAP_IMAPFOLDER);
182 setText( 0, account->getAccountName() ); 197 setText( 0, account->getAccountName() );
@@ -339,2 +354,3 @@ void IMAPviewItem::contextMenuSelected(int id)
339 account->save(); 354 account->save();
355 SETPIX(PIXMAP_IMAPFOLDER);
340 refreshFolders(false); 356 refreshFolders(false);
@@ -667,3 +683,2 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
667{ 683{
668 unsigned int i = 0;
669 AbstractMail*targetMail = 0; 684 AbstractMail*targetMail = 0;
@@ -679,14 +694,11 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
679 } 694 }
680 695 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) {
681 QList<RecMail> t; 696 QMessageBox::critical(0,tr("Error creating new Folder"),
682 fromWrapper->listMessages(fromFolder->getName(),t); 697 tr("<center>Error while creating<br>new folder - breaking.</center>"));
683 encodedString*st = 0; 698 return;
684 for (i = 0; i < t.count();++i) {
685 RecMail*r = t.at(i);
686 st = fromWrapper->fetchRawBody(*r);
687 if (st) {
688 targetMail->storeMessage(st->Content(),st->Length(),targetFolder);
689 delete st;
690 }
691 } 699 }
700 qDebug("Targetfolder: %s",targetFolder.latin1());
701 qDebug("Fromfolder: %s",fromFolder->getName().latin1());
702 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
703 refreshCurrent();
692} 704}
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 48f52c7..df916c1 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -50,2 +50,3 @@ protected:
50 POP3account *account; 50 POP3account *account;
51 virtual void refresh();
51 AbstractMail *wrapper; 52 AbstractMail *wrapper;
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index ebe8e08..d840f09 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -18,2 +18,4 @@
18 18
19#define PIC_OFFLINE "mail/notconnected"
20
19#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) 21#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
@@ -32,2 +34,3 @@
32#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) 34#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) )
35#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) )
33 36
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 3dd2fce..4b4c728 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -106 +106,20 @@ void AbstractMail::deleteMails(const QString &,QList<RecMail> &)
106} 106}
107
108void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
109{
110 QList<RecMail> t;
111 listMessages(fromFolder->getName(),t);
112 encodedString*st = 0;
113 while (t.count()>0) {
114 RecMail*r = t.at(0);
115 st = fetchRawBody(*r);
116 if (st) {
117 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
118 delete st;
119 }
120 t.removeFirst();
121 }
122 if (moveit) {
123 deleteAllMail(fromFolder);
124 }
125}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 15d83cb..8debaae 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -37,2 +37,4 @@ public:
37 37
38 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
39
38 virtual void cleanMimeCache(){}; 40 virtual void cleanMimeCache(){};
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index bb74de9..23c678b 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -1011,2 +1011,3 @@ const QString&IMAPwrapper::getName()const
1011{ 1011{
1012 qDebug("Get name: %s",account->getAccountName().latin1());
1012 return account->getAccountName(); 1013 return account->getAccountName();
@@ -1020 +1021,31 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
1020} 1021}
1022
1023void IMAPwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1024{
1025 qDebug("mvcp mail imap");
1026 if (targetWrapper != this) {
1027 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
1028 qDebug("Using generic");
1029 return;
1030 }
1031 qDebug("Using internal");
1032 mailimap_set *set = 0;
1033
1034 int err = mailimap_select( m_imap, fromFolder->getName().latin1());
1035 if ( err != MAILIMAP_NO_ERROR ) {
1036 Global::statusMessage(tr("error selecting mailbox: %1").arg(m_imap->imap_response));
1037 return;
1038 }
1039
1040 int last = m_imap->imap_selection_info->sel_exists;
1041 set = mailimap_set_new_interval( 1, last );
1042 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1043 if ( err != MAILIMAP_NO_ERROR ) {
1044 Global::statusMessage(tr("error copy mails: %1").arg(m_imap->imap_response));
1045 return;
1046 }
1047 mailimap_set_free( set );
1048 if (moveit) {
1049 deleteAllMail(fromFolder);
1050 }
1051}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index b2bd7e9..07c6210 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -33,2 +33,3 @@ public:
33 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 33 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
34 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
34 35