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.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index ed5c898..870985e 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -139,96 +139,99 @@ QString AbstractMail::draftFolder()
139 139
140/* temporary - will be removed when implemented in all classes */ 140/* temporary - will be removed when implemented in all classes */
141void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) 141void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
142{ 142{
143} 143}
144void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 144void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
145{ 145{
146 //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 146 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
147 // this is currently re-implemented in pop3wrapper and imapwrapper 147 // this is currently re-implemented in pop3wrapper and imapwrapper
148 int iii = 0; 148 int iii = 0;
149 int count = target.count(); 149 int count = target.count();
150 QProgressBar wid ( count ); 150 QProgressBar wid ( count );
151 wid.setCaption( i18n("Deleting ...")); 151 wid.setCaption( i18n("Deleting ..."));
152 wid.show(); 152 wid.show();
153 while (iii < count ) { 153 while (iii < count ) {
154 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); 154 Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
155 wid.setProgress( iii ); 155 wid.setProgress( iii );
156 wid.raise(); 156 wid.raise();
157 qApp->processEvents(); 157 qApp->processEvents();
158 RecMailP mail = (*target.at( iii )); 158 RecMailP mail = (*target.at( iii ));
159 deleteMail(mail); 159 deleteMail(mail);
160 ++iii; 160 ++iii;
161 } 161 }
162} 162}
163 163
164void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) 164void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
165{ 165{
166 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); 166 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
167 // get local folder 167 // get local folder
168 Account * acc = getAccount(); 168 Account * acc = getAccount();
169 if ( !acc ) return; 169 if ( !acc ) return;
170 QString lfName = acc->getLocalFolder(); 170 QString lfName = acc->getLocalFolder();
171 if ( lfName.isEmpty() ) 171 if ( lfName.isEmpty() )
172 lfName = acc->getAccountName(); 172 lfName = acc->getAccountName();
173 // create local folder 173 // create local folder
174 if ( !targetMail->createMbox(lfName)) 174 if ( !targetMail->createMbox(lfName))
175 { 175 {
176 QMessageBox::critical(0,i18n("Error creating new Folder"), 176 QMessageBox::critical(0,i18n("Error creating new Folder"),
177 i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); 177 i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
178 return; 178 return;
179 } 179 }
180 QValueList<RecMailP> t; 180 QValueList<RecMailP> t;
181 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); 181 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
182 if ( t.count() == 0 ) { 182 if ( t.count() == 0 ) {
183 qDebug("There are no new messages %s", fromFolder->getName().latin1()); 183 qDebug("There are no new messages %s", fromFolder->getName().latin1());
184 Global::statusMessage(i18n("There are no new messages")); 184 Global::statusMessage(i18n("There are no new messages"));
185 return; 185 return;
186 } 186 }
187 Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
188 qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
189 qApp->processEvents();
187 QValueList<RecMailP> e; 190 QValueList<RecMailP> e;
188 targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); 191 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
189 //qDebug("target has mails %d ", e.count()); 192 //qDebug("target has mails %d ", e.count());
190 QValueList<RecMailP> n; 193 QValueList<RecMailP> n;
191 int iii = 0; 194 int iii = 0;
192 int count = t.count(); 195 int count = t.count();
193 while (iii < count ) { 196 while (iii < count ) {
194 RecMailP r = (*t.at( iii )); 197 RecMailP r = (*t.at( iii ));
195 bool found = false; 198 bool found = false;
196 int jjj = 0; 199 int jjj = 0;
197 int countE = e.count(); 200 int countE = e.count();
198 while (jjj < countE ) { 201 while (jjj < countE ) {
199 RecMailP re = (*e.at( jjj )); 202 RecMailP re = (*e.at( jjj ));
200 if ( re->isEqual(r) ) { 203 if ( re->isEqual(r) ) {
201 found = true; 204 found = true;
202 break; 205 break;
203 } 206 }
204 ++jjj; 207 ++jjj;
205 } 208 }
206 if ( !found ) { 209 if ( !found ) {
207 //qDebug("AAAdate *%s* ", r->isodate.latin1() ); 210 //qDebug("AAAdate *%s* ", r->isodate.latin1() );
208 n.append( r ); 211 n.append( r );
209 } 212 }
210 ++iii; 213 ++iii;
211 } 214 }
212 qDebug("Downloaded %d messages ",n.count() ); 215 qDebug("Downloaded %d messages ",n.count() );
213 if ( n.count() == 0 ) { 216 if ( n.count() == 0 ) {
214 Global::statusMessage(i18n("There are no new messages")); 217 Global::statusMessage(i18n("There are no new messages"));
215 return; 218 return;
216 } 219 }
217 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); 220 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
218 Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); 221 Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count()));
219 222
220#if 0 223#if 0
221 QValueList<RecMailP> t; 224 QValueList<RecMailP> t;
222 listMessages(fromFolder->getName(),t, maxSizeInKb); 225 listMessages(fromFolder->getName(),t, maxSizeInKb);
223 mvcpMailList( t,targetFolder,targetWrapper,moveit); 226 mvcpMailList( t,targetFolder,targetWrapper,moveit);
224#endif 227#endif
225 228
226} 229}
227void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 230void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
228 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 231 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
229{ 232{
230 QValueList<RecMailP> t; 233 QValueList<RecMailP> t;
231 listMessages(fromFolder->getName(),t, maxSizeInKb); 234 listMessages(fromFolder->getName(),t, maxSizeInKb);
232 mvcpMailList( t,targetFolder,targetWrapper,moveit); 235 mvcpMailList( t,targetFolder,targetWrapper,moveit);
233 236
234} 237}