2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _OAUTHWIZARD_H_
21 #define _OAUTHWIZARD_H_
26 #include <QWizardPage>
27 #include <QNetworkAccessManager>
31 //------------------------------------------------------------------------------
33 class OAuthFirstPage
: public QWizardPage
{
37 OAuthFirstPage(QWidget
* parent
=0);
38 void setMessage(QString msg
);
41 void committed(QString
, QString
);
44 virtual bool validatePage();
45 virtual bool isComplete() const;
48 bool splitAccountId(QString
& username
, QString
& server
) const;
49 QLabel
* m_messageLabel
;
52 //------------------------------------------------------------------------------
54 class OAuthSecondPage
: public QWizardPage
{
58 OAuthSecondPage(QWidget
* parent
=0);
61 virtual bool validatePage();
64 void committed(QString
, QString
);
67 //------------------------------------------------------------------------------
69 class OAuthWizard
: public QWizard
{
73 OAuthWizard(QNetworkAccessManager
* nam
, KQOAuthManager
* oam
,
77 void clientRegistered(QString
, QString
, QString
, QString
);
78 void accessTokenReceived(QString
, QString
);
81 void onFirstPageCommitted(QString
, QString
);
82 void onSecondPageCommitted(QString
, QString
);
84 void onOAuthClientRegDone();
85 void onTemporaryTokenReceived(QString temporaryToken
,
86 QString temporaryTokenSecret
);
87 void onAccessTokenReceived(QString token
, QString tokenSecret
);
90 void notifyMessage(QString
);
91 void errorMessage(QString
);
93 void registerOAuthClient();
94 void getOAuthAccess();
99 KQOAuthManager
*m_oam
;
100 KQOAuthRequest
*m_oar
;
101 QNetworkAccessManager
*m_nam
;
103 QString m_server
, m_username
;
104 QString m_clientId
, m_clientSecret
;
106 int m_clientRegTryCount
;
109 #endif /* _OAUTHWIZARD_H_ */