Add folder support

This commit is contained in:
Aurélie Delhaie
2022-10-22 19:33:54 +02:00
parent 8ceae034e1
commit 7b17dfb044
35 changed files with 1299 additions and 1313 deletions

View File

@@ -1,9 +1,20 @@
#include "note.h"
Note::Note()
Note::Note(QString name)
{
QUuid uid = QUuid::createUuid();
this->uuid = uid.toString(QUuid::StringFormat::WithoutBraces);
this->title = name;
}
Note::Note(QJsonObject obj)
{
QUuid uid = QUuid::createUuid();
QString newUuid = uid.toString(QUuid::StringFormat::WithoutBraces);
this->uuid = obj["uuid"].toString(newUuid);
this->title = obj["title"].toString("<untitled note>");
this->content = obj["content"].toString();
}
QJsonObject Note::toJson()
@@ -14,18 +25,7 @@ QJsonObject Note::toJson()
o["content"] = this->content;
return o;
}
Note *Note::fromJson(QJsonObject o)
{
Note *n = new Note();
n->uuid = o["uuid"].toString(n->uuid);
n->title = o["title"].toString();
n->content = o["content"].toString();
n->encrypted = o["encrypted"].toBool(false);
return n;
}
QString Note::getUuid()
QString Note::getUUID()
{
return uuid;
}
@@ -37,11 +37,7 @@ QString Note::getTitle()
QString Note::getContent()
{
if (!this->encrypted)
{
return content;
}
return "";
return content;
}
void Note::setTitle(QString value)
{
@@ -50,7 +46,5 @@ void Note::setTitle(QString value)
void Note::setContent(QString value)
{
if (!this->encrypted) {
this->content = value;
}
}