File indexing completed on 2024-05-12 05:37:17

0001 /*
0002     SPDX-FileCopyrightText: 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Plasma5Support/DataEngine>
0010 
0011 class KDirWatch;
0012 
0013 /**
0014  * This class evaluates the basic expressions given in the interface.
0015  */
0016 class FileBrowserEngine : public Plasma5Support::DataEngine
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     FileBrowserEngine(QObject *parent);
0022     ~FileBrowserEngine() override;
0023 
0024 protected:
0025     bool sourceRequestEvent(const QString &path) override;
0026     void init();
0027 
0028 protected Q_SLOTS:
0029     void dirDirty(const QString &path);
0030     void dirCreated(const QString &path);
0031     void dirDeleted(const QString &path);
0032 
0033 private:
0034     enum EventType {
0035         INIT,
0036         DIRTY,
0037         CREATED,
0038         DELETED,
0039     };
0040     enum ObjectType {
0041         NOTHING,
0042         FILE,
0043         DIRECTORY,
0044     };
0045 
0046     KDirWatch *const m_dirWatch;
0047     void updateData(const QString &path, EventType event);
0048     void clearData(const QString &path);
0049 
0050     // QMap < QString, QStringList > m_regiteredListeners;
0051 };