File indexing completed on 2024-04-14 14:26:41

0001 /*
0002     SPDX-FileCopyrightText: 2002 Cornelius Schumacher <schumacher@kde.org>
0003     SPDX-FileCopyrightText: 2003-2007 Josef Spillner <spillner@kde.org>
0004     SPDX-FileCopyrightText: 2009 Jeremy Whiting <jpwhiting@kde.org>
0005     SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-or-later
0008 */
0009 
0010 #ifndef KNEWSTUFF3_KNEWSTUFFENTRY_H
0011 #define KNEWSTUFF3_KNEWSTUFFENTRY_H
0012 
0013 #include <QLoggingCategory>
0014 #include <QSharedDataPointer>
0015 #include <QStringList>
0016 
0017 #include "knewstuff_export.h"
0018 namespace KNSCore
0019 {
0020 class EntryInternal;
0021 }
0022 namespace KNS3
0023 {
0024 class EntryPrivate;
0025 /**
0026  * @short KNewStuff information about changed entries
0027  *
0028  * This class provides information about the entries that
0029  * have been installed while the new stuff dialog was shown.
0030  * It is a minimal version that only gives applications what they need
0031  * to know.
0032  *
0033  * @since 4.4
0034  */
0035 class KNEWSTUFF_EXPORT Entry
0036 {
0037 public:
0038     typedef QList<Entry> List;
0039 
0040     /**
0041      * Status of the entry. An entry will be downloadable from the provider's
0042      * site prior to the download. Once downloaded and installed, it will
0043      * be either installed or updateable, implying an out-of-date
0044      * installation. Finally, the entry can be deleted and hence show up as
0045      * downloadable again.
0046      * Entries not taking part in this cycle, for example those in upload,
0047      * have an invalid status.
0048      */
0049     enum Status {
0050         Invalid,
0051         Downloadable,
0052         Installed,
0053         Updateable,
0054         Deleted,
0055         Installing,
0056         Updating,
0057     };
0058 
0059     ~Entry();
0060     Entry(const Entry &other);
0061     Entry &operator=(const Entry &other);
0062 
0063     /**
0064      * Retrieve the name of the data object.
0065      *
0066      * @return object name
0067      */
0068     QString name() const;
0069 
0070     /**
0071      * Retrieve the category of the data object.
0072      *
0073      * @return object category
0074      */
0075     QString category() const;
0076 
0077     /**
0078      * Retrieve the locally installed files.
0079      * @return file names
0080      */
0081     QStringList installedFiles() const;
0082 
0083     /**
0084      * Retrieve the locally uninstalled files.
0085      * @return file names
0086      */
0087     QStringList uninstalledFiles() const;
0088 
0089     /**
0090      * Retrieves the entry's status.
0091      *
0092      * @return Current status of the entry
0093      */
0094     Status status() const;
0095 
0096     /**
0097      * Retrieve the license name of the object.
0098      *
0099      * @return object license
0100      */
0101     QString license() const;
0102 
0103     /**
0104      * Retrieve a short description about the object.
0105      *
0106      * @return object description
0107      */
0108     QString summary() const;
0109 
0110     /**
0111      * Retrieve the version string of the object.
0112      *
0113      * @return object version
0114      *
0115      * @sa installedVersion()
0116      */
0117     QString version() const;
0118 
0119     /**
0120      * Id of this Entry. It is guaranteed to be unique for one provider.
0121      * Id and ProviderId together identify this entry.
0122      * @return the id
0123      * @since 4.5
0124      */
0125     QString id() const;
0126 
0127     /**
0128      * The Provider which is the source of the Entry.
0129      * @return the Id of the Provider
0130      * @since 4.5
0131      */
0132     QString providerId() const;
0133 
0134     /**
0135      * @returns if available an url identifying the asset
0136      * @since 5.23
0137      */
0138     QUrl url() const;
0139 
0140     /**
0141      * @returns a list of urls to small previews to be displayed as thumbnails
0142      * @since 5.23
0143      */
0144     QList<QUrl> previewThumbnails() const;
0145 
0146     /**
0147      * @returns a list of full previews of the asset
0148      * @since 5.23
0149      */
0150     QList<QUrl> previewImages() const;
0151 
0152     /**
0153      * @returns the advertised disk size of the asset
0154      * @since 5.23
0155      */
0156     quint64 size() const;
0157 
0158     /**
0159      * @returns the number of comments in the asset
0160      * @since 5.23
0161      */
0162     uint numberOfComments() const;
0163 
0164     /**
0165      * @returns the rating of the asset, between 0 and 100
0166      * @since 5.23
0167      */
0168     uint rating() const;
0169 
0170     /**
0171      * @returns the asset's change log
0172      * @since 5.23
0173      */
0174     QString changelog() const;
0175 
0176     /**
0177      * @returns a short one-line summary of the asset
0178      * @since 5.23
0179      */
0180     QString shortSummary() const;
0181 
0182     /**
0183      * @returns the available version
0184      *
0185      * If the entry is not updateable, it will be the same as version.
0186      *
0187      * @sa version()
0188      *
0189      * @since 5.23
0190      */
0191     QString updateVersion() const;
0192 
0193 private:
0194     Entry();
0195 
0196     QExplicitlySharedDataPointer<EntryPrivate> d;
0197 
0198     friend class KNSCore::EntryInternal;
0199     friend class EntryPrivate;
0200 };
0201 
0202 }
0203 
0204 #endif