File indexing completed on 2025-03-09 03:52:14

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-09-28
0007  * Description : a tool to export image to a KIO accessible
0008  *               location
0009  *
0010  * SPDX-FileCopyrightText: 2006-2009 by Johannes Wienke <languitar at semipol dot de>
0011  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_FT_EXPORT_WINDOW_H
0018 #define DIGIKAM_FT_EXPORT_WINDOW_H
0019 
0020 // Qt includes
0021 
0022 #include <QUrl>
0023 
0024 // Local includes
0025 
0026 #include "wstooldialog.h"
0027 #include "dinfointerface.h"
0028 
0029 class KJob;
0030 
0031 namespace KIO
0032 {
0033     class Job;
0034 }
0035 
0036 using namespace Digikam;
0037 
0038 namespace DigikamGenericFileTransferPlugin
0039 {
0040 
0041 class FTExportWidget;
0042 
0043 /**
0044  * Main window of the KIOExport tool.
0045  */
0046 
0047 class FTExportWindow: public WSToolDialog
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052 
0053     /**
0054      * Constructor.
0055      *
0056      * @param parent the parent QWidget
0057      */
0058     explicit FTExportWindow(DInfoInterface* const iface, QWidget* const parent);
0059 
0060     /**
0061      * Destructor.
0062      */
0063     ~FTExportWindow() override;
0064 
0065     /**
0066      * Use this method to (re-)activate the dialog after it has been created
0067      * to display it. This also loads the currently selected images.
0068      */
0069     void reactivate();
0070 
0071 private Q_SLOTS:
0072 
0073     /**
0074      * Processes changes on the image list.
0075      */
0076     void slotImageListChanged();
0077 
0078     /**
0079      * Starts uploading the selected images.
0080      */
0081     void slotUpload();
0082 
0083     /**
0084      * Processes changes in the target url.
0085      */
0086     void slotTargetUrlChanged(const QUrl& target);
0087 
0088     /**
0089      * Removes the copied image from the image list.
0090      */
0091     void slotCopyingDone(KIO::Job* job, const QUrl& from, const QUrl& to,
0092                          const QDateTime& mtime, bool directory, bool renamed);
0093 
0094     /**
0095      * Re-enables the dialog after the job finished and displays a warning if
0096      * something didn't work.
0097      */
0098     void slotCopyingFinished(KJob* job);
0099 
0100     void slotFinished();
0101 
0102 protected:
0103 
0104     /**
0105      * Handle Close event from dialog title bar.
0106      */
0107     void closeEvent(QCloseEvent* e) override;
0108 
0109     /**
0110      * Refresh status (enabled / disabled) of the upload button according to
0111      * contents of the image list and the specified target.
0112      */
0113     void updateUploadButton();
0114 
0115     /**
0116      * Restores settings.
0117      */
0118     void restoreSettings();
0119 
0120     /**
0121      * Saves settings.
0122      */
0123     void saveSettings();
0124 
0125 private:
0126 
0127     class Private;
0128     Private* const d;
0129 };
0130 
0131 } // namespace DigikamGenericFileTransferPlugin
0132 
0133 #endif // DIGIKAM_FT_EXPORT_WINDOW_H