File indexing completed on 2025-01-19 03:55:51

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2015-06-15
0007  * Description : IO Jobs for file systems jobs
0008  *
0009  * SPDX-FileCopyrightText: 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0010  * SPDX-FileCopyrightText: 2018 by Maik Qualmann <metzpinguin at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IO_JOB_H
0017 #define DIGIKAM_IO_JOB_H
0018 
0019 // Qt includes
0020 
0021 #include <QUrl>
0022 
0023 // Local includes
0024 
0025 #include "actionthreadbase.h"
0026 #include "digikam_export.h"
0027 #include "iojobdata.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class ItemInfo;
0033 
0034 class DIGIKAM_GUI_EXPORT IOJob : public ActionJob
0035 {
0036     Q_OBJECT
0037 
0038 protected:
0039 
0040     IOJob();
0041 
0042 Q_SIGNALS:
0043 
0044     void signalError(const QString& errMsg);
0045     void signalOneProccessed(const QUrl& url);
0046 
0047 private:
0048 
0049     // Disable
0050     explicit IOJob(QObject*);
0051 };
0052 
0053 // ---------------------------------------
0054 
0055 class DIGIKAM_GUI_EXPORT CopyOrMoveJob : public IOJob
0056 {
0057     Q_OBJECT
0058 
0059 public:
0060 
0061     explicit CopyOrMoveJob(IOJobData* const data);
0062 
0063 protected:
0064 
0065     void run() override;
0066 
0067 private:
0068 
0069     // Disable
0070     CopyOrMoveJob(QObject*);
0071 
0072 private:
0073 
0074     IOJobData* m_data;
0075 };
0076 
0077 // ---------------------------------------
0078 
0079 class DIGIKAM_GUI_EXPORT DeleteJob : public IOJob
0080 {
0081     Q_OBJECT
0082 
0083 public:
0084 
0085     explicit DeleteJob(IOJobData* const data);
0086 
0087 protected:
0088 
0089     void run() override;
0090 
0091 private:
0092 
0093     // Disable
0094     DeleteJob(QObject*);
0095 
0096 private:
0097 
0098     IOJobData* m_data;
0099 };
0100 
0101 // ---------------------------------------
0102 
0103 class DIGIKAM_GUI_EXPORT RenameFileJob : public IOJob
0104 {
0105     Q_OBJECT
0106 
0107 public:
0108 
0109     explicit RenameFileJob(IOJobData* const data);
0110 
0111 Q_SIGNALS:
0112 
0113     void signalRenameFailed(const QUrl& url);
0114 
0115 protected:
0116 
0117     void run() override;
0118 
0119 private:
0120 
0121     // Disable
0122     RenameFileJob(QObject*);
0123 
0124 private:
0125 
0126     IOJobData* m_data;
0127 };
0128 
0129 // ----------------------------------------------
0130 
0131 class DIGIKAM_GUI_EXPORT DTrashItemsListingJob : public IOJob
0132 {
0133     Q_OBJECT
0134 
0135 public:
0136 
0137     explicit DTrashItemsListingJob(const QString& collectionPath);
0138 
0139 Q_SIGNALS:
0140 
0141     void trashItemInfo(const DTrashItemInfo& info);
0142 
0143 protected:
0144 
0145     void run() override;
0146 
0147 private:
0148 
0149     // Disable
0150     DTrashItemsListingJob(QObject*);
0151 
0152 private:
0153 
0154     QString m_collectionPath;
0155 };
0156 
0157 // ----------------------------------------------
0158 
0159 class DIGIKAM_GUI_EXPORT RestoreDTrashItemsJob : public IOJob
0160 {
0161     Q_OBJECT
0162 
0163 public:
0164 
0165     explicit RestoreDTrashItemsJob(IOJobData* const data);
0166 
0167 protected:
0168 
0169     void run() override;
0170 
0171 private:
0172 
0173     // Disable
0174     RestoreDTrashItemsJob(QObject*);
0175 
0176 private:
0177 
0178     IOJobData* m_data;
0179 };
0180 
0181 // ----------------------------------------------
0182 
0183 class DIGIKAM_GUI_EXPORT EmptyDTrashItemsJob : public IOJob
0184 {
0185     Q_OBJECT
0186 
0187 public:
0188 
0189     explicit EmptyDTrashItemsJob(IOJobData* const data);
0190 
0191 protected:
0192 
0193     void run() override;
0194 
0195 private:
0196 
0197     // Disable
0198     EmptyDTrashItemsJob(QObject*);
0199 
0200 private:
0201 
0202     IOJobData* m_data;
0203 };
0204 
0205 // ----------------------------------------------
0206 
0207 class DIGIKAM_GUI_EXPORT BuildTrashCountersJob : public IOJob
0208 {
0209     Q_OBJECT
0210 
0211 public:
0212 
0213     explicit BuildTrashCountersJob();
0214 
0215 Q_SIGNALS:
0216 
0217     void signalTrashCountersMap(const QMap<QString, int>& counterMap);
0218 
0219 protected:
0220 
0221     void run() override;
0222 
0223 private:
0224 
0225     // Disable
0226     BuildTrashCountersJob(QObject*);
0227 };
0228 
0229 } // namespace Digikam
0230 
0231 #endif // DIGIKAM_IO_JOB_H