KNewStuff

cache.h
1 /*
2  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
3  SPDX-FileCopyrightText: 2010 Matthias Fuchs <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef CACHE_H
9 #define CACHE_H
10 
11 #include <QObject>
12 #include <QSet>
13 
14 #include "engine.h"
15 #include "entryinternal.h"
16 
17 #include "knewstuffcore_export.h"
18 
19 namespace KNSCore
20 {
21 
22 class KNEWSTUFFCORE_EXPORT Cache : public QObject
23 {
24  Q_OBJECT
25 
26 public:
34  static QSharedPointer<Cache> getCache(const QString &appName);
35 
36  ~Cache();
37 
39  void readRegistry();
41  EntryInternal::List registryForProvider(const QString &providerId);
42 
44  void writeRegistry();
45 
46  void insertRequest(const KNSCore::Provider::SearchRequest &, const KNSCore::EntryInternal::List &entries);
47  EntryInternal::List requestFromCache(const KNSCore::Provider::SearchRequest &);
48 
61  void removeDeletedEntries();
62 public Q_SLOTS:
63  void registerChangedEntry(const KNSCore::EntryInternal &entry);
64 
65 private:
66  Q_DISABLE_COPY(Cache)
67  Cache(const QString &appName);
68 
69  // compatibility with KNS2
70  void readKns2MetaFiles();
71 
72 private:
73  // The file that is used to keep track of downloaded entries
74  QString registryFile;
75 
76  // The component name that was used in KNS2 to keep track of .meta files
77  // This is only for compatibility with the former version - KNewStuff2.
78  QString m_kns2ComponentName;
79 
80  QSet<EntryInternal> cache;
81  QHash<QString, EntryInternal::List> requestCache;
82 };
83 
84 }
85 
86 #endif
Contains the core functionality for handling interaction with NewStuff providers. ...
used to keep track of a search
Definition: provider.h:67
KNewStuff data entry container.
Definition: entryinternal.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:43:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.