digiKam
dio.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2005-05-17
7  * Description : low level files management interface.
8  *
9  * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2012-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2018 by Maik Qualmann <metzpinguin at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * 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_DIO_H
27 #define DIGIKAM_DIO_H
28 
29 // Qt includes
30 
31 #include <QObject>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 #include "dtrashiteminfo.h"
37 
38 class QUrl;
39 
40 namespace Digikam
41 {
42 
43 class Album;
44 class PAlbum;
45 class ItemInfo;
46 class IOJobData;
47 class ProgressItem;
48 
49 class DIGIKAM_GUI_EXPORT DIO : public QObject
50 {
51  Q_OBJECT
52 
53 public:
54 
55  static DIO* instance();
56 
57  static void cleanUp();
58 
59  static bool itemsUnderProcessing();
60 
66  static void copy(PAlbum* const src, PAlbum* const dest);
67 
69  static void copy(const QList<ItemInfo>& infos, PAlbum* const dest);
70 
72  static void copy(const QUrl& src, PAlbum* const dest);
73 
75  static void copy(const QList<QUrl>& srcList, PAlbum* const dest);
76 
78  static void copy(const QList<ItemInfo>& infos, const QUrl& dest);
79 
81  static void move(PAlbum* const src, PAlbum* const dest);
82 
84  static void move(const QList<ItemInfo>& infos, PAlbum* const dest);
85 
87  static void move(const QUrl& src, PAlbum* const dest);
88 
90  static void move(const QList<QUrl>& srcList, PAlbum* const dest);
91 
92  static void del(const QList<ItemInfo>& infos, bool useTrash);
93  static void del(const ItemInfo& info, bool useTrash);
94  static void del(PAlbum* const album, bool useTrash);
95 
97  static void rename(const QUrl& src, const QString& newName, bool overwrite = false);
98 
100  static void restoreTrash(const DTrashItemInfoList& infos);
101  static void emptyTrash(const DTrashItemInfoList& infos);
102 
103 Q_SIGNALS:
104 
107  void signalRenameFailed(const QUrl& url);
108 
109 private:
110 
111  void processJob(IOJobData* const data);
112  void createJob(IOJobData* const data);
113 
114  QString getItemString(IOJobData* const data) const;
115  ProgressItem* getProgressItem(IOJobData* const data) const;
116  void addAlbumChildrenToList(QList<int>& list, Album* const album);
117 
118 private Q_SLOTS:
119 
120  void slotResult();
121  void slotOneProccessed(const QUrl& url);
122  void slotCancel(ProgressItem* item);
123 
124 private:
125 
126  // Disable
127  DIO();
128  explicit DIO(QObject*) = delete;
129  ~DIO() override;
130 
131 private:
132 
133  int m_processingCount;
134 
135  friend class DIOCreator;
136 };
137 
138 } // namespace Digikam
139 
140 #endif // DIGIKAM_DIO_H
Abstract base class for all album types.
Definition: album.h:67
Definition: dio.h:50
void signalRenameFinished()
void signalTrashFinished()
void signalRenameFailed(const QUrl &url)
Definition: iojobdata.h:45
Definition: iteminfo.h:78
Definition: album.h:357
Definition: progressmanager.h:45
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43