parent
457da122cc
commit
5b748d35e7
@ -0,0 +1,41 @@
|
||||
#include "dbusinterface.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
DBusInterface::DBusInterface()
|
||||
{
|
||||
QDBusConnection::sessionBus().registerObject("/org/freedesktop/FileManager1", this,
|
||||
QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface();
|
||||
|
||||
if (sessionInterface) {
|
||||
sessionInterface->registerService(QStringLiteral("org.freedesktop.FileManager1"), QDBusConnectionInterface::QueueService);
|
||||
}
|
||||
}
|
||||
|
||||
void DBusInterface::ShowFolders(const QStringList &uriList, const QString &startUpId)
|
||||
{
|
||||
Q_UNUSED(startUpId);
|
||||
|
||||
qDebug() << uriList;
|
||||
|
||||
QProcess::startDetached("cutefish-filemanager", uriList);
|
||||
}
|
||||
|
||||
void DBusInterface::ShowItems(const QStringList &uriList, const QString &startUpId)
|
||||
{
|
||||
Q_UNUSED(startUpId);
|
||||
|
||||
QProcess::startDetached("cutefish-filemanager", uriList);
|
||||
}
|
||||
|
||||
void DBusInterface::ShowItemProperties(const QStringList &uriList, const QString &startUpId)
|
||||
{
|
||||
Q_UNUSED(uriList);
|
||||
Q_UNUSED(startUpId);
|
||||
|
||||
// TODO
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
#ifndef DBUSINTERFACE_H
|
||||
#define DBUSINTERFACE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class DBusInterface : QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.freedesktop.FileManager1")
|
||||
|
||||
public:
|
||||
explicit DBusInterface();
|
||||
|
||||
Q_SCRIPTABLE void ShowFolders(const QStringList& uriList, const QString& startUpId);
|
||||
Q_SCRIPTABLE void ShowItems(const QStringList& uriList, const QString& startUpId);
|
||||
Q_SCRIPTABLE void ShowItemProperties(const QStringList& uriList, const QString& startUpId);
|
||||
};
|
||||
|
||||
#endif // DBUSINTERFACE_H
|
||||
Loading…
Reference in New Issue