Note: this is only the structure of the interface Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>feat/improvements
parent
ae92cf1205
commit
fa084fcf02
@ -1,32 +0,0 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/">
|
||||
<interface name="org.freedesktop.impl.portal.FileChooser">
|
||||
<method name="OpenFile">
|
||||
<arg name="handle" type="o" direction="in" />
|
||||
<arg name="app_id" type="s" direction="in" />
|
||||
<arg name="parent_window" type="s" direction="in" />
|
||||
<arg name="title" type="s" direction="in" />
|
||||
<arg name="options" type="a{sv}" direction="in" />
|
||||
<arg name="response" type="u" direction="out" />
|
||||
<arg name="results" type="a{sv}" direction="out" />
|
||||
</method>
|
||||
<method name="SaveFile">
|
||||
<arg name="handle" type="o" direction="in" />
|
||||
<arg name="app_id" type="s" direction="in" />
|
||||
<arg name="parent_window" type="s" direction="in" />
|
||||
<arg name="title" type="s" direction="in" />
|
||||
<arg name="options" type="a{sv}" direction="in" />
|
||||
<arg name="response" type="u" direction="out" />
|
||||
<arg name="results" type="a{sv}" direction="out" />
|
||||
</method>
|
||||
<method name="SaveFiles">
|
||||
<arg name="handle" type="o" direction="in" />
|
||||
<arg name="app_id" type="s" direction="in" />
|
||||
<arg name="parent_window" type="s" direction="in" />
|
||||
<arg name="title" type="s" direction="in" />
|
||||
<arg name="options" type="a{sv}" direction="in" />
|
||||
<arg name="response" type="u" direction="out" />
|
||||
<arg name="results" type="a{sv}" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/org/freedesktop/portal/desktop/session">
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg type="s" name="xml_data" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Session">
|
||||
<method name="Close" />
|
||||
<signal name="Closed" />
|
||||
<property type="u" name="version" access="read" />
|
||||
</interface>
|
||||
</node>
|
@ -0,0 +1,220 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/org/freedesktop/portal/desktop">
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg type="s" name="xml_data" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
<method name="Get">
|
||||
<arg type="s" name="interface_name" direction="in" />
|
||||
<arg type="s" name="property_name" direction="in" />
|
||||
<arg type="v" name="value" direction="out" />
|
||||
</method>
|
||||
<method name="GetAll">
|
||||
<arg type="s" name="interface_name" direction="in" />
|
||||
<arg type="a{sv}" name="properties" direction="out" />
|
||||
</method>
|
||||
<method name="Set">
|
||||
<arg type="s" name="interface_name" direction="in" />
|
||||
<arg type="s" name="property_name" direction="in" />
|
||||
<arg type="v" name="value" direction="in" />
|
||||
</method>
|
||||
<signal name="PropertiesChanged">
|
||||
<arg type="s" name="interface_name" />
|
||||
<arg type="a{sv}" name="changed_properties" />
|
||||
<arg type="as" name="invalidated_properties" />
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.AppChooser">
|
||||
<method name="ChooseApplication">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="as" name="choices" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
<method name="UpdateChoices">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="as" name="choices" direction="in" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.DynamicLauncher">
|
||||
<method name="PrepareInstall">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="name" direction="in" />
|
||||
<arg type="v" name="icon_v" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
<method name="RequestInstallToken">
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
</method>
|
||||
<property type="u" name="SupportedLauncherTypes"
|
||||
access="read" />
|
||||
<property type="u" name="version" access="read" />
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.FileChooser">
|
||||
<method name="OpenFile">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
<method name="SaveFile">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
<method name="SaveFiles">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Account">
|
||||
<method name="GetUserInformation">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="window" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Access">
|
||||
<method name="AccessDialog">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="s" name="subtitle" direction="in" />
|
||||
<arg type="s" name="body" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Lockdown">
|
||||
<property type="b" name="disableprinting" access="readwrite" />
|
||||
<property type="b" name="disablesavetodisk"
|
||||
access="readwrite" />
|
||||
<property type="b" name="disableapplicationhandlers"
|
||||
access="readwrite" />
|
||||
<property type="b" name="disablelocation" access="readwrite" />
|
||||
<property type="b" name="disablecamera" access="readwrite" />
|
||||
<property type="b" name="disablemicrophone"
|
||||
access="readwrite" />
|
||||
<property type="b" name="disablesoundoutput"
|
||||
access="readwrite" />
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Email">
|
||||
<method name="ComposeEmail">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Print">
|
||||
<method name="Print">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="h" name="fd" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
<method name="PreparePrint">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="parent_window" direction="in" />
|
||||
<arg type="s" name="title" direction="in" />
|
||||
<arg type="a{sv}" name="settings" direction="in" />
|
||||
<arg type="a{sv}" name="page_setup" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
<arg type="a{sv}" name="results" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Settings">
|
||||
<method name="ReadAll">
|
||||
<arg type="as" name="namespaces" direction="in" />
|
||||
<arg type="a{sa{sv}}" name="value" direction="out" />
|
||||
</method>
|
||||
<method name="Read">
|
||||
<arg type="s" name="ns" direction="in" />
|
||||
<arg type="s" name="key" direction="in" />
|
||||
<arg type="v" name="value" direction="out" />
|
||||
</method>
|
||||
<signal name="SettingChanged">
|
||||
<arg type="s" name="ns" />
|
||||
<arg type="s" name="key" />
|
||||
<arg type="v" name="value" />
|
||||
</signal>
|
||||
<property type="u" name="version" access="read" />
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Inhibit">
|
||||
<method name="Inhibit">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="window" direction="in" />
|
||||
<arg type="u" name="flags" direction="in" />
|
||||
<arg type="a{sv}" name="options" direction="in" />
|
||||
</method>
|
||||
<method name="CreateMonitor">
|
||||
<arg type="o" name="handle" direction="in" />
|
||||
<arg type="o" name="session_handle" direction="in" />
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="window" direction="in" />
|
||||
<arg type="u" name="response" direction="out" />
|
||||
</method>
|
||||
<method name="QueryEndResponse">
|
||||
<arg type="o" name="session_handle" direction="in" />
|
||||
</method>
|
||||
<signal name="StateChanged">
|
||||
<arg type="o" name="session_handle" />
|
||||
<arg type="a{sv}" name="state" />
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.impl.portal.Notification">
|
||||
<method name="AddNotification">
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="id" direction="in" />
|
||||
<arg type="a{sv}" name="notification" direction="in" />
|
||||
</method>
|
||||
<method name="RemoveNotification">
|
||||
<arg type="s" name="app_id" direction="in" />
|
||||
<arg type="s" name="id" direction="in" />
|
||||
</method>
|
||||
<signal name="ActionInvoked">
|
||||
<arg type="s" name="app_id" />
|
||||
<arg type="s" name="id" />
|
||||
<arg type="s" name="action" />
|
||||
<arg type="av" name="parameter" />
|
||||
</signal>
|
||||
</interface>
|
||||
<node name="session" />
|
||||
</node>
|
@ -0,0 +1,652 @@
|
||||
/*******************************************************************************
|
||||
XDG desktop portal implementation for TDE
|
||||
Copyright © 2024 Mavridis Philippe <mavridisf@gmail.com>
|
||||
|
||||
This program or library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Improvements and feedback are welcome!
|
||||
*******************************************************************************/
|
||||
|
||||
// TQt
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusvariant.h>
|
||||
|
||||
// TDE
|
||||
#include <tdemessagebox.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
// Portal
|
||||
#include "PortalService.h"
|
||||
|
||||
#define INTROSPECTABLE_DBUS_SRVC "org.freedesktop.DBus.Introspectable"
|
||||
#define PORTAL_DBUS_SRVC "org.freedesktop.impl.portal.desktop.tde"
|
||||
#define PORTAL_DBUS_PATH "/org/freedesktop/portal/desktop"
|
||||
|
||||
#define FREEDESKTOP_DBUS_PROPERTIES_SRVC "org.freedesktop.DBus.Properties"
|
||||
|
||||
#define PORTAL_DBUS_APPCHOOSER_SRVC "org.freedesktop.impl.portal.AppChooser"
|
||||
#define PORTAL_DBUS_DYNAMICLAUNCHER_SRVC "org.freedesktop.impl.portal.DynamicLauncher"
|
||||
#define PORTAL_DBUS_FILECHOOSER_SRVC "org.freedesktop.impl.portal.FileChooser"
|
||||
#define PORTAL_DBUS_ACCOUNT_SRVC "org.freedesktop.impl.portal.Account"
|
||||
#define PORTAL_DBUS_ACCESS_SRVC "org.freedesktop.impl.portal.Access"
|
||||
#define PORTAL_DBUS_LOCKDOWN_SRVC "org.freedesktop.impl.portal.Lockdown"
|
||||
#define PORTAL_DBUS_EMAIL_SRVC "org.freedesktop.impl.portal.Email"
|
||||
#define PORTAL_DBUS_PRINT_SRVC "org.freedesktop.impl.portal.Print"
|
||||
#define PORTAL_DBUS_SESTTINGS_SRVC "org.freedesktop.impl.portal.Settings"
|
||||
#define PORTAL_DBUS_INHIBIT_SRVC "org.freedesktop.impl.portal.Inhibit"
|
||||
#define PORTAL_DBUS_NOTIFICATION_SRVC "org.freedesktop.impl.portal.Notification"
|
||||
|
||||
#define PORTAL_DBUS_SESSION_SRVC "org.freedesktop.impl.portal.Session"
|
||||
#define PORTAL_DBUS_SESSION_PATH "/org/freedesktop/portal/desktop/session"
|
||||
|
||||
PropertiesService::PropertiesService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertiesService::~PropertiesService(){
|
||||
}
|
||||
|
||||
void PropertiesService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
bool PropertiesService::Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error) {
|
||||
// do something
|
||||
// get interface
|
||||
// get param name from interface
|
||||
// value.value = TQT_DBusData::fromUInt64(131719);
|
||||
// value.signature = value.value.buildDBusSignature();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PropertiesService::Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PropertiesService::GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PropertiesService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString PropertiesService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Services
|
||||
*/
|
||||
|
||||
// // // // // // AccessService
|
||||
|
||||
AccessService::AccessService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
AccessService::~AccessService(){
|
||||
}
|
||||
|
||||
bool AccessService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString AccessService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool AccessService::AccessDialog(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title, const TQString& subtitle,
|
||||
const TQString& body, const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // AccountService
|
||||
|
||||
AccountService::AccountService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
AccountService::~AccountService(){
|
||||
}
|
||||
|
||||
bool AccountService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString AccountService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool AccountService::GetUserInformation(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& window, const TQMap<TQString, TQT_DBusVariant>& options,
|
||||
TQ_UINT32& response, TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccountService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // AppChooserService
|
||||
|
||||
AppChooserService::AppChooserService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
AppChooserService::~AppChooserService(){
|
||||
}
|
||||
|
||||
bool AppChooserService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString AppChooserService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool AppChooserService::ChooseApplication(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQStringList& choices,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppChooserService::UpdateChoices(const TQT_DBusObjectPath& handle,
|
||||
const TQStringList& choices, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void AppChooserService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // DynamicLauncherService
|
||||
|
||||
DynamicLauncherService::DynamicLauncherService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
DynamicLauncherService::~DynamicLauncherService(){
|
||||
}
|
||||
|
||||
bool DynamicLauncherService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString DynamicLauncherService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool DynamicLauncherService::PrepareInstall(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& name, const TQT_DBusVariant& icon_v,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DynamicLauncherService::RequestInstallToken(const TQString& app_id,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void DynamicLauncherService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // EmailService
|
||||
|
||||
EmailService::EmailService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
EmailService::~EmailService(){
|
||||
}
|
||||
|
||||
bool EmailService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString EmailService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool EmailService::ComposeEmail(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmailService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // FileChooserService
|
||||
|
||||
FileChooserService::FileChooserService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
FileChooserService::~FileChooserService(){
|
||||
}
|
||||
|
||||
bool FileChooserService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString FileChooserService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool FileChooserService::OpenFile(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileChooserService::SaveFile(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileChooserService::SaveFiles(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileChooserService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // InhibitService
|
||||
|
||||
InhibitService::InhibitService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
InhibitService::~InhibitService(){
|
||||
}
|
||||
|
||||
bool InhibitService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString InhibitService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool InhibitService::Inhibit(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& window, TQ_UINT32 flags,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InhibitService::CreateMonitor(const TQT_DBusObjectPath& handle,
|
||||
const TQT_DBusObjectPath& session_handle, const TQString& app_id,
|
||||
const TQString& window, TQ_UINT32& response, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InhibitService::QueryEndResponse(const TQT_DBusObjectPath& session_handle, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void InhibitService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // LockdownService
|
||||
|
||||
LockdownService::LockdownService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
LockdownService::~LockdownService(){
|
||||
}
|
||||
|
||||
bool LockdownService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString LockdownService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
void LockdownService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
|
||||
// // // // // // NotificationService
|
||||
|
||||
NotificationService::NotificationService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
NotificationService::~NotificationService(){
|
||||
}
|
||||
|
||||
bool NotificationService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString NotificationService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool NotificationService::AddNotification(const TQString& app_id, const TQString& id,
|
||||
const TQMap<TQString, TQT_DBusVariant>& notification, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NotificationService::RemoveNotification(const TQString& app_id,
|
||||
const TQString& id, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void NotificationService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // PrintService
|
||||
|
||||
PrintService::PrintService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
PrintService::~PrintService(){
|
||||
}
|
||||
|
||||
bool PrintService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString PrintService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool PrintService::Print(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title, const TQT_DBusUnixFd& fd,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PrintService::PreparePrint(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& settings,
|
||||
const TQMap<TQString, TQT_DBusVariant>& page_setup,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void PrintService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // SettingsService
|
||||
|
||||
SettingsService::SettingsService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
SettingsService::~SettingsService(){
|
||||
}
|
||||
|
||||
bool SettingsService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString SettingsService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool SettingsService::ReadAll(const TQStringList& namespaces,
|
||||
TQT_DBusDataMap<TQString>& value, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsService::Read(const TQString& _namespace,
|
||||
const TQString& key, TQT_DBusVariant& value, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void SettingsService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
|
||||
// // // // // // SessionService
|
||||
|
||||
SessionService::SessionService(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
SessionService::~SessionService(){
|
||||
}
|
||||
|
||||
bool SessionService::handleSignalSend(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString SessionService::objectPath() const {
|
||||
// do something
|
||||
return TQString();
|
||||
}
|
||||
|
||||
bool SessionService::Close(TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void SessionService::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
// // // // // // RootNodeService
|
||||
|
||||
RootNodeService::RootNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), mConnection(connection)
|
||||
{
|
||||
addChildNode(TQString("org"));
|
||||
registerObject(mConnection,TQString("/"));
|
||||
}
|
||||
|
||||
RootNodeService::~RootNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* RootNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// // // // // // OrgNodeService
|
||||
|
||||
OrgNodeService::OrgNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), mConnection(connection)
|
||||
{
|
||||
addChildNode(TQString("freedesktop"));
|
||||
registerObject(mConnection,TQString("/org"));
|
||||
}
|
||||
|
||||
OrgNodeService::~OrgNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* OrgNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// // // // // // FreeDesktopNodeService
|
||||
|
||||
FreeDesktopNodeService::FreeDesktopNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), mConnection(connection)
|
||||
{
|
||||
addChildNode(TQString("portal"));
|
||||
registerObject(mConnection,TQString("/org/freedesktop"));
|
||||
}
|
||||
|
||||
FreeDesktopNodeService::~FreeDesktopNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* FreeDesktopNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// // // // // // PortalNodeService
|
||||
|
||||
PortalNodeService::PortalNodeService(TQT_DBusConnection &conn)
|
||||
: DBusBaseNode(), mConnection(conn)
|
||||
{
|
||||
addChildNode(TQString("desktop"));
|
||||
registerObject(mConnection,TQString("/org/freedesktop/portal"));
|
||||
}
|
||||
|
||||
PortalNodeService::~PortalNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* PortalNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// // // // // // DesktopNodeService
|
||||
|
||||
DesktopNodeService::DesktopNodeService(TQT_DBusConnection &conn)
|
||||
: org::freedesktop::portal::desktopNode(),
|
||||
mConnection(conn)
|
||||
{
|
||||
addChildNode(TQString("session"));
|
||||
|
||||
mInterfaces.insert(INTROSPECTABLE_DBUS_SRVC, this);
|
||||
mInterfaces.insert(FREEDESKTOP_DBUS_PROPERTIES_SRVC, new PropertiesService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_APPCHOOSER_SRVC, new AppChooserService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_DYNAMICLAUNCHER_SRVC, new DynamicLauncherService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_FILECHOOSER_SRVC, new FileChooserService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_ACCOUNT_SRVC, new AccountService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_ACCESS_SRVC, new AccessService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_LOCKDOWN_SRVC, new LockdownService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_EMAIL_SRVC, new EmailService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_PRINT_SRVC, new PrintService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_SESTTINGS_SRVC, new SettingsService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_INHIBIT_SRVC, new InhibitService(mConnection));
|
||||
mInterfaces.insert(PORTAL_DBUS_NOTIFICATION_SRVC, new NotificationService(mConnection));
|
||||
// TODO implement Session handling
|
||||
// mInterfaces.insert(PORTAL_DBUS_SESSION_SRVC, new SessionService(mConnection));
|
||||
registerObject(mConnection,TQString(PORTAL_DBUS_PATH));
|
||||
}
|
||||
|
||||
DesktopNodeService::~DesktopNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* DesktopNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// // // // // // SessionNodeService
|
||||
|
||||
SessionNodeService::SessionNodeService(TQT_DBusConnection &conn)
|
||||
: org::freedesktop::portal::desktop::sessionNode(),
|
||||
mConnection(conn)
|
||||
{
|
||||
mInterfaces.insert(INTROSPECTABLE_DBUS_SRVC, new SessionService(mConnection));
|
||||
registerObject(mConnection,TQString(PORTAL_DBUS_SESSION_PATH));
|
||||
}
|
||||
|
||||
SessionNodeService::~SessionNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* SessionNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) mInterfaces[interfaceName];
|
||||
}
|
||||
|
||||
// kate: replace-tabs true; tab-width 4; indent-width 4;
|
@ -0,0 +1,501 @@
|
||||
/*******************************************************************************
|
||||
XDG desktop portal implementation for TDE
|
||||
Copyright © 2024 Mavridis Philippe <mavridisf@gmail.com>
|
||||
|
||||
This program or library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Improvements and feedback are welcome!
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __PORTAL_SERVICE_H
|
||||
#define __PORTAL_SERVICE_H
|
||||
|
||||
// TQt
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
#include <tqmap.h>
|
||||
|
||||
#include <printInterface.h>
|
||||
#include <settingsInterface.h>
|
||||
#include <notificationInterface.h>
|
||||
#include <lockdownInterface.h>
|
||||
#include <inhibitInterface.h>
|
||||
#include <filechooserInterface.h>
|
||||
#include <emailInterface.h>
|
||||
#include <dynamiclauncherInterface.h>
|
||||
#include <appchooserInterface.h>
|
||||
#include <accountInterface.h>
|
||||
#include <accessInterface.h>
|
||||
#include <sessionInterface.h>
|
||||
|
||||
#include <propertiesInterface.h>
|
||||
|
||||
#include <desktopNode.h>
|
||||
#include <dbusbaseNode.h>
|
||||
#include <sessionNode.h>
|
||||
|
||||
class PropertiesService: public org::freedesktop::DBus::PropertiesInterface
|
||||
{
|
||||
public:
|
||||
PropertiesService(TQT_DBusConnection&);
|
||||
virtual ~PropertiesService();
|
||||
|
||||
protected:
|
||||
bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
TQString objectPath() const;
|
||||
|
||||
bool Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error);
|
||||
bool Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error);
|
||||
bool GetAll(const TQString& interface, TQMap<TQString, TQT_DBusVariant>& properties, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class AccessService: public org::freedesktop::impl::portal::AccessInterface
|
||||
{
|
||||
public:
|
||||
AccessService(TQT_DBusConnection&);
|
||||
virtual ~AccessService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool AccessDialog(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title, const TQString& subtitle,
|
||||
const TQString& body, const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class AccountService: public org::freedesktop::impl::portal::AccountInterface
|
||||
{
|
||||
public:
|
||||
AccountService(TQT_DBusConnection&);
|
||||
virtual ~AccountService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool GetUserInformation(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& window, const TQMap<TQString, TQT_DBusVariant>& options,
|
||||
TQ_UINT32& response, TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class AppChooserService: public org::freedesktop::impl::portal::AppChooserInterface
|
||||
{
|
||||
public:
|
||||
AppChooserService(TQT_DBusConnection&);
|
||||
virtual ~AppChooserService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool ChooseApplication(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQStringList& choices,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
virtual bool UpdateChoices(const TQT_DBusObjectPath& handle,
|
||||
const TQStringList& choices, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class DynamicLauncherService: public org::freedesktop::impl::portal::DynamicLauncherInterface
|
||||
{
|
||||
public:
|
||||
DynamicLauncherService(TQT_DBusConnection&);
|
||||
virtual ~DynamicLauncherService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool PrepareInstall(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& name, const TQT_DBusVariant& icon_v,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestInstallToken(const TQString& app_id,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class EmailService: public org::freedesktop::impl::portal::EmailInterface
|
||||
{
|
||||
public:
|
||||
EmailService(TQT_DBusConnection&);
|
||||
virtual ~EmailService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool ComposeEmail(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class FileChooserService: public org::freedesktop::impl::portal::FileChooserInterface
|
||||
{
|
||||
public:
|
||||
FileChooserService(TQT_DBusConnection&);
|
||||
virtual ~FileChooserService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
protected:
|
||||
virtual bool OpenFile(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
virtual bool SaveFile(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
virtual bool SaveFiles(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class InhibitService: public org::freedesktop::impl::portal::InhibitInterface
|
||||
{
|
||||
public:
|
||||
InhibitService(TQT_DBusConnection&);
|
||||
virtual ~InhibitService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool Inhibit(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& window, TQ_UINT32 flags,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQT_DBusError& error);
|
||||
|
||||
virtual bool CreateMonitor(const TQT_DBusObjectPath& handle,
|
||||
const TQT_DBusObjectPath& session_handle, const TQString& app_id,
|
||||
const TQString& window, TQ_UINT32& response, TQT_DBusError& error);
|
||||
|
||||
virtual bool QueryEndResponse(const TQT_DBusObjectPath& session_handle, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class LockdownService: public org::freedesktop::impl::portal::LockdownInterface
|
||||
{
|
||||
public:
|
||||
LockdownService(TQT_DBusConnection&);
|
||||
virtual ~LockdownService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
// this requires Properties as there are properties handled here
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class NotificationService: public org::freedesktop::impl::portal::NotificationInterface
|
||||
{
|
||||
public:
|
||||
NotificationService(TQT_DBusConnection&);
|
||||
virtual ~NotificationService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool AddNotification(const TQString& app_id, const TQString& id,
|
||||
const TQMap<TQString, TQT_DBusVariant>& notification, TQT_DBusError& error);
|
||||
|
||||
virtual bool RemoveNotification(const TQString& app_id, const TQString& id, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class PrintService: public org::freedesktop::impl::portal::PrintInterface
|
||||
{
|
||||
public:
|
||||
PrintService(TQT_DBusConnection&);
|
||||
virtual ~PrintService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
virtual bool Print(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title, const TQT_DBusUnixFd& fd,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
virtual bool PreparePrint(const TQT_DBusObjectPath& handle, const TQString& app_id,
|
||||
const TQString& parent_window, const TQString& title,
|
||||
const TQMap<TQString, TQT_DBusVariant>& settings,
|
||||
const TQMap<TQString, TQT_DBusVariant>& page_setup,
|
||||
const TQMap<TQString, TQT_DBusVariant>& options, TQ_UINT32& response,
|
||||
TQMap<TQString, TQT_DBusVariant>& results, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class SettingsService: public org::freedesktop::impl::portal::SettingsInterface
|
||||
{
|
||||
public:
|
||||
SettingsService(TQT_DBusConnection&);
|
||||
virtual ~SettingsService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool ReadAll(const TQStringList& namespaces, TQT_DBusDataMap<
|
||||
TQString>& value, TQT_DBusError& error);
|
||||
|
||||
virtual bool Read(const TQString& _namespace, const TQString& key, TQT_DBusVariant& value, TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class SessionService: public org::freedesktop::impl::portal::SessionInterface
|
||||
{
|
||||
public:
|
||||
SessionService(TQT_DBusConnection&);
|
||||
virtual ~SessionService();
|
||||
|
||||
protected:
|
||||
// implement methods
|
||||
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
|
||||
virtual TQString objectPath() const;
|
||||
|
||||
protected:
|
||||
virtual bool Close(TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
// implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
/**
|
||||
* RootNodeService
|
||||
* Service: -
|
||||
* Path : /
|
||||
* Children: org
|
||||
*/
|
||||
class RootNodeService: public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
RootNodeService(TQT_DBusConnection&);
|
||||
virtual ~RootNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
/**
|
||||
* OrgNodeService
|
||||
* Service: -
|
||||
* Path : /org
|
||||
* Children: freedesktop
|
||||
*/
|
||||
class OrgNodeService: public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
OrgNodeService(TQT_DBusConnection&);
|
||||
virtual ~OrgNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
/**
|
||||
* FreeDesktopNodeService
|
||||
* Service: -
|
||||
* Path : /org/freedesktop
|
||||
* Children: portal
|
||||
*/
|
||||
class FreeDesktopNodeService: public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
FreeDesktopNodeService(TQT_DBusConnection&);
|
||||
virtual ~FreeDesktopNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
/**
|
||||
* PortalNodeService
|
||||
* Service: -
|
||||
* Path : /org/freedesktop/portal
|
||||
* Children: desktop
|
||||
*/
|
||||
class PortalNodeService: public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
PortalNodeService(TQT_DBusConnection&);
|
||||
virtual ~PortalNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
/*
|
||||
* DesktopNodeService
|
||||
* Service: org.freedesktop.DBus.Introspectable
|
||||
* Path : /org/freedesktop/portal/desktop
|
||||
* Children: session
|
||||
* Interfaces:
|
||||
*/
|
||||
class DesktopNodeService: public org::freedesktop::portal::desktopNode
|
||||
{
|
||||
public:
|
||||
DesktopNodeService(TQT_DBusConnection&);
|
||||
virtual ~DesktopNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
/*
|
||||
* SessionNodeService
|
||||
* Service: -
|
||||
* Path : /org/freedesktop/portal/desktop/session
|
||||
* Children: -
|
||||
*/
|
||||
class SessionNodeService: public org::freedesktop::portal::desktop::sessionNode
|
||||
{
|
||||
public:
|
||||
SessionNodeService(TQT_DBusConnection&);
|
||||
virtual ~SessionNodeService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> mInterfaces;
|
||||
TQT_DBusConnection mConnection;
|
||||
};
|
||||
|
||||
#endif // __DESTKOP_PORTAL_H
|
||||
|
||||
// kate: replace-tabs true; tab-width 4; indent-width 4;
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* PortalServiceDaemon.cpp
|
||||
*
|
||||
* Copyright (C) 2021 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of xdg portal services.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <tqtimer.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbuserror.h>
|
||||
|
||||
#include "PortalServiceDaemon.h"
|
||||
|
||||
// path /org/freedesktop/portal/desktop
|
||||
#define PORTALSERVICE_DBUS_SRVC "org.freedesktop.impl.portal.desktop.tde"
|
||||
|
||||
#define DBUS_CONNECTION_TIMEOUT 4000
|
||||
#define DBUS_CONNECTION_RETRY 3
|
||||
|
||||
PortalServiceDaemon::PortalServiceDaemon()
|
||||
: KUniqueApplication(),
|
||||
retryCount(0)
|
||||
{
|
||||
// init session connection to dbus
|
||||
if (!initDBUS()) {
|
||||
tqDebug("Failed to initialize the connection to DBus");
|
||||
TQTimer::singleShot(DBUS_CONNECTION_TIMEOUT, this, TQ_SLOT(slotReconnect()));
|
||||
retryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
PortalServiceDaemon::~PortalServiceDaemon()
|
||||
{
|
||||
// close D-Bus connection
|
||||
dbusConnectionClose();
|
||||
}
|
||||
|
||||
bool PortalServiceDaemon::initDBUS(){
|
||||
mConnection = TQT_DBusConnection::addConnection(TQT_DBusConnection::SessionBus, PORTALSERVICE_DBUS_SRVC);
|
||||
|
||||
if ( !mConnection.isConnected() ) {
|
||||
tqDebug("Failed to open connection to system message bus: "
|
||||
+ mConnection.lastError().message());
|
||||
return false;
|
||||
}
|
||||
mConnection.connect(this, TQ_SLOT(slotDbusSignal(const TQT_DBusMessage&)));
|
||||
|
||||
// try to get a specific service name
|
||||
if (!mConnection.requestName(PORTALSERVICE_DBUS_SRVC, TQT_DBusConnection::NoReplace))
|
||||
return false;
|
||||
|
||||
// make sure we get a reply
|
||||
mConnection.scheduleDispatch();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PortalServiceDaemon::dbusConnectionClose() {
|
||||
|
||||
if(rootService)
|
||||
{
|
||||
delete rootService;
|
||||
rootService=0;
|
||||
}
|
||||
if(orgService)
|
||||
{
|
||||
delete orgService;
|
||||
orgService=0;
|
||||
}
|
||||
if(freedesktopService)
|
||||
{
|
||||
delete freedesktopService;
|
||||
freedesktopService=0;
|
||||
}
|
||||
if(portalNodeService)
|
||||
{
|
||||
delete portalNodeService;
|
||||
portalNodeService=0;
|
||||
}
|
||||
if(desktopNodeService)
|
||||
{
|
||||
delete desktopNodeService;
|
||||
desktopNodeService=0;
|
||||
}
|
||||
if(sessionNodeService)
|
||||
{
|
||||
delete sessionNodeService;
|
||||
sessionNodeService=0;
|
||||
}
|
||||
|
||||
if(mConnection.isConnected()) {
|
||||
mConnection.disconnect(this, TQ_SLOT(slotDbusSignal(const TQT_DBusMessage&)));
|
||||
mConnection.closeConnection(PORTALSERVICE_DBUS_SRVC);
|
||||
}
|
||||
retryCount=0;
|
||||
}
|
||||
|
||||
void PortalServiceDaemon::slotReconnect() {
|
||||
|
||||
dbusConnectionClose();
|
||||
|
||||
if (!initDBUS()) {
|
||||
if (DBUS_CONNECTION_RETRY > retryCount) {
|
||||
tqFatal("Failed to initialize the connection to DBus");
|
||||
}
|
||||
TQTimer::singleShot(DBUS_CONNECTION_TIMEOUT, this, TQ_SLOT(slotReconnect()));
|
||||
retryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
void PortalServiceDaemon::slotDbusSignal(const TQT_DBusMessage& message) {
|
||||
TQString serviceName = message[0].toString();
|
||||
if ( message.interface() == TQString("org.freedesktop.DBus") &&
|
||||
message.member() == TQString("NameAcquired") &&
|
||||
serviceName == PORTALSERVICE_DBUS_SRVC )
|
||||
{
|
||||
tqDebug("TDEPortalService unique DBus name acquired: " + serviceName);
|
||||
rootService = new RootNodeService(mConnection);
|
||||
orgService = new OrgNodeService(mConnection);
|
||||
freedesktopService = new FreeDesktopNodeService(mConnection);
|
||||
portalNodeService = new PortalNodeService(mConnection);
|
||||
desktopNodeService = new DesktopNodeService(mConnection);
|
||||
//TODO: session needs clarification - perhaps it is registered here, via some app
|
||||
tqDebug("TDEPortalService service setup done.");
|
||||
}
|
||||
}
|
||||
|
||||
#include "PortalServiceDaemon.moc"
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* PortalServiceDaemon.h
|
||||
*
|
||||
* Copyright (C) 2021 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of kdbusPortalService.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef SRC_DAEMON_PORTALSERVICEDAEMON_H_
|
||||
#define SRC_DAEMON_PORTALSERVICEDAEMON_H_
|
||||
|
||||
#include <kuniqueapplication.h>
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusmessage.h>
|
||||
|
||||
#include "PortalService.h"
|
||||
|
||||
class PortalServiceDaemon : public KUniqueApplication
|
||||
{
|
||||
TQ_OBJECT
|
||||
|
||||
public:
|
||||
PortalServiceDaemon();
|
||||
virtual ~PortalServiceDaemon();
|
||||
|
||||
private:
|
||||
/*!
|
||||
* This function initialise the connection to the D-Bus daemon.
|
||||
* \return boolean with the result of the operation
|
||||
* \retval true if successful initialised D-Bus connection
|
||||
* \retval false if unsuccessful
|
||||
*/
|
||||
bool initDBUS();
|
||||
//! to close the connection to D-Bus
|
||||
void dbusConnectionClose();
|
||||
|
||||
private:
|
||||
RootNodeService *rootService;
|
||||
OrgNodeService *orgService;
|
||||
FreeDesktopNodeService *freedesktopService;
|
||||
PortalNodeService *portalNodeService;
|
||||
DesktopNodeService *desktopNodeService;
|
||||
SessionNodeService *sessionNodeService;
|
||||
|
||||
TQT_DBusConnection mConnection;
|
||||
int retryCount;
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
* This function does a reconnect to D-Bus.
|
||||
* \return void
|
||||
*/
|
||||
void slotReconnect();
|
||||
/*!
|
||||
* This function is to process D-Bus signals.
|
||||
* \return void
|
||||
*/
|
||||
void slotDbusSignal(const TQT_DBusMessage&);
|
||||
};
|
||||
|
||||
#endif /* SRC_DAEMON_PORTALSERVICEDAEMON_H_ */
|
Loading…
Reference in new issue