diff --git a/dataengines/potd/potdprovider.cpp b/dataengines/potd/potdprovider.cpp index d0806142e..c7d83e7df 100644 --- a/dataengines/potd/potdprovider.cpp +++ b/dataengines/potd/potdprovider.cpp @@ -1,72 +1,72 @@ /* * Copyright (C) 2007 Tobias Koenig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "potdprovider.h" -class PotdProvider::Private +class PotdProviderPrivate { public: QString name; QDate date; }; PotdProvider::PotdProvider( QObject *parent, const QVariantList &args ) : QObject( parent ), - d(new Private) + d(new PotdProviderPrivate) { if ( args.count() > 0 ) { d->name = args[ 0 ].toString(); if ( args.count() > 1 && args[ 1 ].canConvert( QVariant::Date ) ) { d->date = args[ 1 ].toDate(); } } else { d->name = QStringLiteral("Unknown"); } } PotdProvider::~PotdProvider() { } QString PotdProvider::name() const { return d->name; } QDate PotdProvider::date() const { return d->date.isNull() ? QDate::currentDate() : d->date; } bool PotdProvider::isFixedDate() const { return !d->date.isNull(); } QString PotdProvider::identifier() const { if (isFixedDate()) { return d->name + QLatin1Char(':') + d->date.toString(Qt::ISODate); } return d->name; } diff --git a/dataengines/potd/potdprovider.h b/dataengines/potd/potdprovider.h index 282f7593f..9e97ab209 100644 --- a/dataengines/potd/potdprovider.h +++ b/dataengines/potd/potdprovider.h @@ -1,101 +1,100 @@ /* * Copyright (C) 2007 Tobias Koenig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef POTDPROVIDER_H #define POTDPROVIDER_H #include #include #include #include "plasma_potd_export.h" class QImage; /** * This class is an interface for PoTD providers. */ class PLASMA_POTD_EXPORT PotdProvider : public QObject { Q_OBJECT public: /** * Creates a new PoTD provider. * * @param parent The parent object. */ explicit PotdProvider(QObject *parent, const QVariantList &args = QVariantList()); /** * Destroys the PoTD provider. */ ~PotdProvider() override; /** * Returns the requested image. * * Note: This method returns only a valid image after the * finished() signal has been emitted. */ virtual QImage image() const = 0; /** * Returns the identifier of the PoTD request (name + date). */ virtual QString identifier() const; /** * @return the name of this provider (equiv to X-KDE-PlasmaPoTDProvider-Identifier) */ QString name() const; /** * @reutrn the date to load for this item, if any */ QDate date() const; /** * @return if the date is fixed, or if it should always be "today" */ bool isFixedDate() const; Q_SIGNALS: /** * This signal is emitted whenever a request has been finished * successfully. * * @param provider The provider which emitted the signal. */ void finished( PotdProvider *provider ); /** * This signal is emitted whenever an error has occurred. * * @param provider The provider which emitted the signal. */ void error( PotdProvider *provider ); private: - class Private; - Private * const d; + const QScopedPointer d; }; #endif