1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2011-02-11
7  * Description : a tool to export images to WikiMedia web service
8  *
9  * Copyright (C) 2011      by Alexandre Mendes <alex dot mendes1988 at gmail dot com>
10  * Copyright (C) 2011-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2012      by Parthasarathy Gopavarapu <gparthasarathy93 at gmail dot com>
12  * Copyright (C) 2013      by Peter Potrowl <peter dot potrowl at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_MEDIAWIKI_WINDOW_H
27 #define DIGIKAM_MEDIAWIKI_WINDOW_H
28 
29 // Local includes
30 
31 #include "wstooldialog.h"
32 #include "dinfointerface.h"
33 
34 class QCloseEvent;
35 
36 class KJob;
37 
38 using namespace Digikam;
39 
40 namespace DigikamGenericMediaWikiPlugin
41 {
42 
43 class MediaWikiWindow : public WSToolDialog
44 {
45     Q_OBJECT
46 
47 public:
48 
49     explicit MediaWikiWindow(DInfoInterface* const iface, QWidget* const parent);
50     ~MediaWikiWindow()                            override;
51 
52 public:
53 
54     void reactivate();
55     bool prepareImageForUpload(const QString& imgPath);
56 
57 private Q_SLOTS:
58 
59     void slotFinished();
60     void slotProgressCanceled();
61     void slotStartTransfer();
62     void slotChangeUserClicked();
63     void slotDoLogin(const QString& login,
64                      const QString& pass,
65                      const QString& wikiName,
66                      const QUrl& wikiUrl);
67     void slotEndUpload();
68     int  slotLoginHandle(KJob* loginJob);
69 
70 private:
71 
72     bool eventFilter(QObject* obj, QEvent* event) override;
73     void closeEvent(QCloseEvent*)                 override;
74     void readSettings();
75     void saveSettings();
76 
77 private:
78 
79     class Private;
80     Private* const d;
81 };
82 
83 } // namespace DigikamGenericMediaWikiPlugin
84 
85 #endif // DIGIKAM_MEDIAWIKI_WINDOW_H
86