Use the model of NotesApp
This commit is contained in:
parent
6ff59f1971
commit
5cb5ec8637
4 changed files with 10 additions and 9 deletions
|
@ -80,8 +80,9 @@ ApplicationWindow
|
||||||
Connections {
|
Connections {
|
||||||
target: appSettings
|
target: appSettings
|
||||||
onCurrentAccountChanged: {
|
onCurrentAccountChanged: {
|
||||||
account.path = appSettings.path + "/accounts/" + appSettings.currentAccount
|
|
||||||
console.log("Current account: " + account.username + "@" + account.url)
|
console.log("Current account: " + account.username + "@" + account.url)
|
||||||
|
account.path = appSettings.path + "/accounts/" + appSettings.currentAccount
|
||||||
|
notesApp.model().account = appSettings.currentAccount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ Page {
|
||||||
|
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
|
|
||||||
model: notesModel
|
model: notesApp.model()
|
||||||
|
|
||||||
delegate: BackgroundItem {
|
delegate: BackgroundItem {
|
||||||
id: note
|
id: note
|
||||||
|
|
|
@ -88,7 +88,7 @@ bool NotesApp::createNote(const QJsonObject& note, bool local) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotesApp::updateNote(const int id, const QJsonObject& note, bool local) {
|
bool NotesApp::updateNote(const int id, const QJsonObject& note, bool local) {
|
||||||
qDebug() << "Updating note: " << id;
|
qDebug() << "Updating note:" << id;
|
||||||
bool done = true;
|
bool done = true;
|
||||||
if (!m_notes.contains(QJsonValue(note))) {
|
if (!m_notes.contains(QJsonValue(note))) {
|
||||||
done = false;
|
done = false;
|
||||||
|
@ -156,7 +156,7 @@ void NotesApp::updateReply(QNetworkReply* reply) {
|
||||||
QByteArray data = reply->readAll();
|
QByteArray data = reply->readAll();
|
||||||
//qDebug() << data;
|
//qDebug() << data;
|
||||||
QJsonDocument json = QJsonDocument::fromJson(data);
|
QJsonDocument json = QJsonDocument::fromJson(data);
|
||||||
qDebug() << json;
|
//qDebug() << json;
|
||||||
if (json.isObject()) {
|
if (json.isObject()) {
|
||||||
QJsonObject obj = json.object();
|
QJsonObject obj = json.object();
|
||||||
updateNote(obj.value("id").toInt(), obj, true);
|
updateNote(obj.value("id").toInt(), obj, true);
|
||||||
|
|
|
@ -912,27 +912,27 @@ 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="115"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="116"/>
|
||||||
<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="116"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="117"/>
|
||||||
<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="117"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="118"/>
|
||||||
<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="131"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="132"/>
|
||||||
<source>API error</source>
|
<source>API error</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../qml/harbour-nextcloudnotes.qml" line="124"/>
|
<location filename="../qml/harbour-nextcloudnotes.qml" line="125"/>
|
||||||
<source>File error</source>
|
<source>File error</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Loading…
Reference in a new issue