Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 71a0d74..6bc8b8b 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,8 +1,8 @@ | |||
1 | #include <stdlib.h> | ||
1 | #include "accountview.h" | 2 | #include "accountview.h" |
2 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
3 | #include "defines.h" | 4 | #include "defines.h" |
4 | 5 | ||
5 | |||
6 | /** | 6 | /** |
7 | * POP3 Account stuff | 7 | * POP3 Account stuff |
8 | */ | 8 | */ |
@@ -228,6 +228,7 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | |||
228 | return imap->getWrapper()->fetchBody(aMail); | 228 | return imap->getWrapper()->fetchBody(aMail); |
229 | } | 229 | } |
230 | 230 | ||
231 | |||
231 | /** | 232 | /** |
232 | * Generic stuff | 233 | * Generic stuff |
233 | */ | 234 | */ |
@@ -244,6 +245,9 @@ void AccountView::populate( QList<Account> list ) | |||
244 | { | 245 | { |
245 | clear(); | 246 | clear(); |
246 | 247 | ||
248 | QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); | ||
249 | (void) new MBOXviewItem(localfolders,this); | ||
250 | |||
247 | Account *it; | 251 | Account *it; |
248 | for ( it = list.first(); it; it = list.next() ) { | 252 | for ( it = list.first(); it; it = list.next() ) { |
249 | if ( it->getType().compare( "IMAP" ) == 0 ) { | 253 | if ( it->getType().compare( "IMAP" ) == 0 ) { |
@@ -293,3 +297,83 @@ RecBody AccountView::fetchBody(const RecMail&aMail) | |||
293 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 297 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
294 | return view->fetchBody(aMail); | 298 | return view->fetchBody(aMail); |
295 | } | 299 | } |
300 | |||
301 | /** | ||
302 | * MBOX Account stuff | ||
303 | */ | ||
304 | |||
305 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | ||
306 | : AccountViewItem( parent ) | ||
307 | { | ||
308 | m_Path = aPath; | ||
309 | wrapper = AbstractMail::getWrapper( m_Path ); | ||
310 | setPixmap( 0, PIXMAP_POP3FOLDER ); | ||
311 | setText( 0, " Local Folders" ); | ||
312 | setOpen( true ); | ||
313 | } | ||
314 | |||
315 | MBOXviewItem::~MBOXviewItem() | ||
316 | { | ||
317 | delete wrapper; | ||
318 | } | ||
319 | |||
320 | AbstractMail *MBOXviewItem::getWrapper() | ||
321 | { | ||
322 | return wrapper; | ||
323 | } | ||
324 | |||
325 | void MBOXviewItem::refresh( QList<RecMail> & ) | ||
326 | { | ||
327 | QList<Folder> *folders = wrapper->listFolders(); | ||
328 | QListViewItem *child = firstChild(); | ||
329 | while ( child ) { | ||
330 | QListViewItem *tmp = child; | ||
331 | child = child->nextSibling(); | ||
332 | delete tmp; | ||
333 | } | ||
334 | Folder *it; | ||
335 | QListViewItem*item = 0; | ||
336 | for ( it = folders->first(); it; it = folders->next() ) { | ||
337 | item = new MBOXfolderItem( it, this , item ); | ||
338 | item->setSelectable(it->may_select()); | ||
339 | } | ||
340 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
341 | folders->setAutoDelete(false); | ||
342 | delete folders; | ||
343 | } | ||
344 | |||
345 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | ||
346 | { | ||
347 | qDebug( "POP3 fetchBody" ); | ||
348 | return wrapper->fetchBody( mail ); | ||
349 | } | ||
350 | |||
351 | MBOXfolderItem::~MBOXfolderItem() | ||
352 | { | ||
353 | delete folder; | ||
354 | } | ||
355 | |||
356 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) | ||
357 | : AccountViewItem( parent,after ) | ||
358 | { | ||
359 | folder = folderInit; | ||
360 | mbox = parent; | ||
361 | if (folder->getDisplayName().lower()!="inbox") { | ||
362 | setPixmap( 0, PIXMAP_POP3FOLDER ); | ||
363 | } else { | ||
364 | setPixmap( 0, PIXMAP_INBOXFOLDER); | ||
365 | } | ||
366 | setText( 0, folder->getDisplayName() ); | ||
367 | } | ||
368 | |||
369 | void MBOXfolderItem::refresh(QList<RecMail>&target) | ||
370 | { | ||
371 | if (folder->may_select()) | ||
372 | mbox->getWrapper()->listMessages( folder->getName(),target ); | ||
373 | } | ||
374 | |||
375 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | ||
376 | { | ||
377 | return mbox->getWrapper()->fetchBody(aMail); | ||
378 | } | ||
379 | |||