/*  This file is part of the KDE libraries
    Copyright (C) 2026 Ivailo Monev <xakepa10@gmail.com>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License version 2, as published by the Free Software Foundation.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef KDIRNOTIFY_H
#define KDIRNOTIFY_H

#include <QString>
#include <QStringList>
#include <QDBusAbstractInterface>
#include <kio/kio_export.h>

/*!
    KDirNotify can be used to inform KIO about changes in real or virtual file systems.
    Classes like KDirModel connect to the signals as in the following example to
    be able to keep caches up-to-date.

    \code
    kdirnotify = new KDirNotify(this);
    connect(kdirnotify, SIGNAL(FileRenamed(QString,QString)), SLOT(slotFileRenamed(QString,QString)));
    connect(kdirnotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString)));
    connect(kdirnotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList)));
    connect(kdirnotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList)));
    \endcode

    The second usage is to actually emit the signals. For that emitFileRenamed() and friends are
    to be used.

    @since 4.25
*/
class KIO_EXPORT KDirNotify: public QDBusAbstractInterface
{
    Q_OBJECT
public:
    KDirNotify(QObject *parent = nullptr);

Q_SIGNALS:
    void FileRenamed(const QString &src, const QString &dst);
    void FilesAdded(const QString &directory);
    void FilesChanged(const QStringList &fileList);
    void FilesRemoved(const QStringList &fileList);

public:
    static void emitFileRenamed(const QString &src, const QString &dst);
    static void emitFilesAdded(const QString &directory);
    static void emitFilesChanged(const QStringList &fileList);
    static void emitFilesRemoved(const QStringList &fileList);
};

#endif
