File indexing completed on 2024-04-21 16:33:13

0001 /*
0002     SPDX-FileCopyrightText: 2006 Csaba Karai <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2006-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SYNCHRONIZERDIRLIST_H
0009 #define SYNCHRONIZERDIRLIST_H
0010 
0011 // QtCore
0012 #include <QHash>
0013 #include <QObject>
0014 
0015 #include <KIO/Job>
0016 
0017 #include "../FileSystem/fileitem.h"
0018 
0019 class SynchronizerDirList : public QObject, public QHash<QString, FileItem *>
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     SynchronizerDirList(QWidget *w, bool ignoreHidden);
0025     ~SynchronizerDirList() override;
0026 
0027     FileItem *search(const QString &name, bool ignoreCase = false);
0028     FileItem *first();
0029     FileItem *next();
0030 
0031     inline const QString &url()
0032     {
0033         return currentUrl;
0034     }
0035     bool load(const QString &urlIn, bool wait = false);
0036 
0037 public slots:
0038 
0039     void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
0040     void slotListResult(KJob *job);
0041 
0042 signals:
0043     void finished(bool err);
0044 
0045 private:
0046     QHashIterator<QString, FileItem *> *fileIterator; //< Point to a dictionary of file items
0047     QWidget *parentWidget;
0048     bool busy;
0049     bool result;
0050     bool ignoreHidden;
0051     QString currentUrl;
0052 };
0053 
0054 #endif /* __SYNCHRONIZER_DIR_LIST_H__ */