Clearing NotesModel when changing the account
This commit is contained in:
parent
4ea61c565f
commit
10b9423f35
8 changed files with 79 additions and 135 deletions
|
@ -33,6 +33,7 @@ ApplicationWindow
|
||||||
onPasswordChanged: notesApi.password = password
|
onPasswordChanged: notesApi.password = password
|
||||||
onDoNotVerifySslChanged: notesApi.verifySsl = !doNotVerifySsl
|
onDoNotVerifySslChanged: notesApi.verifySsl = !doNotVerifySsl
|
||||||
onPathChanged: {
|
onPathChanged: {
|
||||||
|
notesModel.sourceModel.clear()
|
||||||
notesStore.account = appSettings.currentAccount
|
notesStore.account = appSettings.currentAccount
|
||||||
notesApi.account = appSettings.currentAccount
|
notesApi.account = appSettings.currentAccount
|
||||||
}
|
}
|
||||||
|
@ -53,6 +54,16 @@ ApplicationWindow
|
||||||
property bool useMonoFont: value("useMonoFont", false, Boolean)
|
property bool useMonoFont: value("useMonoFont", false, Boolean)
|
||||||
property bool useCapitalX: value("useCapitalX", false, Boolean)
|
property bool useCapitalX: value("useCapitalX", false, Boolean)
|
||||||
|
|
||||||
|
onSortByChanged: {
|
||||||
|
if (sortBy == "none")
|
||||||
|
notesModel.invalidate()
|
||||||
|
else
|
||||||
|
notesModel.sortRole = notesModel.roleFromName(sortBy)
|
||||||
|
}
|
||||||
|
onFavoritesOnTopChanged: {
|
||||||
|
notesModel.favoritesOnTop = favoritesOnTop
|
||||||
|
}
|
||||||
|
|
||||||
function addAccount() {
|
function addAccount() {
|
||||||
var uuid = uuidv4()
|
var uuid = uuidv4()
|
||||||
var tmpIDs = accounts.value
|
var tmpIDs = accounts.value
|
||||||
|
@ -143,14 +154,7 @@ ApplicationWindow
|
||||||
|
|
||||||
onAccountChanged: {
|
onAccountChanged: {
|
||||||
//console.log(notesStore.account)
|
//console.log(notesStore.account)
|
||||||
if (notesStore.account !== "")
|
notesStore.getAllNotes()
|
||||||
notesStore.getAllNotes()
|
|
||||||
}
|
|
||||||
onNoteUpdated: {
|
|
||||||
//console.log("Note updated", note.id)
|
|
||||||
}
|
|
||||||
onNoteDeleted: {
|
|
||||||
//console.log("Note deleted", note.id)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,8 +163,7 @@ ApplicationWindow
|
||||||
|
|
||||||
onAccountChanged: {
|
onAccountChanged: {
|
||||||
//console.log(notesStore.account)
|
//console.log(notesStore.account)
|
||||||
if (notesApi.account !== "")
|
notesApi.getAllNotes()
|
||||||
notesApi.getAllNotes()
|
|
||||||
}
|
}
|
||||||
onNetworkAccessibleChanged: {
|
onNetworkAccessibleChanged: {
|
||||||
console.log("Device is " + (accessible ? "online" : "offline"))
|
console.log("Device is " + (accessible ? "online" : "offline"))
|
||||||
|
|
|
@ -7,30 +7,6 @@ Page {
|
||||||
|
|
||||||
property string searchString
|
property string searchString
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: appSettings
|
|
||||||
onSortByChanged: {
|
|
||||||
if (appSettings.sortBy == "none")
|
|
||||||
notesModel.invalidate()
|
|
||||||
else
|
|
||||||
notesModel.sortRole = notesModel.roleFromName(appSettings.sortBy)
|
|
||||||
}
|
|
||||||
onFavoritesOnTopChanged: {
|
|
||||||
notesModel.favoritesOnTop = appSettings.favoritesOnTop
|
|
||||||
}
|
|
||||||
onCurrentAccountChanged: {
|
|
||||||
notesList.model = 0
|
|
||||||
notesList.model = notesApi.model()
|
|
||||||
if (appSettings.currentAccount.length > 0)
|
|
||||||
notesApi.getAllNotes()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
notesModel.favoritesOnTop = appSettings.favoritesOnTop
|
|
||||||
notesModel.sortRole = notesModel.roleFromName(appSettings.sortBy)
|
|
||||||
}
|
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === PageStatus.Active) {
|
if (status === PageStatus.Active) {
|
||||||
if (accounts.value.length <= 0) {
|
if (accounts.value.length <= 0) {
|
||||||
|
|
|
@ -30,9 +30,9 @@ int main(int argc, char *argv[])
|
||||||
NotesStore* notesStore = new NotesStore;
|
NotesStore* notesStore = new NotesStore;
|
||||||
NotesApi* notesApi = new NotesApi;
|
NotesApi* notesApi = new NotesApi;
|
||||||
|
|
||||||
QObject::connect(notesApi, SIGNAL(noteUpdated(Note)), notesStore, SLOT(updateNote(Note)));
|
//QObject::connect(notesApi, SIGNAL(noteUpdated(Note)), notesStore, SLOT(updateNote(Note)));
|
||||||
//QObject::connect(notesStore, SIGNAL(noteUpdated(Note)), notesApi, SLOT(updateNote(Note)));
|
//QObject::connect(notesStore, SIGNAL(noteUpdated(Note)), notesApi, SLOT(updateNote(Note)));
|
||||||
QObject::connect(notesApi, SIGNAL(noteDeleted(int)), notesStore, SLOT(deleteNote(int)));
|
//QObject::connect(notesApi, SIGNAL(noteDeleted(int)), notesStore, SLOT(deleteNote(int)));
|
||||||
//QObject::connect(notesStore, SIGNAL(noteDeleted(int)), notesApi, SLOT(deleteNote(int)));
|
//QObject::connect(notesStore, SIGNAL(noteDeleted(int)), notesApi, SLOT(deleteNote(int)));
|
||||||
|
|
||||||
QObject::connect(notesStore, SIGNAL(noteUpdated(Note)), notesModel, SLOT(insertNote(Note)));
|
QObject::connect(notesStore, SIGNAL(noteUpdated(Note)), notesModel, SLOT(insertNote(Note)));
|
||||||
|
@ -60,9 +60,9 @@ int main(int argc, char *argv[])
|
||||||
QObject::disconnect(notesStore, SIGNAL(noteUpdated(Note)), notesModel, SLOT(insertNote(Note)));
|
QObject::disconnect(notesStore, SIGNAL(noteUpdated(Note)), notesModel, SLOT(insertNote(Note)));
|
||||||
|
|
||||||
//QObject::disconnect(notesStore, SIGNAL(noteDeleted(int)), notesApi, SLOT(deleteNote(int)));
|
//QObject::disconnect(notesStore, SIGNAL(noteDeleted(int)), notesApi, SLOT(deleteNote(int)));
|
||||||
QObject::disconnect(notesApi, SIGNAL(noteDeleted(int)), notesStore, SLOT(deleteNote(int)));
|
//QObject::disconnect(notesApi, SIGNAL(noteDeleted(int)), notesStore, SLOT(deleteNote(int)));
|
||||||
//QObject::disconnect(notesStore, SIGNAL(noteUpdated(Note)), notesApi, SLOT(updateNote(Note)));
|
//QObject::disconnect(notesStore, SIGNAL(noteUpdated(Note)), notesApi, SLOT(updateNote(Note)));
|
||||||
QObject::disconnect(notesApi, SIGNAL(noteUpdated(Note)), notesStore, SLOT(updateNote(Note)));
|
//QObject::disconnect(notesApi, SIGNAL(noteUpdated(Note)), notesStore, SLOT(updateNote(Note)));
|
||||||
|
|
||||||
notesApi->deleteLater();
|
notesApi->deleteLater();
|
||||||
notesStore->deleteLater();
|
notesStore->deleteLater();
|
||||||
|
|
|
@ -45,6 +45,7 @@ NotesApi::~NotesApi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::setAccount(const QString &account) {
|
void NotesApi::setAccount(const QString &account) {
|
||||||
|
qDebug() << "Setting account: " << account;
|
||||||
if (account != m_account) {
|
if (account != m_account) {
|
||||||
m_account = account;
|
m_account = account;
|
||||||
// TODO reset the class
|
// TODO reset the class
|
||||||
|
@ -53,6 +54,7 @@ void NotesApi::setAccount(const QString &account) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::getAllNotes(Note::NoteField exclude) {
|
void NotesApi::getAllNotes(Note::NoteField exclude) {
|
||||||
|
qDebug() << "Getting all notes";
|
||||||
QUrl url = apiEndpointUrl(m_notesEndpoint);
|
QUrl url = apiEndpointUrl(m_notesEndpoint);
|
||||||
QStringList excludeFields;
|
QStringList excludeFields;
|
||||||
QList<Note::NoteField> noteFields = Note::noteFields();
|
QList<Note::NoteField> noteFields = Note::noteFields();
|
||||||
|
@ -75,6 +77,7 @@ void NotesApi::getAllNotes(Note::NoteField exclude) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::getNote(const int id, Note::NoteField exclude) {
|
void NotesApi::getNote(const int id, Note::NoteField exclude) {
|
||||||
|
qDebug() << "Getting note: " << id;
|
||||||
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(id));
|
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(id));
|
||||||
QStringList excludeFields;
|
QStringList excludeFields;
|
||||||
QList<Note::NoteField> noteFields = Note::noteFields();
|
QList<Note::NoteField> noteFields = Note::noteFields();
|
||||||
|
@ -97,6 +100,8 @@ void NotesApi::getNote(const int id, Note::NoteField exclude) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::createNote(const Note ¬e) {
|
void NotesApi::createNote(const Note ¬e) {
|
||||||
|
// TODO verify modified
|
||||||
|
qDebug() << "Creating note: " << note.id();
|
||||||
QUrl url = apiEndpointUrl(m_notesEndpoint);
|
QUrl url = apiEndpointUrl(m_notesEndpoint);
|
||||||
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
||||||
qDebug() << "POST" << url.toDisplayString();
|
qDebug() << "POST" << url.toDisplayString();
|
||||||
|
@ -107,6 +112,8 @@ void NotesApi::createNote(const Note ¬e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::updateNote(const Note ¬e) {
|
void NotesApi::updateNote(const Note ¬e) {
|
||||||
|
// TODO verify modified
|
||||||
|
qDebug() << "Updating note: " << note.id();
|
||||||
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(note.id()));
|
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(note.id()));
|
||||||
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
||||||
qDebug() << "PUT" << url.toDisplayString();
|
qDebug() << "PUT" << url.toDisplayString();
|
||||||
|
@ -117,6 +124,7 @@ void NotesApi::updateNote(const Note ¬e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesApi::deleteNote(const int id) {
|
void NotesApi::deleteNote(const int id) {
|
||||||
|
qDebug() << "Deleting note: " << id;
|
||||||
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(id));
|
QUrl url = apiEndpointUrl(m_notesEndpoint + QString("/%1").arg(id));
|
||||||
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) {
|
||||||
qDebug() << "DELETE" << url.toDisplayString();
|
qDebug() << "DELETE" << url.toDisplayString();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
NotesProxyModel::NotesProxyModel(QObject *parent) {
|
NotesProxyModel::NotesProxyModel(QObject *parent) : QSortFilterProxyModel(parent) {
|
||||||
m_favoritesOnTop = true;
|
m_favoritesOnTop = true;
|
||||||
//connect(this, SIGNAL(favoritesOnTopChanged(bool)), this, SLOT(resort()));
|
//connect(this, SIGNAL(favoritesOnTopChanged(bool)), this, SLOT(resort()));
|
||||||
}
|
}
|
||||||
|
@ -42,66 +42,12 @@ void NotesProxyModel::sort() {
|
||||||
QSortFilterProxyModel::sort(0);
|
QSortFilterProxyModel::sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NotesModel::NotesModel(QObject *parent) {
|
NotesModel::NotesModel(QObject *parent) : QAbstractListModel(parent) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotesModel::~NotesModel() {
|
NotesModel::~NotesModel() {
|
||||||
m_notes.clear();
|
clear();
|
||||||
}
|
|
||||||
|
|
||||||
bool NotesModel::fromJsonDocument(const QJsonDocument &jdoc) {
|
|
||||||
qDebug() << "Applying new JSON input"; // << json;
|
|
||||||
if (!jdoc.isNull() && !jdoc.isEmpty()) {
|
|
||||||
if (jdoc.isArray()) {
|
|
||||||
//qDebug() << "- It's an array...";
|
|
||||||
QVector<int> notesIdsToRemove;
|
|
||||||
QJsonArray jarr = jdoc.array();
|
|
||||||
if (!jarr.empty())
|
|
||||||
notesIdsToRemove = ids();
|
|
||||||
while (!jarr.empty()) {
|
|
||||||
QJsonValue jval = jarr.first();
|
|
||||||
if (jval.isObject()) {
|
|
||||||
QJsonObject jobj = jval.toObject();
|
|
||||||
if (!jobj.isEmpty()) {
|
|
||||||
insertNote(jobj);
|
|
||||||
notesIdsToRemove.removeAll(Note::id(jobj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "-- JSON array element is not an object!";
|
|
||||||
}
|
|
||||||
jarr.pop_front();
|
|
||||||
}
|
|
||||||
while (!notesIdsToRemove.empty()) {
|
|
||||||
removeNote(notesIdsToRemove.first());
|
|
||||||
notesIdsToRemove.pop_front();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (jdoc.isObject()) {
|
|
||||||
//qDebug() << "- It's a single object...";
|
|
||||||
insertNote(jdoc.object());
|
|
||||||
}
|
|
||||||
else if (jdoc.isEmpty()) {
|
|
||||||
qDebug() << "- Empty JSON document.";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "- Unknown JSON document. This message should never occure!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "JSON document is NULL!";
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonDocument NotesModel::toJsonDocument() const {
|
|
||||||
QJsonArray jarr;
|
|
||||||
for (int i = 0; i < m_notes.size(); ++i) {
|
|
||||||
jarr << m_notes[i].toJsonValue();
|
|
||||||
}
|
|
||||||
return QJsonDocument(jarr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<int> NotesModel::ids() const {
|
QVector<int> NotesModel::ids() const {
|
||||||
|
@ -113,6 +59,7 @@ QVector<int> NotesModel::ids() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int NotesModel::insertNote(const Note ¬e) {
|
int NotesModel::insertNote(const Note ¬e) {
|
||||||
|
qDebug() << "Inserting note: " << note.id();
|
||||||
int position = m_notes.indexOf(note);
|
int position = m_notes.indexOf(note);
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
if (m_notes.at(position).equal(note)) {
|
if (m_notes.at(position).equal(note)) {
|
||||||
|
@ -138,6 +85,7 @@ int NotesModel::insertNote(const Note ¬e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotesModel::removeNote(const Note ¬e) {
|
bool NotesModel::removeNote(const Note ¬e) {
|
||||||
|
qDebug() << "Removing note: " << note.id();
|
||||||
int position = m_notes.indexOf(note);
|
int position = m_notes.indexOf(note);
|
||||||
if (position >= 0 && position < m_notes.size()) {
|
if (position >= 0 && position < m_notes.size()) {
|
||||||
beginRemoveRows(QModelIndex(), position, position);
|
beginRemoveRows(QModelIndex(), position, position);
|
||||||
|
@ -150,9 +98,19 @@ bool NotesModel::removeNote(const Note ¬e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotesModel::removeNote(int id) {
|
bool NotesModel::removeNote(int id) {
|
||||||
|
qDebug() << "Removing note: " << id;
|
||||||
return removeNote(Note(QJsonObject{ {"id", id} } ));
|
return removeNote(Note(QJsonObject{ {"id", id} } ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotesModel::clear() {
|
||||||
|
qDebug() << "Clearing model";
|
||||||
|
int lastNoteIndex = m_notes.size() - 1;
|
||||||
|
beginRemoveRows(QModelIndex(), 0, lastNoteIndex);
|
||||||
|
m_notes.clear();
|
||||||
|
endRemoveRows();
|
||||||
|
emit dataChanged(index(0), index(lastNoteIndex));
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> NotesModel::roleNames() const {
|
QHash<int, QByteArray> NotesModel::roleNames() const {
|
||||||
return QHash<int, QByteArray> {
|
return QHash<int, QByteArray> {
|
||||||
{NotesModel::IdRole, "id"},
|
{NotesModel::IdRole, "id"},
|
||||||
|
|
|
@ -38,9 +38,6 @@ public:
|
||||||
explicit NotesModel(QObject *parent = 0);
|
explicit NotesModel(QObject *parent = 0);
|
||||||
virtual ~NotesModel();
|
virtual ~NotesModel();
|
||||||
|
|
||||||
bool fromJsonDocument(const QJsonDocument &jdoc);
|
|
||||||
QJsonDocument toJsonDocument() const;
|
|
||||||
|
|
||||||
enum NoteRoles {
|
enum NoteRoles {
|
||||||
IdRole = Qt::UserRole,
|
IdRole = Qt::UserRole,
|
||||||
ModifiedRole = Qt::UserRole + 1,
|
ModifiedRole = Qt::UserRole + 1,
|
||||||
|
@ -67,21 +64,16 @@ public slots:
|
||||||
int insertNote(const Note ¬e);
|
int insertNote(const Note ¬e);
|
||||||
bool removeNote(const Note ¬e);
|
bool removeNote(const Note ¬e);
|
||||||
bool removeNote(int id);
|
bool removeNote(int id);
|
||||||
|
Q_INVOKABLE void clear();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//void addNote(const QJsonValue ¬e);
|
|
||||||
QVector<int> ids() const;
|
QVector<int> ids() const;
|
||||||
//int indexOf(const Note ¬e) const;
|
|
||||||
//int indexOf(int id) const;
|
|
||||||
//bool replaceNote(const Note ¬e);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int> ());
|
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int> ());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<Note> m_notes;
|
QVector<Note> m_notes;
|
||||||
//QJsonArray m_notes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NOTESMODEL_H
|
#endif // NOTESMODEL_H
|
||||||
|
|
|
@ -23,7 +23,7 @@ QString NotesStore::account() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::setAccount(const QString& account) {
|
void NotesStore::setAccount(const QString& account) {
|
||||||
//qDebug() << account << m_dir.path();
|
qDebug() << "Setting account: " << account;
|
||||||
if (account != m_dir.path()) {
|
if (account != m_dir.path()) {
|
||||||
if (m_dir != QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) {
|
if (m_dir != QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) {
|
||||||
m_dir.cdUp();
|
m_dir.cdUp();
|
||||||
|
@ -40,6 +40,7 @@ void NotesStore::setAccount(const QString& account) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::getAllNotes(Note::NoteField exclude) {
|
void NotesStore::getAllNotes(Note::NoteField exclude) {
|
||||||
|
qDebug() << "Getting all notes";
|
||||||
QFileInfoList files = m_dir.entryInfoList();
|
QFileInfoList files = m_dir.entryInfoList();
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -51,6 +52,7 @@ void NotesStore::getAllNotes(Note::NoteField exclude) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::getNote(const int id, Note::NoteField exclude) {
|
void NotesStore::getNote(const int id, Note::NoteField exclude) {
|
||||||
|
qDebug() << "Getting note: " << id;
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
Note note = readNoteFile(id, exclude);
|
Note note = readNoteFile(id, exclude);
|
||||||
if (note.isValid())
|
if (note.isValid())
|
||||||
|
@ -59,6 +61,8 @@ void NotesStore::getNote(const int id, Note::NoteField exclude) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::createNote(const Note& note) {
|
void NotesStore::createNote(const Note& note) {
|
||||||
|
// TODO verify modified
|
||||||
|
qDebug() << "Creating note: " << note.id();
|
||||||
if (!note.isValid()) {
|
if (!note.isValid()) {
|
||||||
// TODO probably crate files with an '.json.<NUMBER>.new' extension
|
// TODO probably crate files with an '.json.<NUMBER>.new' extension
|
||||||
qDebug() << "Creating notes without the server API is not supported yet!";
|
qDebug() << "Creating notes without the server API is not supported yet!";
|
||||||
|
@ -71,6 +75,8 @@ void NotesStore::createNote(const Note& note) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::updateNote(const Note& note) {
|
void NotesStore::updateNote(const Note& note) {
|
||||||
|
// TODO verify modified
|
||||||
|
qDebug() << "Updating note: " << note.id();
|
||||||
if (note.isValid()) {
|
if (note.isValid()) {
|
||||||
Note file = readNoteFile(note.id());
|
Note file = readNoteFile(note.id());
|
||||||
if (!file.equal(note)) {
|
if (!file.equal(note)) {
|
||||||
|
@ -82,6 +88,7 @@ void NotesStore::updateNote(const Note& note) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotesStore::deleteNote(const int id) {
|
void NotesStore::deleteNote(const int id) {
|
||||||
|
qDebug() << "Deleting note: " << id;
|
||||||
if (removeNoteFile(id)) {
|
if (removeNoteFile(id)) {
|
||||||
emit noteDeleted(id);
|
emit noteDeleted(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,37 +311,37 @@
|
||||||
<context>
|
<context>
|
||||||
<name>NotesApi</name>
|
<name>NotesApi</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="335"/>
|
<location filename="../src/notesapi.cpp" line="343"/>
|
||||||
<source>No network connection available</source>
|
<source>No network connection available</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="338"/>
|
<location filename="../src/notesapi.cpp" line="346"/>
|
||||||
<source>Failed to communicate with the Nextcloud server</source>
|
<source>Failed to communicate with the Nextcloud server</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="341"/>
|
<location filename="../src/notesapi.cpp" line="349"/>
|
||||||
<source>An error happened while reading from the local storage</source>
|
<source>An error happened while reading from the local storage</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="344"/>
|
<location filename="../src/notesapi.cpp" line="352"/>
|
||||||
<source>An error happened while writing to the local storage</source>
|
<source>An error happened while writing to the local storage</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="347"/>
|
<location filename="../src/notesapi.cpp" line="355"/>
|
||||||
<source>An error occured while establishing an encrypted connection</source>
|
<source>An error occured while establishing an encrypted connection</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="350"/>
|
<location filename="../src/notesapi.cpp" line="358"/>
|
||||||
<source>Could not authenticate to the Nextcloud instance</source>
|
<source>Could not authenticate to the Nextcloud instance</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/notesapi.cpp" line="353"/>
|
<location filename="../src/notesapi.cpp" line="361"/>
|
||||||
<source>Unknown error</source>
|
<source>Unknown error</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -349,97 +349,97 @@
|
||||||
<context>
|
<context>
|
||||||
<name>NotesPage</name>
|
<name>NotesPage</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="54"/>
|
<location filename="../qml/pages/NotesPage.qml" line="30"/>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="58"/>
|
<location filename="../qml/pages/NotesPage.qml" line="34"/>
|
||||||
<source>Add note</source>
|
<source>Add note</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="63"/>
|
<location filename="../qml/pages/NotesPage.qml" line="39"/>
|
||||||
<source>Reload</source>
|
<source>Reload</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="63"/>
|
<location filename="../qml/pages/NotesPage.qml" line="39"/>
|
||||||
<source>Updating...</source>
|
<source>Updating...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="69"/>
|
<location filename="../qml/pages/NotesPage.qml" line="45"/>
|
||||||
<source>Last update</source>
|
<source>Last update</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="72"/>
|
<location filename="../qml/pages/NotesPage.qml" line="48"/>
|
||||||
<source>never</source>
|
<source>never</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="82"/>
|
<location filename="../qml/pages/NotesPage.qml" line="58"/>
|
||||||
<source>Nextcloud Notes</source>
|
<source>Nextcloud Notes</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="223"/>
|
<location filename="../qml/pages/NotesPage.qml" line="199"/>
|
||||||
<source>Modified</source>
|
<source>Modified</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="226"/>
|
<location filename="../qml/pages/NotesPage.qml" line="202"/>
|
||||||
<source>Delete</source>
|
<source>Delete</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="228"/>
|
<location filename="../qml/pages/NotesPage.qml" line="204"/>
|
||||||
<source>Deleting note</source>
|
<source>Deleting note</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="258"/>
|
<location filename="../qml/pages/NotesPage.qml" line="234"/>
|
||||||
<source>Loading notes...</source>
|
<source>Loading notes...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="264"/>
|
<location filename="../qml/pages/NotesPage.qml" line="240"/>
|
||||||
<source>No account yet</source>
|
<source>No account yet</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="265"/>
|
<location filename="../qml/pages/NotesPage.qml" line="241"/>
|
||||||
<source>Got to the settings to add an account</source>
|
<source>Got to the settings to add an account</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="271"/>
|
<location filename="../qml/pages/NotesPage.qml" line="247"/>
|
||||||
<source>No notes yet</source>
|
<source>No notes yet</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="272"/>
|
<location filename="../qml/pages/NotesPage.qml" line="248"/>
|
||||||
<source>Pull down to add a note</source>
|
<source>Pull down to add a note</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="278"/>
|
<location filename="../qml/pages/NotesPage.qml" line="254"/>
|
||||||
<source>No result</source>
|
<source>No result</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="279"/>
|
<location filename="../qml/pages/NotesPage.qml" line="255"/>
|
||||||
<source>Try another query</source>
|
<source>Try another query</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="285"/>
|
<location filename="../qml/pages/NotesPage.qml" line="261"/>
|
||||||
<source>An error occurred</source>
|
<source>An error occurred</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/pages/NotesPage.qml" line="296"/>
|
<location filename="../qml/pages/NotesPage.qml" line="272"/>
|
||||||
<source>Open the settings to configure your Nextcloud accounts</source>
|
<source>Open the settings to configure your Nextcloud accounts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -840,22 +840,22 @@ You can also use other markdown syntax inside them.</source>
|
||||||
<context>
|
<context>
|
||||||
<name>harbour-nextcloudnotes</name>
|
<name>harbour-nextcloudnotes</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/harbour-nextcloudnotes.qml" line="110"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="117"/>
|
||||||
<source>Notes</source>
|
<source>Notes</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/harbour-nextcloudnotes.qml" line="111"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="118"/>
|
||||||
<source>Offline</source>
|
<source>Offline</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/harbour-nextcloudnotes.qml" line="112"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="119"/>
|
||||||
<source>Synced</source>
|
<source>Synced</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/harbour-nextcloudnotes.qml" line="119"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="126"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Loading…
Reference in a new issue