entry.h
00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef KNEWSTUFF_ENTRY_H 00021 #define KNEWSTUFF_ENTRY_H 00022 00023 #include <qdatetime.h> 00024 #include <qdom.h> 00025 #include <qmap.h> 00026 #include <qstring.h> 00027 #include <qstringlist.h> 00028 00029 #include <kurl.h> 00030 00031 namespace KNS { 00032 00044 class KDE_EXPORT Entry 00045 { 00046 public: 00047 Entry(); 00051 Entry( const QDomElement & ); 00052 00056 ~Entry(); 00057 00061 void setName( const QString & ); 00062 00066 void setName( const QString &, const QString & ); 00067 00073 QString name() const; 00074 00080 QString name( const QString &lang ) const; 00081 00085 void setType( const QString & ); 00086 00092 QString type() const; 00093 00097 void setAuthor( const QString & ); 00098 00104 QString author() const; 00105 00109 void setAuthorEmail( const QString & ); 00110 00116 QString authorEmail() const; 00117 00121 void setLicence( const QString & ); 00122 00128 QString license() const; 00129 00133 void setSummary( const QString &, const QString &lang = QString::null ); 00134 00141 QString summary( const QString &lang = QString::null ) const; 00142 00146 void setVersion( const QString & ); 00147 00153 QString version() const; 00154 00159 void setRelease( int ); 00160 00166 int release() const; 00167 00171 void setReleaseDate( const QDate & ); 00172 00178 QDate releaseDate() const; 00179 00183 void setPayload( const KURL &, const QString &lang = QString::null ); 00184 00191 KURL payload( const QString &lang = QString::null ) const; 00192 00197 void setPreview( const KURL &, const QString &lang = QString::null ); 00198 00205 KURL preview( const QString &lang = QString::null ) const; 00206 00212 void setRating( int ); 00213 00220 int rating(); 00221 00227 void setDownloads( int ); 00228 00235 int downloads(); 00236 00241 QString fullName(); 00242 00246 QStringList langs(); 00247 00251 void parseDomElement( const QDomElement & ); 00252 00256 QDomElement createDomElement( QDomDocument &, QDomElement &parent ); 00257 00258 protected: 00259 QDomElement addElement( QDomDocument &doc, QDomElement &parent, 00260 const QString &tag, const QString &value ); 00261 00262 private: 00263 QString mName; 00264 QString mType; 00265 QString mAuthor; 00266 QString mLicence; 00267 QMap<QString,QString> mSummaryMap; 00268 QString mVersion; 00269 int mRelease; 00270 QDate mReleaseDate; 00271 QMap<QString,KURL> mPayloadMap; 00272 QMap<QString,KURL> mPreviewMap; 00273 int mRating; 00274 int mDownloads; 00275 00276 QStringList mLangs; 00277 }; 00278 00279 } 00280 00281 #endif