kioslave/imap4
imapinfo.h
00001 #ifndef _IMAPINFO_H 00002 #define _IMAPINFO_H 00003 /********************************************************************** 00004 * 00005 * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler 00006 * Copyright (C) 2000 Sven Carstens <s.carstens@gmx.de> 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 * 00022 * Send comments and bug fixes to 00023 * 00024 *********************************************************************/ 00025 00026 #include <QStringList> 00027 #include <QString> 00028 #include <QLatin1String> 00029 00030 //class handling the info we get on EXAMINE and SELECT 00031 class imapInfo 00032 { 00033 public: 00034 00035 00036 enum MessageAttribute 00037 { 00038 Seen = 1 << 0, 00039 Answered = 1 << 1, 00040 Flagged = 1 << 2, 00041 Deleted = 1 << 3, 00042 Draft = 1 << 4, 00043 Recent = 1 << 5, 00044 User = 1 << 6, 00045 // non standard flags 00046 Forwarded = 1 << 7, 00047 Todo = 1 << 8, 00048 Watched = 1 << 9, 00049 Ignored = 1 << 10 00050 }; 00051 00052 00053 imapInfo (); 00054 imapInfo (const QStringList &); 00055 imapInfo (const imapInfo &); 00056 imapInfo & operator = (const imapInfo &); 00057 00058 static ulong _flags (const QByteArray &); 00059 00060 void setCount (ulong l) 00061 { 00062 countAvailable_ = true; 00063 count_ = l; 00064 } 00065 00066 void setRecent (ulong l) 00067 { 00068 recentAvailable_ = true; 00069 recent_ = l; 00070 } 00071 00072 void setUnseen (ulong l) 00073 { 00074 unseenAvailable_ = true; 00075 unseen_ = l; 00076 } 00077 00078 void setUidValidity (ulong l) 00079 { 00080 uidValidityAvailable_ = true; 00081 uidValidity_ = l; 00082 } 00083 00084 void setUidNext (ulong l) 00085 { 00086 uidNextAvailable_ = true; 00087 uidNext_ = l; 00088 } 00089 00090 void setFlags (ulong l) 00091 { 00092 flagsAvailable_ = true; 00093 flags_ = l; 00094 } 00095 00096 void setFlags (const QByteArray & inFlag) 00097 { 00098 flagsAvailable_ = true; 00099 flags_ = _flags (inFlag); 00100 } 00101 00102 void setPermanentFlags (ulong l) 00103 { 00104 permanentFlagsAvailable_ = true; 00105 permanentFlags_ = l; 00106 } 00107 00108 void setPermanentFlags (const QByteArray& inFlag) 00109 { 00110 permanentFlagsAvailable_ = true; 00111 permanentFlags_ = _flags (inFlag); 00112 } 00113 00114 void setReadWrite (bool b) 00115 { 00116 readWriteAvailable_ = true; 00117 readWrite_ = b; 00118 } 00119 00120 void setAlert( const char* cstr ) 00121 { 00122 alert_ = QLatin1String( cstr ); 00123 } 00124 00125 ulong count () const 00126 { 00127 return count_; 00128 } 00129 00130 ulong recent () const 00131 { 00132 return recent_; 00133 } 00134 00135 ulong unseen () const 00136 { 00137 return unseen_; 00138 } 00139 00140 ulong uidValidity () const 00141 { 00142 return uidValidity_; 00143 } 00144 00145 ulong uidNext () const 00146 { 00147 return uidNext_; 00148 } 00149 00150 ulong flags () const 00151 { 00152 return flags_; 00153 } 00154 00155 ulong permanentFlags () const 00156 { 00157 return permanentFlags_; 00158 } 00159 00160 bool readWrite () const 00161 { 00162 return readWrite_; 00163 } 00164 00165 ulong countAvailable () const 00166 { 00167 return countAvailable_; 00168 } 00169 00170 ulong recentAvailable () const 00171 { 00172 return recentAvailable_; 00173 } 00174 00175 ulong unseenAvailable () const 00176 { 00177 return unseenAvailable_; 00178 } 00179 00180 ulong uidValidityAvailable () const 00181 { 00182 return uidValidityAvailable_; 00183 } 00184 00185 ulong uidNextAvailable () const 00186 { 00187 return uidNextAvailable_; 00188 } 00189 00190 ulong flagsAvailable () const 00191 { 00192 return flagsAvailable_; 00193 } 00194 00195 ulong permanentFlagsAvailable () const 00196 { 00197 return permanentFlagsAvailable_; 00198 } 00199 00200 bool readWriteAvailable () const 00201 { 00202 return readWriteAvailable_; 00203 } 00204 00205 QString alert() const 00206 { 00207 return alert_; 00208 } 00209 00210 private: 00211 00212 QString alert_; 00213 00214 ulong count_; 00215 ulong recent_; 00216 ulong unseen_; 00217 ulong uidValidity_; 00218 ulong uidNext_; 00219 ulong flags_; 00220 ulong permanentFlags_; 00221 bool readWrite_; 00222 00223 bool countAvailable_; 00224 bool recentAvailable_; 00225 bool unseenAvailable_; 00226 bool uidValidityAvailable_; 00227 bool uidNextAvailable_; 00228 bool flagsAvailable_; 00229 bool permanentFlagsAvailable_; 00230 bool readWriteAvailable_; 00231 }; 00232 00233 #endif