Commit 7f239f41 authored by camilo higuita's avatar camilo higuita

more work for the boolets model

parent 914f0aa1
#include "booklet.h"
#include "syncer.h"
Booklet::Booklet(QObject *parent) : MauiList(parent)
Booklet::Booklet(Syncer *_syncer, QObject *parent) : MauiList(parent),
syncer(_syncer)
{
}
......@@ -30,6 +32,31 @@ Booklet::ORDER Booklet::getOrder() const
return this->order;
}
void Booklet::insert(const QVariantMap &data)
{
emit this->preItemAppended();
auto __booklet = FMH::toModel(data);
__booklet[FMH::MODEL_KEY::MODIFIED] = QDateTime::currentDateTime().toString(Qt::TextDate);
__booklet[FMH::MODEL_KEY::ADDDATE] = QDateTime::currentDateTime().toString(Qt::TextDate);
this->syncer->insertBooklet(__booklet);
this->m_list << __booklet;
emit this->postItemAppended();
}
void Booklet::update(const QVariantMap &data, const int &index)
{
}
void Booklet::remove(const int &index)
{
}
void Booklet::sortList()
{
......
......@@ -10,6 +10,7 @@
#include <MauiKit/mauilist.h>
#endif
class Syncer;
class Booklet : public MauiList
{
Q_OBJECT
......@@ -19,7 +20,7 @@ class Booklet : public MauiList
Q_PROPERTY(QString book READ getBook WRITE setBook NOTIFY bookChanged)
public:
Booklet(QObject *parent = nullptr);
Booklet(Syncer *syncer = nullptr, QObject *parent = nullptr);
enum ORDER : uint8_t
{
......@@ -61,8 +62,13 @@ public slots:
emit bookChanged(m_book);
}
void insert(const QVariantMap &data);
void update(const QVariantMap &data, const int &index);
void remove(const int &index);
private:
FMH::MODEL_LIST m_list;
Syncer *syncer;
void sortList();
......
......@@ -121,6 +121,11 @@ void Syncer::insertBook(FMH::MODEL &book)
emit this->bookInserted(book, {STATE::TYPE::LOCAL, STATE::STATUS::OK, "Book inserted locally sucessfully"});
}
void Syncer::insertBooklet(const FMH::MODEL &booklet)
{
}
void Syncer::addId(FMH::MODEL &model)
{
const auto id = QUuid::createUuid().toString();
......
Markdown is supported
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