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 "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)
|
||||
{
|
||||
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->message = message;
|
||||
this->date = date;
|
||||
};
|
||||
this->m_title = title;
|
||||
}
|
||||
|
||||
QString Error::title() const
|
||||
{
|
||||
QString title;
|
||||
QString title = m_title;
|
||||
if (title.isEmpty()) {
|
||||
if (!id.isEmpty()) {
|
||||
if (DataManager::instance().getEntry(id))
|
||||
title = DataManager::instance().getEntry(id)->title();
|
||||
|
@ -35,6 +37,7 @@ QString Error::title() const
|
|||
if (DataManager::instance().getFeed(url))
|
||||
title = DataManager::instance().getFeed(url)->name();
|
||||
}
|
||||
}
|
||||
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 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 description() const;
|
||||
|
@ -46,4 +52,7 @@ public:
|
|||
int code;
|
||||
QString message;
|
||||
QDateTime date;
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue