2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2017-10-06 19:22:50 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
2017-10-06 19:22:50 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-10-06 19:22:50 +00:00
|
|
|
#include "virtualkeyboard_dbus.h"
|
|
|
|
#include <QDBusConnection>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2021-02-26 15:16:45 +00:00
|
|
|
VirtualKeyboardDBus::VirtualKeyboardDBus(InputMethod *parent)
|
2017-10-06 19:22:50 +00:00
|
|
|
: QObject(parent)
|
2021-02-26 15:16:45 +00:00
|
|
|
, m_inputMethod(parent)
|
2017-10-06 19:22:50 +00:00
|
|
|
{
|
|
|
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualKeyboard"), this,
|
2021-02-23 15:12:38 +00:00
|
|
|
QDBusConnection::ExportAllProperties |
|
2022-01-14 11:16:49 +00:00
|
|
|
QDBusConnection::ExportScriptableContents | //qdbuscpp2xml doesn't support yet properties with NOTIFY
|
2017-10-06 19:22:50 +00:00
|
|
|
QDBusConnection::ExportAllSlots);
|
2021-02-26 15:16:45 +00:00
|
|
|
connect(parent, &InputMethod::activeChanged, this, &VirtualKeyboardDBus::activeChanged);
|
|
|
|
connect(parent, &InputMethod::enabledChanged, this, &VirtualKeyboardDBus::enabledChanged);
|
2021-07-21 00:04:33 +00:00
|
|
|
connect(parent, &InputMethod::visibleChanged, this, &VirtualKeyboardDBus::visibleChanged);
|
2021-07-22 15:38:13 +00:00
|
|
|
connect(parent, &InputMethod::availableChanged, this, &VirtualKeyboardDBus::availableChanged);
|
2017-10-06 19:22:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VirtualKeyboardDBus::~VirtualKeyboardDBus() = default;
|
|
|
|
|
2021-02-23 15:12:38 +00:00
|
|
|
bool VirtualKeyboardDBus::isActive() const
|
|
|
|
{
|
2021-02-26 15:16:45 +00:00
|
|
|
return m_inputMethod->isActive();
|
2021-02-23 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 15:16:45 +00:00
|
|
|
void VirtualKeyboardDBus::setEnabled(bool enabled)
|
2021-02-23 15:12:38 +00:00
|
|
|
{
|
2021-02-26 15:16:45 +00:00
|
|
|
m_inputMethod->setEnabled(enabled);
|
2021-02-23 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VirtualKeyboardDBus::setActive(bool active)
|
|
|
|
{
|
2021-02-26 15:16:45 +00:00
|
|
|
m_inputMethod->setActive(active);
|
2021-02-23 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VirtualKeyboardDBus::isEnabled() const
|
|
|
|
{
|
2021-02-26 15:16:45 +00:00
|
|
|
return m_inputMethod->isEnabled();
|
2021-02-23 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
2021-07-21 00:04:33 +00:00
|
|
|
bool VirtualKeyboardDBus::isVisible() const
|
|
|
|
{
|
|
|
|
return m_inputMethod->isVisible();
|
|
|
|
}
|
|
|
|
|
2021-07-22 15:38:13 +00:00
|
|
|
bool VirtualKeyboardDBus::isAvailable() const
|
|
|
|
{
|
|
|
|
return m_inputMethod->isAvailable();
|
|
|
|
}
|
|
|
|
|
2021-11-30 14:52:47 +00:00
|
|
|
bool VirtualKeyboardDBus::willShowOnActive() const
|
|
|
|
{
|
|
|
|
return isAvailable() && isEnabled() && m_inputMethod->shouldShowOnActive();
|
|
|
|
}
|
|
|
|
|
2017-10-06 19:22:50 +00:00
|
|
|
}
|