1 /*
2  * Copyright (C) by Olivier Goffart <ogoffart@woboq.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12  * for more details.
13  */
14 
15 #pragma once
16 
17 #include <QList>
18 #include <QMap>
19 #include <QNetworkCookie>
20 #include <QUrl>
21 #include <QPointer>
22 
23 #include "wizard/abstractcredswizardpage.h"
24 #include "accountfwd.h"
25 #include "creds/oauth.h"
26 
27 #include "ui_owncloudoauthcredspage.h"
28 
29 
30 namespace OCC {
31 
32 
33 class OwncloudOAuthCredsPage : public AbstractCredentialsWizardPage
34 {
35     Q_OBJECT
36 public:
37     OwncloudOAuthCredsPage();
38 
39     AbstractCredentials *getCredentials() const override;
40 
41     void initializePage() override;
42     void cleanupPage() override;
43     int nextId() const override;
44     void setConnected();
45     bool isComplete() const override;
46 
47 public Q_SLOTS:
48     void asyncAuthResult(OAuth::Result, const QString &user, const QString &token,
49         const QString &reniewToken);
50 
51 signals:
52     void connectToOCUrl(const QString &);
53 
54 public:
55     QString _user;
56     QString _token;
57     QString _refreshToken;
58     QScopedPointer<OAuth> _asyncAuth;
59     Ui_OwncloudOAuthCredsPage _ui;
60 };
61 
62 } // namespace OCC
63