kmail Library API Documentation

folderIface.cpp

00001 /*  -*- mode: C++; c-file-style: "gnu" -*-
00002  *
00003  *  This file is part of KMail, the KDE mail client.
00004  *  Copyright (c) 2003 Zack Rusin <zack@kde.org>
00005  *
00006  *  KMail is free software; you can redistribute it and/or modify it
00007  *  under the terms of the GNU General Public License, version 2, as
00008  *  published by the Free Software Foundation.
00009  *
00010  *  KMail is distributed in the hope that it will be useful, but
00011  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  *  In addition, as a special exception, the copyright holders give
00020  *  permission to link the code of this program with any edition of
00021  *  the Qt library by Trolltech AS, Norway (or with modified versions
00022  *  of Qt that use the same license as Qt), and distribute linked
00023  *  combinations including the two.  You must obey the GNU General
00024  *  Public License in all respects for all of the code used other than
00025  *  Qt.  If you modify this file, you may extend this exception to
00026  *  your version of the file, but you are not obligated to do so.  If
00027  *  you do not wish to do so, delete this exception statement from
00028  *  your version.
00029  */
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include "folderIface.h"
00035 #include "kmfoldermgr.h"
00036 #include "kmfolder.h"
00037 
00038 #include <stdlib.h>
00039 
00040 #include <kdebug.h>
00041 
00042 namespace KMail {
00043 
00044 FolderIface::FolderIface( const QString& vpath )
00045   : DCOPObject( "FolderIface" ), mPath( vpath )
00046 {
00047     //kdDebug(5006)<<"FolderIface folder = "<< mPath <<endl;
00048     mFolder = kmkernel->folderMgr()->getFolderByURL( mPath );
00049     if ( !mFolder )
00050       mFolder = kmkernel->imapFolderMgr()->getFolderByURL( mPath );
00051     if ( !mFolder )
00052       mFolder = kmkernel->dimapFolderMgr()->getFolderByURL( mPath );
00053 }
00054 
00055 QString
00056 FolderIface::path() const
00057 {
00058   return mPath;
00059 }
00060 
00061 bool
00062 FolderIface::usesCustomIcons() const
00063 {
00064   return mFolder->useCustomIcons();
00065 }
00066 
00067 QString
00068 FolderIface::normalIconPath() const
00069 {
00070   return mFolder->normalIconPath();
00071 }
00072 
00073 QString
00074 FolderIface::unreadIconPath() const
00075 {
00076   return mFolder->unreadIconPath();
00077 }
00078 
00079 int
00080 FolderIface::messages()
00081 {
00082     return mFolder->count();
00083 }
00084 
00085 int
00086 FolderIface::unreadMessages()
00087 {
00088     return mFolder->countUnread();
00089 }
00090 
00091 int
00092 FolderIface::unreadRecursiveMessages()
00093 {
00094     return mFolder->countUnreadRecursive();
00095 }
00096 
00097 /*
00098 QValueList<DCOPRef>
00099 FolderIface::messageRefs()
00100 {
00101     QValueList<DCOPRef> refList;
00102     KMMsgList messageCache;
00103     KMFolderIndex *indexFolder = static_cast<KMFolderIndex*>( mFolder);
00104 
00105     if ( indexFolder ) {
00106       mFolder->open();
00107       indexFolder->readIndex();
00108       messageCache = indexFolder->mMsgList;
00109       mFolder->close();
00110     } else
00111       return refList;
00112 
00113     kdDebug()<<"refList == "<<messageCache.count()<<endl;
00114 
00115     for( int i = 0; i < messageCache.size(); ++i ) {
00116       KMMsgBase *msg = messageCache[i];
00117       if ( msg ) {
00118         KMMessage *fmsg = msg->parent()->getMsg( msg->parent()->find( msg ) );
00119         refList.append( DCOPRef( new MessageIface( fmsg ) ) );
00120       }
00121     }
00122 
00123     kdDebug()<<"Reflist size = "<<refList.count()<<endl;
00124     return refList;
00125 }*/
00126 
00127 }
00128 
00129 #include "folderIface.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:18 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003