1 /* ============================================================
2  *
3  * This file is a part of KDE project
4  *
5  *
6  * Date        : 2010-11-15
7  * Description : a kipi plugin to export images to VKontakte web service
8  *
9  * Copyright (C) 2011, 2012, 2015  Alexander Potashev <aspotashev@gmail.com>
10  *
11  * GUI based on Yandex.Fotki KIPI Plugin
12  * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
13  * Copyright (C) 2008-2018 by Gilles Caulier <caulier dot gilles at gmail dot com>
14  * Copyright (C) 2009      by Luka Renko <lure at kubuntu dot org>
15  * Copyright (C) 2010      by Roman Tsisyk <roman at tsisyk dot com>
16  *
17  * This program is free software; you can redistribute it
18  * and/or modify it under the terms of the GNU General
19  * Public License as published by the Free Software Foundation;
20  * either version 2, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * ============================================================ */
28 
29 #ifndef VKWINDOW_H
30 #define VKWINDOW_H
31 
32 // Local includes
33 
34 #include "kptooldialog.h"
35 
36 class QLabel;
37 class KJob;
38 
39 namespace KIPI
40 {
41     class Interface;
42     class UploadWidget;
43 }
44 
45 namespace KIPIPlugins
46 {
47     class KPImagesList;
48     class KPProgressWidget;
49 }
50 
51 namespace Vkontakte
52 {
53     class VkApi;
54 }
55 
56 using namespace KIPI;
57 using namespace KIPIPlugins;
58 
59 namespace KIPIVkontaktePlugin
60 {
61 
62 class AlbumChooserWidget;
63 class AuthInfoWidget;
64 
65 class VkontakteWindow : public KPToolDialog
66 {
67     Q_OBJECT
68 
69 public:
70 
71     VkontakteWindow(bool import, QWidget* const parent);
72     ~VkontakteWindow();
73 
74     /**
75      * Use this method to (re-)activate the dialog after it has been created
76      * to display it. This also loads the currently selected images.
77      */
78     void startReactivation();
79 
80 Q_SIGNALS:
81 
82     void signalUpdateBusyStatus(bool busy);
83 
84 protected Q_SLOTS:
85 
86     // requesting photo information
87     void slotPhotoUploadDone(KJob* kjob);
88 
89     void slotStartTransfer();
90 
91     void slotFinished();
92 
93     void updateBusyStatus(bool busy);
94     void updateBusyStatusReady();
95 
96     void authenticated();
97     void authCleared();
98     void updateHeaderLabel();
99 
100 protected:
101 
102     void initAccountBox();
103 
104     void readSettings();
105     void writeSettings();
106 
107     void reset();
108 
109     void handleVkError(KJob* kjob);
110 
111     void closeEvent(QCloseEvent* event) override;
112 
113 protected:
114 
115     /// Plugin
116     bool                           m_import;
117 
118     /// User interface
119     QWidget*                       m_mainWidget;
120     QWidget*                       m_settingsBox;
121     QLabel*                        m_headerLabel;
122 
123     /// accounts
124     AuthInfoWidget*                m_accountBox;
125 
126     // album selection
127     AlbumChooserWidget*            m_albumsBox;
128 
129     /// options
130     //QCheckBox*                    m_checkKeepOriginal;
131 
132     KPImagesList*                  m_imgList;
133     UploadWidget*                  m_uploadWidget;
134 
135     KPProgressWidget*              m_progressBar;
136 
137     /// Pointers to running jobs
138     QList<KJob*>                   m_jobs;
139 
140     Vkontakte::VkApi*              m_vkapi;
141 
142     int                            m_albumToSelect;
143 
144     QString                        m_appId;
145 };
146 
147 } // namespace KIPIVkontaktePlugin
148 
149 #endif // VKWINDOW_H
150