KNewStuff
cache.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2009 Frederik Gladhorn <gladhorn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef CACHE_H 00019 #define CACHE_H 00020 00021 #include <QtCore/QObject> 00022 #include <QtCore/QSet> 00023 00024 #include "engine.h" 00025 #include "entryinternal.h" 00026 00027 namespace KNS3 { 00028 00029 class Cache : public QObject 00030 { 00031 Q_OBJECT 00032 public: 00033 Cache(QObject* parent = 0); 00035 void setRegistryFileName(const QString& appName); 00036 00038 void readRegistry(); 00040 EntryInternal::List registryForProvider(const QString& providerId); 00041 00043 void writeRegistry(); 00044 00045 void insertRequest(const KNS3::Provider::SearchRequest&, const KNS3::EntryInternal::List& entries); 00046 EntryInternal::List requestFromCache(const KNS3::Provider::SearchRequest&); 00047 00048 public Q_SLOTS: 00049 void registerChangedEntry(const KNS3::EntryInternal& entry); 00050 00051 private: 00052 // compatibility with KNS2 00053 void readKns2MetaFiles(); 00054 00055 // The file that is used to keep track of downloaded entries 00056 QString registryFile; 00057 00058 // The component name that was used in KNS2 to keep track of .meta files 00059 // This is only for compatibility with the former version - KNewStuff2. 00060 QString m_kns2ComponentName; 00061 00062 QSet<EntryInternal> cache; 00063 QHash<QString, EntryInternal::List> requestCache; 00064 }; 00065 00066 } 00067 00068 #endif
KDE 4.6 API Reference