MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / uploadNotebooks

Method uploadNotebooks

threads/syncrunner.cpp:1046–1088  ·  view source on GitHub ↗

Upload any saved searchs

Source from the content-addressed store, hash-verified

1044
1045// Upload any saved searchs
1046qint32 SyncRunner::uploadNotebooks() {
1047 QLOG_TRACE_IN();
1048 qint32 usn;
1049 qint32 maxUsn = 0;
1050 NotebookTable table(db);
1051 QList<qint32> lids;
1052 table.resetDirtyLocalNotebooks();
1053 table.resetLinkedNotebooksDirty();
1054 table.getAllDirty(lids);
1055 for (int i=0; i<lids.size(); i++) {
1056 Notebook notebook;
1057 table.get(notebook, lids[i]);
1058 if (!table.isDeleted(lids[i])) {
1059 qint32 oldUsn = notebook.updateSequenceNum;
1060 usn = comm->uploadNotebook(notebook);
1061 if (usn == 0) {
1062 this->communicationErrorHandler();
1063 error = true;
1064 QLOG_TRACE_OUT();
1065 return maxUsn;
1066 }
1067 if (usn > maxUsn) {
1068 maxUsn = usn;
1069 if (oldUsn == 0)
1070 table.updateGuid(lids[i], notebook.guid);
1071 table.setUpdateSequenceNumber(lids[i], usn);
1072 } else {
1073 error = true;
1074 }
1075 } else {
1076 QString guid;
1077 table.getGuid(guid, lids[i]);
1078 table.expunge(lids[i]);
1079 if (notebook.updateSequenceNum > 0) {
1080 usn = comm->expungeNotebook(guid);
1081 if (usn>maxUsn)
1082 maxUsn = usn;
1083 }
1084 }
1085 }
1086 QLOG_TRACE_OUT();
1087 return maxUsn;
1088}
1089
1090
1091

Callers

nothing calls this directly

Calls 12

uploadNotebookMethod · 0.80
getAllDirtyMethod · 0.45
getMethod · 0.45
isDeletedMethod · 0.45
updateGuidMethod · 0.45
getGuidMethod · 0.45
expungeMethod · 0.45
expungeNotebookMethod · 0.45

Tested by

no test coverage detected