Changeset View
Changeset View
Standalone View
Standalone View
virtualkeyboard.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "virtualkeyboard.h" | 20 | #include "virtualkeyboard.h" | ||
21 | #include "virtualkeyboard_dbus.h" | ||||
21 | #include "input.h" | 22 | #include "input.h" | ||
22 | #include "keyboard_input.h" | 23 | #include "keyboard_input.h" | ||
23 | #include "utils.h" | 24 | #include "utils.h" | ||
24 | #include "screens.h" | 25 | #include "screens.h" | ||
25 | #include "wayland_server.h" | 26 | #include "wayland_server.h" | ||
26 | #include "workspace.h" | 27 | #include "workspace.h" | ||
27 | #include "xkb.h" | 28 | #include "xkb.h" | ||
28 | 29 | | |||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 69 | { | |||
93 | m_sni->setStatus(KStatusNotifierItem::Passive); | 94 | m_sni->setStatus(KStatusNotifierItem::Passive); | ||
94 | m_sni->setTitle(i18n("Virtual Keyboard")); | 95 | m_sni->setTitle(i18n("Virtual Keyboard")); | ||
95 | updateSni(); | 96 | updateSni(); | ||
96 | connect(m_sni, &KStatusNotifierItem::activateRequested, this, | 97 | connect(m_sni, &KStatusNotifierItem::activateRequested, this, | ||
97 | [this] { | 98 | [this] { | ||
98 | setEnabled(!m_enabled); | 99 | setEnabled(!m_enabled); | ||
99 | } | 100 | } | ||
100 | ); | 101 | ); | ||
102 | connect(this, &VirtualKeyboard::enabledChanged, this, &VirtualKeyboard::updateSni); | ||||
103 | | ||||
104 | auto dbus = new VirtualKeyboardDBus(this); | ||||
105 | dbus->setEnabled(m_enabled); | ||||
106 | connect(dbus, &VirtualKeyboardDBus::activateRequested, this, &VirtualKeyboard::setEnabled); | ||||
107 | connect(this, &VirtualKeyboard::enabledChanged, dbus, &VirtualKeyboardDBus::setEnabled); | ||||
101 | 108 | | |||
102 | if (waylandServer()) { | 109 | if (waylandServer()) { | ||
103 | // we can announce support for the text input interface | 110 | // we can announce support for the text input interface | ||
104 | auto t = waylandServer()->display()->createTextInputManager(TextInputInterfaceVersion::UnstableV0, waylandServer()->display()); | 111 | auto t = waylandServer()->display()->createTextInputManager(TextInputInterfaceVersion::UnstableV0, waylandServer()->display()); | ||
105 | t->create(); | 112 | t->create(); | ||
106 | auto t2 = waylandServer()->display()->createTextInputManager(TextInputInterfaceVersion::UnstableV2, waylandServer()->display()); | 113 | auto t2 = waylandServer()->display()->createTextInputManager(TextInputInterfaceVersion::UnstableV2, waylandServer()->display()); | ||
107 | t2->create(); | 114 | t2->create(); | ||
108 | connect(waylandServer()->seat(), &SeatInterface::focusedTextInputChanged, this, | 115 | connect(waylandServer()->seat(), &SeatInterface::focusedTextInputChanged, this, | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
181 | 188 | | |||
182 | void VirtualKeyboard::setEnabled(bool enabled) | 189 | void VirtualKeyboard::setEnabled(bool enabled) | ||
183 | { | 190 | { | ||
184 | if (m_enabled == enabled) { | 191 | if (m_enabled == enabled) { | ||
185 | return; | 192 | return; | ||
186 | } | 193 | } | ||
187 | m_enabled = enabled; | 194 | m_enabled = enabled; | ||
188 | qApp->inputMethod()->update(Qt::ImQueryAll); | 195 | qApp->inputMethod()->update(Qt::ImQueryAll); | ||
189 | 196 | emit enabledChanged(m_enabled); | |||
190 | updateSni(); | | |||
191 | 197 | | |||
192 | // send OSD message | 198 | // send OSD message | ||
193 | QDBusMessage msg = QDBusMessage::createMethodCall( | 199 | QDBusMessage msg = QDBusMessage::createMethodCall( | ||
194 | QStringLiteral("org.kde.plasmashell"), | 200 | QStringLiteral("org.kde.plasmashell"), | ||
195 | QStringLiteral("/org/kde/osdService"), | 201 | QStringLiteral("/org/kde/osdService"), | ||
196 | QStringLiteral("org.kde.osdService"), | 202 | QStringLiteral("org.kde.osdService"), | ||
197 | QStringLiteral("virtualKeyboardEnabledChanged") | 203 | QStringLiteral("virtualKeyboardEnabledChanged") | ||
198 | ); | 204 | ); | ||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |