| 1 | /* |
| 2 | This file is part of the KDE Project |
| 3 | SPDX-FileCopyrightText: 2004 Kévin Ottens <ervin ipsquad net> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-only |
| 6 | */ |
| 7 | |
| 8 | #include "remotedirnotify.h" |
| 9 | |
| 10 | #include <KDirNotify> |
| 11 | #include <KDirWatch> |
| 12 | |
| 13 | #include <QStandardPaths> |
| 14 | #include <QUrl> |
| 15 | |
| 16 | RemoteDirNotify::RemoteDirNotify() |
| 17 | { |
| 18 | const QString path = QStringLiteral("%1/remoteview" ).arg(a: QStandardPaths::writableLocation(type: QStandardPaths::GenericDataLocation)); |
| 19 | |
| 20 | m_dirWatch = new KDirWatch(this); |
| 21 | m_dirWatch->addDir(path, watchModes: KDirWatch::WatchFiles); |
| 22 | |
| 23 | connect(sender: m_dirWatch, signal: &KDirWatch::created, context: this, slot: &RemoteDirNotify::slotRemoteChanged); |
| 24 | connect(sender: m_dirWatch, signal: &KDirWatch::deleted, context: this, slot: &RemoteDirNotify::slotRemoteChanged); |
| 25 | connect(sender: m_dirWatch, signal: &KDirWatch::dirty, context: this, slot: &RemoteDirNotify::slotRemoteChanged); |
| 26 | } |
| 27 | |
| 28 | void RemoteDirNotify::slotRemoteChanged() |
| 29 | { |
| 30 | org::kde::KDirNotify::emitFilesAdded(directory: QUrl(QStringLiteral("remote:/" ))); |
| 31 | } |
| 32 | |
| 33 | #include "moc_remotedirnotify.cpp" |
| 34 | |