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

Method synchronize

nixnote.cpp:1422–1457  ·  view source on GitHub ↗

User synchronize was requested

Source from the content-addressed store, hash-verified

1420//* User synchronize was requested
1421//******************************************************************************
1422void NixNote::synchronize() {
1423 // If we are already connected, we are already synchronizing so there is nothing more to do
1424 if (global.connected == true)
1425 return;
1426
1427 this->pauseIndexing(true);
1428
1429 if (tabWindow->currentBrowser()->noteTitle.hasFocus())
1430 tabWindow->currentBrowser()->noteTitle.checkNoteTitleChange();
1431
1432 if (!global.accountsManager->oauthTokenFound()) {
1433 QString consumerKey = "baumgarr-3523";
1434 QString consumerSecret = "8d5ee175f8a5d3ec";
1435 EvernoteOAuthDialog d(consumerKey, consumerSecret, global.server);
1436 d.setWindowTitle(tr("Log in to Evernote"));
1437 if(d.exec() != QDialog::Accepted) {
1438 QMessageBox::critical(0, tr("NixNote"), "Login failed.\n" + d.oauthError());
1439 return;
1440 }
1441 QString token = QString("oauth_token=") +d.oauthResult().authenticationToken +
1442 QString("&oauth_token_secret=&edam_shard=")+d.oauthResult().shardId +
1443 QString("&edam_userId=") +QString::number(d.oauthResult().userId) +
1444 QString("&edam_expires=") +QString::number(d.oauthResult().expires) +
1445 QString("&edam_noteStoreUrl=") + d.oauthResult().noteStoreUrl +
1446 QString("&edam_webApiUrlPrefix=") +d.oauthResult().webApiUrlPrefix;
1447
1448 global.accountsManager->setOAuthToken(token);
1449 }
1450
1451 this->saveContents();
1452 statusBar()->clearMessage();
1453
1454 tabWindow->saveAllNotes();
1455 syncButtonTimer.start(3);
1456 emit syncRequested();
1457}
1458
1459
1460

Callers 2

syncMethod · 0.45

Calls 12

pauseIndexingMethod · 0.95
saveContentsMethod · 0.95
currentBrowserMethod · 0.80
checkNoteTitleChangeMethod · 0.80
oauthTokenFoundMethod · 0.80
setOAuthTokenMethod · 0.80
saveAllNotesMethod · 0.80
QStringClass · 0.50
execMethod · 0.45
oauthErrorMethod · 0.45
oauthResultMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected