Changeset View
Changeset View
Standalone View
Standalone View
kioslave/desktop/kio_desktop.cpp
Show All 22 Lines | |||||
23 | #include <KDesktopFile> | 23 | #include <KDesktopFile> | ||
24 | #include <KDirNotify> | 24 | #include <KDirNotify> | ||
25 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
26 | 26 | | |||
27 | #include <kio/udsentry.h> | 27 | #include <kio/udsentry.h> | ||
28 | 28 | | |||
29 | #include <QCoreApplication> | 29 | #include <QCoreApplication> | ||
30 | #include <QFile> | 30 | #include <QFile> | ||
31 | #include <QDBusInterface> | | |||
32 | #include <QDir> | 31 | #include <QDir> | ||
33 | #include <QStandardPaths> | 32 | #include <QStandardPaths> | ||
34 | 33 | | |||
34 | #include "kded_interface.h" | ||||
35 | #include "desktopnotifier_interface.h" | ||||
36 | | ||||
35 | extern "C" | 37 | extern "C" | ||
36 | { | 38 | { | ||
37 | int Q_DECL_EXPORT kdemain(int argc, char **argv) | 39 | int Q_DECL_EXPORT kdemain(int argc, char **argv) | ||
38 | { | 40 | { | ||
39 | // necessary to use other kio slaves | 41 | // necessary to use other kio slaves | ||
40 | QCoreApplication app(argc, argv); | 42 | QCoreApplication app(argc, argv); | ||
41 | app.setApplicationName("kio_desktop"); | 43 | app.setApplicationName("kio_desktop"); | ||
42 | 44 | | |||
43 | // start the slave | 45 | // start the slave | ||
44 | DesktopProtocol slave(argv[1], argv[2], argv[3]); | 46 | DesktopProtocol slave(argv[1], argv[2], argv[3]); | ||
45 | slave.dispatchLoop(); | 47 | slave.dispatchLoop(); | ||
46 | return 0; | 48 | return 0; | ||
47 | } | 49 | } | ||
48 | } | 50 | } | ||
49 | 51 | | |||
50 | DesktopProtocol::DesktopProtocol(const QByteArray& protocol, const QByteArray &pool, const QByteArray &app) | 52 | DesktopProtocol::DesktopProtocol(const QByteArray& protocol, const QByteArray &pool, const QByteArray &app) | ||
51 | : KIO::ForwardingSlaveBase(protocol, pool, app) | 53 | : KIO::ForwardingSlaveBase(protocol, pool, app) | ||
52 | { | 54 | { | ||
53 | checkLocalInstall(); | 55 | checkLocalInstall(); | ||
54 | 56 | | |||
55 | QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/kded"), QStringLiteral("org.kde.kded5")); | 57 | org::kde::kded5 kded(QStringLiteral("org.kde.kded5"), | ||
56 | kded.call(QStringLiteral("loadModule"), "desktopnotifier"); | 58 | QStringLiteral("/kded"), | ||
59 | QDBusConnection::sessionBus()); | ||||
60 | auto pending = kded.loadModule("desktopnotifier"); | ||||
61 | pending.waitForFinished(); | ||||
57 | } | 62 | } | ||
58 | 63 | | |||
59 | DesktopProtocol::~DesktopProtocol() | 64 | DesktopProtocol::~DesktopProtocol() | ||
60 | { | 65 | { | ||
61 | } | 66 | } | ||
62 | 67 | | |||
63 | void DesktopProtocol::checkLocalInstall() | 68 | void DesktopProtocol::checkLocalInstall() | ||
64 | { | 69 | { | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
119 | 124 | | |||
120 | void DesktopProtocol::listDir(const QUrl &url) | 125 | void DesktopProtocol::listDir(const QUrl &url) | ||
121 | { | 126 | { | ||
122 | KIO::ForwardingSlaveBase::listDir(url); | 127 | KIO::ForwardingSlaveBase::listDir(url); | ||
123 | 128 | | |||
124 | QUrl actual; | 129 | QUrl actual; | ||
125 | rewriteUrl(url, actual); | 130 | rewriteUrl(url, actual); | ||
126 | 131 | | |||
127 | QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/desktopnotifier"), QStringLiteral("org.kde.DesktopNotifier")); | 132 | org::kde::DesktopNotifier kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/desktopnotifier"), QDBusConnection::sessionBus()); | ||
128 | kded.call(QStringLiteral("watchDir"), actual.path()); | 133 | kded.watchDir(actual.path()); | ||
129 | } | 134 | } | ||
130 | 135 | | |||
131 | QString DesktopProtocol::desktopFile(KIO::UDSEntry &entry) const | 136 | QString DesktopProtocol::desktopFile(KIO::UDSEntry &entry) const | ||
132 | { | 137 | { | ||
133 | const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME); | 138 | const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME); | ||
134 | if (name == QLatin1String(".") || name == QLatin1String("..")) | 139 | if (name == QLatin1String(".") || name == QLatin1String("..")) | ||
135 | return QString(); | 140 | return QString(); | ||
136 | 141 | | |||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |