File indexing completed on 2025-01-05 03:53:26

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-12-26
0007  * Description : a tool to export items to Facebook web service
0008  *
0009  * SPDX-FileCopyrightText: 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
0010  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2008-2009 by Luka Renko <lure at kubuntu dot org>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_FB_WINDOW_H
0018 #define DIGIKAM_FB_WINDOW_H
0019 
0020 // Qt includes
0021 
0022 #include <QList>
0023 
0024 // Local includes
0025 
0026 #include "dinfointerface.h"
0027 #include "wstooldialog.h"
0028 
0029 class QCloseEvent;
0030 class QUrl;
0031 
0032 using namespace Digikam;
0033 
0034 namespace DigikamGenericFaceBookPlugin
0035 {
0036 
0037 class FbAlbum;
0038 
0039 class FbWindow : public WSToolDialog
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044 
0045     explicit FbWindow(DInfoInterface* const iface, QWidget* const parent);
0046     ~FbWindow()                         override;
0047 
0048 private Q_SLOTS:
0049 
0050     void slotBusy(bool val);
0051     void slotLoginProgress(int step, int maxStep, const QString& label);
0052     void slotLoginDone(int errCode, const QString& errMsg);
0053     void slotAddPhotoDone(int errCode, const QString& errMsg);
0054     void slotCreateAlbumDone(int errCode, const QString& errMsg,
0055                              const QString& newAlbumID);
0056     void slotListAlbumsDone(int errCode, const QString& errMsg,
0057                             const QList<FbAlbum>& albumsList);
0058 
0059     void slotUserChangeRequest();
0060     void slotReloadAlbumsRequest(long long userID);
0061     void slotNewAlbumRequest();
0062     void slotStartTransfer();
0063     void slotImageListChanged();
0064     void slotStopAndCloseProgressBar();
0065 
0066     void slotFinished();
0067     void slotCancelClicked();
0068 
0069 private:
0070 
0071     void    setProfileAID(long long userID);
0072     QString getImageCaption(const QString& fileName);
0073     bool    prepareImageForUpload(const QString& imgPath, QString& caption);
0074 
0075     void    uploadNextPhoto();
0076 
0077     void    readSettings();
0078     void    writeSettings();
0079 
0080     void    authenticate(bool forceLogin);
0081 
0082     void    buttonStateChange(bool state);
0083 
0084     void    closeEvent(QCloseEvent*)    override;
0085 
0086 private:
0087 
0088     class Private;
0089     Private* const d;
0090 };
0091 
0092 } // namespace DigikamGenericFaceBookPlugin
0093 
0094 #endif // DIGIKAM_FB_WINDOW_H