QEverCloud  4.0.0
Unofficial Evernote Cloud API for Qt
oauth.h
Go to the documentation of this file.
1 
9 #ifndef QEVERCLOUD_OAUTH_H
10 #define QEVERCLOUD_OAUTH_H
11 
12 // Workarounding https://bugreports.qt.io/browse/QTBUG-28885
13 #if defined(_MSC_VER) && (_MSC_VER <= 1600)
14 #define QT_NO_UNICODE_LITERAL
15 #endif
16 
17 #include "generated/types.h"
18 #include "export.h"
19 #include "qt4helpers.h"
20 #include <QString>
21 #include <QDialog>
22 
23 #if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
24 // VS2010 is supposed to be C++11 but does not fulfull the entire standard.
25 #ifdef QStringLiteral
26 #undef QStringLiteral
27 #define QStringLiteral(str) QString::fromUtf8("" str "", sizeof(str) - 1)
28 #endif
29 #endif
30 
31 namespace qevercloud {
32 
44 void setNonceGenerator(quint64 (*nonceGenerator)());
45 
47 class EvernoteOAuthWebViewPrivate;
61 {
62  Q_OBJECT
63 public:
64  EvernoteOAuthWebView(QWidget * parent = Q_NULLPTR);
65 
82  void authenticate(QString host, QString consumerKey, QString consumerSecret);
83 
85  bool isSucceeded() const;
86 
88  QString oauthError() const;
89 
91  struct OAuthResult
92  {
93  QString noteStoreUrl;
95  QString shardId;
97  QString webApiUrlPrefix;
99  };
100 
102  OAuthResult oauthResult() const;
103 
105  void setSizeHint(QSize sizeHint);
106 
107  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
108 
109 Q_SIGNALS:
111  void authenticationFinished(bool success);
112 
114  void authenticationSuceeded();
115 
117  void authenticationFailed();
118 
119 private:
120  EvernoteOAuthWebViewPrivate * const d_ptr;
121  Q_DECLARE_PRIVATE(EvernoteOAuthWebView)
122 };
123 
125 class EvernoteOAuthDialogPrivate;
156 {
157  Q_OBJECT
158 public:
160 
174  EvernoteOAuthDialog(QString consumerKey, QString consumerSecret, QString host = QStringLiteral("www.evernote.com"), QWidget * parent = Q_NULLPTR);
176 
183  void setWebViewSizeHint(QSize sizeHint);
184 
188  bool isSucceeded() const;
189 
193  QString oauthError() const;
194 
198  OAuthResult oauthResult() const;
199 
204 #if QT_VERSION < 0x050000
205  int exec();
206 #else
207  virtual int exec() Q_DECL_OVERRIDE;
208 #endif
209 
212 #if QT_VERSION < 0x050000
213  void open();
214 #else
215  virtual void open() Q_DECL_OVERRIDE;
216 #endif
217 
218 private:
219  EvernoteOAuthDialogPrivate * const d_ptr;
220  Q_DECLARE_PRIVATE(EvernoteOAuthDialog)
221 };
222 
223 } // namespace qevercloud
224 
225 #endif // QEVERCLOUD_OAUTH_H
qint64 Timestamp
Definition: types.h:459
void setNonceGenerator(quint64(*nonceGenerator)())
Sets the function to use for nonce generation for OAuth authentication.
qint32 UserID
Definition: types.h:428
EvernoteOAuthWebView::OAuthResult OAuthResult
Definition: oauth.h:159
QString authenticationToken
This is what this all was for!
Definition: oauth.h:98
#define QEVERCLOUD_EXPORT
Definition: export.h:19
Definition: AsyncResult.h:18
QString noteStoreUrl
note store url for the user; no need to question UserStore::getNoteStoreUrl for it.
Definition: oauth.h:93
QString webApiUrlPrefix
see PublicUserInfo::webApiUrlPrefix
Definition: oauth.h:97
The class is tailored specifically for OAuth authorization with Evernote.
Definition: oauth.h:60
Authorizes your app with the Evernote service by means of OAuth authentication.
Definition: oauth.h:155
Timestamp expires
authenticationToken time of expiration.
Definition: oauth.h:94
UserID userId
same as PublicUserInfo::userId
Definition: oauth.h:96
QString shardId
usually is not used
Definition: oauth.h:95