kmail

kmacctfolder.cpp
1 // kmacctfolder.cpp
2 
3 #ifdef HAVE_CONFIG_H
4 #include <config.h>
5 #endif
6 
7 #include "kmacctfolder.h"
8 
9 //-----------------------------------------------------------------------------
11 {
12  if ( acctList() )
13  return acctList()->first();
14  return 0;
15 }
16 
17 //-----------------------------------------------------------------------------
18 void KMAcctFolder::addAccount( KMAccount* aAcct )
19 {
20  if ( !aAcct ) return;
21  if ( !acctList() )
22  setAcctList( new AccountList() );
23 
24  acctList()->append( aAcct );
25  aAcct->setFolder( this );
26 }
27 
28 //-----------------------------------------------------------------------------
30 {
31  if ( acctList() )
32  acctList()->clear();
33 }
34 
35 //-----------------------------------------------------------------------------
36 void KMAcctFolder::removeAccount( KMAccount* aAcct )
37 {
38  if ( !aAcct || !acctList() ) return;
39 
40  acctList()->remove( aAcct );
41  aAcct->setFolder( 0 );
42  if ( acctList()->count() <= 0 ) {
43  delete acctList();
44  setAcctList( 0 );
45  }
46 }
void addAccount(KMAccount *)
Add given account to the list.
void removeAccount(KMAccount *)
Remove given account from the list.
KMAccount * account()
Returns first account or 0 if no account is associated with this folder.
void clearAccountList()
Clear list of accounts.
int count(bool cache=false) const
Number of messages in this folder.
Definition: kmfolder.cpp:445