SVN_SILENT made messages (.desktop file)
[kdepim.git] / knode / knmemorymanager.h
blob7d156ffeba2bc6f95600a5f3e793986cac2aa038
1 /*
2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
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
15 #ifndef KNMEMORYMANAGER_H
16 #define KNMEMORYMANAGER_H
18 #include "knarticle.h"
19 #include "knarticlecollection.h"
21 #include <QList>
23 class KNArticleCollection;
25 /** Memory manager. */
26 class KNMemoryManager {
28 public:
29 KNMemoryManager();
30 ~KNMemoryManager();
32 /** Collection-Handling */
33 void updateCacheEntry( KNArticleCollection::Ptr c );
34 void removeCacheEntry( KNArticleCollection::Ptr c );
35 /** try to free enough memory for this collection */
36 void prepareLoad( KNArticleCollection::Ptr c );
38 /** Article-Handling */
39 void updateCacheEntry( KNArticle::Ptr a );
40 void removeCacheEntry( KNArticle::Ptr a );
42 protected:
44 /** Article cache item. */
45 class ArticleItem {
46 public:
47 explicit ArticleItem( KNArticle::Ptr a ) { art=a; sync(); }
48 ~ArticleItem() {}
49 void sync();
51 KNArticle::Ptr art;
52 int storageSize;
54 /// List of article cache items.
55 typedef QList<KNMemoryManager::ArticleItem*> List;
58 /** Group/folder cache item. */
59 class CollectionItem {
60 public:
61 explicit CollectionItem( KNArticleCollection::Ptr c )
63 col = c;
64 sync();
66 ~CollectionItem() { }
67 void sync();
69 KNArticleCollection::Ptr col;
70 int storageSize;
72 /// List of collection cache items.
73 typedef QList<KNMemoryManager::CollectionItem*> List;
76 CollectionItem * findCacheEntry( KNArticleCollection::Ptr c, bool take = false );
77 ArticleItem * findCacheEntry( KNArticle::Ptr a, bool take = false );
78 void checkMemoryUsageCollections();
79 void checkMemoryUsageArticles();
81 CollectionItem::List mColList;
82 ArticleItem::List mArtList;
83 int c_ollCacheSize, a_rtCacheSize;
87 #endif