File indexing completed on 2024-05-19 03:58:11

0001 /*
0002     This file is part of the KDE Project
0003     SPDX-FileCopyrightText: 2004 Kévin Ottens <ervin ipsquad net>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #include "remotedirnotify.h"
0009 
0010 #include <KDirNotify>
0011 #include <KDirWatch>
0012 
0013 #include <QStandardPaths>
0014 #include <QUrl>
0015 
0016 RemoteDirNotify::RemoteDirNotify()
0017 {
0018     const QString path = QStringLiteral("%1/remoteview").arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
0019 
0020     m_dirWatch = new KDirWatch(this);
0021     m_dirWatch->addDir(path, KDirWatch::WatchFiles);
0022 
0023     connect(m_dirWatch, &KDirWatch::created, this, &RemoteDirNotify::slotRemoteChanged);
0024     connect(m_dirWatch, &KDirWatch::deleted, this, &RemoteDirNotify::slotRemoteChanged);
0025     connect(m_dirWatch, &KDirWatch::dirty, this, &RemoteDirNotify::slotRemoteChanged);
0026 }
0027 
0028 void RemoteDirNotify::slotRemoteChanged()
0029 {
0030     org::kde::KDirNotify::emitFilesAdded(QUrl(QStringLiteral("remote:/")));
0031 }
0032 
0033 #include "moc_remotedirnotify.cpp"