digiKam
fbtalker_wizard.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 : 2008-12-26
7  * Description : a tool to export items to Facebook web service
8  *
9  * Copyright (C) 2008-2009 by Luka Renko <lure at kubuntu dot org>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FB_TALKER_WIZARD_H
26 #define DIGIKAM_FB_TALKER_WIZARD_H
27 
28 // Qt includes
29 
30 #include <QList>
31 #include <QString>
32 #include <QTime>
33 #include <QObject>
34 #include <QUrl>
35 #include <QNetworkReply>
36 #include <QMap>
37 #include <QSettings>
38 
39 // Local includes
40 
41 #include "fbitem.h"
42 #include "wsnewalbumdialog.h"
43 #include "wstalker.h"
44 #include "wsitem.h"
45 
46 // O2 include
47 
48 #include "o2.h"
49 #include "o0globals.h"
50 
51 class QDomElement;
52 
53 using namespace Digikam;
54 
56 {
57 
58 class FbTalker : public WSTalker
59 {
60  Q_OBJECT
61 
62 public:
63 
64  explicit FbTalker(QWidget* const parent, WSNewAlbumDialog* albumDlg=0);
66 
67  void link();
68  void unlink();
69  bool linked() const;
70 
71  void resetTalker(const QString& expire, const QString& accessToken, const QString& refreshToken);
72 
73  FbUser getUser() const;
74 
75  void authenticate();
76  void logout();
77 
78  void listAlbums(long long userID = 0);
79 
80  void createNewAlbum();
81  void createAlbum(const FbAlbum& album);
82 
83  void addPhoto(const QString& imgPath, const QString& albumID,
84  const QString& caption);
85 
86 Q_SIGNALS:
87 
88  void signalLoginProgress(int step, int maxStep = 0, const QString& label = QString());
89  void signalLoginDone(int errCode, const QString& errMsg);
90 
91 private:
92 
93  //QString getApiSig(const QMap<QString, QString>& args);
94  void authenticationDone(int errCode, const QString& errMsg);
95  void getLoggedInUser();
96 
97  QString errorToText(int errCode, const QString& errMsg);
98  int parseErrorResponse(const QDomElement& e, QString& errMsg);
99  void parseResponseGetLoggedInUser(const QByteArray& data);
100  void parseResponseAddPhoto(const QByteArray& data);
101  void parseResponseCreateAlbum(const QByteArray& data);
102  void parseResponseListAlbums(const QByteArray& data);
103 
104 private Q_SLOTS:
105 
106  void slotResponseTokenReceived(const QMap<QString, QString>& rep);
107 
108 private:
109 
110  class Private;
111  Private* const d;
112 };
113 
114 } // namespace DigikamGenericFaceBookPlugin
115 
116 #endif // DIGIKAM_FB_TALKER_WIZARD_H
void signalLoginProgress(int step, int maxStep=0, const QString &label=QString())
void createAlbum(const FbAlbum &album)
void addPhoto(const QString &imgPath, const QString &albumID, const QString &caption)
void listAlbums(long long userID=0)
void signalLoginDone(int errCode, const QString &errMsg)
Definition: wsnewalbumdialog.h:52
Definition: fbitem.h:38
Definition: datefolderview.cpp:43