1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000-2012 David Faure <faure@kde.org> |
4 | SPDX-FileCopyrightText: 2006 Thiago Macieira <thiago@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #include "kdirnotify.h" |
10 | #include <QUrl> |
11 | |
12 | /* |
13 | * Implementation of interface class OrgKdeKDirNotifyInterface |
14 | */ |
15 | |
16 | OrgKdeKDirNotifyInterface::OrgKdeKDirNotifyInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) |
17 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) |
18 | { |
19 | } |
20 | |
21 | OrgKdeKDirNotifyInterface::~OrgKdeKDirNotifyInterface() |
22 | { |
23 | } |
24 | |
25 | static void emitSignal(const QString &signalName, const QVariantList &args) |
26 | { |
27 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/" ), interface: QLatin1String(org::kde::KDirNotify::staticInterfaceName()), name: signalName); |
28 | message.setArguments(args); |
29 | QDBusConnection::sessionBus().send(message); |
30 | } |
31 | |
32 | void OrgKdeKDirNotifyInterface::emitFileRenamed(const QUrl &src, const QUrl &dst) |
33 | { |
34 | emitSignal(QStringLiteral("FileRenamed" ), args: QVariantList{src.toString(), dst.toString()}); |
35 | emitSignal(QStringLiteral("FileRenamedWithLocalPath" ), args: QVariantList{src.toString(), dst.toString(), QString()}); |
36 | } |
37 | |
38 | void OrgKdeKDirNotifyInterface::emitFileRenamedWithLocalPath(const QUrl &src, const QUrl &dst, const QString &dstPath) |
39 | { |
40 | emitSignal(QStringLiteral("FileRenamed" ), args: QVariantList{src.toString(), dst.toString()}); |
41 | emitSignal(QStringLiteral("FileRenamedWithLocalPath" ), args: QVariantList{src.toString(), dst.toString(), dstPath}); |
42 | } |
43 | |
44 | void OrgKdeKDirNotifyInterface::emitFileMoved(const QUrl &src, const QUrl &dst) |
45 | { |
46 | emitSignal(QStringLiteral("FileMoved" ), args: QVariantList{src.toString(), dst.toString()}); |
47 | } |
48 | |
49 | void OrgKdeKDirNotifyInterface::emitFilesAdded(const QUrl &directory) |
50 | { |
51 | emitSignal(QStringLiteral("FilesAdded" ), args: QVariantList{QVariant(directory.toString())}); |
52 | } |
53 | |
54 | void OrgKdeKDirNotifyInterface::emitFilesChanged(const QList<QUrl> &fileList) |
55 | { |
56 | emitSignal(QStringLiteral("FilesChanged" ), args: QVariantList{QVariant(QUrl::toStringList(uris: fileList))}); |
57 | } |
58 | |
59 | void OrgKdeKDirNotifyInterface::emitFilesRemoved(const QList<QUrl> &fileList) |
60 | { |
61 | emitSignal(QStringLiteral("FilesRemoved" ), args: QVariantList{QVariant(QUrl::toStringList(uris: fileList))}); |
62 | } |
63 | |
64 | void OrgKdeKDirNotifyInterface::emitEnteredDirectory(const QUrl &url) |
65 | { |
66 | emitSignal(QStringLiteral("enteredDirectory" ), args: QVariantList{QVariant(url.toString())}); |
67 | } |
68 | |
69 | void OrgKdeKDirNotifyInterface::emitLeftDirectory(const QUrl &url) |
70 | { |
71 | emitSignal(QStringLiteral("leftDirectory" ), args: QVariantList{QVariant(url.toString())}); |
72 | } |
73 | |
74 | #include "moc_kdirnotify.cpp" |
75 | |