| 1 | /* |
| 2 | This file is part of the KDE libraries |
| 3 | SPDX-FileCopyrightText: 2017 Elvis Angelaccio <elvis.angelaccio@kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef KIOEXECD_H |
| 9 | #define KIOEXECD_H |
| 10 | |
| 11 | #include <KDEDModule> |
| 12 | |
| 13 | #include <QMap> |
| 14 | #include <QTimer> |
| 15 | #include <QUrl> |
| 16 | |
| 17 | class KDirWatch; |
| 18 | |
| 19 | class KIOExecd : public KDEDModule |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | Q_CLASSINFO("D-Bus Interface" , "org.kde.KIOExecd" ) |
| 23 | |
| 24 | public: |
| 25 | KIOExecd(QObject *parent, const QList<QVariant> &); |
| 26 | ~KIOExecd() override; |
| 27 | |
| 28 | public Q_SLOTS: |
| 29 | void watch(const QString &path, const QString &destUrl); |
| 30 | |
| 31 | private Q_SLOTS: |
| 32 | void slotDirty(const QString &path); |
| 33 | void slotDeleted(const QString &path); |
| 34 | void slotCreated(const QString &path); |
| 35 | void slotCheckDeletedFiles(); |
| 36 | |
| 37 | private: |
| 38 | KDirWatch *m_watcher; |
| 39 | // temporary file and associated remote file |
| 40 | QMap<QString, QUrl> m_watched; |
| 41 | // temporary file and the last date it was removed |
| 42 | QMap<QString, QDateTime> m_deleted; |
| 43 | QTimer m_timer; |
| 44 | }; |
| 45 | |
| 46 | #endif |
| 47 | |