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

Method evernoteSync

threads/syncrunner.cpp:99–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98
99void SyncRunner::evernoteSync() {
100 QLOG_TRACE() << "Sync thread:" << QThread::currentThreadId();
101 if (!global.connected)
102 return;
103
104 User user;
105 UserTable userTable(db);
106 if (!comm->getUserInfo(user)) {
107 this->communicationErrorHandler();
108 error =true;
109 return;
110 }
111 userTable.updateUser(user);
112
113 SyncState syncState;
114 if (!comm->getSyncState("", syncState)) {
115 this->communicationErrorHandler();
116 error = true;
117 return;
118 }
119
120 fullSync = false;
121
122 qlonglong lastSyncDate = userTable.getLastSyncDate();
123 updateSequenceNumber = userTable.getLastSyncNumber();
124
125 if ((syncState.fullSyncBefore/1000) > lastSyncDate) {
126 QLOG_DEBUG() << "Full sequence date has expired";
127 lastSyncDate = 0;
128 fullSync = true;
129 }
130
131 if (updateSequenceNumber == 0)
132 fullSync = true;
133
134 emit setMessage(tr("Beginning Sync"), defaultMsgTimeout);
135 // If there are remote changes
136 QLOG_DEBUG() << "--->>> Current Chunk High Sequence Number: " << syncState.updateCount;
137 QLOG_DEBUG() << "--->>> Last User High Sequence Number: " << updateSequenceNumber;
138
139 if (syncState.updateCount > updateSequenceNumber) {
140 QLOG_DEBUG() << "Remote changes found";
141 QLOG_DEBUG() << "Downloading changes";
142 emit setMessage(tr("Downloading changes"), defaultMsgTimeout);
143 bool rc = syncRemoteToLocal(syncState.updateCount);
144 if (!rc)
145 error = true;
146 }
147
148 if (!comm->getUserInfo(user)) {
149 this->communicationErrorHandler();
150 error = true;
151 return;
152 }
153 userTable.updateUser(user);
154
155 if (!global.disableUploads && !error) {
156 qint32 searchUsn = uploadSavedSearches();

Callers

nothing calls this directly

Calls 9

getUserInfoMethod · 0.80
updateUserMethod · 0.80
getLastSyncDateMethod · 0.80
getLastSyncNumberMethod · 0.80
updateSyncStateMethod · 0.80
findMissingParentsMethod · 0.80
cleanupMissingParentsMethod · 0.80
getSyncStateMethod · 0.45

Tested by

no test coverage detected