1 /***************************************************************************** 2 * Copyright (C) 2010 Jan Lepper <dehtris@yahoo.de> * 3 * Copyright (C) 2010-2019 Krusader Krew [https://krusader.org] * 4 * * 5 * This file is part of Krusader [https://krusader.org]. * 6 * * 7 * Krusader is free software: you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation, either version 2 of the License, or * 10 * (at your option) any later version. * 11 * * 12 * Krusader is distributed in the hope that it will be useful, * 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 * GNU General Public License for more details. * 16 * * 17 * You should have received a copy of the GNU General Public License * 18 * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * 19 *****************************************************************************/ 20 21 #ifndef DIRLISTERINTERFACE_H 22 #define DIRLISTERINTERFACE_H 23 24 // QtCore 25 #include <QObject> 26 #include <QUrl> 27 28 class FileItem; 29 30 /** 31 * A minimal interface representing a list of files in a directory. 32 */ 33 class DirListerInterface : public QObject 34 { 35 Q_OBJECT 36 public: DirListerInterface(QObject * parent)37 explicit DirListerInterface(QObject *parent) : QObject(parent) {} ~DirListerInterface()38 virtual ~DirListerInterface() {} 39 40 /** 41 * Return the file items of all files and directorys. Without current (".") and parent ("..") 42 * directory. 43 */ 44 virtual QList<FileItem *> fileItems() const = 0; 45 /** 46 * Return the number of all file items. 47 */ 48 virtual unsigned long numFileItems() const = 0; 49 /** 50 * Return true if the directory does not have a parent, else false. 51 */ 52 virtual bool isRoot() const = 0; 53 54 signals: 55 /** 56 * Emitted when scanning the directory for file items finished. The list of file items should 57 * now be updated by the view. 58 * @param dirChange true if changed to another directory. 59 */ 60 void scanDone(bool dirChange); 61 /** 62 * Emitted when all file items were removed. The file items may be deleted after this signal and 63 * should not be used anymore. 64 */ 65 void cleared(); 66 /** 67 * Emitted when a file was added to the list of file items (not by scan). 68 */ 69 void addedFileItem(FileItem *fileItem); 70 /** 71 * Emitted when a file item (with the same name) was replaced. 72 * The old file item will be deleted after this signal. 73 */ 74 void updatedFileItem(FileItem *newFileItem); 75 }; 76 77 #endif // DIRLISTERINTERFACE_H 78