diff --git a/kcms/access/CMakeLists.txt b/kcms/access/CMakeLists.txt --- a/kcms/access/CMakeLists.txt +++ b/kcms/access/CMakeLists.txt @@ -1,27 +1,47 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmaccess\") -set(kcm_access_PART_SRCS kcmaccess.cpp ) +set(kcmaccess_PART_SRCS kcmaccess.cpp ) -ki18n_wrap_ui(kcm_access_PART_SRCS - accessibility.ui -) +# needed for krdb +qt5_add_dbus_interface(kcmaccess_PART_SRCS ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml klauncher_iface) +kconfig_add_kcfg_files(kcmaccess_PART_SRCS + kcmaccessibilitybell.kcfgc + kcmaccessibilitykeyboard.kcfgc + kcmaccessibilitymouse.kcfgc + kcmaccessibilityscreenreader.kcfgc + GENERATE_MOC) -add_library(kcm_access MODULE ${kcm_access_PART_SRCS}) +add_library(kcmaccess MODULE ${kcmaccess_PART_SRCS}) -target_link_libraries(kcm_access - Qt5::X11Extras +message("Arquivos" ${kcmaccess_PART_SRCS}) +target_link_libraries(kcmaccess + Qt5::DBus KF5::KCMUtils + KF5::CoreAddons + KF5::Declarative + KF5::GuiAddons KF5::I18n - KF5::KIOCore - KF5::KIOWidgets - KF5::NotifyConfig + KF5::NewStuff + KF5::QuickAddons KF5::WindowSystem + KF5::NotifyConfig + Qt5::X11Extras ${X11_LIBRARIES} ) -install(TARGETS kcm_access DESTINATION ${KDE_INSTALL_PLUGINDIR}) +kcoreaddons_desktop_to_json(kcmaccess "kcmaccess.desktop") -########### install files ############### +install(FILES kcmaccess.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS kcmaccess DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms) +install( + FILES + kcmaccessibilitybell.kcfg + kcmaccessibilitykeyboard.kcfg + kcmaccessibilitymouse.kcfg + kcmaccessibilityscreenreader.kcfg + DESTINATION + ${KDE_INSTALL_KCFGDIR} +) -install( FILES kcmaccess.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) +kpackage_install_package(package kcmaccess kcms) diff --git a/kcms/access/accessibility.ui b/kcms/access/accessibility.ui deleted file mode 100644 --- a/kcms/access/accessibility.ui +++ /dev/null @@ -1,1043 +0,0 @@ - - - access - - - - 0 - 0 - 649 - 447 - - - - - - - 0 - - - - &Bell - - - - - - Audible Bell - - - - - - If this option is checked, the default system bell will be used. Usually, this is just a "beep". - - - Use &system bell - - - - - - - Check this option if you want to use a customized bell, playing a sound file. If you do this, you will probably want to turn off the system bell. - - - Us&e customized bell - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - If the option "Use customized bell" is enabled, you can choose a sound file here. Click "Browse..." to choose a sound file using the file dialog. - - - Sound &to play: - - - soundEdit - - - - - - - If the option "Use customized bell" is enabled, you can choose a sound file here. Click "Browse..." to choose a sound file using the file dialog. - - - - - - - If the option "Use customized bell" is enabled, you can choose a sound file here. Click "Browse..." to choose a sound file using the file dialog. - - - Browse... - - - - - - - - - - - - Visual Bell - - - - - - This option will turn on the "visual bell", i.e. a visual notification shown every time that normally just a bell would occur. This is especially useful for deaf people. - - - &Use visual bell - - - - - - - The screen will turn to a custom color for the amount of time specified below. - - - F&lash screen - - - - - - - All screen colors will be inverted for the amount of time specified below. - - - I&nvert screen - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Click here to choose the color used for the "flash screen" visible bell. - - - - - - - &Duration: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - duration - - - - - - - Here you can customize the duration of the "visible bell" effect being shown. - - - msec - - - 100 - - - 2000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Modifier Keys - - - - - - Sticky Keys - - - - - - Use &sticky keys - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - - - &Lock sticky keys - - - - - - - Turn sticky keys off when two keys are pressed simultaneously - - - - - - - Use system bell whenever a modifier gets latched, locked or unlocked - - - - - - - - - - - - - - Locking Keys - - - - - - Use system bell whenever a locking key gets activated or deactivated - - - - - - - Use Plasma's notification mechanism for modifier or locking key state changes - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Configure &Notifications... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 76 - - - - - - - - - &Keyboard Filters - - - - - - Slo&w Keys - - - - - - - - &Use slow keys - - - - - - - Here you can customize the duration of the "visible bell" effect being shown. - - - msec - - - 50 - - - 10000 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - - - &Use system bell whenever a key is pressed - - - - - - - &Use system bell whenever a key is accepted - - - - - - - &Use system bell whenever a key is rejected - - - - - - - - - - - - - - Bounce Keys - - - - - - - - Use bou&nce keys - - - - - - - Here you can customize the duration of the "visible bell" effect being shown. - - - msec - - - 100 - - - 10000 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Use the system bell whenever a key is rejected - - - - - - - - - - - - Qt::Vertical - - - - 20 - 94 - - - - - - - - - Activation &Gestures - - - - - - Activation Gestures - - - - - - If this option is checked, the default system bell will be used. Usually, this is just a "beep". - - - Use gestures for activating sticky keys and slow keys - - - - - - - - - - Turn sticky keys and slow keys off after a certain period of inactivity. - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Here you can customize the duration of the "visible bell" effect being shown. - - - min - - - 1 - - - 30 - - - 4 - - - 5 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Notification - - - - - - Check this option if you want to use a customized bell, playing a sound file. If you do this, you will probably want to turn off the system bell. - - - Use the system bell whenever a gesture is used to toggle an accessibility feature - - - - - - - If this option is checked, KDE will show a confirmation dialog whenever a keyboard accessibility feature is turned on or off. -Ensure you know what you are doing if you uncheck it, as the keyboard accessibility settings will then always be applied without confirmation. - - - Show a confirmation dialog whenever a keyboard accessibility feature is toggled - - - - - - - Use Plasma's notification mechanism whenever a keyboard accessibility feature is toggled - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Configure &Notifications... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 69 - - - - - - - - - Mouse Navigation - - - - - - - - &Move pointer with keyboard (using the num pad) - - - - - - - - 0 - 0 - - - - msec - - - 1 - - - 1000 - - - 50 - - - - - - - &Acceleration delay: - - - mk_delay - - - - - - - R&epeat interval: - - - mk_interval - - - - - - - - 0 - 0 - - - - msec - - - 1 - - - 1000 - - - 10 - - - - - - - Acceleration &time: - - - mk_time_to_max - - - - - - - - 0 - 0 - - - - msec - - - 100 - - - 10000 - - - 200 - - - - - - - Ma&ximum speed: - - - mk_max_speed - - - - - - - - 0 - 0 - - - - pixel/sec - - - 1 - - - 2000 - - - 20 - - - - - - - Acceleration &profile: - - - mk_curve - - - - - - - - 0 - 0 - - - - -1000 - - - 1000 - - - 100 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Screen Reader - - - - - - Screen reader enabled - - - - - - - - - &Launch Orca Configuration - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - - Please note that you may have to log out once to allow the screen reader to work properly. - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
- 1 -
-
- - tab - systemBell - customBell - soundEdit - soundButton - visibleBell - invertScreen - flashScreen - colorButton - duration - stickyKeys - stickyKeysLock - stickyKeysAutoOff - stickyKeysBeep - toggleKeysBeep - kNotifyModifiers - kNotifyModifiersButton - slowKeys - slowKeysDelay - slowKeysPressBeep - slowKeysAcceptBeep - slowKeysRejectBeep - bounceKeys - bounceKeysDelay - bounceKeysRejectBeep - gestures - timeout - timeoutDelay - accessxBeep - gestureConfirmation - kNotifyAccess - kNotifyAccessButton - - - -
diff --git a/kcms/access/kcmaccess.h b/kcms/access/kcmaccess.h --- a/kcms/access/kcmaccess.h +++ b/kcms/access/kcmaccess.h @@ -22,36 +22,49 @@ #ifndef __kcmaccess_h__ #define __kcmaccess_h__ +#include +#include +#include -#include -#include "ui_accessibility.h" +class MouseSettings; +class BellSettings; +class KeyboardSettings; +class ScreenReaderSettings; -class KAccessConfig : public KCModule +class KAccessConfig : public KQuickAddons::ManagedConfigModule { Q_OBJECT + Q_PROPERTY(MouseSettings *mouseSettings MEMBER m_mouseSettings CONSTANT) + Q_PROPERTY(BellSettings *bellSettings MEMBER m_bellSettings CONSTANT) + Q_PROPERTY(KeyboardSettings *keyboardSettings MEMBER m_keyboardSettings CONSTANT) + Q_PROPERTY(ScreenReaderSettings *screenReaderSettings MEMBER m_screenReaderSettings CONSTANT) + Q_PROPERTY(QString orcaLaunchFeedback READ orcaLaunchFeedback WRITE setOrcaLaunchFeedback NOTIFY orcaLaunchFeedbackChanged) + Q_PROPERTY(QString desktopShortcutInfo MEMBER m_desktopShortcutInfo CONSTANT) public: - KAccessConfig(QWidget *parent, const QVariantList&); + KAccessConfig(QObject *parent, const QVariantList&); ~KAccessConfig() override; - void load() override; void save() override; - void defaults() override; -protected Q_SLOTS: + Q_SCRIPTABLE void configureKNotify(); + Q_SCRIPTABLE void launchOrcaConfiguration(); - void configChanged(); - void checkAccess(); - void invertClicked(); - void flashClicked(); - void selectSound(); - void changeFlashScreenColor(); - void configureKNotify(); - void launchOrcaConfiguration(); + QString orcaLaunchFeedback() const; +public Q_SLOTS: + void setOrcaLaunchFeedback(const QString& value); + +Q_SIGNALS: + void orcaLaunchFeedbackChanged(); private: - Ui::access ui; + MouseSettings *m_mouseSettings; + BellSettings *m_bellSettings; + KeyboardSettings *m_keyboardSettings; + ScreenReaderSettings *m_screenReaderSettings; + QString m_orcaLaunchFeedback; + QString m_desktopShortcutInfo; }; diff --git a/kcms/access/kcmaccess.cpp b/kcms/access/kcmaccess.cpp --- a/kcms/access/kcmaccess.cpp +++ b/kcms/access/kcmaccess.cpp @@ -29,21 +29,27 @@ #include #include -#include +#include #include #include -#include -#include +#include +#include #include -#include +#include +#include #include #include #define XK_MISCELLANY #define XK_XKB_KEYS #include -K_PLUGIN_FACTORY(KAccessConfigFactory, registerPlugin();) +#include "kcmaccessibilitybell.h" +#include "kcmaccessibilitykeyboard.h" +#include "kcmaccessibilitymouse.h" +#include "kcmaccessibilityscreenreader.h" + +K_PLUGIN_FACTORY_WITH_JSON(KCMColorsFactory, "kcmaccess.json", registerPlugin();) QString mouseKeysShortcut(Display *display) { @@ -155,292 +161,65 @@ return result; } -KAccessConfig::KAccessConfig(QWidget *parent, const QVariantList& args) - : KCModule(parent, args) +KAccessConfig::KAccessConfig(QObject *parent, const QVariantList& args) + : KQuickAddons::ManagedConfigModule(parent, args) + , m_mouseSettings(new MouseSettings(this)) + , m_bellSettings(new BellSettings(this)) + , m_keyboardSettings(new KeyboardSettings(this)) + , m_screenReaderSettings(new ScreenReaderSettings(this)) + , m_desktopShortcutInfo(mouseKeysShortcut(QX11Info::display())) { + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + KAboutData *about = new KAboutData(QStringLiteral("kcmaccess"), i18n("KDE Accessibility Tool"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL, i18n("(c) 2000, Matthias Hoelzer-Kluepfel")); about->addAuthor(i18n("Matthias Hoelzer-Kluepfel"), i18n("Author") , QStringLiteral("hoelzer@kde.org")); - setAboutData(about); - - ui.setupUi(this); - - connect(ui.soundButton, &QPushButton::clicked, this, &KAccessConfig::selectSound); - connect(ui.customBell, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - connect(ui.systemBell, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.customBell, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.soundEdit, &QLineEdit::textChanged, this, &KAccessConfig::configChanged); - - connect(ui.invertScreen, &QRadioButton::clicked, this, &KAccessConfig::configChanged); - connect(ui.flashScreen, &QRadioButton::clicked, this, &KAccessConfig::configChanged); - connect(ui.visibleBell, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.visibleBell, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - connect(ui.colorButton, &KColorButton::clicked, this, &KAccessConfig::changeFlashScreenColor); - - connect(ui.invertScreen, &QRadioButton::clicked, this, &KAccessConfig::invertClicked); - connect(ui.flashScreen, &QRadioButton::clicked, this, &KAccessConfig::flashClicked); - - connect(ui.duration, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - - - // modifier key settings ------------------------------- - - connect(ui.stickyKeys, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.stickyKeysLock, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.stickyKeysAutoOff, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.stickyKeys, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - - connect(ui.stickyKeysBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.toggleKeysBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.kNotifyModifiers, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.kNotifyModifiers, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - connect(ui.kNotifyModifiersButton, &QPushButton::clicked, this, &KAccessConfig::configureKNotify); - - // key filter settings --------------------------------- - - connect(ui.slowKeysDelay, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.slowKeys, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.slowKeys, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - - connect(ui.slowKeysPressBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.slowKeysAcceptBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.slowKeysRejectBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - - connect(ui.bounceKeysDelay, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.bounceKeys, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.bounceKeysRejectBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.bounceKeys, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - - // gestures -------------------------------------------- - QString shortcut = mouseKeysShortcut(QX11Info::display()); - if (shortcut.isEmpty()) - ui.gestures->setToolTip(i18n("Here you can activate keyboard gestures that turn on the following features: \n" - "Sticky keys: Press Shift key 5 consecutive times\n" - "Slow keys: Hold down Shift for 8 seconds")); - else - ui.gestures->setToolTip(i18n("Here you can activate keyboard gestures that turn on the following features: \n" - "Mouse Keys: %1\n" - "Sticky keys: Press Shift key 5 consecutive times\n" - "Slow keys: Hold down Shift for 8 seconds", shortcut)); - - connect(ui.gestures, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.timeout, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.timeout, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - connect(ui.timeoutDelay, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.accessxBeep, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.gestureConfirmation, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.kNotifyAccess, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.kNotifyAccess, &QCheckBox::clicked, this, &KAccessConfig::checkAccess); - connect(ui.kNotifyAccessButton, &QPushButton::clicked, this, &KAccessConfig::configureKNotify); - - // keynboard navigation - connect(ui.mouseKeys, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.mk_delay, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.mk_interval, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.mk_time_to_max, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.mk_max_speed, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - connect(ui.mk_curve, static_cast(&QSpinBox::valueChanged), this, &KAccessConfig::configChanged); - - // screen reader - connect(ui.screenReaderEnabled, &QCheckBox::clicked, this, &KAccessConfig::configChanged); - connect(ui.launchOrcaConfiguration, &QPushButton::clicked, this, &KAccessConfig::launchOrcaConfiguration); + setAboutData(about); } - KAccessConfig::~KAccessConfig() { } void KAccessConfig::configureKNotify() { - KNotifyConfigWidget::configure(this, QStringLiteral("kaccess")); + KNotifyConfigWidget::configure(nullptr, QStringLiteral("kaccess")); } void KAccessConfig::launchOrcaConfiguration() { - const QStringList gsettingArgs = { QStringLiteral("set"), QStringLiteral("org.gnome.desktop.a11y.applications"), QStringLiteral("screen-reader-enabled"), QStringLiteral("true") }; + const QStringList gsettingArgs = { + QStringLiteral("set"), + QStringLiteral("org.gnome.desktop.a11y.applications"), + QStringLiteral("screen-reader-enabled"), + QStringLiteral("true") + }; + int ret = QProcess::execute(QStringLiteral("gsettings"), gsettingArgs); if (ret) { const QString errorStr = QLatin1String("gsettings ") + gsettingArgs.join(QLatin1Char(' ')); - ui.orcaLaunchFeedbackLabel->setText(i18n("Could not set gsettings for Orca: \"%1\" failed", errorStr)); + setOrcaLaunchFeedback(i18n("Could not set gsettings for Orca: \"%1\" failed", errorStr)); return; } qint64 pid = 0; bool started = QProcess::startDetached(QStringLiteral("orca"), {QStringLiteral("--setup")}, QString(), &pid); if (!started) { - ui.orcaLaunchFeedbackLabel->setText(i18n("Error: Could not launch \"orca --setup\"")); - } -} - -void KAccessConfig::changeFlashScreenColor() -{ - ui.invertScreen->setChecked(false); - ui.flashScreen->setChecked(true); - configChanged(); -} - -void KAccessConfig::selectSound() -{ - const QStringList list = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("sound/")); - QString start; - if (!list.isEmpty()) - start = list[0]; - const QString fname = QFileDialog::getOpenFileName(this, QString(), start); - if (!fname.isEmpty()) - ui.soundEdit->setText(fname); -} - - -void KAccessConfig::configChanged() -{ - emit changed(true); -} - - -void KAccessConfig::load() -{ - KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Bell"); - - ui.systemBell->setChecked(cg.readEntry("SystemBell", true)); - ui.customBell->setChecked(cg.readEntry("ArtsBell", false)); - ui.soundEdit->setText(cg.readPathEntry("ArtsBellFile", QString())); - - ui.visibleBell->setChecked(cg.readEntry("VisibleBell", false)); - ui.invertScreen->setChecked(cg.readEntry("VisibleBellInvert", true)); - ui.flashScreen->setChecked(!ui.invertScreen->isChecked()); - ui.colorButton->setColor(cg.readEntry("VisibleBellColor", QColor(Qt::red))); - - ui.duration->setValue(cg.readEntry("VisibleBellPause", 500)); - - KConfigGroup keyboardGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Keyboard"); - - ui.stickyKeys->setChecked(keyboardGroup.readEntry("StickyKeys", false)); - ui.stickyKeysLock->setChecked(keyboardGroup.readEntry("StickyKeysLatch", true)); - ui.stickyKeysAutoOff->setChecked(keyboardGroup.readEntry("StickyKeysAutoOff", false)); - ui.stickyKeysBeep->setChecked(keyboardGroup.readEntry("StickyKeysBeep", true)); - ui.toggleKeysBeep->setChecked(keyboardGroup.readEntry("ToggleKeysBeep", false)); - ui.kNotifyModifiers->setChecked(keyboardGroup.readEntry("kNotifyModifiers", false)); - - ui.slowKeys->setChecked(keyboardGroup.readEntry("SlowKeys", false)); - ui.slowKeysDelay->setValue(keyboardGroup.readEntry("SlowKeysDelay", 500)); - ui.slowKeysPressBeep->setChecked(keyboardGroup.readEntry("SlowKeysPressBeep", true)); - ui.slowKeysAcceptBeep->setChecked(keyboardGroup.readEntry("SlowKeysAcceptBeep", true)); - ui.slowKeysRejectBeep->setChecked(keyboardGroup.readEntry("SlowKeysRejectBeep", true)); - - ui.bounceKeys->setChecked(keyboardGroup.readEntry("BounceKeys", false)); - ui.bounceKeysDelay->setValue(keyboardGroup.readEntry("BounceKeysDelay", 500)); - ui.bounceKeysRejectBeep->setChecked(keyboardGroup.readEntry("BounceKeysRejectBeep", true)); - - ui.gestures->setChecked(keyboardGroup.readEntry("Gestures", false)); - ui.timeout->setChecked(keyboardGroup.readEntry("AccessXTimeout", false)); - ui.timeoutDelay->setValue(keyboardGroup.readEntry("AccessXTimeoutDelay", 30)); - - ui.accessxBeep->setChecked(keyboardGroup.readEntry("AccessXBeep", true)); - ui.gestureConfirmation->setChecked(keyboardGroup.readEntry("GestureConfirmation", false)); - ui.kNotifyAccess->setChecked(keyboardGroup.readEntry("kNotifyAccess", false)); - - KConfigGroup mouseGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Mouse"); - ui.mouseKeys->setChecked(mouseGroup.readEntry("MouseKeys", false)); - ui.mk_delay->setValue(mouseGroup.readEntry("MKDelay", 160)); - - const int interval = mouseGroup.readEntry("MKInterval", 5); - ui.mk_interval->setValue(interval); - - // Default time to reach maximum speed: 5000 msec - int time_to_max = mouseGroup.readEntry("MKTimeToMax", (5000+interval/2)/interval); - time_to_max = mouseGroup.readEntry("MK-TimeToMax", time_to_max*interval); - ui.mk_time_to_max->setValue(time_to_max); - - // Default maximum speed: 1000 pixels/sec - // (The old default maximum speed from KDE <= 3.4 - // (100000 pixels/sec) was way too fast) - long max_speed = mouseGroup.readEntry("MKMaxSpeed", interval); - max_speed = max_speed * 1000 / interval; - if (max_speed > 2000) { - max_speed = 2000; + setOrcaLaunchFeedback(i18n("Error: Could not launch \"orca --setup\"")); } - max_speed = mouseGroup.readEntry("MK-MaxSpeed", int(max_speed)); - ui.mk_max_speed->setValue(max_speed); - - ui.mk_curve->setValue(mouseGroup.readEntry("MKCurve", 0)); - - KConfigGroup screenReaderGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "ScreenReader"); - ui.screenReaderEnabled->setChecked(screenReaderGroup.readEntry("Enabled", false)); - - checkAccess(); - - emit changed(false); } - void KAccessConfig::save() { - KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Bell"); - - cg.writeEntry("SystemBell", ui.systemBell->isChecked()); - cg.writeEntry("ArtsBell", ui.customBell->isChecked()); - cg.writePathEntry("ArtsBellFile", ui.soundEdit->text()); - - cg.writeEntry("VisibleBell", ui.visibleBell->isChecked()); - cg.writeEntry("VisibleBellInvert", ui.invertScreen->isChecked()); - cg.writeEntry("VisibleBellColor", ui.colorButton->color()); - - cg.writeEntry("VisibleBellPause", ui.duration->value()); - cg.sync(); - - KConfigGroup keyboardGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Keyboard"); - - keyboardGroup.writeEntry("StickyKeys", ui.stickyKeys->isChecked()); - keyboardGroup.writeEntry("StickyKeysLatch", ui.stickyKeysLock->isChecked()); - keyboardGroup.writeEntry("StickyKeysAutoOff", ui.stickyKeysAutoOff->isChecked()); - keyboardGroup.writeEntry("StickyKeysBeep", ui.stickyKeysBeep->isChecked()); - keyboardGroup.writeEntry("ToggleKeysBeep", ui.toggleKeysBeep->isChecked()); - keyboardGroup.writeEntry("kNotifyModifiers", ui.kNotifyModifiers->isChecked()); - - keyboardGroup.writeEntry("SlowKeys", ui.slowKeys->isChecked()); - keyboardGroup.writeEntry("SlowKeysDelay", ui.slowKeysDelay->value()); - keyboardGroup.writeEntry("SlowKeysPressBeep", ui.slowKeysPressBeep->isChecked()); - keyboardGroup.writeEntry("SlowKeysAcceptBeep", ui.slowKeysAcceptBeep->isChecked()); - keyboardGroup.writeEntry("SlowKeysRejectBeep", ui.slowKeysRejectBeep->isChecked()); - - - keyboardGroup.writeEntry("BounceKeys", ui.bounceKeys->isChecked()); - keyboardGroup.writeEntry("BounceKeysDelay", ui.bounceKeysDelay->value()); - keyboardGroup.writeEntry("BounceKeysRejectBeep", ui.bounceKeysRejectBeep->isChecked()); - - keyboardGroup.writeEntry("Gestures", ui.gestures->isChecked()); - keyboardGroup.writeEntry("AccessXTimeout", ui.timeout->isChecked()); - keyboardGroup.writeEntry("AccessXTimeoutDelay", ui.timeoutDelay->value()); - - keyboardGroup.writeEntry("AccessXBeep", ui.accessxBeep->isChecked()); - keyboardGroup.writeEntry("GestureConfirmation", ui.gestureConfirmation->isChecked()); - keyboardGroup.writeEntry("kNotifyAccess", ui.kNotifyAccess->isChecked()); + ManagedConfigModule::save(); - - keyboardGroup.sync(); - - KConfigGroup mouseGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "Mouse"); - const int interval = ui.mk_interval->value(); - mouseGroup.writeEntry("MouseKeys", ui.mouseKeys->isChecked()); - mouseGroup.writeEntry("MKDelay", ui.mk_delay->value()); - mouseGroup.writeEntry("MKInterval", interval); - mouseGroup.writeEntry("MK-TimeToMax", ui.mk_time_to_max->value()); - mouseGroup.writeEntry("MKTimeToMax", (ui.mk_time_to_max->value() + interval/2)/interval); - mouseGroup.writeEntry("MK-MaxSpeed", ui.mk_max_speed->value()); - mouseGroup.writeEntry("MKMaxSpeed", (ui.mk_max_speed->value()*interval + 500)/1000); - mouseGroup.writeEntry("MKCurve", ui.mk_curve->value()); - mouseGroup.sync(); - - KConfigGroup screenReaderGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "ScreenReader"); - screenReaderGroup.writeEntry("Enabled", ui.screenReaderEnabled->isChecked()); - - if (ui.systemBell->isChecked() || - ui.customBell->isChecked() || - ui.visibleBell->isChecked()) { + if (m_bellSettings->systemBell() || m_bellSettings->artsBell() || m_bellSettings->visibleBell()) { KConfig _cfg(QStringLiteral("kdeglobals"), KConfig::NoGlobals); KConfigGroup cfg(&_cfg, "General"); cfg.writeEntry("UseSystemBell", true); @@ -451,106 +230,19 @@ // turning a11y features off needs to be done by kaccess // so run it to clear any enabled features and it will exit if it should KToolInvocation::startServiceByDesktopName(QStringLiteral("kaccess")); - - emit changed(false); } - -void KAccessConfig::defaults() +QString KAccessConfig::orcaLaunchFeedback() const { - ui.systemBell->setChecked(true); - ui.customBell->setChecked(false); - ui.soundEdit->setText(QString()); - - ui.visibleBell->setChecked(false); - ui.invertScreen->setChecked(true); - ui.flashScreen->setChecked(false); - ui.colorButton->setColor(QColor(Qt::red)); - - ui.duration->setValue(500); - - ui.slowKeys->setChecked(false); - ui.slowKeysDelay->setValue(500); - ui.slowKeysPressBeep->setChecked(true); - ui.slowKeysAcceptBeep->setChecked(true); - ui.slowKeysRejectBeep->setChecked(true); - - ui.bounceKeys->setChecked(false); - ui.bounceKeysDelay->setValue(500); - ui.bounceKeysRejectBeep->setChecked(true); - - ui.stickyKeys->setChecked(false); - ui.stickyKeysLock->setChecked(true); - ui.stickyKeysAutoOff->setChecked(false); - ui.stickyKeysBeep->setChecked(true); - ui.toggleKeysBeep->setChecked(false); - ui.kNotifyModifiers->setChecked(false); - - ui.gestures->setChecked(false); - ui.timeout->setChecked(false); - ui.timeoutDelay->setValue(30); - - ui.accessxBeep->setChecked(true); - ui.gestureConfirmation->setChecked(true); - ui.kNotifyAccess->setChecked(false); - - ui.mouseKeys->setChecked(false); - ui.mk_delay->setValue(160); - ui.mk_interval->setValue(5); - ui.mk_time_to_max->setValue(5000); - ui.mk_max_speed->setValue(1000); - ui.mk_curve->setValue(0); - - ui.screenReaderEnabled->setChecked(false); - - checkAccess(); - - emit changed(true); + return m_orcaLaunchFeedback; } - -void KAccessConfig::invertClicked() +void KAccessConfig::setOrcaLaunchFeedback(const QString& value) { - ui.flashScreen->setChecked(false); -} - - -void KAccessConfig::flashClicked() -{ - ui.invertScreen->setChecked(false); -} - - -void KAccessConfig::checkAccess() -{ - bool custom = ui.customBell->isChecked(); - ui.soundEdit->setEnabled(custom); - ui.soundButton->setEnabled(custom); - ui.soundLabel->setEnabled(custom); - - bool visible = ui.visibleBell->isChecked(); - ui.invertScreen->setEnabled(visible); - ui.flashScreen->setEnabled(visible); - ui.colorButton->setEnabled(visible); - ui.duration->setEnabled(visible); - - bool sticky = ui.stickyKeys->isChecked(); - ui.stickyKeysLock->setEnabled(sticky); - ui.stickyKeysAutoOff->setEnabled(sticky); - ui.stickyKeysBeep->setEnabled(sticky); - - bool slow = ui.slowKeys->isChecked(); - ui.slowKeysDelay->setEnabled(slow); - ui.slowKeysPressBeep->setEnabled(slow); - ui.slowKeysAcceptBeep->setEnabled(slow); - ui.slowKeysRejectBeep->setEnabled(slow); - - bool bounce = ui.bounceKeys->isChecked(); - ui.bounceKeysDelay->setEnabled(bounce); - ui.bounceKeysRejectBeep->setEnabled(bounce); - - bool useTimeout = ui.timeout->isChecked(); - ui.timeoutDelay->setEnabled(useTimeout); + if (m_orcaLaunchFeedback != value) { + m_orcaLaunchFeedback = value; + emit orcaLaunchFeedbackChanged(); + } } extern "C" @@ -565,4 +257,3 @@ } #include "kcmaccess.moc" - diff --git a/kcms/access/kcmaccess.desktop b/kcms/access/kcmaccess.desktop --- a/kcms/access/kcmaccess.desktop +++ b/kcms/access/kcmaccess.desktop @@ -5,8 +5,7 @@ X-KDE-ServiceTypes=KCModule,KCModuleInit X-DocPath=kcontrol/kcmaccess/index.html -X-KDE-Library=kcm_access -X-KDE-Init-Symbol=kcminit_access +X-KDE-Library=kcmaccess X-KDE-ParentApp=kcontrol X-KDE-OnlyShowOnQtPlatforms=xcb; X-KDE-Init-Phase=0 diff --git a/kcms/access/kcmaccessibilitybell.kcfg b/kcms/access/kcmaccessibilitybell.kcfg new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitybell.kcfg @@ -0,0 +1,36 @@ + + + + + + + true + + + + false + + + + + + + false + + + + true + + + + + + + + 500 + + + diff --git a/kcms/access/kcmaccessibilitybell.kcfgc b/kcms/access/kcmaccessibilitybell.kcfgc new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitybell.kcfgc @@ -0,0 +1,6 @@ +File=kcmaccessibilitybell.kcfg +ClassName=BellSettings +Mutators=true +DefaultValueGetters=true +GenerateProperties=true +ParentInConstructor=true diff --git a/kcms/access/kcmaccessibilitykeyboard.kcfg b/kcms/access/kcmaccessibilitykeyboard.kcfg new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitykeyboard.kcfg @@ -0,0 +1,89 @@ + + + + + + + false + + + + true + + + + false + + + + true + + + + false + + + + false + + + + false + + + + 500 + + + + true + + + + true + + + + true + + + + false + + + + 500 + + + + false + + + + false + + + + 30 + + + + false + + + + false + + + + false + + + + false + + + diff --git a/kcms/access/kcmaccessibilitykeyboard.kcfgc b/kcms/access/kcmaccessibilitykeyboard.kcfgc new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitykeyboard.kcfgc @@ -0,0 +1,6 @@ +File=kcmaccessibilitykeyboard.kcfg +ClassName=KeyboardSettings +Mutators=true +DefaultValueGetters=true +GenerateProperties=true +ParentInConstructor=true diff --git a/kcms/access/kcmaccessibilitymouse.kcfg b/kcms/access/kcmaccessibilitymouse.kcfg new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitymouse.kcfg @@ -0,0 +1,39 @@ + + + + + + + false + + + + 1 + + + + 1 + + + + 5000 + + + + + + + 1000 + + + + + + + 0 + + + diff --git a/kcms/access/kcmaccessibilitymouse.kcfgc b/kcms/access/kcmaccessibilitymouse.kcfgc new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilitymouse.kcfgc @@ -0,0 +1,6 @@ +File=kcmaccessibilitymouse.kcfg +ClassName=MouseSettings +Mutators=true +DefaultValueGetters=true +GenerateProperties=true +ParentInConstructor=true diff --git a/kcms/access/kcmaccessibilityscreenreader.kcfg b/kcms/access/kcmaccessibilityscreenreader.kcfg new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilityscreenreader.kcfg @@ -0,0 +1,13 @@ + + + + + + + true + + + diff --git a/kcms/access/kcmaccessibilityscreenreader.kcfgc b/kcms/access/kcmaccessibilityscreenreader.kcfgc new file mode 100644 --- /dev/null +++ b/kcms/access/kcmaccessibilityscreenreader.kcfgc @@ -0,0 +1,6 @@ +File=kcmaccessibilityscreenreader.kcfg +ClassName=ScreenReaderSettings +Mutators=true +DefaultValueGetters=true +GenerateProperties=true +ParentInConstructor=true diff --git a/kcms/access/package/contents/ui/ActivationGestures.qml b/kcms/access/package/contents/ui/ActivationGestures.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/ActivationGestures.qml @@ -0,0 +1,80 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Activation Gestures") + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + text: i18n("Use gestures for activating sticky keys and slow keys") + checked: kcm.keyboardSettings.stickyKeys + onCheckStateChanged: kcm.keyboardSettings.stickyKeys = checked + enabled: !kcm.keyboardSettings.isImmutable("StickyKeys") + } + + QQC2.CheckBox { + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysAutoOff") && kcm.keyboardSettings.stickyKeys + text: i18n("Turn sticky keys and slow keys off after a certain period of inactivity.") + checked: kcm.keyboardSettings.stickyKeysAutoOff + onCheckStateChanged: kcm.keyboardSettings.stickyKeysAutoOff = checked + + } + QQC2.SpinBox { + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysDelay") && kcm.keyboardSettings.stickyKeys + value: kcm.keyboardSettings.slowKeysDelay + onValueChanged: kcm.keyboardSettings.slowKeysDelay = value + } + + Kirigami.Separator { + Kirigami.FormData.label: i18n("Notification") + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + text: i18n("Use the system bell whenever a gesture is used to toggle an accessibility feature") + checked: kcm.keyboardSettings.gestures + onCheckStateChanged: kcm.keyboardSettings.gestures = checked + enabled: !kcm.keyboardSettings.isImmutable("Gestures") + } + QQC2.CheckBox { + text: i18n("Show a confirmation dialog whenever a keyboard accessibility feature is toggled") + checked: kcm.keyboardSettings.gestureConfirmation + onCheckStateChanged: kcm.keyboardSettings.gestureConfirmation = checked + enabled: !kcm.keyboardSettings.isImmutable("GestureConfirmation") + } + QQC2.CheckBox { + text: i18n("Use Plasma's notification mechanism whenever a keyboard accessibility feature is toggled") + checked: kcm.keyboardSettings.kNotifyAccess + onCheckStateChanged: kcm.keyboardSettings.kNotifyAccess = checked + enabled: !kcm.keyboardSettings.isImmutable("KNotifyAccess") + } + QQC2.Button { + text: i18n("Configure Notifications") + onClicked: kcm.configureKNotify(); + } + +} diff --git a/kcms/access/package/contents/ui/Bell.qml b/kcms/access/package/contents/ui/Bell.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/Bell.qml @@ -0,0 +1,96 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM +import org.kde.kquickcontrols 2.0 as KQuickAddons +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Audible Bell") + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + id: systemBell + text: i18n("Use system bell") + checked: kcm.bellSettings.systemBell + onCheckStateChanged: kcm.bellSettings.systemBell = checked + enabled: !kcm.bellSettings.isImmutable("SystemBell") + } + QQC2.CheckBox { + id: customBell + enabled: !kcm.bellSettings.isImmutable("ArtsBell") && kcm.bellSettings.systemBell + text: i18n("Use custom bell") + checked: kcm.bellSettings.artsBell + onCheckStateChanged: kcm.bellSettings.artsBell= checked + } + QQC2.TextField { + id: textEdit + enabled: !kcm.bellSettings.isImmutable("ArtsBellFile") && kcm.bellSettings.artsBell + placeholderText: i18n("Sound to play"); + text: kcm.bellSettings.artsBellFile + onEditingFinished: kcm.bellSettings.artsBellFile = textEdit.text + } + + Kirigami.Separator { + Kirigami.FormData.label: i18n("Visual Bell") + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + id: visibleBell + text: i18n("Use visual bell") + checked: kcm.bellSettings.visibleBell + onCheckStateChanged: kcm.bellSettings.visibleBell = checked + enabled: !kcm.bellSettings.isImmutable("VisibleBell") + } + QQC2.RadioButton { + id: invertScreen + text: i18n("Invert Screen") + enabled: !kcm.bellSettings.isImmutable("InvertScreen") && kcm.bellSettings.visibleBell + checked: kcm.bellSettings.invertScreen + onCheckedChanged: kcm.bellSettings.invertScreen = checked + } + RowLayout { + enabled: kcm.bellSettings.visibleBell + QQC2.RadioButton { + id: flashScreen + text: i18n("Flash") + checked: !kcm.bellSettings.invertScreen + onCheckedChanged: kcm.bellSettings.invertScreen = !checked + enabled: !kcm.bellSettings.isImmutable("InvertScreen") + } + KQuickAddons.ColorButton { + text: i18n("Browse") + color: kcm.bellSettings.visibleBellColor + onColorChanged: kcm.bellSettings.visibleBellColor = color + enabled: !kcm.bellSettings.isImmutable("VisibleBellColor") + } + } + QQC2.SpinBox { + value: kcm.bellSettings.visibleBellPause + enabled: !kcm.bellSettings.isImmutable("VisibleBellPause") && kcm.bellSettings.visibleBell + onValueChanged: kcm.bellSettings.visibleBellPause = value + Kirigami.FormData.label: i18n("Duration") + } +} diff --git a/kcms/access/package/contents/ui/KeyboardFilters.qml b/kcms/access/package/contents/ui/KeyboardFilters.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/KeyboardFilters.qml @@ -0,0 +1,93 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM + +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Slow keys") + Kirigami.FormData.isSection: true + } + RowLayout { + QQC2.CheckBox { + id: slowKeys + text: i18n("Use Slow Keys") + checked: kcm.keyboardSettings.slowKeys + onCheckStateChanged: kcm.keyboardSettings.slowKeys = checked + enabled: !kcm.keyboardSettings.isImmutable("SlowKeys") + } + QQC2.SpinBox { + id: slowKayDelay + } + } + QQC2.CheckBox { + id: slowKeysPressBeep + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysPressBeep") && kcm.keyboardSettings.slowKeys + text: i18n("&Use system bell whenever a key is pressed") + checked: kcm.keyboardSettings.slowKeysPressBeep + onCheckStateChanged: kcm.keyboardSettings.slowKeysPressBeep = checked + } + QQC2.CheckBox{ + id: slowKeysAcceptBeep + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysAcceptBeep") && kcm.keyboardSettings.slowKeys + text: i18n("&Use system bell whenever a key is accepted") + checked: kcm.keyboardSettings.slowKeysAcceptBeep + onCheckStateChanged: kcm.keyboardSettings.slowKeysAcceptBeep = checked + } + QQC2.CheckBox{ + id: slowKeysRejectBeep + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysRejectBeep") && kcm.keyboardSettings.slowKeys + text: i18n("&Use system bell whenever a key is rejected") + checked: kcm.keyboardSettings.slowKeysRejectBeep + onCheckStateChanged: kcm.keyboardSettings.slowKeysRejectBeep = checked + } + + Kirigami.Separator { + Kirigami.FormData.label: i18n("Bounce Keys") + Kirigami.FormData.isSection: true + } + + RowLayout { + QQC2.CheckBox { + id: bounceKeys + text: i18n("Use bounce keys"); + checked: kcm.keyboardSettings.bounceKeys + onCheckStateChanged: kcm.keyboardSettings.bounceKeys = checked + enabled: !kcm.keyboardSettings.isImmutable("BounceKeys") + } + QQC2.SpinBox { + id: bounceKeysDelay + enabled: !kcm.keyboardSettings.isImmutable("BounceKeysDelay") && kcm.keyboardSettings.bounceKeys + onValueChanged: kcm.keyboardSettings.bounceDelay = value + } + } + QQC2.CheckBox { + id: bounceKeysRejectBeep + enabled: !kcm.keyboardSettings.isImmutable("BounceKeysRejectBeep") && kcm.keyboardSettings.bounceKeys + text: i18n("Use the system bell whenever a key is rejected") + checked: kcm.keyboardSettings.bounceKeysRejectBeep + onCheckStateChanged: kcm.keyboardSettings.bounceKeysRejectBeep = checked + } +} diff --git a/kcms/access/package/contents/ui/ModifierKeys.qml b/kcms/access/package/contents/ui/ModifierKeys.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/ModifierKeys.qml @@ -0,0 +1,81 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM + +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Sticky Keys") + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + text: i18n("Use sticky keys") + checked: kcm.keyboardSettings.stickyKeys + onCheckStateChanged: kcm.keyboardSettings.stickyKeys = checked + enabled: !kcm.keyboardSettings.isImmutable("StickyKeys") + } + QQC2.CheckBox { + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysLatch") && kcm.keyboardSettings.stickyKeys + text: i18n("Lock sticky keys") + checked: kcm.keyboardSettings.stickyKeysLatch + onCheckStateChanged: kcm.keyboardSettings.stickyKeysLatch = checked + } + QQC2.CheckBox { + id: stickyKeysAutoOff + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysAutoOff") && kcm.keyboardSettings.stickyKeys + text: i18n("Turn off sticky keys when two keys are pressed continuously") + checked: kcm.keyboardSettings.stickyKeysAutoOff + onCheckStateChanged: kcm.keyboardSettings.stickyKeysAutoOff = checked + } + QQC2.CheckBox { + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysBeep") && kcm.keyboardSettings.stickyKeys + text: i18n("Use system bell whenever a modifier gets latched, locked or unlocked") + checked: kcm.keyboardSettings.stickyKeysBeep + onCheckStateChanged: kcm.keyboardSettings.stickyKeysBeep = checked + } + + Kirigami.Separator { + Kirigami.FormData.label: i18n("Locking Keys") + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + text: i18n("Use system bell whenever a locking key gets activated or deactivated") + checked: kcm.keyboardSettings.toggleKeysBeep + onCheckStateChanged: kcm.keyboardSettings.toggleKeysBeep = checked + enabled: !kcm.keyboardSettings.isImmutable("ToggleKeysBeep") + } + QQC2.CheckBox { + text: i18n("Use Plasma's notification mechanism for modifier or locking key state changes") + checked: kcm.keyboardSettings.kNotifyModifiers + onCheckStateChanged: kcm.keyboardSettings.kNotifyModifiers = checked + enabled: !kcm.keyboardSettings.isImmutable("KNotifyModifiers") + } + QQC2.Button { + text: i18n("Configure Notifications") + onClicked: kcm.keyboardSettings.configureKNotify(); + } + +} diff --git a/kcms/access/package/contents/ui/MouseNavigation.qml b/kcms/access/package/contents/ui/MouseNavigation.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/MouseNavigation.qml @@ -0,0 +1,70 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.12 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Activation Gestures") + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + id: mouseKeys + text: i18n("Move pointer with keyboard (using the num pad)") + checked: kcm.mouseSettings.mouseKeys + onCheckStateChanged: kcm.mouseSettings.mouseKeys = checked + enabled: !kcm.keyboardSettings.isImmutable("MouseKeys") + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration delay:") + value: kcm.mouseSettings.mKDelay + onValueChanged: kcm.mouseSettings.mKDelay = value + enabled: !kcm.keyboardSettings.isImmutable("MKDelay") + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Repeat interval:") + value: kcm.mouseSettings.mKInterval + onValueChanged: kcm.mouseSettings.mKInterval = value + enabled: !kcm.keyboardSettings.isImmutable("MKInterval") + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration time:") + value: kcm.mouseSettings.mKTimeToMax + onValueChanged: kcm.mouseSettings.mKTimeToMax = value + enabled: !kcm.keyboardSettings.isImmutable("MKTimeToMax") + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Maximum speed:") + value: kcm.mouseSettings.mKMaxSpeed + onValueChanged: kcm.mouseSettings.mKMaxSpeed = value + enabled: !kcm.keyboardSettings.isImmutable("MKMaxSpeed") + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration profile:") + value: kcm.mouseSettings.mKCurve + onValueChanged: kcm.mouseSettings.mKCurve = value + enabled: !kcm.keyboardSettings.isImmutable("MKCurve") + } +} diff --git a/kcms/access/package/contents/ui/ScreenReader.qml b/kcms/access/package/contents/ui/ScreenReader.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/ScreenReader.qml @@ -0,0 +1,49 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kcm 1.1 as KCM +import org.kde.kirigami 2.3 as Kirigami + +Kirigami.FormLayout { + Item { + Kirigami.FormData.label: i18n("Screen Reader") + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + text: i18n("Screen reader enabled") + checked: kcm.screenReaderSettings.enabled + onCheckStateChanged: kcm.screenReaderSettings.enabled = checked + enabled: !kcm.screenReaderSettings.isImmutable("Enabled") + } + QQC2.Button { + text: i18n("Launch Orca Configuration") + onClicked: kcm.screenReaderSettings.launchOrcaConfiguration() + enabled: !kcm.screenReaderSettings.isImmutable("Enabled") + } + QQC2.Label { + text: kcm.orcaLaunchFeedback + } + QQC2.Label { + text: i18n("Please note that you may have to log out \n once to allow the screen reader to work properly.") + } +} diff --git a/kcms/access/package/contents/ui/main.qml b/kcms/access/package/contents/ui/main.qml new file mode 100644 --- /dev/null +++ b/kcms/access/package/contents/ui/main.qml @@ -0,0 +1,100 @@ +/* + * Copyright 2018 Tomaz Canabrava + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.9 +import QtQuick.Layouts 1.12 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.0 as QtDialogs +import QtQuick.Controls 2.12 as QQC2 +import org.kde.kirigami 2.4 as Kirigami +import org.kde.kcm 1.1 as KCM + +KCM.SimpleKCM { + id: root + + RowLayout { + anchors.fill: parent + anchors.margins: Kirigami.Units.largeSpacing + + QQC2.ScrollView { + id: bgObject + Component.onCompleted: bgObject.background.visible = true + Layout.fillHeight: true + Layout.preferredWidth: parent.width * 0.3 + + ListView { + id: listView + model: elements + anchors.fill: parent + onCurrentIndexChanged: stackView.currentIndex = currentIndex + activeFocusOnTab: true + keyNavigationEnabled: true + + delegate: Kirigami.BasicListItem { + width: listView.width + icon: model.icon + label: i18n(model.title) + } + } + } + + + StackLayout { + id: stackView + Layout.fillHeight: true + Layout.fillWidth: true + + Bell {} + ModifierKeys {} + KeyboardFilters {} + ActivationGestures {} + MouseNavigation {} + ScreenReader {} + } + } + + ListModel { + id: elements + ListElement { + icon: "preferences-desktop-notification-bell" + title: QT_TR_NOOP("Bell") + } + ListElement { + icon: "input-keyboard" + title: QT_TR_NOOP("Modifier Keys") + } + ListElement { + icon: "preferences-desktop-keyboard" + title: QT_TR_NOOP("Keyboard Filters") + } + ListElement { + icon: "object-rotate-right" + title: QT_TR_NOOP("Activation Gestures") + } + ListElement { + icon: "input-mouse" + title: QT_TR_NOOP("Mouse Navigation") + } + ListElement { + icon: "audio-input-microphone" + title: QT_TR_NOOP("Screen Reader") + } + } +} diff --git a/kcms/access/package/metadata.desktop b/kcms/access/package/metadata.desktop new file mode 100644 --- /dev/null +++ b/kcms/access/package/metadata.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Name=Accessibility +Comment=Accessibility Options + +Icon=preferences-desktop-accessibility +Type=Service +X-KDE-PluginInfo-Author=Tomaz Canabrava +X-KDE-PluginInfo-Email=tcanabrava@kde.org +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-Name=kcmaccess +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-KDE-ServiceTypes=Plasma/Generic +X-Plasma-API=declarativeappletscript + +X-Plasma-MainScript=ui/main.qml