Commit 24655730 authored by Fushan Wen's avatar Fushan Wen Committed by Nate Graham
Browse files

dataengines/potd: Add more roles

Expose more data in PotdProviderModel.

CCBUG: 422934
parent d68fb6f8
......@@ -209,10 +209,74 @@ void PotdProviderModel::setLocalUrl(const QString &urlString)
Q_EMIT localUrlChanged();
}
QUrl PotdProviderModel::infoUrl() const
{
return m_data.wallpaperInfoUrl;
}
void PotdProviderModel::setInfoUrl(const QUrl &url)
{
if (m_data.wallpaperInfoUrl == url) {
return;
}
m_data.wallpaperInfoUrl = url;
Q_EMIT infoUrlChanged();
}
QUrl PotdProviderModel::remoteUrl() const
{
return m_data.wallpaperRemoteUrl;
}
void PotdProviderModel::setRemoteUrl(const QUrl &url)
{
if (m_data.wallpaperRemoteUrl == url) {
return;
}
m_data.wallpaperRemoteUrl = url;
Q_EMIT remoteUrlChanged();
}
QString PotdProviderModel::title() const
{
return m_data.wallpaperTitle;
}
void PotdProviderModel::setTitle(const QString &title)
{
if (m_data.wallpaperTitle == title) {
return;
}
m_data.wallpaperTitle = title;
Q_EMIT titleChanged();
}
QString PotdProviderModel::author() const
{
return m_data.wallpaperAuthor;
}
void PotdProviderModel::setAuthor(const QString &author)
{
if (m_data.wallpaperAuthor == author) {
return;
}
m_data.wallpaperAuthor = author;
Q_EMIT authorChanged();
}
void PotdProviderModel::resetData()
{
setImage(QImage());
setLocalUrl(QString());
setInfoUrl(QUrl());
setRemoteUrl(QUrl());
setTitle(QString());
setAuthor(QString());
}
bool PotdProviderModel::updateSource(bool refresh)
......
......@@ -36,6 +36,16 @@ class PotdProviderModel : public QAbstractListModel
*/
Q_PROPERTY(QImage image READ image NOTIFY imageChanged)
Q_PROPERTY(QString localUrl READ localUrl NOTIFY localUrlChanged)
/**
* @return The website URL of the image
*/
Q_PROPERTY(QUrl infoUrl READ infoUrl NOTIFY infoUrlChanged)
/**
* @return The remote image URL
*/
Q_PROPERTY(QUrl remoteUrl READ remoteUrl NOTIFY remoteUrlChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QString author READ author NOTIFY authorChanged)
public:
enum Roles {
......@@ -63,6 +73,10 @@ public:
QImage image() const;
QString localUrl() const;
QUrl infoUrl() const;
QUrl remoteUrl() const;
QString title() const;
QString author() const;
Q_SIGNALS:
void runningChanged();
......@@ -71,6 +85,10 @@ Q_SIGNALS:
void imageChanged();
void localUrlChanged();
void infoUrlChanged();
void remoteUrlChanged();
void titleChanged();
void authorChanged();
private Q_SLOTS:
void slotFinished(PotdProvider *);
......@@ -86,6 +104,10 @@ private:
void setImage(const QImage &image);
void setLocalUrl(const QString &urlString);
void setInfoUrl(const QUrl &url);
void setRemoteUrl(const QUrl &url);
void setTitle(const QString &title);
void setAuthor(const QString &author);
std::vector<KPluginMetaData> m_providers;
QString m_identifier;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment