KNewStuff
entryinternal.h
Go to the documentation of this file.
00001 /* 00002 knewstuff3/entry.h. 00003 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00004 Copyright (c) 2003 - 2007 Josef Spillner <spillner@kde.org> 00005 Copyright (c) 2009 Jeremy Whiting <jpwhiting@kde.org> 00006 Copyright (C) 2009 Frederik Gladhorn <gladhorn@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef KNEWSTUFF3_ENTRY_H 00023 #define KNEWSTUFF3_ENTRY_H 00024 00025 #include <QtCore/QDate> 00026 #include <QtXml/QDomElement> 00027 #include <QtCore/QString> 00028 00029 #include <kurl.h> 00030 00031 #include <knewstuff3/core/author.h> 00032 #include <knewstuff3/entry.h> 00033 00034 namespace KNS3 00035 { 00036 static const int PreviewWidth = 96; 00037 static const int PreviewHeight = 72; 00038 00042 QString replaceBBCode(const QString& unformattedText); 00043 00054 class EntryInternal 00055 { 00056 public: 00057 typedef QList<EntryInternal> List; 00058 00064 enum Source { 00065 Cache, 00066 Online, 00067 Registry 00068 }; 00069 00070 enum PreviewType { 00071 PreviewSmall1, 00072 PreviewSmall2, 00073 PreviewSmall3, 00074 PreviewBig1, 00075 PreviewBig2, 00076 PreviewBig3 00077 }; 00078 00079 struct DownloadLinkInformation { 00080 QString name; 00081 QString priceAmount; 00082 QString distributionType; 00083 QString descriptionLink; 00084 int id; 00085 bool isDownloadtypeLink; 00086 }; 00087 00091 EntryInternal(); 00092 00093 EntryInternal(const EntryInternal& other); 00094 EntryInternal& operator=(const EntryInternal& other); 00095 00096 bool operator==(const EntryInternal& other) const; 00097 bool operator<(const EntryInternal& other) const; 00098 00102 ~EntryInternal(); 00103 00104 bool isValid() const; 00105 00109 void setName(const QString& name); 00110 00116 QString name() const; 00117 00118 void setUniqueId(const QString& id); 00119 QString uniqueId() const; 00120 00124 void setCategory(const QString& category); 00125 00131 QString category() const; 00132 00133 void setHomepage(const KUrl& page); 00134 KUrl homepage() const; 00135 00139 void setAuthor(const Author& author); 00140 00146 Author author() const; 00147 00151 void setLicense(const QString& license); 00152 00158 QString license() const; 00159 00163 void setSummary(const QString& summary); 00164 00170 QString summary() const; 00171 00175 void setChangelog(const QString& changelog); 00176 QString changelog() const; 00177 00181 void setVersion(const QString& version); 00182 00188 QString version() const; 00189 00193 void setReleaseDate(const QDate& releasedate); 00194 00200 QDate releaseDate() const; 00201 00205 void setUpdateVersion(const QString& version); 00206 00212 QString updateVersion() const; 00213 00217 void setUpdateReleaseDate(const QDate& releasedate); 00218 00224 QDate updateReleaseDate() const; 00225 00229 void setPayload(const QString& url); 00230 00236 QString payload() const; 00237 00242 void setPreviewUrl(const QString& url, PreviewType type = PreviewSmall1); 00243 00249 QString previewUrl(PreviewType type = PreviewSmall1) const; 00250 00254 QImage previewImage(PreviewType type = PreviewSmall1) const; 00255 void setPreviewImage(const QImage& image, PreviewType type = PreviewSmall1); 00256 00261 void setInstalledFiles(const QStringList& files); 00262 00267 QStringList installedFiles() const; 00268 00274 void setUnInstalledFiles(const QStringList& files); 00275 00281 QStringList uninstalledFiles() const; 00282 00288 void setRating(int rating); 00289 00296 int rating() const; 00297 00303 void setDownloadCount(int downloads); 00304 00311 int downloadCount() const; 00312 00313 int numberFans() const; 00314 void setNumberFans(int fans); 00315 00316 int numberKnowledgebaseEntries() const; 00317 void setNumberKnowledgebaseEntries(int num); 00318 QString knowledgebaseLink() const; 00319 void setKnowledgebaseLink(const QString& link); 00320 00321 int downloadLinkCount() const; 00322 QList<DownloadLinkInformation> downloadLinkInformationList() const; 00323 void appendDownloadLinkInformation(const DownloadLinkInformation& info); 00324 void clearDownloadLinkInformation(); 00325 00326 QString donationLink() const; 00327 void setDonationLink(const QString& link); 00328 00332 QString providerId() const; 00333 void setProviderId(const QString& id); 00334 00338 void setSource(Source source); 00339 Source source() const; 00340 00350 bool setEntryXML(const QDomElement & xmldata); 00351 00355 QDomElement entryXML() const; 00356 00364 //QString checksum() const; 00365 00372 //void setChecksum(const QString& checksum); 00373 00381 //QString signature() const; 00382 00389 //void setSignature(const QString& signature); 00390 00397 void setStatus(Entry::Status status); 00398 00404 Entry::Status status() const; 00405 00406 //void setIdNumber(int number); 00407 //int idNumber() const; 00408 00409 Entry toEntry() const; 00410 00411 static KNS3::EntryInternal fromEntry(const KNS3::Entry& entry); 00412 private: 00413 class Private; 00414 QExplicitlySharedDataPointer<Private> d; 00415 }; 00416 00417 inline uint qHash(const KNS3::EntryInternal& entry) { 00418 return qHash(entry.uniqueId()); 00419 } 00420 00421 } 00422 00423 #endif
KDE 4.6 API Reference