kmail
kmacctfolder.cpp
Go to the documentation of this file.00001 // kmacctfolder.cpp 00002 00003 00004 #include "kmacctfolder.h" 00005 #include "kmaccount.h" 00006 00007 //----------------------------------------------------------------------------- 00008 KMAccount* KMAcctFolder::account() 00009 { 00010 if ( acctList() ) 00011 return acctList()->first(); 00012 return 0; 00013 } 00014 00015 //----------------------------------------------------------------------------- 00016 void KMAcctFolder::addAccount( KMAccount* aAcct ) 00017 { 00018 if ( !aAcct ) return; 00019 if ( !acctList() ) 00020 setAcctList( new AccountList() ); 00021 00022 acctList()->append( aAcct ); 00023 aAcct->setFolder( this ); 00024 } 00025 00026 //----------------------------------------------------------------------------- 00027 void KMAcctFolder::clearAccountList() 00028 { 00029 if ( acctList() ) 00030 acctList()->clear(); 00031 } 00032 00033 //----------------------------------------------------------------------------- 00034 void KMAcctFolder::removeAccount( KMAccount* aAcct ) 00035 { 00036 if ( !aAcct || !acctList() ) return; 00037 00038 acctList()->removeAll( aAcct ); 00039 aAcct->setFolder( 0 ); 00040 if ( acctList()->count() <= 0 ) { 00041 delete acctList(); 00042 setAcctList( 0 ); 00043 } 00044 }
KDE 4.2 API Reference