Diffstat (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 88545f8..673f288 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -136,124 +136,126 @@ QString AbstractMail::defaultLocalfolder() | |||
136 | QString AbstractMail::draftFolder() | 136 | QString AbstractMail::draftFolder() |
137 | { | 137 | { |
138 | return QString("Drafts"); | 138 | return QString("Drafts"); |
139 | } | 139 | } |
140 | 140 | ||
141 | /* temporary - will be removed when implemented in all classes */ | 141 | /* temporary - will be removed when implemented in all classes */ |
142 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) | 142 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) |
143 | { | 143 | { |
144 | } | 144 | } |
145 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | 145 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) |
146 | { | 146 | { |
147 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | 147 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); |
148 | // this is currently re-implemented in pop3wrapper and imapwrapper | 148 | // this is currently re-implemented in pop3wrapper and imapwrapper |
149 | int iii = 0; | 149 | int iii = 0; |
150 | int count = target.count(); | 150 | int count = target.count(); |
151 | QProgressBar wid ( count ); | 151 | QProgressBar wid ( count ); |
152 | wid.setCaption( tr("Deleting ...")); | 152 | wid.setCaption( tr("Deleting ...")); |
153 | wid.show(); | 153 | wid.show(); |
154 | while (iii < count ) { | 154 | while (iii < count ) { |
155 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 155 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
156 | wid.setProgress( iii ); | 156 | wid.setProgress( iii ); |
157 | wid.raise(); | 157 | wid.raise(); |
158 | qApp->processEvents(); | 158 | qApp->processEvents(); |
159 | RecMailP mail = (*target.at( iii )); | 159 | RecMailP mail = (*target.at( iii )); |
160 | deleteMail(mail); | 160 | deleteMail(mail); |
161 | ++iii; | 161 | ++iii; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) | 165 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) |
166 | { | 166 | { |
167 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); | 167 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); |
168 | // get local folder | 168 | // get local folder |
169 | Account * acc = getAccount(); | 169 | Account * acc = getAccount(); |
170 | if ( !acc ) return; | 170 | if ( !acc ) return; |
171 | QString lfName = acc->getLocalFolder(); | 171 | QString lfName = acc->getLocalFolder(); |
172 | if ( lfName.isEmpty() ) | 172 | if ( lfName.isEmpty() ) |
173 | lfName = acc->getAccountName(); | 173 | lfName = acc->getAccountName(); |
174 | // create local folder | 174 | // create local folder |
175 | if ( !targetMail->createMbox(lfName)) | 175 | if ( !targetMail->createMbox(lfName)) |
176 | { | 176 | { |
177 | QMessageBox::critical(0,tr("Error creating new Folder"), | 177 | QMessageBox::critical(0,tr("Error creating new Folder"), |
178 | tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); | 178 | tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); |
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | QValueList<RecMailP> t; | 181 | QValueList<RecMailP> t; |
182 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); | 182 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); |
183 | if ( t.count() == 0 ) { | 183 | if ( t.count() == 0 ) { |
184 | qDebug("There are no new messages %s", fromFolder->getName().latin1()); | ||
184 | Global::statusMessage(tr("There are no new messages")); | 185 | Global::statusMessage(tr("There are no new messages")); |
185 | return; | 186 | return; |
186 | } | 187 | } |
187 | QValueList<RecMailP> e; | 188 | QValueList<RecMailP> e; |
188 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); | 189 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); |
189 | //qDebug("target has mails %d ", e.count()); | 190 | //qDebug("target has mails %d ", e.count()); |
190 | QValueList<RecMailP> n; | 191 | QValueList<RecMailP> n; |
191 | int iii = 0; | 192 | int iii = 0; |
192 | int count = t.count(); | 193 | int count = t.count(); |
193 | while (iii < count ) { | 194 | while (iii < count ) { |
194 | RecMailP r = (*t.at( iii )); | 195 | RecMailP r = (*t.at( iii )); |
195 | bool found = false; | 196 | bool found = false; |
196 | int jjj = 0; | 197 | int jjj = 0; |
197 | int countE = e.count(); | 198 | int countE = e.count(); |
198 | while (jjj < countE ) { | 199 | while (jjj < countE ) { |
199 | RecMailP re = (*e.at( jjj )); | 200 | RecMailP re = (*e.at( jjj )); |
200 | if ( re->isEqual(r) ) { | 201 | if ( re->isEqual(r) ) { |
201 | found = true; | 202 | found = true; |
202 | break; | 203 | break; |
203 | } | 204 | } |
204 | ++jjj; | 205 | ++jjj; |
205 | } | 206 | } |
206 | if ( !found ) { | 207 | if ( !found ) { |
207 | //qDebug("AAAdate *%s* ", r->isodate.latin1() ); | 208 | //qDebug("AAAdate *%s* ", r->isodate.latin1() ); |
208 | n.append( r ); | 209 | n.append( r ); |
209 | } | 210 | } |
210 | ++iii; | 211 | ++iii; |
211 | } | 212 | } |
213 | qDebug("Downloaded %d messages ",n.count() ); | ||
212 | if ( n.count() == 0 ) { | 214 | if ( n.count() == 0 ) { |
213 | Global::statusMessage(tr("There are no new messages")); | 215 | Global::statusMessage(tr("There are no new messages")); |
214 | return; | 216 | return; |
215 | } | 217 | } |
216 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | 218 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); |
217 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); | 219 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); |
218 | 220 | ||
219 | #if 0 | 221 | #if 0 |
220 | QValueList<RecMailP> t; | 222 | QValueList<RecMailP> t; |
221 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 223 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
222 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 224 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
223 | #endif | 225 | #endif |
224 | 226 | ||
225 | } | 227 | } |
226 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 228 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
227 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 229 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
228 | { | 230 | { |
229 | QValueList<RecMailP> t; | 231 | QValueList<RecMailP> t; |
230 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 232 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
231 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 233 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
232 | 234 | ||
233 | } | 235 | } |
234 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | 236 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, |
235 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 237 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
236 | { | 238 | { |
237 | encodedString*st = 0; | 239 | encodedString*st = 0; |
238 | int iii = 0; | 240 | int iii = 0; |
239 | int count = t.count(); | 241 | int count = t.count(); |
240 | if ( count == 0 ) | 242 | if ( count == 0 ) |
241 | return; | 243 | return; |
242 | // wel, processevents is qite strange, we need a widget for getting | 244 | // wel, processevents is qite strange, we need a widget for getting |
243 | // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye | 245 | // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye |
244 | 246 | ||
245 | QProgressBar wid ( count ); | 247 | QProgressBar wid ( count ); |
246 | wid.setCaption( tr("Copying ...")); | 248 | wid.setCaption( tr("Copying ...")); |
247 | wid.show(); | 249 | wid.show(); |
248 | while (iii < count ) { | 250 | while (iii < count ) { |
249 | Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); | 251 | Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); |
250 | wid.setProgress( iii ); | 252 | wid.setProgress( iii ); |
251 | wid.raise(); | 253 | wid.raise(); |
252 | qApp->processEvents(); | 254 | qApp->processEvents(); |
253 | RecMailP r = (*t.at( iii )); | 255 | RecMailP r = (*t.at( iii )); |
254 | st = fetchRawBody(r); | 256 | st = fetchRawBody(r); |
255 | if (st) { | 257 | if (st) { |
256 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 258 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
257 | delete st; | 259 | delete st; |
258 | } | 260 | } |
259 | ++iii; | 261 | ++iii; |