summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/abstractmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 2d7533c..8ee112c 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -2,25 +2,25 @@
2#include "abstractmail.h" 2#include "abstractmail.h"
3#include "imapwrapper.h" 3#include "imapwrapper.h"
4#include "pop3wrapper.h" 4#include "pop3wrapper.h"
5#include "nntpwrapper.h" 5#include "nntpwrapper.h"
6#include "mhwrapper.h" 6#include "mhwrapper.h"
7#include "mailtypes.h" 7#include "mailtypes.h"
8#include <qpe/global.h> 8#include <qpe/global.h>
9 9
10 10
11#include <qprogressbar.h> 11#include <qprogressbar.h>
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14 14#include <klocale.h>
15#include <kdecore/kstandarddirs.h> 15#include <kdecore/kstandarddirs.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <stdlib.h> 18#include <stdlib.h>
19#include <libetpan/mailmime_content.h> 19#include <libetpan/mailmime_content.h>
20#include <libetpan/mailmime.h> 20#include <libetpan/mailmime.h>
21 21
22using namespace Opie::Core; 22using namespace Opie::Core;
23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
24{ 24{
25 return new IMAPwrapper(a); 25 return new IMAPwrapper(a);
26} 26}
@@ -138,58 +138,58 @@ QString AbstractMail::draftFolder()
138 138
139/* temporary - will be removed when implemented in all classes */ 139/* temporary - will be removed when implemented in all classes */
140void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) 140void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
141{ 141{
142} 142}
143void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 143void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
144{ 144{
145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
146 // this is currently re-implemented in pop3wrapper and imapwrapper 146 // this is currently re-implemented in pop3wrapper and imapwrapper
147 int iii = 0; 147 int iii = 0;
148 int count = target.count(); 148 int count = target.count();
149 QProgressBar wid ( count ); 149 QProgressBar wid ( count );
150 wid.setCaption( tr("Deleting ...")); 150 wid.setCaption( i18n("Deleting ..."));
151 wid.show(); 151 wid.show();
152 while (iii < count ) { 152 while (iii < count ) {
153 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 153 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
154 wid.setProgress( iii ); 154 wid.setProgress( iii );
155 wid.raise(); 155 wid.raise();
156 qApp->processEvents(); 156 qApp->processEvents();
157 RecMailP mail = (*target.at( iii )); 157 RecMailP mail = (*target.at( iii ));
158 deleteMail(mail); 158 deleteMail(mail);
159 ++iii; 159 ++iii;
160 } 160 }
161} 161}
162 162
163void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) 163void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
164{ 164{
165 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); 165 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
166 // get local folder 166 // get local folder
167 Account * acc = getAccount(); 167 Account * acc = getAccount();
168 if ( !acc ) return; 168 if ( !acc ) return;
169 QString lfName = acc->getLocalFolder(); 169 QString lfName = acc->getLocalFolder();
170 if ( lfName.isEmpty() ) 170 if ( lfName.isEmpty() )
171 lfName = acc->getAccountName(); 171 lfName = acc->getAccountName();
172 // create local folder 172 // create local folder
173 if ( !targetMail->createMbox(lfName)) 173 if ( !targetMail->createMbox(lfName))
174 { 174 {
175 QMessageBox::critical(0,tr("Error creating new Folder"), 175 QMessageBox::critical(0,i18n("Error creating new Folder"),
176 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); 176 i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
177 return; 177 return;
178 } 178 }
179 QValueList<RecMailP> t; 179 QValueList<RecMailP> t;
180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); 180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
181 if ( t.count() == 0 ) { 181 if ( t.count() == 0 ) {
182 qDebug("There are no new messages %s", fromFolder->getName().latin1()); 182 qDebug("There are no new messages %s", fromFolder->getName().latin1());
183 Global::statusMessage(tr("There are no new messages")); 183 Global::statusMessage(i18n("There are no new messages"));
184 return; 184 return;
185 } 185 }
186 QValueList<RecMailP> e; 186 QValueList<RecMailP> e;
187 targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); 187 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
188 //qDebug("target has mails %d ", e.count()); 188 //qDebug("target has mails %d ", e.count());
189 QValueList<RecMailP> n; 189 QValueList<RecMailP> n;
190 int iii = 0; 190 int iii = 0;
191 int count = t.count(); 191 int count = t.count();
192 while (iii < count ) { 192 while (iii < count ) {
193 RecMailP r = (*t.at( iii )); 193 RecMailP r = (*t.at( iii ));
194 bool found = false; 194 bool found = false;
195 int jjj = 0; 195 int jjj = 0;
@@ -201,29 +201,29 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe
201 break; 201 break;
202 } 202 }
203 ++jjj; 203 ++jjj;
204 } 204 }
205 if ( !found ) { 205 if ( !found ) {
206 //qDebug("AAAdate *%s* ", r->isodate.latin1() ); 206 //qDebug("AAAdate *%s* ", r->isodate.latin1() );
207 n.append( r ); 207 n.append( r );
208 } 208 }
209 ++iii; 209 ++iii;
210 } 210 }
211 qDebug("Downloaded %d messages ",n.count() ); 211 qDebug("Downloaded %d messages ",n.count() );
212 if ( n.count() == 0 ) { 212 if ( n.count() == 0 ) {
213 Global::statusMessage(tr("There are no new messages")); 213 Global::statusMessage(i18n("There are no new messages"));
214 return; 214 return;
215 } 215 }
216 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); 216 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
217 Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); 217 Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count()));
218 218
219#if 0 219#if 0
220 QValueList<RecMailP> t; 220 QValueList<RecMailP> t;
221 listMessages(fromFolder->getName(),t, maxSizeInKb); 221 listMessages(fromFolder->getName(),t, maxSizeInKb);
222 mvcpMailList( t,targetFolder,targetWrapper,moveit); 222 mvcpMailList( t,targetFolder,targetWrapper,moveit);
223#endif 223#endif
224 224
225} 225}
226void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 226void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
227 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 227 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
228{ 228{
229 QValueList<RecMailP> t; 229 QValueList<RecMailP> t;
@@ -231,31 +231,31 @@ void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
231 mvcpMailList( t,targetFolder,targetWrapper,moveit); 231 mvcpMailList( t,targetFolder,targetWrapper,moveit);
232 232
233} 233}
234void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, 234void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
235 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 235 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
236{ 236{
237 encodedString*st = 0; 237 encodedString*st = 0;
238 int iii = 0; 238 int iii = 0;
239 int count = t.count(); 239 int count = t.count();
240 if ( count == 0 ) 240 if ( count == 0 )
241 return; 241 return;
242 // wel, processevents is qite strange, we need a widget for getting 242 // wel, processevents is qite strange, we need a widget for getting
243 // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye 243 // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye
244 244
245 QProgressBar wid ( count ); 245 QProgressBar wid ( count );
246 wid.setCaption( tr("Copying ...")); 246 wid.setCaption( i18n("Copying..."));
247 wid.show(); 247 wid.show();
248 while (iii < count ) { 248 while (iii < count ) {
249 Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); 249 Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count));
250 wid.setProgress( iii ); 250 wid.setProgress( iii );
251 wid.raise(); 251 wid.raise();
252 qApp->processEvents(); 252 qApp->processEvents();
253 RecMailP r = (*t.at( iii )); 253 RecMailP r = (*t.at( iii ));
254 st = fetchRawBody(r); 254 st = fetchRawBody(r);
255 if (st) { 255 if (st) {
256 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); 256 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
257 delete st; 257 delete st;
258 } 258 }
259 ++iii; 259 ++iii;
260 } 260 }
261 if (moveit) { 261 if (moveit) {