• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knode

  • sources
  • kde-4.12
  • kdepim
  • knode
kngroup.h
Go to the documentation of this file.
1 /*
2  KNode, the KDE newsreader
3  Copyright (c) 1999-2005 the KNode authors.
4  See file AUTHORS for details
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  You should have received a copy of the GNU General Public License
11  along with this program; if not, write to the Free Software Foundation,
12  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
13 */
14 
15 #ifndef KNGROUP_H
16 #define KNGROUP_H
17 
18 #include "configuration/settings_container_interface.h"
19 #include "knarticle.h"
20 #include "knarticlecollection.h"
21 #include "knjobdata.h"
22 #include "knglobals.h"
23 #include "knnntpaccount.h"
24 
25 #include <kio/job.h>
26 #include <KPIMIdentities/Identity>
27 #include <QByteArray>
28 #include <QList>
29 
30 namespace KNode {
31  class Cleanup;
32 }
33 
34 
41 class KNGroup : public KNArticleCollection , public KNJobItem, public KNode::SettingsContainerInterface
42 {
43  public:
47  typedef boost::shared_ptr<KNGroup> Ptr;
48 
50  enum Status { unknown=0, readOnly=1, postingAllowed=2, moderated=3 };
51 
52  explicit KNGroup( KNCollection::Ptr p = KNCollection::Ptr() );
53  ~KNGroup();
54 
56  typedef QList<KNGroup::Ptr> List;
57 
59  collectionType type() { return CTgroup; }
60 
62  void updateListItem();
63 
65  QString path();
66  bool readInfo(const QString &confPath);
67  void writeConfig();
68 
70  bool hasName() const { return (!n_ame.isEmpty()); }
71  const QString& name();
72  const QString& groupname() { return g_roupname; }
73  void setGroupname(const QString &s) { g_roupname=s; }
75  QString description() const { return d_escription; }
79  void setDescription( const QString &s ) { d_escription = s; }
80 
82  int newCount() const { return n_ewCount; }
83  void setNewCount(int i) { n_ewCount=i; }
84  void incNewCount(int i=1) { n_ewCount+=i; }
85  void decNewCount(int i=1) { n_ewCount-=i; }
86  int firstNewIndex() const { return f_irstNew; }
87  void setFirstNewIndex(int i) { f_irstNew=i; }
88 
89  int lastFetchCount() const { return l_astFetchCount; }
90  void setLastFetchCount(int i) { l_astFetchCount=i; }
91 
92  int readCount()const { return r_eadCount; }
93  void setReadCount(int i) { r_eadCount=i; }
94  void incReadCount(int i=1) { r_eadCount+=i; }
95  void decReadCount(int i=1) { r_eadCount-=i; }
96 
98  int firstNr() const { return f_irstNr; }
102  void setFirstNr( int i ) { f_irstNr = i; }
104  int lastNr() const { return l_astNr; }
108  void setLastNr( int i ) { l_astNr = i; }
110  int maxFetch() const { return m_axFetch; }
114  void setMaxFetch( int i ) { m_axFetch = i; }
115 
116  int statThrWithNew();
117  int statThrWithUnread();
118 
119  // article access
120  KNRemoteArticle::Ptr at( int i )
121  { return boost::static_pointer_cast<KNRemoteArticle>( KNArticleCollection::at( i ) ); }
122  KNRemoteArticle::Ptr byId( int id )
123  { return boost::static_pointer_cast<KNRemoteArticle>( KNArticleCollection::byId( id ) ); }
124  KNRemoteArticle::Ptr byMessageId( const QByteArray &mId )
125  { return boost::static_pointer_cast<KNRemoteArticle>( KNArticleCollection::byMessageId( mId ) ); }
126 
128  bool loadHdrs();
129  bool unloadHdrs(bool force=true);
131  void insortNewHeaders( const KIO::UDSEntryList &list, KNJobData *job = 0 );
132  int saveStaticData(int cnt,bool ovr=false);
133  void saveDynamicData(int cnt,bool ovr=false);
134  void syncDynamicData();
135 
137  void appendXPostID(const QString &id);
138  void processXPostBuffer(bool deleteAfterwards);
139 
141  void updateThreadInfo();
142  void reorganize();
143  void scoreArticles(bool onlynew=true);
144 
146  bool isLocked() { return l_ocked; }
147  void setLocked(bool l) { l_ocked=l; }
148 
149  QString prepareForExecution();
150 
152  const QByteArray defaultCharset() { return d_efaultChSet; }
156  void setDefaultCharset( const QByteArray &s ) { d_efaultChSet = s; }
157  bool useCharset() { return ( u_seCharset && !d_efaultChSet.isEmpty() ); }
158  void setUseCharset(bool b) { u_seCharset=b; }
159 
161  KNNntpAccount::Ptr account();
162 
167  virtual const KPIMIdentities::Identity & identity() const;
171  virtual void setIdentity( const KPIMIdentities::Identity &i )
172  { mIdentityUoid = ( i.isNull() ? -1 : i.uoid() ); }
173 
176  Status status() const { return s_tatus; }
180  void setStatus(Status s) { s_tatus = s; }
184  void showProperties();
185 
187  KNode::Cleanup *cleanupConfig() const { return mCleanupConf; }
191  KNode::Cleanup *activeCleanupConfig();
192 
193 
194  protected:
195  void buildThreads(int cnt, KNJobData *parent=0);
200  KNRemoteArticle::Ptr findReference( KNRemoteArticle::Ptr a );
201 
202  int n_ewCount,
203  l_astFetchCount,
204  r_eadCount,
205  i_gnoreCount,
206  f_irstNr,
207  l_astNr,
208  m_axFetch,
209  d_ynDataFormat,
210  f_irstNew;
211 
213  QByteArray d_efaultChSet;
214  QString g_roupname,
215  d_escription;
216 
217  bool l_ocked,
218  u_seCharset;
219 
220  Status s_tatus;
221 
222  QStringList c_rosspostIDBuffer;
223 
227  QList<QByteArray> mOptionalHeaders;
228 
234  int mIdentityUoid;
235 
236  KNode::Cleanup *mCleanupConf;
237 
238  class dynDataVer0 {
239 
240  public:
241  dynDataVer0() { id=-1; idRef=-1; read=0; thrLevel=0; score=50; }
242  ~dynDataVer0() {}
243  void setData( KNRemoteArticle::Ptr a );
244  void getData( KNRemoteArticle::Ptr a );
245 
246  int id;
247  int idRef;
248  bool read;
249  short thrLevel, score;
250  };
251 
252  class dynDataVer1 {
253 
254  public:
255  dynDataVer1() { id=-1; idRef=-1; read=0; thrLevel=0; score=0, ignoredWatched=0; }
256  void setData( KNRemoteArticle::Ptr a );
257  void getData( KNRemoteArticle::Ptr a );
258 
259  int id;
260  int idRef;
261  bool read;
262  short thrLevel, score;
263  char ignoredWatched;
264  };
265 
269  KNGroup::Ptr thisGroupPtr();
270 
274  virtual KNCollection::Ptr selfPtr()
275  {
276  return thisGroupPtr();
277  }
278 
279 };
280 
281 #endif
282 
283 // kate: space-indent on; indent-width 2;
KNGroup::defaultCharset
const QByteArray defaultCharset()
Returns the default charset for this group.
Definition: kngroup.h:152
KNGroup::g_roupname
QString g_roupname
Definition: kngroup.h:214
KNGroup::d_ynDataFormat
int d_ynDataFormat
Definition: kngroup.h:202
KNGroup::setReadCount
void setReadCount(int i)
Definition: kngroup.h:93
KNGroup::setDescription
void setDescription(const QString &s)
Sets the group description.
Definition: kngroup.h:79
KNGroup::mOptionalHeaders
QList< QByteArray > mOptionalHeaders
Optional headers provided by the XOVER command.
Definition: kngroup.h:227
KNCollection::parent
KNCollection::Ptr parent() const
Returns the parent collection.
Definition: kncollection.h:71
KNGroup::scoreArticles
void scoreArticles(bool onlynew=true)
Definition: kngroup.cpp:909
KNGroup::incNewCount
void incNewCount(int i=1)
Definition: kngroup.h:84
KNGroup::f_irstNew
int f_irstNew
Definition: kngroup.h:202
KNGroup::dynDataVer1::thrLevel
short thrLevel
Definition: kngroup.h:262
KNGroup::cleanupConfig
KNode::Cleanup * cleanupConfig() const
Returns the cleanup configuration of this group (might be empty).
Definition: kngroup.h:187
KNGroup::buildThreads
void buildThreads(int cnt, KNJobData *parent=0)
Definition: kngroup.cpp:697
KNGroup::mIdentityUoid
int mIdentityUoid
Unique object identifier of the identity of this group.
Definition: kngroup.h:234
KNGroup::dynDataVer0::dynDataVer0
dynDataVer0()
Definition: kngroup.h:241
KNGroup::processXPostBuffer
void processXPostBuffer(bool deleteAfterwards)
Definition: kngroup.cpp:676
KNGroup::dynDataVer0::idRef
int idRef
Definition: kngroup.h:247
KNGroup::setDefaultCharset
void setDefaultCharset(const QByteArray &s)
Sets the default charset for this group.
Definition: kngroup.h:156
KNGroup::moderated
Definition: kngroup.h:50
KNGroup::firstNr
int firstNr() const
Returns the smallest available article serial number in this group.
Definition: kngroup.h:98
KNGroup::setStatus
void setStatus(Status s)
Sets the posting rights for this group.
Definition: kngroup.h:180
KNGroup::decReadCount
void decReadCount(int i=1)
Definition: kngroup.h:95
KNGroup::Status
Status
The posting rights status of this group.
Definition: kngroup.h:50
KNGroup::path
QString path()
info
Definition: kngroup.cpp:62
KNGroup::name
const QString & name()
Returns the collection name.
Definition: kngroup.cpp:68
KNJobData
Abstract base class for all KNode internal jobs.
Definition: knjobdata.h:101
KNGroup::mCleanupConf
KNode::Cleanup * mCleanupConf
Definition: kngroup.h:236
KNGroup::description
QString description() const
Returns the group description.
Definition: kngroup.h:75
KNGroup::readCount
int readCount() const
Definition: kngroup.h:92
KNGroup::saveDynamicData
void saveDynamicData(int cnt, bool ovr=false)
Definition: kngroup.cpp:594
KNGroup::saveStaticData
int saveStaticData(int cnt, bool ovr=false)
Definition: kngroup.cpp:523
KNGroup::setIdentity
virtual void setIdentity(const KPIMIdentities::Identity &i)
Sets the identity for this group.
Definition: kngroup.h:171
KNGroup::l_astFetchCount
int l_astFetchCount
Definition: kngroup.h:202
KNGroup::dynDataVer1::ignoredWatched
char ignoredWatched
Definition: kngroup.h:263
KNGroup::firstNewIndex
int firstNewIndex() const
Definition: kngroup.h:86
KNGroup
Representation of a news group.
Definition: kngroup.h:41
KNGroup::dynDataVer0::id
int id
Definition: kngroup.h:246
KNode::Cleanup
Expirery/cleaup settings (globally or per account/group/folder).
Definition: knconfig.h:132
KNGroup::groupname
const QString & groupname()
Definition: kngroup.h:72
KNNntpAccount::Ptr
boost::shared_ptr< KNNntpAccount > Ptr
Shared pointer to a KNNntpAccount.
Definition: knnntpaccount.h:62
knnntpaccount.h
KNGroup::dynDataVer1::setData
void setData(KNRemoteArticle::Ptr a)
Definition: kngroup.cpp:1092
KNode::SettingsContainerInterface
Interface for object (global settings, account and group) that contains common settings (like identit...
Definition: settings_container_interface.h:40
KNGroup::setLastFetchCount
void setLastFetchCount(int i)
Definition: kngroup.h:90
knjobdata.h
KNArticleCollection::at
KNArticle::Ptr at(int i)
Returns the article at index i in this collection, or an empty KNArticle::Ptr if it is not found...
Definition: knarticlecollection.h:123
KNGroup::dynDataVer0::setData
void setData(KNRemoteArticle::Ptr a)
Definition: kngroup.cpp:1072
KNCollection::n_ame
QString n_ame
The name of this collection.
Definition: kncollection.h:97
KNGroup::d_efaultChSet
QByteArray d_efaultChSet
The default charset of this group.
Definition: kngroup.h:213
KNGroup::dynDataVer0::read
bool read
Definition: kngroup.h:248
KNGroup::readOnly
Definition: kngroup.h:50
KNGroup::findReference
KNRemoteArticle::Ptr findReference(KNRemoteArticle::Ptr a)
Returns the first message that appears in the References header of a and which exists in this group...
Definition: kngroup.cpp:888
KNGroup::appendXPostID
void appendXPostID(const QString &id)
mark articles with this id as read when we later load the headers / fetch new articles ...
Definition: kngroup.cpp:670
KNGroup::writeConfig
void writeConfig()
Save the configuration to disk.
Definition: kngroup.cpp:124
settings_container_interface.h
KNGroup::postingAllowed
Definition: kngroup.h:50
KNGroup::setLastNr
void setLastNr(int i)
Sets the largest used serial number.
Definition: kngroup.h:108
KNGroup::dynDataVer0::~dynDataVer0
~dynDataVer0()
Definition: kngroup.h:242
KNGroup::l_astNr
int l_astNr
Definition: kngroup.h:202
KNGroup::n_ewCount
int n_ewCount
Definition: kngroup.h:202
KNGroup::unknown
Definition: kngroup.h:50
KNGroup::useCharset
bool useCharset()
Definition: kngroup.h:157
KNGroup::r_eadCount
int r_eadCount
Definition: kngroup.h:202
KNGroup::incReadCount
void incReadCount(int i=1)
Definition: kngroup.h:94
KNGroup::updateThreadInfo
void updateThreadInfo()
article handling
Definition: kngroup.cpp:988
KNGroup::f_irstNr
int f_irstNr
Definition: kngroup.h:202
KNGroup::isLocked
bool isLocked()
locking
Definition: kngroup.h:146
KNGroup::byId
KNRemoteArticle::Ptr byId(int id)
Definition: kngroup.h:122
KNGroup::showProperties
void showProperties()
Shows the group properties dialog.
Definition: kngroup.cpp:1030
KNGroup::insortNewHeaders
void insortNewHeaders(const KIO::UDSEntryList &list, KNJobData *job=0)
Insert headers of new articles into this group, and then sort.
Definition: kngroup.cpp:390
KNArticleCollection::byId
KNArticle::Ptr byId(int id)
Returns the article whose id is id, or an empty KNArticle::Ptr if it is not found.
Definition: knarticlecollection.cpp:214
knarticlecollection.h
KNCollection::CTgroup
Definition: kncollection.h:33
KNGroup::activeCleanupConfig
KNode::Cleanup * activeCleanupConfig()
Returns the active cleanup configuration of this group, ie.
Definition: kngroup.cpp:1119
knglobals.h
KNGroup::dynDataVer1::idRef
int idRef
Definition: kngroup.h:260
KNGroup::dynDataVer1::dynDataVer1
dynDataVer1()
Definition: kngroup.h:255
KNGroup::c_rosspostIDBuffer
QStringList c_rosspostIDBuffer
Definition: kngroup.h:222
KNGroup::s_tatus
Status s_tatus
Definition: kngroup.h:220
KNRemoteArticle::Ptr
boost::shared_ptr< KNRemoteArticle > Ptr
Shared pointer to a KNRemoteArticle. To be used instead of raw KNRemoteArticle*.
Definition: knarticle.h:107
KNCollection::Ptr
boost::shared_ptr< KNCollection > Ptr
Shared pointer to a KNCollection.
Definition: kncollection.h:40
KNGroup::reorganize
void reorganize()
Definition: kngroup.cpp:965
KNGroup::setFirstNr
void setFirstNr(int i)
Sets the smallest available serial number.
Definition: kngroup.h:102
KNGroup::prepareForExecution
QString prepareForExecution()
Definition: kngroup.cpp:1061
KNGroup::lastFetchCount
int lastFetchCount() const
Definition: kngroup.h:89
KNGroup::dynDataVer0::score
short score
Definition: kngroup.h:249
KNGroup::u_seCharset
bool u_seCharset
Definition: kngroup.h:217
KNGroup::m_axFetch
int m_axFetch
Definition: kngroup.h:202
KNGroup::setLocked
void setLocked(bool l)
Definition: kngroup.h:147
KNGroup::dynDataVer0
Definition: kngroup.h:238
KNGroup::dynDataVer1::id
int id
Definition: kngroup.h:259
KNGroup::dynDataVer1::score
short score
Definition: kngroup.h:262
KNJobItem
Base class for data structures used in jobs.
Definition: knjobdata.h:74
KNGroup::setFirstNewIndex
void setFirstNewIndex(int i)
Definition: kngroup.h:87
knarticle.h
KNGroup::setNewCount
void setNewCount(int i)
Definition: kngroup.h:83
KNGroup::i_gnoreCount
int i_gnoreCount
Definition: kngroup.h:202
KNGroup::List
QList< KNGroup::Ptr > List
List of groups.
Definition: kngroup.h:56
KNGroup::statThrWithUnread
int statThrWithUnread()
Definition: kngroup.cpp:1053
KNGroup::type
collectionType type()
type
Definition: kngroup.h:59
KNGroup::dynDataVer1::getData
void getData(KNRemoteArticle::Ptr a)
Definition: kngroup.cpp:1107
KNGroup::newCount
int newCount() const
count + numbers
Definition: kngroup.h:82
KNGroup::dynDataVer1::read
bool read
Definition: kngroup.h:261
KNRemoteArticle
KNRemoteArticle represents an article, whos body has to be retrieved from a remote host or from the l...
Definition: knarticle.h:103
KNGroup::thisGroupPtr
KNGroup::Ptr thisGroupPtr()
Returns a shared pointer pointing to this group.
Definition: kngroup.cpp:1126
KNGroup::lastNr
int lastNr() const
Returns the largest used article serial number in this group.
Definition: kngroup.h:104
KNArticleCollection
Abstract base class for article collections, ie.
Definition: knarticlecollection.h:76
KNGroup::at
KNRemoteArticle::Ptr at(int i)
Definition: kngroup.h:120
KNCollection::collectionType
collectionType
Definition: kncollection.h:33
KNGroup::l_ocked
bool l_ocked
Definition: kngroup.h:217
KNGroup::~KNGroup
~KNGroup()
Definition: kngroup.cpp:56
KNGroup::hasName
bool hasName() const
name
Definition: kngroup.h:70
KNArticleCollection::byMessageId
KNArticle::Ptr byMessageId(const QByteArray &mid)
Returns the article whose message-id is mid, or an empty KNArticle::Ptr if it is not found...
Definition: knarticlecollection.cpp:220
KNGroup::decNewCount
void decNewCount(int i=1)
Definition: kngroup.h:85
KNGroup::dynDataVer0::thrLevel
short thrLevel
Definition: kngroup.h:249
KNGroup::setMaxFetch
void setMaxFetch(int i)
Sets the maximal number of articles to download from the server.
Definition: kngroup.h:114
KNGroup::syncDynamicData
void syncDynamicData()
Definition: kngroup.cpp:626
KNGroup::account
KNNntpAccount::Ptr account()
Returns the account this group belongs to.
Definition: kngroup.cpp:161
KNGroup::status
Status status() const
Returns the posting rights of this group.
Definition: kngroup.h:176
KNGroup::readInfo
bool readInfo(const QString &confPath)
Load the properties/settings of this collection.
Definition: kngroup.cpp:90
KNGroup::identity
virtual const KPIMIdentities::Identity & identity() const
Returns the identity configured for this group.
Definition: kngroup.cpp:169
KNGroup::KNGroup
KNGroup(KNCollection::Ptr p=KNCollection::Ptr())
Definition: kngroup.cpp:46
KNGroup::selfPtr
virtual KNCollection::Ptr selfPtr()
Reimplemented from KNArticleCollection::selfPtr().
Definition: kngroup.h:274
KNGroup::loadHdrs
bool loadHdrs()
Load the stored headers from disk.
Definition: kngroup.cpp:178
KNGroup::statThrWithNew
int statThrWithNew()
Definition: kngroup.cpp:1044
KNGroup::dynDataVer0::getData
void getData(KNRemoteArticle::Ptr a)
Definition: kngroup.cpp:1082
KNGroup::setGroupname
void setGroupname(const QString &s)
Definition: kngroup.h:73
KNGroup::dynDataVer1
Definition: kngroup.h:252
KNGroup::byMessageId
KNRemoteArticle::Ptr byMessageId(const QByteArray &mId)
Definition: kngroup.h:124
KNGroup::maxFetch
int maxFetch() const
Returns the maximal number of articles to download from the server.
Definition: kngroup.h:110
QList< KNGroup::Ptr >
KNGroup::Ptr
boost::shared_ptr< KNGroup > Ptr
Shared pointer to a KNGroup.
Definition: kngroup.h:47
KNGroup::setUseCharset
void setUseCharset(bool b)
Definition: kngroup.h:158
KNGroup::d_escription
QString d_escription
Definition: kngroup.h:214
KNGroup::unloadHdrs
bool unloadHdrs(bool force=true)
Definition: kngroup.cpp:367
KNGroup::updateListItem
void updateListItem()
list-item handling
Definition: kngroup.cpp:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal