Commit d88a3026 authored by Frederik Gladhorn's avatar Frederik Gladhorn

Add a button to launch orca configuration in kcm

parent df0a0109
......@@ -752,6 +752,33 @@ Ensure you know what you are doing if you uncheck it, as the keyboard accessibil
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QPushButton" name="launchOrcaConfiguration">
<property name="text">
<string>&amp;Launch Orca Configuration</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="orcaLaunchFeedbackLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
......
......@@ -239,6 +239,7 @@ KAccessConfig::KAccessConfig(QWidget *parent, const QVariantList& args)
// screen reader
connect(ui.screenReaderEnabled, &QCheckBox::clicked, this, &KAccessConfig::configChanged);
connect(ui.launchOrcaConfiguration, &QPushButton::clicked, this, &KAccessConfig::launchOrcaConfiguration);
}
......@@ -251,6 +252,22 @@ void KAccessConfig::configureKNotify()
KNotifyConfigWidget::configure(this, QStringLiteral("kaccess"));
}
void KAccessConfig::launchOrcaConfiguration()
{
QStringList gsettingArgs = { "set", "org.gnome.desktop.a11y.applications", "screen-reader-enabled", "true" };
int ret = QProcess::execute("gsettings", gsettingArgs);
if (ret) {
ui.orcaLaunchFeedbackLabel->setText(i18n("Could not set gesttings for Orca: \"%1\" failed").arg(QLatin1String("gsettings ") + gsettingArgs.join(' ')));
return;
}
qint64 pid = 0;
bool started = QProcess::startDetached("orca", {"--setup"}, QString(), &pid);
if (!started) {
ui.orcaLaunchFeedbackLabel->setText(i18n("Error: Could not launch \"orca --setup\""));
}
}
void KAccessConfig::changeFlashScreenColor()
{
ui.invertScreen->setChecked(false);
......
......@@ -48,6 +48,7 @@ protected Q_SLOTS:
void selectSound();
void changeFlashScreenColor();
void configureKNotify();
void launchOrcaConfiguration();
private:
Ui::access ui;
......
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