vkwindow.h 3.99 KB
Newer Older
1
2
3
/* ============================================================
 *
 * This file is a part of kipi-plugins project
4
 * http://www.digikam.org
5
6
7
8
 *
 * Date        : 2010-11-15
 * Description : a kipi plugin to export images to VKontakte web service
 *
9
 * Copyright (C) 2011, 2012 by Alexander Potashev <aspotashev at gmail dot com>
10
11
12
 *
 * GUI based on Yandex.Fotki KIPI Plugin
 * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
Gilles Caulier's avatar
Gilles Caulier committed
13
 * Copyright (C) 2008-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
Gilles Caulier's avatar
Gilles Caulier committed
14
15
 * Copyright (C) 2009      by Luka Renko <lure at kubuntu dot org>
 * Copyright (C) 2010      by Roman Tsisyk <roman at tsisyk dot com>
16
17
18
19
20
21
22
23
24
25
26
27
28
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

Alexander Potashev's avatar
Alexander Potashev committed
29
30
#ifndef VKWINDOW_H
#define VKWINDOW_H
31
32
33
34
35

// libkvkontakte includes

#include <libkvkontakte/albuminfo.h>

Gilles Caulier's avatar
Gilles Caulier committed
36
37
38
// Local includes

#include "kptooldialog.h"
39
40
41
42
43
44
45

class QLabel;
class QSpinBox;
class QCheckBox;
class QGroupBox;
class QButtonGroup;
class QCloseEvent;
Alexander Potashev's avatar
Alexander Potashev committed
46
class QToolButton;
47
48
49
50
51
52
53
54
55
56

class KUrl;
class KPasswordDialog;
class KComboBox;
class KPushButton;
class KLineEdit;
class KJob;

namespace KIPI
{
Gilles Caulier's avatar
Gilles Caulier committed
57
58
    class Interface;
    class UploadWidget;
59
60
61
62
}

namespace KIPIPlugins
{
Gilles Caulier's avatar
Gilles Caulier committed
63
    class KPImagesList;
smit mehta's avatar
Polish    
smit mehta committed
64
    class KPProgressWidget;
65
66
}

Gilles Caulier's avatar
Gilles Caulier committed
67
68
69
using namespace KIPI;
using namespace KIPIPlugins;

70
71
72
namespace KIPIVkontaktePlugin
{

73
class VkAPI;
74
class AlbumChooserWidget;
75

Gilles Caulier's avatar
Gilles Caulier committed
76
class VkontakteWindow : public KPToolDialog
77
78
79
80
81
{
    Q_OBJECT

public:

Gilles Caulier's avatar
Gilles Caulier committed
82
    VkontakteWindow(bool import, QWidget* const parent);
83
84
85
86
87
88
89
90
91
92
93
    ~VkontakteWindow();

    /**
     * Use this method to (re-)activate the dialog after it has been created
     * to display it. This also loads the currently selected images.
     */
    void startReactivation();

    QString getDestinationPath() const;

Q_SIGNALS:
Gilles Caulier's avatar
Gilles Caulier committed
94

95
    void signalUpdateAuthInfo();
96
    void signalUpdateBusyStatus(bool busy);
97
98

protected Q_SLOTS:
Gilles Caulier's avatar
Gilles Caulier committed
99

100
101
102
103
    // ui slots
    void slotChangeUserClicked();

    // requesting album information
104
    void startGetFullName();
105
    void startGetUserId();
106
107
    void slotGetFullNameDone(KJob *kjob);
    void slotGetUserIdDone(KJob *kjob);
108
109

    // requesting photo information
110
    void slotPhotoUploadDone(KJob *kjob);
111
112
113
114
115

    void slotStartTransfer();

    void slotButtonClicked(int button);

116
    void slotFinished();
117

118
119
120
    void updateAuthInfo();
    void updateBusyStatus(bool busy);

121
protected:
Gilles Caulier's avatar
Gilles Caulier committed
122

123
124
    void readSettings();
    void writeSettings();
125
126
127

    void reset();

Alexander Potashev's avatar
Alexander Potashev committed
128
    void startAuthentication(bool forceLogout);
129

130
131
    void handleVkError(KJob *kjob);

132
133
protected:

Gilles Caulier's avatar
Gilles Caulier committed
134
135
136
137
138
    /// Plugin
    bool                           m_import;

    /// User interface
    QWidget*                       m_mainWidget;
139
    QWidget*                       m_settingsBox;
140

Gilles Caulier's avatar
Gilles Caulier committed
141
142
143
144
145
    /// accounts
    QGroupBox*                     m_accountBox;
    QLabel*                        m_loginLabel;
    QLabel*                        m_headerLabel;
    KPushButton*                   m_changeUserButton;
146

147
148
    // album selection
    AlbumChooserWidget*            m_albumsBox;
149

Gilles Caulier's avatar
Gilles Caulier committed
150
151
    /// options
//     QCheckBox*                  m_checkKeepOriginal;
152

Gilles Caulier's avatar
Gilles Caulier committed
153
    KPImagesList*                  m_imgList;
Gilles Caulier's avatar
Gilles Caulier committed
154
    UploadWidget*                  m_uploadWidget;
155

smit mehta's avatar
Polish    
smit mehta committed
156
    KPProgressWidget*              m_progressBar;
157

Gilles Caulier's avatar
Gilles Caulier committed
158
159
    /** Pointers to running jobs */
    QList<KJob*>                   m_jobs;
160

161
    VkAPI*                         m_vkapi;
162

Gilles Caulier's avatar
Gilles Caulier committed
163
164
    QString                        m_userFullName;
    int                            m_userId;
165

Gilles Caulier's avatar
Gilles Caulier committed
166
    int                            m_albumToSelect;
167

Gilles Caulier's avatar
Gilles Caulier committed
168
    QString                        m_appId;
169
170
171
172
};

} // namespace KIPIVkontaktePlugin

Alexander Potashev's avatar
Alexander Potashev committed
173
#endif // VKWINDOW_H