Commit c45f1713 authored by camilo higuita's avatar camilo higuita

push quick fixes

parent ee299dfe
......@@ -27,7 +27,7 @@ Maui.ApplicationWindow
// highlightColor: accentColor
// altColorText : "white"/*Qt.darker(accentColor, 2.5)*/
showAccounts: true
about.appDescription: qsTr("Buho allows you to take quick notes, collect links and take long notes organized by chapters.")
about.appIcon: "qrc:/buho.svg"
......
......@@ -31,10 +31,7 @@ Notes::Notes(QObject *parent) : MauiList(parent),
void Notes::sortList()
{
emit this->preListChanged();
syncer->setCredentials("milo.h@aol.com", "Corazon1corazon", "free01.thegood.cloud");
syncer->getNotes();
emit this->preListChanged();
this->notes = this->db->getDBData(QString("select * from notes ORDER BY %1 %2").arg(
FMH::MODEL_NAME[static_cast<FMH::MODEL_KEY>(this->sort)],
this->order == ORDER::ASC ? "asc" : "desc"));
......@@ -215,6 +212,20 @@ bool Notes::remove(const int &index)
return false;
}
void Notes::setAccount(const QVariantMap &account)
{
this->m_account = account;
const auto data = FM::toModel(this->m_account);
syncer->setCredentials(data[FMH::MODEL_KEY::USER], data[FMH::MODEL_KEY::PASSWORD], QUrl(data[FMH::MODEL_KEY::SERVER]).host());
syncer->getNotes();
emit accountChanged();
}
QVariantMap Notes::getAccount() const
{
return this->m_account;
}
QVariantList Notes::getTags(const int &index)
{
if(index < 0 || index >= this->notes.size())
......
......@@ -21,6 +21,7 @@ class Notes : public MauiList
Q_OBJECT
Q_PROPERTY(SORTBY sortBy READ getSortBy WRITE setSortBy NOTIFY sortByChanged)
Q_PROPERTY(ORDER order READ getOrder WRITE setOrder NOTIFY orderChanged)
Q_PROPERTY(QVariantMap account READ getAccount WRITE setAccount NOTIFY accountChanged)
public:
enum ORDER : uint8_t
......@@ -49,6 +50,9 @@ public:
void setOrder(const ORDER &order);
ORDER getOrder() const;
void setAccount(const QVariantMap &account);
QVariantMap getAccount() const;
private:
DB *db;
Tagging *tag;
......@@ -59,10 +63,12 @@ private:
SORTBY sort = SORTBY::MODIFIED;
ORDER order = ORDER::DESC;
QVariantMap m_account;
signals:
void orderChanged();
void sortByChanged();
void accountChanged();
public slots:
QVariantList getTags(const int &index);
......@@ -73,6 +79,7 @@ public slots:
bool update(const QVariantMap &data, const int &index);
bool update(const FMH::MODEL &note);
bool remove(const int &index);
};
#endif // NOTES_H
......@@ -117,6 +117,7 @@ Maui.Page
Notes
{
id: notesList
account: root.currentAccount
}
Maui.BaseModel
......
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