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

knode

knarticlecollection.h

Go to the documentation of this file.
00001 /*
00002     KNode, the KDE newsreader
00003     Copyright (c) 1999-2005 the KNode authors.
00004     See file AUTHORS for details
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010     You should have received a copy of the GNU General Public License
00011     along with this program; if not, write to the Free Software Foundation,
00012     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
00013 */
00014 
00015 #ifndef KNARTICLECOLLECTION_H
00016 #define KNARTICLECOLLECTION_H
00017 
00018 #include "kncollection.h"
00019 
00020 #include <QByteArray>
00021 
00022 class KNArticle;
00023 
00024 
00027 class KNArticleVector {
00028 
00029   public:
00030     enum SortingType { STid, STmsgId, STunsorted };
00031 
00032     KNArticleVector(KNArticleVector *master=0, SortingType sorting=STunsorted);
00033     virtual ~KNArticleVector();
00034 
00035     // list-info
00036     KNArticleVector* master()            { return m_aster; }
00037     void setMaster(KNArticleVector *m)   { m_aster=m; }
00038     bool isMaster()   { return (m_aster==0); }
00039 
00040     bool isEmpty()    { return ( (l_ist==0) || (l_en==0) ); }
00041     int length()      { return l_en; }
00042     int size()        { return s_ize; }
00043 
00044     // list-handling
00045     bool resize(int s=0);
00046     bool append(KNArticle *a, bool autoSort=false);
00047     void remove(int pos, bool autoDel=false, bool autoCompact=false);
00048     void clear();
00049     void compact();
00050     void syncWithMaster();
00051 
00052     // sorting
00053     SortingType sortMode()            { return s_ortType; }
00054     void setSortMode(SortingType s)   { s_ortType=s; }
00055     void sort();
00056     static int compareById(const void *a1, const void *a2);
00057     static int compareByMsgId(const void *a1, const void *a2);
00058 
00059     // article access
00060     KNArticle* at(int i)  { return ( (i>=0 && i<l_en) ? l_ist[i] : 0 ); }
00061     KNArticle* bsearch(int id);
00062     KNArticle* bsearch( const QByteArray &id );
00063 
00064     int indexForId(int id);
00065     int indexForMsgId( const QByteArray &id );
00066 
00067   protected:
00068     KNArticleVector *m_aster;
00069     int l_en,
00070         s_ize;
00071     KNArticle **l_ist;
00072     SortingType s_ortType;
00073 };
00074 
00075 
00078 class KNArticleCollection : public KNCollection {
00079 
00080   public:
00081     KNArticleCollection(KNCollection *p=0);
00082     ~KNArticleCollection();
00083 
00085     bool isEmpty()                { return a_rticles.isEmpty(); }
00086     bool isLoaded()               { return (c_ount==0 || a_rticles.length()>0); }
00087     int size()                    { return a_rticles.size(); }
00088     int length()                  { return a_rticles.length(); }
00089 
00090     // cache behavior
00091     bool isNotUnloadable()               { return n_otUnloadable; }
00092     void setNotUnloadable(bool b=true)   { n_otUnloadable = b; }
00093 
00094     // locking
00095     unsigned int lockedArticles() { return l_ockedArticles; }
00096     void articleLocked()          { l_ockedArticles++; }
00097     void articleUnlocked()        { l_ockedArticles--; }
00098 
00099     // list-handling
00100     bool resize(int s=0);
00101     bool append(KNArticle *a, bool autoSync=false);
00102     void clear();
00103     void compact();
00104     void setLastID();
00105 
00106     // article access
00107     KNArticle* at(int i)          { return a_rticles.at(i); }
00108     KNArticle* byId(int id);
00109     KNArticle* byMessageId( const QByteArray &mid );
00110 
00111     // search index
00112     void syncSearchIndex();
00113     void clearSearchIndex();
00114 
00115   protected:
00116     int l_astID;
00117     unsigned int l_ockedArticles;
00118     bool n_otUnloadable;
00119     KNArticleVector a_rticles;
00120     KNArticleVector m_idIndex;
00121 };
00122 
00123 
00124 #endif

knode

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal