User synchronize was requested
| 1420 | //* User synchronize was requested |
| 1421 | //****************************************************************************** |
| 1422 | void 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 |
no test coverage detected