Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/remote/kdedmodule/remotedirnotify.cpp
- This file was added.
1 | /* This file is part of the KDE Project | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2004 Kévin Ottens <ervin ipsquad net> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License version 2 as published by the Free Software Foundation. | ||||
7 | | ||||
8 | This library is distributed in the hope that it will be useful, | ||||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
11 | Library General Public License for more details. | ||||
12 | | ||||
13 | You should have received a copy of the GNU Library General Public License | ||||
14 | along with this library; see the file COPYING.LIB. If not, write to | ||||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
16 | Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #include "remotedirnotify.h" | ||||
20 | | ||||
21 | #include <KDirNotify> | ||||
22 | #include <KDirWatch> | ||||
23 | | ||||
24 | #include <QStandardPaths> | ||||
25 | #include <QUrl> | ||||
26 | | ||||
27 | RemoteDirNotify::RemoteDirNotify() | ||||
28 | { | ||||
29 | const QString path = QStringLiteral("%1/remoteview").arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); | ||||
30 | | ||||
31 | m_dirWatch = new KDirWatch(this); | ||||
32 | m_dirWatch->addDir(path, KDirWatch::WatchFiles); | ||||
33 | | ||||
34 | connect(m_dirWatch, &KDirWatch::created, this, &RemoteDirNotify::slotRemoteChanged); | ||||
35 | connect(m_dirWatch, &KDirWatch::deleted, this, &RemoteDirNotify::slotRemoteChanged); | ||||
36 | connect(m_dirWatch, &KDirWatch::dirty, this, &RemoteDirNotify::slotRemoteChanged); | ||||
37 | } | ||||
38 | | ||||
39 | void RemoteDirNotify::slotRemoteChanged() | ||||
40 | { | ||||
41 | org::kde::KDirNotify::emitFilesAdded(QUrl("remote:/")); | ||||
42 | } |