kmail Library API Documentation

kmacctfolder.cpp

00001 // kmacctfolder.cpp
00002 
00003 #ifdef HAVE_CONFIG_H
00004 #include <config.h>
00005 #endif
00006 
00007 #include "kmacctfolder.h"
00008 #include "kmacctmgr.h"
00009 #include "folderstorage.h"
00010 #include <stdlib.h>
00011 
00012 #define MAX_ACCOUNTS 16
00013 
00014 //-----------------------------------------------------------------------------
00015 KMAccount* KMAcctFolder::account(void)
00016 {
00017   if (storage()->acctList()) return storage()->acctList()->first();
00018   return 0;
00019 }
00020 
00021 
00022 //-----------------------------------------------------------------------------
00023 KMAccount* KMAcctFolder::nextAccount(void)
00024 {
00025   if (storage()->acctList()) return storage()->acctList()->next();
00026   return 0;
00027 }
00028 
00029 
00030 //-----------------------------------------------------------------------------
00031 void KMAcctFolder::addAccount(KMAccount* aAcct)
00032 {
00033   if (!aAcct) return;
00034   if (!storage()->acctList()) storage()->setAcctList( new KMAcctList );
00035 
00036   storage()->acctList()->append(aAcct);
00037   aAcct->setFolder(this);
00038 }
00039 
00040 
00041 //-----------------------------------------------------------------------------
00042 void KMAcctFolder::clearAccountList(void)
00043 {
00044   if (storage()->acctList()) storage()->acctList()->clear();
00045 }
00046 
00047 
00048 //-----------------------------------------------------------------------------
00049 void KMAcctFolder::removeAccount(KMAccount* aAcct)
00050 {
00051   if (!aAcct || !storage()->acctList()) return;
00052 
00053   storage()->acctList()->remove(aAcct);
00054   aAcct->setFolder(0);
00055   if (storage()->acctList()->count() <= 0)
00056   {
00057     delete storage()->acctList();
00058     storage()->setAcctList( 0 );
00059   }
00060 }
00061 
00062 
00063 
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Dec 21 14:24:43 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003