mirror of https://github.com/KDE/kasts.git
Add extra optional title argument to Error constructor
This commit is contained in:
parent
35cfb14e1f
commit
a5b021cffd
|
@ -14,7 +14,7 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "feed.h"
|
#include "feed.h"
|
||||||
|
|
||||||
Error::Error(const Type type, const QString url, const QString id, const int code, const QString message, const QDateTime date)
|
Error::Error(const Type type, const QString url, const QString id, const int code, const QString message, const QDateTime date, const QString title)
|
||||||
: QObject(nullptr)
|
: QObject(nullptr)
|
||||||
{
|
{
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
@ -23,11 +23,13 @@ Error::Error(const Type type, const QString url, const QString id, const int cod
|
||||||
this->code = code;
|
this->code = code;
|
||||||
this->message = message;
|
this->message = message;
|
||||||
this->date = date;
|
this->date = date;
|
||||||
};
|
this->m_title = title;
|
||||||
|
}
|
||||||
|
|
||||||
QString Error::title() const
|
QString Error::title() const
|
||||||
{
|
{
|
||||||
QString title;
|
QString title = m_title;
|
||||||
|
if (title.isEmpty()) {
|
||||||
if (!id.isEmpty()) {
|
if (!id.isEmpty()) {
|
||||||
if (DataManager::instance().getEntry(id))
|
if (DataManager::instance().getEntry(id))
|
||||||
title = DataManager::instance().getEntry(id)->title();
|
title = DataManager::instance().getEntry(id)->title();
|
||||||
|
@ -35,6 +37,7 @@ QString Error::title() const
|
||||||
if (DataManager::instance().getFeed(url))
|
if (DataManager::instance().getFeed(url))
|
||||||
title = DataManager::instance().getFeed(url)->name();
|
title = DataManager::instance().getFeed(url)->name();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
src/error.h
11
src/error.h
|
@ -35,7 +35,13 @@ public:
|
||||||
Q_PROPERTY(QString title READ title CONSTANT)
|
Q_PROPERTY(QString title READ title CONSTANT)
|
||||||
Q_PROPERTY(QString description READ description CONSTANT)
|
Q_PROPERTY(QString description READ description CONSTANT)
|
||||||
|
|
||||||
Error(Type type, const QString url, const QString id, const int code, const QString message, const QDateTime date);
|
Error(Type type,
|
||||||
|
const QString url,
|
||||||
|
const QString id,
|
||||||
|
const int code,
|
||||||
|
const QString message,
|
||||||
|
const QDateTime date,
|
||||||
|
const QString title = QStringLiteral(""));
|
||||||
|
|
||||||
QString title() const;
|
QString title() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
@ -46,4 +52,7 @@ public:
|
||||||
int code;
|
int code;
|
||||||
QString message;
|
QString message;
|
||||||
QDateTime date;
|
QDateTime date;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_title;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue