00001 /* 00002 * Copyright (C) 2006-2007 Funambol, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License version 2 as 00006 * published by the Free Software Foundation. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR 00011 * PURPOSE. See the GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00016 * 02111-1307 USA 00017 */ 00018 00019 #ifndef INCL_CLIENTFOLDER 00020 #define INCL_CLIENTFOLDER 00021 00026 #include "outlook/defs.h" 00027 #include "outlook/ClientItem.h" 00028 #include "outlook/ClientMail.h" 00029 #include "outlook/ClientContact.h" 00030 #include "outlook/ClientAppointment.h" 00031 #include "outlook/ClientTask.h" 00032 #include "outlook/ClientNote.h" 00033 00034 #include <string> 00035 00036 00037 00043 class ClientFolder { 00044 00045 private: 00046 00047 std::wstring ID; 00048 std::wstring itemType; 00049 std::wstring name; 00050 std::wstring path; 00051 00052 00054 int subfoldersCount; 00055 int subfoldersIndex; 00056 00058 int itemsCount; 00059 int itemsIndex; 00060 00061 00063 MAPIFolderPtr pFolder; 00064 _FoldersPtr pSubFolders; 00065 MAPIFolderPtr pSubFolder; 00066 _ItemsPtr pItems; 00067 IDispatchPtr pItem; 00068 _ContactItemPtr pContact; 00069 _AppointmentItemPtr pAppointment; 00070 _MailItemPtr pMail; 00071 _NoteItemPtr pNote; 00072 _TaskItemPtr pTask; 00073 00074 00077 ClientFolder* subFolder; 00078 ClientMail* mail; 00079 ClientContact* contact; 00080 ClientAppointment* appointment; 00081 ClientTask* task; 00082 ClientNote* note; 00083 00084 00086 HRESULT hr; 00087 00089 ClientItem* setInternalItem(IDispatchPtr& pItem); 00090 00091 00092 public: 00093 00095 ClientFolder(); 00096 ClientFolder(ClientFolder& f); 00097 ClientFolder operator=(ClientFolder& f); 00098 00100 ~ClientFolder(); 00101 00102 00104 void setCOMPtr(MAPIFolderPtr& f, const std::wstring& type); 00105 void setCOMPtr(MAPIFolderPtr& f); 00106 00108 MAPIFolderPtr& getCOMPtr(); 00109 00110 00111 const std::wstring& getID(); 00112 const std::wstring& getType(); 00113 const std::wstring& getName(); 00114 const std::wstring& getPath(); 00115 00116 00117 // 00118 // Methods to menage subfolders. 00119 // 00120 const int getSubfoldersCount(); 00121 const int getSubfoldersIndex(); 00122 00123 ClientFolder* getFirstSubfolder(); 00124 ClientFolder* getNextSubfolder(); 00125 ClientFolder* getPreviousSubfolder(); 00126 ClientFolder* getLastSubfolder(); 00127 ClientFolder* getSubfolder(const int index); 00128 ClientFolder* getSubfolderFromName(const std::wstring& subName); 00129 00130 ClientFolder* addSubFolder(const std::wstring& subName, const std::wstring& type); 00131 00132 00133 // 00134 // Methods to menage items. 00135 // 00136 const int getItemsCount(); 00137 const int getItemsIndex(); 00138 00139 ClientItem* getFirstItem(); 00140 ClientItem* getNextItem(); 00141 ClientItem* getPreviousItem(); 00142 ClientItem* getLastItem(); 00143 ClientItem* getItem(const int index); 00144 00145 ClientItem* addItem(); 00146 }; 00147 00150 #endif