Commit 6b7040f3 authored by Xuetian Weng's avatar Xuetian Weng Committed by Xuetian Weng

Hide accent option if it is not supported

CCBUG: 430062
parent ae84eab7
......@@ -42,6 +42,12 @@
#include <X11/Xlib.h>
#include <cmath>
namespace {
bool hasAccentSupport() {
static bool isPlasmaIM = (qgetenv("QT_IM_MODULE") == "plasmaim");
return isPlasmaIM;
}
}
KCMiscKeyboardWidget::KCMiscKeyboardWidget(QWidget *parent)
: QWidget(parent),
......@@ -78,7 +84,11 @@ KCMiscKeyboardWidget::KCMiscKeyboardWidget(QWidget *parent)
connect(_numlockButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(changed()));
_keyboardRepeatButtonGroup = new QButtonGroup(ui.repeatFormLayout);
_keyboardRepeatButtonGroup->addButton(ui.accentMenuRadioButton, 0);
if (hasAccentSupport()) {
_keyboardRepeatButtonGroup->addButton(ui.accentMenuRadioButton, 0);
} else {
ui.accentMenuRadioButton->setVisible(false);
}
_keyboardRepeatButtonGroup->addButton(ui.repeatRadioButton, 1);
_keyboardRepeatButtonGroup->addButton(ui.nothingRadioButton, 2);
......@@ -103,6 +113,9 @@ KCMiscKeyboardWidget::~KCMiscKeyboardWidget()
// set the slider and LCD values
void KCMiscKeyboardWidget::setRepeat(KeyBehaviour keyboardRepeat, int delay_, double rate_)
{
if (keyboardRepeat == KeyBehaviour::AccentMenu && !hasAccentSupport()) {
keyboardRepeat = KeyBehaviour::RepeatKey;
}
_keyboardRepeatButtonGroup->button(keyboardRepeat)->click();
ui.delay->setValue(delay_);
ui.rate->setValue(rate_);
......
......@@ -32,13 +32,20 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="2" column="1">
<widget class="QRadioButton" name="accentMenuRadioButton">
<property name="text">
<string>&amp;Show accented and similar characters </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="repeatRadioButton">
<property name="text">
<string>&amp;Repeat the key being held</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="nothingRadioButton">
<property name="text">
......@@ -46,10 +53,24 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="repeatRadioButton">
</layout>
</item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>&amp;Repeat the key being held</string>
<string>Test area:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="toolTip">
<string>Allows to test keyboard repeat and click volume (just don't forget to apply the changes).</string>
</property>
</widget>
</item>
......@@ -97,7 +118,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QGroupBox" name="keyboardRepeatParamsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
......@@ -232,26 +253,18 @@
</layout>
</widget>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Test area:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="toolTip">
<string>Allows to test keyboard repeat and click volume (just don't forget to apply the changes).</string>
</property>
</widget>
</item>
</layout>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment