summaryrefslogtreecommitdiffstats
path: root/kbugbuster/backend/bugcache.h
blob: af1aed113180963446698ac9a97f28f74a2e5a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef BUGCACHE_H
#define BUGCACHE_H

class KSimpleConfig;

#include "package.h"
#include "bug.h"
#include "bugdetails.h"

class BugCache
{
    public:
        BugCache( const QString &id );
        ~BugCache();

        void savePackageList( const Package::List &pkgs );
        Package::List loadPackageList();
        void invalidatePackageList();

        void saveBugList( const Package &pkg, const QString &component, const Bug::List & );
        Bug::List loadBugList( const Package &pkg, const QString &component, bool disconnected );
        void invalidateBugList( const Package &pkg, const QString &component );

        void saveBugDetails( const Bug &bug, const BugDetails & );
        BugDetails loadBugDetails( const Bug &bug );
        void invalidateBugDetails( const Bug &bug );
        bool hasBugDetails( const Bug& bug ) const;

        void clear();

    private:
        void init();
    
        void writePerson( KSimpleConfig *file, const QString &key,
                          const Person &p );
        struct Person readPerson (KSimpleConfig *file, const QString &key );

        QString mId;

        KSimpleConfig *m_cachePackages;
        KSimpleConfig *m_cacheBugs;

        QString mCachePackagesFileName;
        QString mCacheBugsFileName;
};

#endif