2016-12-10 22:39:53 +00:00
|
|
|
#include "models/item.h"
|
|
|
|
#include "uuid.h"
|
|
|
|
|
|
|
|
using namespace jop;
|
|
|
|
|
|
|
|
Item::Item() {
|
|
|
|
isPartial_ = true;
|
2016-12-27 21:25:07 +01:00
|
|
|
synced_ = false;
|
2016-12-10 22:39:53 +00:00
|
|
|
}
|
|
|
|
|
2016-12-23 19:04:26 +01:00
|
|
|
QString Item::id() const {
|
2016-12-10 22:39:53 +00:00
|
|
|
return id_;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Item::title() const {
|
|
|
|
return title_;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Item::createdTime() const {
|
|
|
|
return createdTime_;
|
|
|
|
}
|
|
|
|
|
2016-12-27 21:25:07 +01:00
|
|
|
int Item::updatedTime() const {
|
|
|
|
return updatedTime_;
|
|
|
|
}
|
|
|
|
|
2016-12-23 19:04:26 +01:00
|
|
|
void Item::setId(const QString& v) {
|
2016-12-11 16:09:39 +00:00
|
|
|
id_ = v;
|
2016-12-10 22:39:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Item::setTitle(const QString &v) {
|
|
|
|
title_ = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Item::setCreatedTime(int v) {
|
|
|
|
createdTime_ = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Item::setIsPartial(bool v) {
|
|
|
|
isPartial_ = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Item::isPartial() const {
|
|
|
|
return isPartial_;
|
|
|
|
}
|
2016-12-27 21:25:07 +01:00
|
|
|
|
|
|
|
QStringList Item::dbFields() {
|
|
|
|
QStringList output;
|
|
|
|
output << "id" << "title" << "created_time" << "updated_time" << "synced";
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Item::fromSqlQuery(const QSqlQuery &q) {
|
|
|
|
id_ = q.value(0).toString();
|
|
|
|
title_ = q.value(1).toString();
|
|
|
|
createdTime_ = q.value(2).toInt();
|
|
|
|
updatedTime_ = q.value(3).toInt();
|
|
|
|
synced_ = q.value(4).toBool();
|
|
|
|
}
|