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 #include <memory.h>
20 
21 namespace KNSCore
22 {
23 class CachePrivate;
24 class KNEWSTUFFCORE_EXPORT Cache : public QObject
25 {
26  Q_OBJECT
27 
28 public:
36  static QSharedPointer<Cache> getCache(const QString &appName);
37 
38  ~Cache();
39 
41  void readRegistry();
43  EntryInternal::List registryForProvider(const QString &providerId);
44 
46  void writeRegistry();
47 
48  void insertRequest(const KNSCore::Provider::SearchRequest &, const KNSCore::EntryInternal::List &entries);
49  EntryInternal::List requestFromCache(const KNSCore::Provider::SearchRequest &);
50 
63  void removeDeletedEntries();
64 
73  KNSCore::EntryInternal entryFromInstalledFile(const QString& installedFile) const;
74 
81  Q_SIGNAL void entryChanged(const KNSCore::EntryInternal &entry);
82 
83 public Q_SLOTS:
84  void registerChangedEntry(const KNSCore::EntryInternal &entry);
85 
86 private:
87  Q_DISABLE_COPY(Cache)
88  Cache(const QString &appName);
89 
90 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 77)
91  // compatibility with KNS2
92  void readKns2MetaFiles();
93 #endif
94 
95 private:
96  // The file that is used to keep track of downloaded entries
97  QString registryFile;
98 
99  // The component name that was used in KNS2 to keep track of .meta files
100  // This is only for compatibility with the former version - KNewStuff2.
101  QString m_kns2ComponentName;
102 
103  QSet<EntryInternal> cache;
104 
105  std::unique_ptr<CachePrivate> d;
106 };
107 
108 }
109 
110 #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-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.