Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 6bc8b8b..59e8bc0 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -262,118 +262,120 @@ void AccountView::populate( QList<Account> list ) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | void AccountView::refresh(QListViewItem *item) { | 265 | void AccountView::refresh(QListViewItem *item) { |
266 | 266 | ||
267 | qDebug("AccountView refresh..."); | 267 | qDebug("AccountView refresh..."); |
268 | if ( item ) { | 268 | if ( item ) { |
269 | m_currentItem = item; | 269 | m_currentItem = item; |
270 | QList<RecMail> headerlist; | 270 | QList<RecMail> headerlist; |
271 | headerlist.setAutoDelete(true); | 271 | headerlist.setAutoDelete(true); |
272 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 272 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
273 | view->refresh(headerlist); | 273 | view->refresh(headerlist); |
274 | emit refreshMailview(&headerlist); | 274 | emit refreshMailview(&headerlist); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | void AccountView::refreshCurrent() | 278 | void AccountView::refreshCurrent() |
279 | { | 279 | { |
280 | if ( !m_currentItem ) return; | 280 | if ( !m_currentItem ) return; |
281 | QList<RecMail> headerlist; | 281 | QList<RecMail> headerlist; |
282 | headerlist.setAutoDelete(true); | 282 | headerlist.setAutoDelete(true); |
283 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 283 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
284 | view->refresh(headerlist); | 284 | view->refresh(headerlist); |
285 | emit refreshMailview(&headerlist); | 285 | emit refreshMailview(&headerlist); |
286 | } | 286 | } |
287 | 287 | ||
288 | void AccountView::refreshAll() | 288 | void AccountView::refreshAll() |
289 | { | 289 | { |
290 | 290 | ||
291 | } | 291 | } |
292 | 292 | ||
293 | RecBody AccountView::fetchBody(const RecMail&aMail) | 293 | RecBody AccountView::fetchBody(const RecMail&aMail) |
294 | { | 294 | { |
295 | QListViewItem*item = selectedItem (); | 295 | QListViewItem*item = selectedItem (); |
296 | if (!item) return RecBody(); | 296 | if (!item) return RecBody(); |
297 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 297 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
298 | return view->fetchBody(aMail); | 298 | return view->fetchBody(aMail); |
299 | } | 299 | } |
300 | 300 | ||
301 | /** | 301 | /** |
302 | * MBOX Account stuff | 302 | * MBOX Account stuff |
303 | */ | 303 | */ |
304 | 304 | ||
305 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | 305 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) |
306 | : AccountViewItem( parent ) | 306 | : AccountViewItem( parent ) |
307 | { | 307 | { |
308 | m_Path = aPath; | 308 | m_Path = aPath; |
309 | wrapper = AbstractMail::getWrapper( m_Path ); | 309 | wrapper = AbstractMail::getWrapper( m_Path ); |
310 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 310 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
311 | setText( 0, " Local Folders" ); | 311 | setText( 0, " Local Folders" ); |
312 | setOpen( true ); | 312 | setOpen( true ); |
313 | } | 313 | } |
314 | 314 | ||
315 | MBOXviewItem::~MBOXviewItem() | 315 | MBOXviewItem::~MBOXviewItem() |
316 | { | 316 | { |
317 | delete wrapper; | 317 | delete wrapper; |
318 | } | 318 | } |
319 | 319 | ||
320 | AbstractMail *MBOXviewItem::getWrapper() | 320 | AbstractMail *MBOXviewItem::getWrapper() |
321 | { | 321 | { |
322 | return wrapper; | 322 | return wrapper; |
323 | } | 323 | } |
324 | 324 | ||
325 | void MBOXviewItem::refresh( QList<RecMail> & ) | 325 | void MBOXviewItem::refresh( QList<RecMail> & ) |
326 | { | 326 | { |
327 | QList<Folder> *folders = wrapper->listFolders(); | 327 | QList<Folder> *folders = wrapper->listFolders(); |
328 | QListViewItem *child = firstChild(); | 328 | QListViewItem *child = firstChild(); |
329 | while ( child ) { | 329 | while ( child ) { |
330 | QListViewItem *tmp = child; | 330 | QListViewItem *tmp = child; |
331 | child = child->nextSibling(); | 331 | child = child->nextSibling(); |
332 | delete tmp; | 332 | delete tmp; |
333 | } | 333 | } |
334 | Folder *it; | 334 | Folder *it; |
335 | QListViewItem*item = 0; | 335 | QListViewItem*item = 0; |
336 | for ( it = folders->first(); it; it = folders->next() ) { | 336 | for ( it = folders->first(); it; it = folders->next() ) { |
337 | item = new MBOXfolderItem( it, this , item ); | 337 | item = new MBOXfolderItem( it, this , item ); |
338 | item->setSelectable(it->may_select()); | 338 | item->setSelectable(it->may_select()); |
339 | } | 339 | } |
340 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 340 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
341 | folders->setAutoDelete(false); | 341 | folders->setAutoDelete(false); |
342 | delete folders; | 342 | delete folders; |
343 | } | 343 | } |
344 | 344 | ||
345 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | 345 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) |
346 | { | 346 | { |
347 | qDebug( "POP3 fetchBody" ); | 347 | qDebug( "POP3 fetchBody" ); |
348 | return wrapper->fetchBody( mail ); | 348 | return wrapper->fetchBody( mail ); |
349 | } | 349 | } |
350 | 350 | ||
351 | MBOXfolderItem::~MBOXfolderItem() | 351 | MBOXfolderItem::~MBOXfolderItem() |
352 | { | 352 | { |
353 | delete folder; | 353 | delete folder; |
354 | } | 354 | } |
355 | 355 | ||
356 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) | 356 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) |
357 | : AccountViewItem( parent,after ) | 357 | : AccountViewItem( parent,after ) |
358 | { | 358 | { |
359 | folder = folderInit; | 359 | folder = folderInit; |
360 | mbox = parent; | 360 | mbox = parent; |
361 | if (folder->getDisplayName().lower()!="inbox") { | 361 | if (folder->getDisplayName().lower() == "outgoing") { |
362 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 362 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
363 | } else { | 363 | } else if (folder->getDisplayName().lower() == "inbox") { |
364 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 364 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
365 | } | 365 | } else { |
366 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | ||
367 | } | ||
366 | setText( 0, folder->getDisplayName() ); | 368 | setText( 0, folder->getDisplayName() ); |
367 | } | 369 | } |
368 | 370 | ||
369 | void MBOXfolderItem::refresh(QList<RecMail>&target) | 371 | void MBOXfolderItem::refresh(QList<RecMail>&target) |
370 | { | 372 | { |
371 | if (folder->may_select()) | 373 | if (folder->may_select()) |
372 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 374 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
373 | } | 375 | } |
374 | 376 | ||
375 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | 377 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) |
376 | { | 378 | { |
377 | return mbox->getWrapper()->fetchBody(aMail); | 379 | return mbox->getWrapper()->fetchBody(aMail); |
378 | } | 380 | } |
379 | 381 | ||