QEverCloud  3.0.0
Unofficial Evernote Cloud API for Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 <QDialog>
21 #include <QString>
22 
23 namespace qevercloud {
24 
36 void setNonceGenerator(quint64 (*nonceGenerator)());
37 
39 class EvernoteOAuthWebViewPrivate;
53 {
54  Q_OBJECT
55 public:
56  EvernoteOAuthWebView(QWidget * parent = Q_NULLPTR);
57 
74  void authenticate(QString host, QString consumerKey, QString consumerSecret);
75 
77  bool isSucceeded() const;
78 
80  QString oauthError() const;
81 
83  struct OAuthResult
84  {
85  QString noteStoreUrl;
87  QString shardId;
89  QString webApiUrlPrefix;
91  };
92 
94  OAuthResult oauthResult() const;
95 
97  void setSizeHint(QSize sizeHint);
98 
99  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
100 
101 Q_SIGNALS:
103  void authenticationFinished(bool success);
104 
106  void authenticationSuceeded();
107 
109  void authenticationFailed();
110 
111 private:
112  EvernoteOAuthWebViewPrivate * const d_ptr;
113  Q_DECLARE_PRIVATE(EvernoteOAuthWebView)
114 };
115 
117 class EvernoteOAuthDialogPrivate;
148 {
149 public:
151 
165  EvernoteOAuthDialog(QString consumerKey, QString consumerSecret, QString host = QStringLiteral("www.evernote.com"), QWidget * parent = Q_NULLPTR);
167 
174  void setWebViewSizeHint(QSize sizeHint);
175 
179  bool isSucceeded() const;
180 
184  QString oauthError() const;
185 
189  OAuthResult oauthResult() const;
190 
195 #if QT_VERSION < 0x050000
196  int exec();
197 #else
198  virtual int exec() Q_DECL_OVERRIDE;
199 #endif
200 
203 #if QT_VERSION < 0x050000
204  void open();
205 #else
206  virtual void open() Q_DECL_OVERRIDE;
207 #endif
208 
209 private:
210  EvernoteOAuthDialogPrivate * const d_ptr;
211  Q_DECLARE_PRIVATE(EvernoteOAuthDialog)
212 };
213 
214 } // namespace qevercloud
215 
216 #endif // QEVERCLOUD_OAUTH_H
qint64 Timestamp
Definition: types.h:250
void setNonceGenerator(quint64(*nonceGenerator)())
Sets the function to use for nonce generation for OAuth authentication.
qint32 UserID
Definition: types.h:219
EvernoteOAuthWebView::OAuthResult OAuthResult
Definition: oauth.h:150
QString authenticationToken
This is what this all was for!
Definition: oauth.h:90
#define QEVERCLOUD_EXPORT
Definition: export.h:23
Definition: AsyncResult.h:18
QString noteStoreUrl
note store url for the user; no need to question UserStore::getNoteStoreUrl for it.
Definition: oauth.h:85
QString webApiUrlPrefix
see PublicUserInfo::webApiUrlPrefix
Definition: oauth.h:89
The class is tailored specifically for OAuth authorization with Evernote.
Definition: oauth.h:52
Authorizes your app with the Evernote service by means of OAuth authentication.
Definition: oauth.h:147
Timestamp expires
authenticationToken time of expiration.
Definition: oauth.h:86
UserID userId
same as PublicUserInfo::userId
Definition: oauth.h:88
QString shardId
usually is not used
Definition: oauth.h:87