mirror of
https://github.com/RustyRaptor/plasma-keyboard.git
synced 2026-12-03 15:55:19 -07:00
Currently layouts are created with the KeyboardLayout component. When we switch to alternate layouts (i.e. numpad, symbols), the Keyboard switches out the KeyboardLayout completely to the alternate layout's KeyboardLayout. We currently don't have a "holding" object for a keyboard layout, preventing us from having a shared TextComposer session between all of the "sublayouts" within a layout (ex. QWERTY <-> symbols <-> numpad) This is problematic for CJK because the TextComposer gets reset when we switch to other pages, like the symbols page. --- This MR introduces a "KeyboardLayoutDefinition" holding component for layouts, so that we can retain state within a keyboard layout. In this case, we keep the TextComposer on the KeyboardLayoutDefinition rather than the KeyboardLayout so it isn't reset when we switch to other keyboard pages. I also replaced the JSON-specified alternate layouts with it now being specified on the KeyboardLayoutDefinition, which makes things a bit more centralized. --- Kind of annoying that I had to do this after porting the layouts, but this was a big oversight I missed that came up during CJK testing :/
48 lines
1.1 KiB
QML
48 lines
1.1 KiB
QML
/*
|
|
SPDX-FileCopyrightText: 2026 Devin Lin <devin@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
import QtQuick
|
|
|
|
import org.kde.plasma.keyboard.virtualkeyboard
|
|
|
|
/**
|
|
* Defines a keyboard layout and its alternative layouts.
|
|
*
|
|
* This is what "File" in keyboard package metadata points to for a keyboard layout.
|
|
*/
|
|
QtObject {
|
|
/**
|
|
* The text composer used by layouts.
|
|
* This can be overridden, see KeyboardLayout.textComposer.
|
|
*/
|
|
property QtObject textComposer: BasicTextComposer {}
|
|
|
|
/**
|
|
* The default layout.
|
|
*/
|
|
default property Component main
|
|
|
|
/**
|
|
* The layout shown in symbol mode.
|
|
*/
|
|
property Component symbols
|
|
|
|
/**
|
|
* The layout for fields that take formatted numbers (Qt::ImhFormattedNumbersOnly).
|
|
*/
|
|
property Component numbers
|
|
|
|
/**
|
|
* The layout for fields that only take digits (Qt::ImhDigitsOnly).
|
|
*/
|
|
property Component digits
|
|
|
|
/**
|
|
* The layout for fields that take phone numbers (Qt::ImhDialableCharactersOnly).
|
|
*/
|
|
property Component dialpad
|
|
}
|