#include <QCoreApplication> #include <QTextStream> #include <exception> #include <QEverCloud.h> using namespace qevercloud; int main (int argc, char * argv []) { QCoreApplication a (argc, argv); QTextStream cout (stdout); try { NoteStore * ns = new NoteStore (& a); // insert your developer token here // https://www.evernote.com/api/DeveloperToken.action ns-> setAuthenticationToken ("S = s41: U = 427a0c: E = 14761d37b39: C = 1400a224f39: P = 1cd: A = en-devtoken: V = 2: H = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // Find your NoteStore URL there ns-> setNoteStoreUrl ("https://www.evernote.com/shard/xxx/notestore"); Note note; note.title = "Test Note"; note.content = QString ("<? xml version = \" 1.0 \ "encoding = \" UTF-8 \ "?> \ n") + "<! DOCTYPE en-note SYSTEM \" http: //xml.evernote.com/pub/enml2.dtd \ "> \ n" + "<en-note>" + "<b> Lives well in the world of Winnie the Pooh! </ b> <br /> <br /> <p> Hmm, it looks like <a href = \" https: //github.com/mgsxx/QEverCloud \ "> QEverCloud </a> does work ... </ p>" + "</ en-note>"; ns-> createNote (note); } catch (const std :: exception & e) { cout << "exception occured:" << e.what () << endl; return 1; } catch (...) { cout << "unknown exception occured!" << endl; return 1; } return 0; }
#include <QEverCloudOAuth.h> ... // consumerKey and consumerSecret get here: https://dev.evernote.com/doc/, GET AN API KEY button EvernoteOAuthDialog d (consumerKey, consumerSecret, "sandbox.evernote.com"); d.setWindowTitle ("Login to Evernote"); if (d.exec ()! = QDialog :: Accepted) { QMessageBox :: critical (0, "Error", d.oauthError ()); } else { QString authenticationToken = d.oauthResult (). AuthenticationToken; QString noteStoreUrl = d.oauthResult (). NoteStoreUrl; }
Source: https://habr.com/ru/post/216007/
All Articles