Commit 4e429e7c authored by camilo higuita's avatar camilo higuita

quick changes b4

parent 7a0577e4
......@@ -14,3 +14,19 @@ FMH::MODEL_LIST Books::items() const
{
return this->m_list;
}
bool Books::insert(const QVariantMap &book)
{
emit this->preItemAppended();
auto __book = FMH::toModel(book);
__book[FMH::MODEL_KEY::MODIFIED] = QDateTime::currentDateTime().toString(Qt::TextDate);
__book[FMH::MODEL_KEY::ADDDATE] = QDateTime::currentDateTime().toString(Qt::TextDate);
this->syncer->insertNote(__book);
this->m_list << __book;
emit this->postItemAppended();
return true;
}
#include "notes.h"
#include "syncer.h"
#include "nextnote.h"
#ifdef STATIC_MAUIKIT
#include "tagging.h"
......@@ -9,14 +10,13 @@
#include <MauiKit/fm.h>
#endif
#include "nextnote.h"
Notes::Notes(QObject *parent) : MauiList(parent),
syncer(new Syncer(this))
{
qDebug()<< "CREATING NOTES LIST";
this->syncer->setProvider(new NextNote);
connect(this, &Notes::accountChanged, syncer, &Syncer::getNotes);
connect(this, &Notes::sortByChanged, this, &Notes::sortList);
connect(this, &Notes::orderChanged, this, &Notes::sortList);
......@@ -155,7 +155,6 @@ bool Notes::update(const QVariantMap &data, const int &index)
auto newData = this->notes[index];
QVector<int> roles;
for(const auto &key : data.keys())
if(newData[FMH::MODEL_NAME_KEY[key]] != data[key].toString())
{
......
......@@ -98,7 +98,7 @@ void Syncer::getNotes()
void Syncer::getBooks()
{
const auto books = this->collectAllNotes();
const auto books = this->collectAllBooks();
// this service is still missing
// if(this->provider && this->provider->isValid())
......@@ -110,6 +110,14 @@ void Syncer::getBooks()
emit this->booksReady(books);
}
void Syncer::insertBook(const FMH::MODEL &book)
{
if(!this->db->insert(OWL::TABLEMAP[OWL::TABLE::BOOKS], FMH::toMap(book)))
{
qWarning()<< "Could not insert Book, Syncer::insertBook";
}
}
void Syncer::stampNote(FMH::MODEL &note)
{
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