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 : 2018-02-24 0007 * Description : Container for IOJob data. 0008 * 0009 * SPDX-FileCopyrightText: 2018 by Maik Qualmann <metzpinguin at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_IO_JOB_DATA_H 0016 #define DIGIKAM_IO_JOB_DATA_H 0017 0018 // Qt includes 0019 0020 #include <QUrl> 0021 #include <QList> 0022 #include <QDateTime> 0023 0024 // Local includes 0025 0026 #include "digikam_export.h" 0027 #include "dtrashiteminfo.h" 0028 0029 namespace Digikam 0030 { 0031 0032 class PAlbum; 0033 class ItemInfo; 0034 0035 class DIGIKAM_GUI_EXPORT IOJobData 0036 { 0037 0038 public: 0039 0040 enum Operation 0041 { 0042 Unknown = 0, 0043 CopyAlbum, 0044 CopyImage, 0045 CopyFiles, 0046 CopyToExt, 0047 MoveAlbum, 0048 MoveImage, 0049 MoveFiles, 0050 Restore, 0051 Rename, 0052 Delete, 0053 Trash, 0054 Empty 0055 }; 0056 0057 enum FileConflict 0058 { 0059 Continue = 0, 0060 AutoRename, 0061 Overwrite 0062 }; 0063 0064 public: 0065 0066 explicit IOJobData(int operation, 0067 const QList<ItemInfo>& infos, 0068 PAlbum* const dest = nullptr); 0069 0070 explicit IOJobData(int operation, 0071 const QList<ItemInfo>& infos, 0072 const QUrl& dest); 0073 0074 explicit IOJobData(int operation, 0075 const QList<QUrl>& urls, 0076 PAlbum* const dest = nullptr); 0077 0078 explicit IOJobData(int operation, 0079 PAlbum* const src, 0080 PAlbum* const dest = nullptr); 0081 0082 explicit IOJobData(int operation, 0083 const QList<QUrl>& urls, 0084 const QUrl& dest); 0085 0086 explicit IOJobData(int operation, 0087 const ItemInfo& info, 0088 const QString& newName, 0089 bool overwrite = false); 0090 0091 explicit IOJobData(int operation, 0092 const DTrashItemInfoList& infos); 0093 0094 ~IOJobData(); 0095 0096 void setItemInfos(const QList<ItemInfo>& infos); 0097 void setSourceUrls(const QList<QUrl>& urls); 0098 0099 void setDestUrl(const QUrl& srcUrl, 0100 const QUrl& destUrl); 0101 0102 void setProgressId(const QString& id); 0103 0104 void setFileConflict(int fc); 0105 void setErrorOrCancel(bool err); 0106 0107 int operation() const; 0108 0109 int fileConflict() const; 0110 0111 bool errorOrCancel() const; 0112 0113 PAlbum* srcAlbum() const; 0114 PAlbum* destAlbum() const; 0115 0116 QUrl destUrl(const QUrl& srcUrl = QUrl()) const; 0117 QUrl getNextUrl() const; 0118 0119 QString destName(const QUrl& srcUrl) const; 0120 QString getProgressId() const; 0121 QDateTime jobTime() const; 0122 0123 ItemInfo findItemInfo(const QUrl& url) const; 0124 0125 QList<int> srcAlbumIds() const; 0126 QList<QUrl> sourceUrls() const; 0127 QList<ItemInfo> itemInfos() const; 0128 0129 DTrashItemInfoList trashItems() const; 0130 0131 private: 0132 0133 // Disable 0134 IOJobData(const IOJobData&) = delete; 0135 IOJobData& operator=(const IOJobData&) = delete; 0136 0137 private: 0138 0139 class Private; 0140 Private* const d; 0141 }; 0142 0143 } // namespace Digikam 0144 0145 #endif // DIGIKAM_IO_JOB_DATA_H