Commit 219cf0a6 authored by Camilo higuita's avatar Camilo higuita

link and note snow use custom models and can be sorted

parent 0a95bc2a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "src/linker.h" #include "src/linker.h"
#include "models/notes/notesmodel.h" #include "models/notes/notesmodel.h"
#include "models/links/linksmodel.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
...@@ -62,10 +63,14 @@ int main(int argc, char *argv[]) ...@@ -62,10 +63,14 @@ int main(int argc, char *argv[])
context->setContextProperty("linker", &linker); context->setContextProperty("linker", &linker);
context->setContextProperty("tag", tag); context->setContextProperty("tag", tag);
qmlRegisterType<DocumentHandler>("org.buho.editor", 1, 0, "DocumentHandler"); qmlRegisterType<DocumentHandler>("org.buho.editor", 1, 0, "DocumentHandler");
qmlRegisterUncreatableMetaObject(OWL::staticMetaObject, "Owl", 1, 0, "KEY", "Error"); qmlRegisterUncreatableMetaObject(OWL::staticMetaObject, "Owl", 1, 0, "KEY", "Error");
qmlRegisterType<NotesModel>("Notes", 1, 0, "NotesModel"); qmlRegisterType<NotesModel>("Notes", 1, 0, "NotesModel");
qmlRegisterType<LinksModel>("Links", 1, 0, "LinksModel");
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty()) if (engine.rootObjects().isEmpty())
return -1; return -1;
......
...@@ -180,13 +180,6 @@ Maui.ApplicationWindow ...@@ -180,13 +180,6 @@ Maui.ApplicationWindow
} }
Component.onCompleted:
{
notesView.populate()
linksView.populate()
}
function newNote() function newNote()
{ {
currentView = views.notes currentView = views.notes
...@@ -209,8 +202,8 @@ Maui.ApplicationWindow ...@@ -209,8 +202,8 @@ Maui.ApplicationWindow
function previewLink(link) function previewLink(link)
{ {
var tags = owl.getLinkTags(link.link) // var tags = linksView.model.getLinkTags(link.link)
link.tags = tags // link.tags = tags
linksView.previewer.show(link) linksView.previewer.show(link)
} }
......
...@@ -67,84 +67,6 @@ QVariantList DBActions::get(const QString &queryTxt) ...@@ -67,84 +67,6 @@ QVariantList DBActions::get(const QString &queryTxt)
return mapList; return mapList;
} }
bool DBActions::insertLink(const QVariantMap &link)
{
auto url = link[OWL::KEYMAP[OWL::KEY::LINK]].toString();
auto color = link[OWL::KEYMAP[OWL::KEY::COLOR]].toString();
auto pin = link[OWL::KEYMAP[OWL::KEY::PIN]].toInt();
auto fav = link[OWL::KEYMAP[OWL::KEY::FAV]].toInt();
auto tags = link[OWL::KEYMAP[OWL::KEY::TAG]].toStringList();
auto preview = link[OWL::KEYMAP[OWL::KEY::PREVIEW]].toString();
auto title = link[OWL::KEYMAP[OWL::KEY::TITLE]].toString();
auto image_path = OWL::saveImage(Linker::getUrl(preview), OWL::LinksPath+QUuid::createUuid().toString());
QVariantMap link_map =
{
{OWL::KEYMAP[OWL::KEY::LINK], url},
{OWL::KEYMAP[OWL::KEY::TITLE], title},
{OWL::KEYMAP[OWL::KEY::PIN], pin},
{OWL::KEYMAP[OWL::KEY::FAV], fav},
{OWL::KEYMAP[OWL::KEY::PREVIEW], image_path},
{OWL::KEYMAP[OWL::KEY::COLOR], color},
{OWL::KEYMAP[OWL::KEY::ADD_DATE], QDateTime::currentDateTime().toString()},
{OWL::KEYMAP[OWL::KEY::UPDATED], QDateTime::currentDateTime().toString()}
};
if(this->db->insert(OWL::TABLEMAP[OWL::TABLE::LINKS], link_map))
{
for(auto tg : tags)
this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::LINKS], url, color);
this->linkInserted(link_map);
return true;
}
return false;
}
bool DBActions::updateLink(const QVariantMap &link)
{
auto url = link[OWL::KEYMAP[OWL::KEY::LINK]].toString();
auto color = link[OWL::KEYMAP[OWL::KEY::COLOR]].toString();
auto pin = link[OWL::KEYMAP[OWL::KEY::PIN]].toInt();
auto fav = link[OWL::KEYMAP[OWL::KEY::FAV]].toInt();
auto tags = link[OWL::KEYMAP[OWL::KEY::TAG]].toStringList();
auto updated = link[OWL::KEYMAP[OWL::KEY::UPDATED]].toString();
QVariantMap link_map =
{
{OWL::KEYMAP[OWL::KEY::COLOR], color},
{OWL::KEYMAP[OWL::KEY::PIN], pin},
{OWL::KEYMAP[OWL::KEY::FAV], fav},
{OWL::KEYMAP[OWL::KEY::UPDATED], updated},
};
for(auto tg : tags)
this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::LINKS], url, color);
return this->db->update(OWL::TABLEMAP[OWL::TABLE::LINKS], link_map, {{OWL::KEYMAP[OWL::KEY::LINK], url}} );
}
bool DBActions::removeLink(const QVariantMap &link)
{
return this->db->remove(OWL::TABLEMAP[OWL::TABLE::LINKS], link);
}
QVariantList DBActions::getLinks()
{
return this->get("select * from links ORDER BY updated ASC");
}
QVariantList DBActions::getLinkTags(const QString &link)
{
return this->tag->getAbstractTags(OWL::TABLEMAP[OWL::TABLE::LINKS], link);
}
bool DBActions::execQuery(const QString &queryTxt) bool DBActions::execQuery(const QString &queryTxt)
{ {
auto query = this->db->getQuery(queryTxt); auto query = this->db->getQuery(queryTxt);
......
...@@ -36,11 +36,6 @@ public: ...@@ -36,11 +36,6 @@ public:
Q_INVOKABLE QVariantList get(const QString &queryTxt); Q_INVOKABLE QVariantList get(const QString &queryTxt);
/*main actions*/ /*main actions*/
Q_INVOKABLE bool insertLink(const QVariantMap &link);
Q_INVOKABLE bool updateLink(const QVariantMap &link);
Q_INVOKABLE bool removeLink(const QVariantMap &link);
Q_INVOKABLE QVariantList getLinks();
Q_INVOKABLE QVariantList getLinkTags(const QString &link);
protected: protected:
OWL::DB_LIST getDBData(const QString &queryTxt); OWL::DB_LIST getDBData(const QString &queryTxt);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <QUuid> #include <QUuid>
#include "db/db.h" #include "db/db.h"
#include "linker.h"
#ifdef STATIC_MAUIKIT #ifdef STATIC_MAUIKIT
#include "tagging.h" #include "tagging.h"
...@@ -17,50 +18,50 @@ Links::Links(QObject *parent) : QObject(parent) ...@@ -17,50 +18,50 @@ Links::Links(QObject *parent) : QObject(parent)
void Links::sortBy(const OWL::KEY &key, const QString &order) void Links::sortBy(const OWL::KEY &key, const QString &order)
{ {
this->notes = this->db->getDBData(QString("select * from notes ORDER BY %1 %2").arg(OWL::KEYMAP[key], order)); this->links = this->db->getDBData(QString("select * from links ORDER BY %1 %2").arg(OWL::KEYMAP[key], order));
} }
OWL::DB_LIST Links::items() const OWL::DB_LIST Links::items() const
{ {
return this->notes; return this->links;
} }
bool Links::insertNote(const QVariantMap &note) bool Links::insertLink(const QVariantMap &link)
{ {
qDebug()<<"TAGS"<< note[OWL::KEYMAP[OWL::KEY::TAG]].toStringList(); auto url = link[OWL::KEYMAP[OWL::KEY::LINK]].toString();
auto color = link[OWL::KEYMAP[OWL::KEY::COLOR]].toString();
auto pin = link[OWL::KEYMAP[OWL::KEY::PIN]].toInt();
auto fav = link[OWL::KEYMAP[OWL::KEY::FAV]].toInt();
auto tags = link[OWL::KEYMAP[OWL::KEY::TAG]].toStringList();
auto preview = link[OWL::KEYMAP[OWL::KEY::PREVIEW]].toString();
auto title = link[OWL::KEYMAP[OWL::KEY::TITLE]].toString();
auto title = note[OWL::KEYMAP[OWL::KEY::TITLE]].toString(); auto image_path = OWL::saveImage(Linker::getUrl(preview), OWL::LinksPath+QUuid::createUuid().toString());
auto body = note[OWL::KEYMAP[OWL::KEY::BODY]].toString();
auto color = note[OWL::KEYMAP[OWL::KEY::COLOR]].toString();
auto pin = note[OWL::KEYMAP[OWL::KEY::PIN]].toInt();
auto fav = note[OWL::KEYMAP[OWL::KEY::FAV]].toInt();
auto tags = note[OWL::KEYMAP[OWL::KEY::TAG]].toStringList();
auto id = QUuid::createUuid().toString(); QVariantMap link_map =
QVariantMap note_map =
{ {
{OWL::KEYMAP[OWL::KEY::ID], id}, {OWL::KEYMAP[OWL::KEY::LINK], url},
{OWL::KEYMAP[OWL::KEY::TITLE], title}, {OWL::KEYMAP[OWL::KEY::TITLE], title},
{OWL::KEYMAP[OWL::KEY::BODY], body},
{OWL::KEYMAP[OWL::KEY::COLOR], color},
{OWL::KEYMAP[OWL::KEY::PIN], pin}, {OWL::KEYMAP[OWL::KEY::PIN], pin},
{OWL::KEYMAP[OWL::KEY::FAV], fav}, {OWL::KEYMAP[OWL::KEY::FAV], fav},
{OWL::KEYMAP[OWL::KEY::UPDATED], QDateTime::currentDateTime().toString()}, {OWL::KEYMAP[OWL::KEY::PREVIEW], image_path},
{OWL::KEYMAP[OWL::KEY::ADD_DATE], QDateTime::currentDateTime().toString()} {OWL::KEYMAP[OWL::KEY::COLOR], color},
{OWL::KEYMAP[OWL::KEY::ADD_DATE], QDateTime::currentDateTime().toString()},
{OWL::KEYMAP[OWL::KEY::UPDATED], QDateTime::currentDateTime().toString()}
}; };
if(this->db->insert(OWL::TABLEMAP[OWL::TABLE::NOTES], note_map)) if(this->db->insert(OWL::TABLEMAP[OWL::TABLE::LINKS], link_map))
{ {
for(auto tg : tags) for(auto tg : tags)
this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::NOTES], id, color); this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::LINKS], url, color);
this->notes << OWL::DB this->links << OWL::DB
({ ({
{OWL::KEY::ID, id}, {OWL::KEY::LINK, url},
{OWL::KEY::TITLE, title}, {OWL::KEY::TITLE, title},
{OWL::KEY::BODY, body},
{OWL::KEY::COLOR, color}, {OWL::KEY::COLOR, color},
{OWL::KEY::PREVIEW, preview},
{OWL::KEY::PIN, QString::number(pin)}, {OWL::KEY::PIN, QString::number(pin)},
{OWL::KEY::FAV, QString::number(fav)}, {OWL::KEY::FAV, QString::number(fav)},
{OWL::KEY::UPDATED, QDateTime::currentDateTime().toString()}, {OWL::KEY::UPDATED, QDateTime::currentDateTime().toString()},
...@@ -73,39 +74,37 @@ bool Links::insertNote(const QVariantMap &note) ...@@ -73,39 +74,37 @@ bool Links::insertNote(const QVariantMap &note)
return false; return false;
} }
bool Links::updateNote(const int &index, const QVariant &value, const int &role) bool Links::updateLink(const int &index, const QVariant &value, const int &role)
{ {
if(index < 0 || index >= notes.size()) if(index < 0 || index >= links.size())
return false; return false;
const auto oldValue = this->notes[index][static_cast<OWL::KEY>(role)]; const auto oldValue = this->links[index][static_cast<OWL::KEY>(role)];
if(oldValue == value.toString()) if(oldValue == value.toString())
return false; return false;
this->notes[index].insert(static_cast<OWL::KEY>(role), value.toString()); qDebug()<< "VALUE TO UPDATE"<< OWL::KEYMAP[static_cast<OWL::KEY>(role)] << oldValue;
this->links[index].insert(static_cast<OWL::KEY>(role), value.toString());
this->updateNote(this->notes[index]); this->updateLink(this->links[index]);
return true; return true;
} }
bool Links::updateNote(const OWL::DB &note) bool Links::updateLink(const OWL::DB &link)
{ {
auto id = note[OWL::KEY::ID]; auto url = link[OWL::KEY::LINK];
auto title = note[OWL::KEY::TITLE]; auto color = link[OWL::KEY::COLOR];
auto body = note[OWL::KEY::BODY]; auto pin = link[OWL::KEY::PIN].toInt();
auto color = note[OWL::KEY::COLOR]; auto fav = link[OWL::KEY::FAV].toInt();
auto pin = note[OWL::KEY::PIN].toInt(); auto tags = link[OWL::KEY::TAG].split(",", QString::SkipEmptyParts);
auto fav = note[OWL::KEY::FAV].toInt(); auto updated = link[OWL::KEY::UPDATED];
auto tags = note[OWL::KEY::TAG].split(",", QString::SkipEmptyParts);
auto updated =note[OWL::KEY::UPDATED]; QVariantMap link_map =
QVariantMap note_map =
{ {
{OWL::KEYMAP[OWL::KEY::TITLE], title},
{OWL::KEYMAP[OWL::KEY::BODY], body},
{OWL::KEYMAP[OWL::KEY::COLOR], color}, {OWL::KEYMAP[OWL::KEY::COLOR], color},
{OWL::KEYMAP[OWL::KEY::PIN], pin}, {OWL::KEYMAP[OWL::KEY::PIN], pin},
{OWL::KEYMAP[OWL::KEY::FAV], fav}, {OWL::KEYMAP[OWL::KEY::FAV], fav},
...@@ -113,18 +112,18 @@ bool Links::updateNote(const OWL::DB &note) ...@@ -113,18 +112,18 @@ bool Links::updateNote(const OWL::DB &note)
}; };
for(auto tg : tags) for(auto tg : tags)
this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::NOTES], id, color); this->tag->tagAbstract(tg, OWL::TABLEMAP[OWL::TABLE::LINKS], url, color);
return this->db->update(OWL::TABLEMAP[OWL::TABLE::NOTES], note_map, {{OWL::KEYMAP[OWL::KEY::ID], id}} ); return this->db->update(OWL::TABLEMAP[OWL::TABLE::LINKS], link_map, {{OWL::KEYMAP[OWL::KEY::LINK], url}} );
} }
bool Links::removeNote(const QVariantMap &note) bool Links::removeLink(const QVariantMap &link)
{ {
qDebug()<<note; qDebug()<<link;
return this->db->remove(OWL::TABLEMAP[OWL::TABLE::NOTES], note); return this->db->remove(OWL::TABLEMAP[OWL::TABLE::LINKS], link);
} }
QVariantList Links::getNoteTags(const QString &id) QVariantList Links::getLinkTags(const QString &link)
{ {
return this->tag->getAbstractTags(OWL::TABLEMAP[OWL::TABLE::NOTES], id); return this->tag->getAbstractTags(OWL::TABLEMAP[OWL::TABLE::LINKS], link);
} }
...@@ -18,19 +18,16 @@ public: ...@@ -18,19 +18,16 @@ public:
void sortBy(const OWL::KEY &key, const QString &order = "DESC"); void sortBy(const OWL::KEY &key, const QString &order = "DESC");
Q_INVOKABLE bool insertLink(const QVariantMap &link);
bool updateLink(const int &index, const QVariant &value, const int &role);
bool updateLink(const OWL::DB &link);
Q_INVOKABLE bool removeLink(const QVariantMap &link);
bool insertNote(const QVariantMap &note); Q_INVOKABLE QVariantList getLinkTags(const QString &link);
bool updateNote(const int &index, const QVariant &value, const int &role);
bool updateNote(const OWL::DB &note);
bool removeNote(const QVariantMap &note);
QVariantList getNoteTags(const QString &id);
private: private:
Tagging *tag; Tagging *tag;
DB *db; DB *db;
OWL::DB_LIST notes; OWL::DB_LIST links;
signals: signals:
......
...@@ -4,29 +4,29 @@ ...@@ -4,29 +4,29 @@
LinksModel::LinksModel(QObject *parent) LinksModel::LinksModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {
this->mNotes = new Links(this); this->mLinks = new Links(this);
} }
int LinksModel::rowCount(const QModelIndex &parent) const int LinksModel::rowCount(const QModelIndex &parent) const
{ {
if (parent.isValid() || !mNotes) if (parent.isValid() || !mLinks)
return 0; return 0;
return mNotes->items().size(); return mLinks->items().size();
} }
QVariant LinksModel::data(const QModelIndex &index, int role) const QVariant LinksModel::data(const QModelIndex &index, int role) const
{ {
if (!index.isValid() || !mNotes) if (!index.isValid() || !mLinks)
return QVariant(); return QVariant();
return mNotes->items().at(index.row())[static_cast<OWL::KEY>(role)]; return mLinks->items().at(index.row())[static_cast<OWL::KEY>(role)];
} }
QVariantMap LinksModel::get(const int &index) QVariantMap LinksModel::get(const int &index)
{ {
QVariantMap res; QVariantMap res;
const auto note = mNotes->items().at(index); const auto note = mLinks->items().at(index);
for(auto key : note.keys()) for(auto key : note.keys())
res.insert(OWL::KEYMAP[key], note[key]); res.insert(OWL::KEYMAP[key], note[key]);
return res; return res;
...@@ -35,25 +35,25 @@ QVariantMap LinksModel::get(const int &index) ...@@ -35,25 +35,25 @@ QVariantMap LinksModel::get(const int &index)
void LinksModel::sortBy(const int &index, const QString &order) void LinksModel::sortBy(const int &index, const QString &order)
{ {
beginResetModel(); beginResetModel();
mNotes->sortBy(static_cast<OWL::KEY>(index), order); mLinks->sortBy(static_cast<OWL::KEY>(index), order);
endResetModel(); endResetModel();
} }
bool LinksModel::insert(const QVariantMap &note) bool LinksModel::insert(const QVariantMap &link)
{ {
const int index = mNotes->items().size(); const int index = mLinks->items().size();
beginInsertRows(QModelIndex(), index, index); beginInsertRows(QModelIndex(), index, index);
this->mNotes->insertNote(note); this->mLinks->insertLink(link);
endInsertRows(); endInsertRows();
return false; return false;
} }
bool LinksModel::setData(const QModelIndex &index, const QVariant &value, int role) bool LinksModel::setData(const QModelIndex &index, const QVariant &value, int role)
{ {
if (!mNotes) if (!mLinks)
return false; return false;
if (mNotes->updateNote(index.row(), value, role)) if (mLinks->updateLink(index.row(), value, role))
{ {
emit dataChanged(index, index, QVector<int>() << role); emit dataChanged(index, index, QVector<int>() << role);
return true; return true;
...@@ -92,36 +92,36 @@ QHash<int, QByteArray> LinksModel::roleNames() const ...@@ -92,36 +92,36 @@ QHash<int, QByteArray> LinksModel::roleNames() const
//Notes *NotesModel::notes() const //Notes *NotesModel::notes() const
//{ //{
// return mNotes; // return mLinks;
//} //}
//void NotesModel::setNotes(Notes *value) //void NotesModel::setNotes(Notes *value)
//{ //{
// beginResetModel(); // beginResetModel();
// if(mNotes) // if(mLinks)
// mNotes->disconnect(this); // mLinks->disconnect(this);
// mNotes = value; // mLinks = value;
//// if(mNotes) //// if(mLinks)
//// { //// {
//// connect(mNotes, &Notes::preItemAppended, this, [=]() //// connect(mLinks, &Notes::preItemAppended, this, [=]()
//// { //// {
//// const int index = mNotes->items().size(); //// const int index = mLinks->items().size();
//// beginInsertRows(QModelIndex(), index, index); //// beginInsertRows(QModelIndex(), index, index);
//// }); //// });
//// connect(mNotes, &Notes::postItemAppended, this, [=]() //// connect(mLinks, &Notes::postItemAppended, this, [=]()
//// { //// {
//// endInsertRows(); //// endInsertRows();
//// }); //// });
//// connect(mNotes, &Notes::preItemRemoved, this, [=](int index) //// connect(mLinks, &Notes::preItemRemoved, this, [=](int index)
//// { //// {
//// beginInsertRows(QModelIndex(), index, index); //// beginInsertRows(QModelIndex(), index, index);
//// }); //// });
//// connect(mNotes, &Notes::preItemRemoved, this, [=]() //// connect(mLinks, &Notes::preItemRemoved, this, [=]()
//// { //// {
//// endRemoveRows(); //// endRemoveRows();
//// }); //// });
......
#ifndef NOTESMODEL_H #ifndef LINKSMODEL_H
#define NOTESMODEL_H #define LINKSMODEL_H
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QList> #include <QList>
...@@ -24,7 +24,7 @@ public: ...@@ -24,7 +24,7 @@ public:
Q_INVOKABLE QVariantMap get(const int &index); Q_INVOKABLE QVariantMap get(const int &index);
Q_INVOKABLE void sortBy(const int &index, const QString &order); Q_INVOKABLE void sortBy(const int &index, const QString &order);
Q_INVOKABLE bool insert(const QVariantMap &note); Q_INVOKABLE bool insert(const QVariantMap &link);
// Editable: // Editable:
bool setData(const QModelIndex &index, const QVariant &value, bool setData(const QModelIndex &index, const QVariant &value,
...@@ -34,13 +34,8 @@ public: ...@@ -34,13 +34,8 @@ public:
virtual QHash<int, QByteArray> roleNames() const override; virtual QHash<int, QByteArray> roleNames() const override;
friend bool operator<(const OWL::DB & m1, const OWL::DB & m2)
{
return m1[OWL::KEY::TITLE] < m2[OWL::KEY::TITLE];
}
private: private:
Links *mNotes; Links *mLinks;
}; };
#endif // NOTESMODEL_H #endif // NOTESMODEL_H
import QtQuick 2.9 import QtQuick 2.9
import "../../widgets" import QtQuick.Controls 2.4
import org.kde.mauikit 1.0 as Maui import org.kde.mauikit 1.0 as Maui
import "../../widgets"
import "../../utils/owl.js" as O import "../../utils/owl.js" as O
import Links 1.0
import Owl 1.0
Maui.Page Maui.Page
{ {
id: control id: control
property alias cardsView : cardsView property alias cardsView : cardsView
property alias previewer : previewer property alias previewer : previewer
property alias model : linksModel
property var currentLink : ({}) property var currentLink : ({})
signal linkClicked(var link) signal linkClicked(var link)
headBarVisible: !cardsView.holder.visible headBarVisible: !cardsView.holder.visible
margins: space.big margins: space.big
...@@ -20,15 +29,46 @@ Maui.Page ...@@ -20,15 +29,46 @@ Maui.Page
Maui.ToolButton Maui.ToolButton
{ {
iconName: cardsView.gridView ? "view-list-icons" : "view-list-details" iconName: cardsView.gridView ? "view-list-icons" : "view-list-details"
onClicked: onClicked: cardsView.gridView = !cardsView.gridView
{
cardsView.gridView = !cardsView.gridView
cardsView.refresh()
}
}, },
Maui.ToolButton Maui.ToolButton
{ {
iconName: "view-sort" iconName: "view-sort"
onClicked: sortMenu.open();
Menu
{
id: sortMenu
MenuItem
{
text: qsTr("Title")
onTriggered: linksModel.sortBy(KEY.TITLE, "ASC")
}
MenuItem
{
text: qsTr("Color")
onTriggered: linksModel.sortBy(KEY.COLOR, "ASC")
}
MenuItem
{
text: qsTr("Add date")
onTriggered: linksModel.sortBy(KEY.ADD_DATE, "DESC")
}
MenuItem
{
text: qsTr("Updated")
onTriggered: linksModel.sortBy(KEY.UPDATED, "DESC")
}
MenuItem
{
text: qsTr("Fav")
onTriggered: linksModel.sortBy(KEY.FAV, "DESC")
}