KNewStuff
staticxmlprovider.h
Go to the documentation of this file.
00001 /* 00002 knewstuff3/provider.h 00003 This file is part of KNewStuff2. 00004 Copyright (c) 2009 Jeremy Whiting <jpwhiting@kde.org> 00005 Copyright (C) 2009-2010 Frederik Gladhorn <gladhorn@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 #ifndef KNEWSTUFF3_STATICXML_PROVIDER_H 00021 #define KNEWSTUFF3_STATICXML_PROVIDER_H 00022 00023 #include "core/provider.h" 00024 00025 namespace KNS3 00026 { 00027 class XmlLoader; 00028 00041 class StaticXmlProvider: public Provider 00042 { 00043 Q_OBJECT 00044 public: 00045 typedef QList<Provider*> List; 00049 StaticXmlProvider(); 00050 00051 virtual QString id() const; 00052 00056 virtual bool setProviderXML(const QDomElement & xmldata); 00057 00058 virtual bool isInitialized() const; 00059 00060 virtual void setCachedEntries(const KNS3::EntryInternal::List& cachedEntries); 00061 00062 virtual void loadEntries(const KNS3::Provider::SearchRequest& request); 00063 virtual void loadPayloadLink(const KNS3::EntryInternal& entry, int); 00064 00065 private Q_SLOTS: 00066 void slotEmitProviderInitialized(); 00067 void slotFeedFileLoaded(const QDomDocument&); 00068 void slotFeedFailed(); 00069 00070 private: 00071 bool searchIncludesEntry(const EntryInternal& entry) const; 00072 KUrl downloadUrl(SortMode mode) const; 00073 EntryInternal::List installedEntries() const; 00074 00075 // map of download urls to their feed name 00076 QMap<QString, KUrl> mDownloadUrls; 00077 KUrl mUploadUrl; 00078 KUrl mNoUploadUrl; 00079 00080 // cache of all entries known from this provider so far, mapped by their id 00081 EntryInternal::List mCachedEntries; 00082 QMap<Provider::SortMode, XmlLoader*> mFeedLoaders; 00083 Provider::SearchRequest mCurrentRequest; 00084 QString mId; 00085 bool mInitialized; 00086 00087 Q_DISABLE_COPY(StaticXmlProvider) 00088 }; 00089 00090 } 00091 00092 #endif
KDE 4.6 API Reference