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