digiKam
vkontakte_vkapi.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2011-02-19
7  * Description : a tool to export images to VKontakte web service
8  *
9  * Copyright (C) 2011-2015 by Alexander Potashev <aspotashev at gmail dot com>
10  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_VKONTAKTE_VKAPI_H
25 #define DIGIKAM_VKONTAKTE_VKAPI_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 
31 // Local includes
32 
34 
35 class QWidget;
36 class KJob;
37 
38 namespace Vkontakte
39 {
40 
47 class VkApi : public QObject // clazy:exclude=ctor-missing-parent-argument
48 {
49  Q_OBJECT
50 
51 public:
52 
53  explicit VkApi(QWidget* const parent);
54  ~VkApi() override;
55 
61  void setAppId(const QString& appId);
62 
68  void setRequiredPermissions(Vkontakte::AppPermissions::Value permissions);
69 
78  void setInitialAccessToken(const QString& accessToken);
79 
80  QString accessToken() const;
81 
82  void startAuthentication(bool forceLogout);
83  bool isAuthenticated();
84 
85 Q_SIGNALS:
86 
87  void authenticated();
88  void canceled();
89 
90 protected Q_SLOTS:
91 
92  void slotApplicationPermissionCheckDone(KJob* kjob);
93  void slotAuthenticationDialogDone(const QString& accessToken);
94 
95 private:
96 
97  class Private;
98  Private* const d;
99 };
100 
101 } // namespace Vkontakte
102 
103 #endif // DIGIKAM_VKONTAKTE_VKAPI_H