~renatofilho/buteo-sync-plugins-contacts/solve-eds-conflict

« back to all changes in this revision

Viewing changes to buteo-contact-client/UAuth.h

  • Committer: CI Train Bot
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2015-09-24 17:50:44 UTC
  • mfrom: (1.3.53 initial-vr)
  • Revision ID: ci-train-bot@canonical.com-20150924175044-rp0akjs0h1xwxmpj
Implemented buteo contacts sync plugin for google, heavily based on:
  - https://github.com/nemomobile-graveyard/buteo-sync-plugins-google
  - https://github.com/nemomobile/buteo-sync-plugins-social
Approved by: Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of buteo-sync-plugins-contacts package
 
3
 *
 
4
 * Copyright (C) 2013 Jolla Ltd. and/or its subsidiary(-ies).
 
5
 *               2015 Canonical Ltd
 
6
 *
 
7
 * Contributors: Sateesh Kavuri <sateesh.kavuri@gmail.com>
 
8
 *               Mani Chandrasekar <maninc@gmail.com>
 
9
 *               Renato Araujo Oliveira Filho <renato.filho@canonical.com>
 
10
 *
 
11
 * This library is free software; you can redistribute it and/or
 
12
 * modify it under the terms of the GNU Lesser General Public License
 
13
 * version 2.1 as published by the Free Software Foundation.
 
14
 *
 
15
 * This library is distributed in the hope that it will be useful, but
 
16
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
18
 * Lesser General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU Lesser General Public
 
21
 * License along with this library; if not, write to the Free Software
 
22
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
23
 * 02110-1301 USA
 
24
 *
 
25
 */
 
26
 
 
27
#ifndef UAUTH_H
 
28
#define UAUTH_H
 
29
 
 
30
#include <QObject>
 
31
#include <QScopedPointer>
 
32
 
 
33
#include <SignOn/AuthService>
 
34
#include <SignOn/Identity>
 
35
 
 
36
#include <Accounts/Account>
 
37
#include <Accounts/Manager>
 
38
 
 
39
class UAuthPrivate;
 
40
 
 
41
class UAuth : public QObject
 
42
{
 
43
    Q_OBJECT
 
44
    Q_DECLARE_PRIVATE(UAuth)
 
45
public:
 
46
    explicit UAuth(QObject *parent = 0);
 
47
    ~UAuth();
 
48
 
 
49
    virtual bool authenticate();
 
50
    virtual bool init(const quint32 accountId, const QString serviceName);
 
51
 
 
52
    inline QString accountDisplayName() const { return mDisplayName; }
 
53
    inline QString token() const { return mToken; }
 
54
 
 
55
signals:
 
56
    void success();
 
57
    void failed();
 
58
 
 
59
protected:
 
60
    QString mToken;
 
61
    QString mDisplayName;
 
62
 
 
63
private:
 
64
    QScopedPointer<UAuthPrivate> d_ptr;
 
65
 
 
66
private slots:
 
67
    void credentialsStored(const quint32);
 
68
    void error(const SignOn::Error &);
 
69
    void sessionResponse(const SignOn::SessionData &);
 
70
};
 
71
 
 
72
#endif // UAUTH_H