File indexing completed on 2024-05-05 17:56:55
0001 /* 0002 SPDX-FileCopyrightText: 2010 Jan Lepper <dehtris@yahoo.de> 0003 SPDX-FileCopyrightText: 2010-2022 Krusader Krew <https://krusader.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef DIRLISTERINTERFACE_H 0009 #define DIRLISTERINTERFACE_H 0010 0011 // QtCore 0012 #include <QObject> 0013 #include <QUrl> 0014 0015 class FileItem; 0016 0017 /** 0018 * A minimal interface representing a list of files in a directory. 0019 */ 0020 class DirListerInterface : public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit DirListerInterface(QObject *parent) 0025 : QObject(parent) 0026 { 0027 } 0028 ~DirListerInterface() override = default; 0029 0030 /** 0031 * Return the file items of all files and directories. Without current (".") and parent ("..") 0032 * directory. 0033 */ 0034 virtual QList<FileItem *> fileItems() const = 0; 0035 /** 0036 * Return the number of all file items. 0037 */ 0038 virtual unsigned long numFileItems() const = 0; 0039 /** 0040 * Return true if the directory does not have a parent, else false. 0041 */ 0042 virtual bool isRoot() const = 0; 0043 0044 signals: 0045 /** 0046 * Emitted when scanning the directory for file items finished. The list of file items should 0047 * now be updated by the view. 0048 * @param dirChange true if changed to another directory. 0049 */ 0050 void scanDone(bool dirChange); 0051 /** 0052 * Emitted when all file items were removed. The file items may be deleted after this signal and 0053 * should not be used anymore. 0054 */ 0055 void cleared(); 0056 /** 0057 * Emitted when a file was added to the list of file items (not by scan). 0058 */ 0059 void addedFileItem(FileItem *fileItem); 0060 /** 0061 * Emitted when a file item (with the same name) was replaced. 0062 * The old file item will be deleted after this signal. 0063 */ 0064 void updatedFileItem(FileItem *newFileItem); 0065 }; 0066 0067 #endif // DIRLISTERINTERFACE_H