2
* Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
4
* You may use this file under the terms of the BSD license as follows:
6
* "Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions are
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in
13
* the documentation and/or other materials provided with the
15
* * Neither the name of Nemo Mobile nor the names of its contributors
16
* may be used to endorse or promote products derived from this
17
* software without specific prior written permission.
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
35
#include "diriteminfo.h"
40
class IORequest : public QObject
51
DirListExternalFSChanges,
54
virtual void run() = 0;
55
RequestType type() const;
58
// hide this because IORequest should *NOT* be parented directly
59
using QObject::setParent;
67
class IORequestLoader : public IORequest
78
IORequestLoader( const QString &pathName,
82
IORequestLoader( const QString& trashRootDir,
83
const QString &pathName,
87
virtual ~IORequestLoader();
88
DirItemInfoList getContents();
91
void itemsAdded(const DirItemInfoList &files);
94
DirItemInfoList getNormalContent();
95
DirItemInfoList getTrashContent();
96
virtual DirItemInfoList getNetworkContent();
97
DirItemInfoList add(const QString &pathName, QDir::Filters filter,
98
bool isRecursive, DirItemInfoList directoryContents);
100
LoaderType mLoaderType;
102
QDir::Filters mFilter;
104
QString mTtrashRootDir;
110
class DirListWorker : public IORequestLoader
114
explicit DirListWorker(const QString &pathName, QDir::Filters filter, const bool isRecursive);
115
explicit DirListWorker(const QString& trashRootDir, const QString &pathName, QDir::Filters filter, const bool isRecursive);
116
virtual ~DirListWorker();
120
void workerFinished();
127
class TrashListWorker : public DirListWorker
131
explicit TrashListWorker(const QString &trashRoot, const QString& path, QDir::Filters filter);
132
virtual ~TrashListWorker();
137
class ExternalFileSystemChangesWorker : public IORequestLoader
141
explicit ExternalFileSystemChangesWorker(const DirItemInfoList& content,
142
const QString &pathName,
143
QDir::Filters filter,
144
const bool isRecursive);
145
virtual ~ExternalFileSystemChangesWorker();
149
int compareItems(const DirItemInfoList& contentNew);
152
void removed(const DirItemInfo&);
153
void changed(const DirItemInfo&);
154
void added(const DirItemInfo& );
157
QHash<QString, DirItemInfo> m_curContent; //!< using hash because the vector can be in any order
162
class ExternalFileSystemTrashChangesWorker : public ExternalFileSystemChangesWorker
167
ExternalFileSystemTrashChangesWorker(const QStringList& pathNames,
168
const DirItemInfoList& list,
169
QDir::Filters filter);
170
virtual ~ExternalFileSystemTrashChangesWorker();
173
QStringList m_pathList;
178
#endif // IOREQUEST_H