source: SMSSender/frontend/gui/ui/importcontacts/pages/google_page_config.h @ 416:4ada10a14951

Last change on this file since 416:4ada10a14951 was 416:4ada10a14951, checked in by Sämy Zehnder <saemy.zehnder@…>, 6 years ago
  • Fixes static initialization problems.
File size: 2.4 KB
Line 
1/*
2 smssender - A frontend for fast and easy SMS sending over different gateways.
3 Copyright (C) 2007-2014, gorrión. See http://smssender.gorrion.ch
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef FRONTEND_GUI_UI_IMPORTCONTACTS_PAGES_GOOGLE_PAGE_CONFIG_H
19#define FRONTEND_GUI_UI_IMPORTCONTACTS_PAGES_GOOGLE_PAGE_CONFIG_H
20
21#include "ui_google_page_config.h"
22
23#include <QIcon>
24#include <QScopedPointer>
25#include <QWizardPage>
26
27#include "common/persistence/imainstorage.h"
28#include "frontend/business/contactimporter/googlecontactimporter.h"
29#include "frontend/business/contactimporter/oauth2.h"
30#include "frontend/persistence/oauth2_credentialstore.h"
31
32namespace UI {
33namespace GCI {
34
35class PageConfig : public QWizardPage {
36    Q_OBJECT
37
38public:
39    PageConfig(OAuth2::AccessToken *accessToken,
40               Persistence::IMainStorage *mainStorage);
41
42public: /* QWizardPage */
43    void initializePage();
44    bool isComplete() const;
45
46private slots:
47    void accessTokenFetched(
48            const OAuth2::AuthorizationFlow::AccessTokenFetchResult &fetchResult);
49    void connectNewAccount();
50    void dataChanged();
51
52private:
53    struct Account {
54        QString id;
55        QString name;
56        QIcon image;
57        OAuth2::AccessToken accessToken;
58    };
59
60    bool fetchAccountInfo(const OAuth2::AccessToken &accessToken,
61                          QString *name, QIcon *image);
62    void showUrlToUser(const QString &url);
63
64    const QSet<QString> kRequiredScopes;
65    ::GCI::Ui::PageConfigClass ui;
66
67    OAuth2::AccessToken * const m_accessToken;
68
69    QScopedPointer<Persistence::OAuth2::CredentialStore> m_credentialStore;
70    QScopedPointer<OAuth2::AuthorizationFlow> m_authorizationFlow;
71    QList<Account> m_pairedAccounts;
72};
73
74} // namespace GCI
75} // namespace UI
76
77#endif // FRONTEND_GUI_UI_IMPORTCONTACTS_PAGES_GOOGLE_PAGE_CONFIG_H
Note: See TracBrowser for help on using the repository browser.