home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / knewstuff / entry.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  6.5 KB  |  282 lines

  1. /*
  2.     This file is part of KOrganizer.
  3.     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef KNEWSTUFF_ENTRY_H
  21. #define KNEWSTUFF_ENTRY_H
  22.  
  23. #include <qdatetime.h>
  24. #include <qdom.h>
  25. #include <qmap.h>
  26. #include <qstring.h>
  27. #include <qstringlist.h>
  28.  
  29. #include <kurl.h>
  30.  
  31. namespace KNS {
  32.  
  33. /**
  34.  * @short KNewStuff data entry container.
  35.  *
  36.  * This class provides accessor methods to the data objects
  37.  * as used by KNewStuff.
  38.  * It should probably not be used directly by the application.
  39.  *
  40.  * @author Cornelius Schumacher (schumacher@kde.org)
  41.  * \par Maintainer:
  42.  * Josef Spillner (spillner@kde.org)
  43.  */
  44. class KDE_EXPORT Entry
  45. {
  46.   public:
  47.     Entry();
  48.     /**
  49.      * Constructor.
  50.      */
  51.     Entry( const QDomElement & );
  52.  
  53.     /**
  54.      * Destructor.
  55.      */
  56.     ~Entry();
  57.  
  58.     /**
  59.      * Sets the (unique) name for this data object.
  60.      */
  61.     void setName( const QString & );
  62.  
  63.     /**
  64.      * Sets the (internationalised) name for this data object.
  65.      */
  66.     void setName( const QString &, const QString & );
  67.  
  68.     /**
  69.      * Retrieve the name of the data object.
  70.      *
  71.      * @return object name
  72.      */
  73.     QString name() const;
  74.  
  75.     /**
  76.      * Retrieve the internationalised name of the data object.
  77.      *
  78.      * @return object name (potentially translated)
  79.      */
  80.     QString name( const QString &lang ) const;
  81.  
  82.     /**
  83.      * Sets the application type, e.g. 'kdesktop/wallpaper'.
  84.      */
  85.     void setType( const QString & );
  86.  
  87.     /**
  88.      * Retrieve the type of the data object.
  89.      *
  90.      * @return object type
  91.      */
  92.     QString type() const;
  93.  
  94.     /**
  95.      * Sets the full name of the object's author.
  96.      */
  97.     void setAuthor( const QString & );
  98.  
  99.     /**
  100.      * Retrieve the author's name of the object.
  101.      *
  102.      * @return object author
  103.      */
  104.     QString author() const;
  105.  
  106.     /**
  107.      * Sets the email address of the object's author.
  108.      */
  109.     void setAuthorEmail( const QString & );
  110.  
  111.     /**
  112.      * Retrieve the author's email address of the object.
  113.      *
  114.      * @return object author email address
  115.      */
  116.     QString authorEmail() const;
  117.  
  118.     /**
  119.      * Sets the license (abbreviation) applicable to the object.
  120.      */
  121.     void setLicence( const QString & );
  122.  
  123.     /**
  124.      * Retrieve the license name of the object.
  125.      *
  126.      * @return object license
  127.      */
  128.     QString license() const;
  129.  
  130.     /**
  131.      * Sets a short description on what the object is all about.
  132.      */
  133.     void setSummary( const QString &, const QString &lang = QString::null );
  134.  
  135.     /**
  136.      * Retrieve a short description about the object.
  137.      *
  138.      * @param lang preferred language, or QString::null for KDE default
  139.      * @return object description
  140.      */
  141.     QString summary( const QString &lang = QString::null ) const;
  142.  
  143.     /**
  144.      * Sets the version number.
  145.      */
  146.     void setVersion( const QString & );
  147.  
  148.     /**
  149.      * Retrieve the version string of the object.
  150.      *
  151.      * @return object version
  152.      */
  153.     QString version() const;
  154.  
  155.     /**
  156.      * Sets the release number, which is increased for feature-equal objects
  157.      * with the same version number, but slightly updated contents.
  158.      */
  159.     void setRelease( int );
  160.  
  161.     /**
  162.      * Retrieve the release number of the object
  163.      *
  164.      * @return object release
  165.      */
  166.     int release() const;
  167.  
  168.     /**
  169.      * Sets the release date.
  170.      */
  171.     void setReleaseDate( const QDate & );
  172.  
  173.     /**
  174.      * Retrieve the date of the object's publication.
  175.      *
  176.      * @return object release date
  177.      */
  178.     QDate releaseDate() const;
  179.  
  180.     /**
  181.      * Sets the object's file.
  182.      */
  183.     void setPayload( const KURL &, const QString &lang = QString::null );
  184.  
  185.     /**
  186.      * Retrieve the file name of the object.
  187.      *
  188.      * @param lang preferred language, or QString::null for KDE default
  189.      * @return object filename
  190.      */
  191.     KURL payload( const QString &lang = QString::null ) const;
  192.  
  193.     /**
  194.      * Sets the object's preview file, if available. This should be a
  195.      * picture file.
  196.      */
  197.     void setPreview( const KURL &, const QString &lang = QString::null );
  198.  
  199.     /**
  200.      * Retrieve the file name of an image containing a preview of the object.
  201.      *
  202.      * @param lang preferred language, or QString::null for KDE default
  203.      * @return object preview filename
  204.      */
  205.     KURL preview( const QString &lang = QString::null ) const;
  206.  
  207.     /**
  208.      * Sets the rating between 0 (worst) and 10 (best).
  209.      *
  210.      * @internal
  211.      */
  212.     void setRating( int );
  213.  
  214.     /**
  215.      * Retrieve the rating for the object, which has been determined by its
  216.      * users and thus might change over time.
  217.      *
  218.      * @return object rating
  219.      */
  220.     int rating();
  221.  
  222.     /**
  223.      * Sets the number of downloads.
  224.      * 
  225.      * @internal
  226.      */
  227.     void setDownloads( int );
  228.  
  229.     /**
  230.      * Retrieve the download count for the object, which has been determined
  231.      * by its hosting sites and thus might change over time.
  232.      *
  233.      * @return object download count
  234.      */
  235.     int downloads();
  236.  
  237.     /**
  238.      * Return the full name for the meta information. It is constructed as
  239.      * name-version-release.
  240.      */
  241.     QString fullName();
  242.  
  243.     /**
  244.      * Return the list of languages this object supports.
  245.      */
  246.     QStringList langs();
  247.  
  248.     /**
  249.      * @internal
  250.      */
  251.     void parseDomElement( const QDomElement & );
  252.  
  253.     /**
  254.      * @internal
  255.      */
  256.     QDomElement createDomElement( QDomDocument &, QDomElement &parent );
  257.  
  258.   protected:
  259.     QDomElement addElement( QDomDocument &doc, QDomElement &parent,
  260.                             const QString &tag, const QString &value );
  261.  
  262.   private:
  263.     QString mName;
  264.     QString mType;
  265.     QString mAuthor;
  266.     QString mLicence;
  267.     QMap<QString,QString> mSummaryMap;
  268.     QString mVersion;
  269.     int mRelease;
  270.     QDate mReleaseDate;
  271.     QMap<QString,KURL> mPayloadMap;
  272.     QMap<QString,KURL> mPreviewMap;
  273.     int mRating;
  274.     int mDownloads;
  275.  
  276.     QStringList mLangs;
  277. };
  278.  
  279. }
  280.  
  281. #endif
  282.