knode
kngroup.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef KNGROUP_H
00016 #define KNGROUP_H
00017
00018 #include "knarticlecollection.h"
00019 #include "knjobdata.h"
00020 #include "knarticle.h"
00021
00022 #include <kio/job.h>
00023
00024 #include <QByteArray>
00025 #include <QList>
00026
00027 class KNProtocolClient;
00028 class KNNntpAccount;
00029
00030 namespace KNode {
00031 class Identity;
00032 class Cleanup;
00033 }
00034
00035
00042 class KNGroup : public KNArticleCollection , public KNJobItem {
00043
00044 public:
00046 enum Status { unknown=0, readOnly=1, postingAllowed=2, moderated=3 };
00047
00048 KNGroup(KNCollection *p=0);
00049 ~KNGroup();
00050
00052 typedef QList<KNGroup*> List;
00053
00055 collectionType type() { return CTgroup; }
00056
00058 void updateListItem();
00059
00061 QString path();
00062 bool readInfo(const QString &confPath);
00063 void saveInfo();
00064
00066 bool hasName() const { return (!n_ame.isEmpty()); }
00067 const QString& name();
00068 const QString& groupname() { return g_roupname; }
00069 void setGroupname(const QString &s) { g_roupname=s; }
00071 QString description() const { return d_escription; }
00075 void setDescription( const QString &s ) { d_escription = s; }
00076
00078 int newCount() const { return n_ewCount; }
00079 void setNewCount(int i) { n_ewCount=i; }
00080 void incNewCount(int i=1) { n_ewCount+=i; }
00081 void decNewCount(int i=1) { n_ewCount-=i; }
00082 int firstNewIndex() const { return f_irstNew; }
00083 void setFirstNewIndex(int i) { f_irstNew=i; }
00084
00085 int lastFetchCount() const { return l_astFetchCount; }
00086 void setLastFetchCount(int i) { l_astFetchCount=i; }
00087
00088 int readCount()const { return r_eadCount; }
00089 void setReadCount(int i) { r_eadCount=i; }
00090 void incReadCount(int i=1) { r_eadCount+=i; }
00091 void decReadCount(int i=1) { r_eadCount-=i; }
00092
00094 int firstNr() const { return f_irstNr; }
00098 void setFirstNr( int i ) { f_irstNr = i; }
00100 int lastNr() const { return l_astNr; }
00104 void setLastNr( int i ) { l_astNr = i; }
00106 int maxFetch() const { return m_axFetch; }
00110 void setMaxFetch( int i ) { m_axFetch = i; }
00111
00112 int statThrWithNew();
00113 int statThrWithUnread();
00114
00116 KNRemoteArticle* at(int i) { return static_cast<KNRemoteArticle*> (KNArticleCollection::at(i)); }
00117 KNRemoteArticle* byId(int id) { return static_cast<KNRemoteArticle*> (KNArticleCollection::byId(id)); }
00118 KNRemoteArticle* byMessageId( const QByteArray &mId )
00119 { return static_cast<KNRemoteArticle*> (KNArticleCollection::byMessageId(mId)); }
00120
00122 bool loadHdrs();
00123 bool unloadHdrs(bool force=true);
00124 void insortNewHeaders( const KIO::UDSEntryList &list, KNProtocolClient *client = 0 );
00125 int saveStaticData(int cnt,bool ovr=false);
00126 void saveDynamicData(int cnt,bool ovr=false);
00127 void syncDynamicData();
00128
00130 void appendXPostID(const QString &id);
00131 void processXPostBuffer(bool deleteAfterwards);
00132
00134 void updateThreadInfo();
00135 void reorganize();
00136 void scoreArticles(bool onlynew=true);
00137
00139 bool isLocked() { return l_ocked; }
00140 void setLocked(bool l) { l_ocked=l; }
00141
00142 QString prepareForExecution();
00143
00145 const QByteArray defaultCharset() { return d_efaultChSet; }
00149 void setDefaultCharset( const QByteArray &s ) { d_efaultChSet = s; }
00150 bool useCharset() { return ( u_seCharset && !d_efaultChSet.isEmpty() ); }
00151 void setUseCharset(bool b) { u_seCharset=b; }
00152
00154 KNNntpAccount* account();
00156 KNode::Identity* identity() const { return i_dentity; }
00160 void setIdentity(KNode::Identity *i) { i_dentity = i; }
00163 Status status() const { return s_tatus; }
00167 void setStatus(Status s) { s_tatus = s; }
00171 void showProperties();
00172
00174 KNode::Cleanup *cleanupConfig() const { return mCleanupConf; }
00178 KNode::Cleanup *activeCleanupConfig();
00179
00180
00181 protected:
00182 void buildThreads(int cnt, KNProtocolClient *client=0);
00183 KNRemoteArticle* findReference(KNRemoteArticle *a);
00184
00185 int n_ewCount,
00186 l_astFetchCount,
00187 r_eadCount,
00188 i_gnoreCount,
00189 f_irstNr,
00190 l_astNr,
00191 m_axFetch,
00192 d_ynDataFormat,
00193 f_irstNew;
00194
00196 QByteArray d_efaultChSet;
00197 QString g_roupname,
00198 d_escription;
00199
00200 bool l_ocked,
00201 u_seCharset;
00202
00203 Status s_tatus;
00204
00205 QStringList c_rosspostIDBuffer;
00206
00210 QList<QByteArray> mOptionalHeaders;
00211
00212 KNode::Identity *i_dentity;
00213 KNode::Cleanup *mCleanupConf;
00214
00215 class dynDataVer0 {
00216
00217 public:
00218 dynDataVer0() { id=-1; idRef=-1; read=0; thrLevel=0; score=50; }
00219 ~dynDataVer0() {}
00220 void setData(KNRemoteArticle *a);
00221 void getData(KNRemoteArticle *a);
00222
00223 int id;
00224 int idRef;
00225 bool read;
00226 short thrLevel, score;
00227 };
00228
00229 class dynDataVer1 {
00230
00231 public:
00232 dynDataVer1() { id=-1; idRef=-1; read=0; thrLevel=0; score=0, ignoredWatched=0; }
00233 void setData(KNRemoteArticle *a);
00234 void getData(KNRemoteArticle *a);
00235
00236 int id;
00237 int idRef;
00238 bool read;
00239 short thrLevel, score;
00240 char ignoredWatched;
00241 };
00242
00243 };
00244
00245 #endif
00246
00247