MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / handleNoteCreated

Method handleNoteCreated

src/gui/documentviewer/CollaborationDocView.cpp:162–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void CollaborationDocView::handleNoteCreated(const QString &docGuid, const QString &title)
163{
164 WizDatabase& pdb = WizDatabaseManager::instance()->db();
165 WizKMSyncThread sync(pdb, false);
166 sync.start(QThread::TimeCriticalPriority);
167
168 bool done = false;
169 connect(&sync, &WizKMSyncThread::syncFinished,
170 this, [&] (int nErrorCode, bool isNetworkError,
171 const QString& strErrorMesssage, bool isBackground) {
172 if (nErrorCode != 0)
173 QMessageBox::critical(this,
174 tr("Sync failed"), strErrorMesssage);
175
176 WIZDOCUMENTDATA data;
177 WizDatabase& db = m_dbMgr.db(m_doc.strKbGUID);
178 if (db.documentFromGuid(docGuid, data)) {
179 data.strTitle = title.isEmpty() ? data.strTitle : title;
180 data.tDataModified = WizGetCurrentTime();
181 data.strLocation = m_doc.strLocation;
182 db.modifyDocumentInfo(data);
183 m_doc = data;
184
185 if (!m_tag.strGUID.isEmpty()) {
186 WizDocument doc(db, m_doc);
187 doc.addTag(m_tag);
188 }
189 }
190
191 done = true;
192 }
193 );
194
195 sync.startSyncAll();
196
197 while(!done)
198 QApplication::processEvents();
199
200 sync.waitForDone();
201}
202
203void CollaborationDocView::handleNoteDeleted(const WIZDOCUMENTDATA& data)
204{

Callers

nothing calls this directly

Calls 8

connectFunction · 0.85
WizGetCurrentTimeFunction · 0.85
isEmptyMethod · 0.80
modifyDocumentInfoMethod · 0.80
startSyncAllMethod · 0.80
documentFromGuidMethod · 0.45
addTagMethod · 0.45
waitForDoneMethod · 0.45

Tested by

no test coverage detected