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

Method sync

cmdtools/cmdlinetool.cpp:763–788  ·  view source on GitHub ↗

Do a sync

Source from the content-addressed store, hash-verified

761
762// Do a sync
763int CmdLineTool::sync() {
764 if (!global.accountsManager->oauthTokenFound()) {
765 std::cout << tr("OAuth token not found.").toStdString() << endl;
766 return 16;
767 }
768
769 global.db = new DatabaseConnection("nixnote"); // Startup the database
770
771 // Check if the table exists. If not, create it.
772 NSqlQuery sql(global.db);
773 sql.exec("Select * from sqlite_master where type='table' and name='NoteTable';");
774 if (!sql.next()) {
775 NoteModel model(this);
776 model.createTable();
777 }
778 sql.finish();
779
780 SyncRunner runner;
781 runner.synchronize();
782 if (runner.error) {
783 std::cout << tr("Error synchronizing with Evernote.").toStdString() << std::endl;
784 return 16;
785 }
786 std::cout << tr("Sync completed.").toStdString() << std::endl;
787 return 0;
788}
789
790
791

Callers 1

runMethod · 0.95

Calls 4

oauthTokenFoundMethod · 0.80
execMethod · 0.45
createTableMethod · 0.45
synchronizeMethod · 0.45

Tested by

no test coverage detected