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,46 @@ # 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 +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,53 @@ #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 NOTIFY orcaLaunchFeedbackChanged) + + // Not used at the moment, but has example strings. I need to discover where to put this in the UI. + 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_INVOKABLE void configureKNotify(QQuickItem *parent); + Q_INVOKABLE void launchOrcaConfiguration(); + Q_INVOKABLE bool orcaInstalled(); + + QString orcaLaunchFeedback() const; - void configChanged(); - void checkAccess(); - void invertClicked(); - void flashClicked(); - void selectSound(); - void changeFlashScreenColor(); - void configureKNotify(); - void launchOrcaConfiguration(); +Q_SIGNALS: + void orcaLaunchFeedbackChanged(); private: - Ui::access ui; + void setOrcaLaunchFeedback(const QString& value); + + MouseSettings *m_mouseSettings; + BellSettings *m_bellSettings; + KeyboardSettings *m_keyboardSettings; + ScreenReaderSettings *m_screenReaderSettings; + QString m_orcaLaunchFeedback; + QString m_desktopShortcutInfo; + bool m_screenReaderInstalled; }; 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,31 @@ #include #include -#include +#include #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(KCMAccessFactory, "kcmaccess.json", registerPlugin();) QString mouseKeysShortcut(Display *display) { @@ -131,316 +141,80 @@ if ((modifiers & ShiftMask) != 0) keyname = QKeySequence(Qt::SHIFT).toString() + QLatin1Char('+') + keyname; - QString result; - if ((modifiers & ScrollMask) != 0) - if ((modifiers & LockMask) != 0) - if ((modifiers & NumMask) != 0) - result = i18n("Press %1 while NumLock, CapsLock and ScrollLock are active", keyname); - else - result = i18n("Press %1 while CapsLock and ScrollLock are active", keyname); - else if ((modifiers & NumMask) != 0) - result = i18n("Press %1 while NumLock and ScrollLock are active", keyname); - else - result = i18n("Press %1 while ScrollLock is active", keyname); - else if ((modifiers & LockMask) != 0) - if ((modifiers & NumMask) != 0) - result = i18n("Press %1 while NumLock and CapsLock are active", keyname); - else - result = i18n("Press %1 while CapsLock is active", keyname); - else if ((modifiers & NumMask) != 0) - result = i18n("Press %1 while NumLock is active", keyname); - else - result = i18n("Press %1", keyname); - - return result; + return modifiers & (ScrollMask | LockMask | NumMask) ? i18n("Press %1 while NumLock, CapsLock and ScrollLock are active", keyname) + : modifiers & (ScrollMask | LockMask) ? i18n("Press %1 while CapsLock and ScrollLock are active", keyname) + : modifiers & (ScrollMask | NumMask) ? i18n("Press %1 while NumLock and ScrollLock are active", keyname) + : modifiers & (LockMask | NumMask) ? i18n("Press %1 while NumLock and CapsLock are active", keyname) + : modifiers & ScrollMask ? i18n("Press %1 while ScrollLock is active", keyname) + : modifiers & LockMask ? i18n("Press %1 while CapsLock is active", keyname) + : modifiers & NumMask ? i18n("Press %1 while NumLock is active", keyname) + : i18n("Press %1", keyname); } -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())) { + qmlRegisterAnonymousType("kcm.kde.org", 1); + qmlRegisterAnonymousType("kcm.kde.org", 1); + qmlRegisterAnonymousType("kcm.kde.org", 1); + qmlRegisterAnonymousType("kcm.kde.org", 1); + 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); + setButtons(ConfigModule::Apply | ConfigModule::Default | ConfigModule::Help); + setAboutData(about); } - KAccessConfig::~KAccessConfig() { } -void KAccessConfig::configureKNotify() +void KAccessConfig::configureKNotify(QQuickItem *parent) { - KNotifyConfigWidget::configure(this, QStringLiteral("kaccess")); + auto dialog = KNotifyConfigWidget::configure(nullptr, QStringLiteral("kaccess")); + if (parent && parent->window()) { + dialog->winId(); + dialog->windowHandle()->setTransientParent(QQuickRenderControl::renderWindowFor(parent->window())); + } } 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\"")); + setOrcaLaunchFeedback(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; - } - 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->customBell() || m_bellSettings->visibleBell()) { KConfig _cfg(QStringLiteral("kdeglobals"), KConfig::NoGlobals); KConfigGroup cfg(&_cfg, "General"); cfg.writeEntry("UseSystemBell", true); @@ -451,106 +225,27 @@ // 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); + if (m_orcaLaunchFeedback != value) { + m_orcaLaunchFeedback = value; + emit orcaLaunchFeedbackChanged(); + } } - -void KAccessConfig::flashClicked() +bool KAccessConfig::orcaInstalled() { - ui.invertScreen->setChecked(false); -} + int tryOrcaRun = QProcess::execute(QStringLiteral("orca"), {QStringLiteral("--version")}); - -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 the process cannot be started, -2 is returned. + return tryOrcaRun != -2; } extern "C" @@ -565,4 +260,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/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,151 @@ +/* + * 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 QtQuick.Dialogs 1.3 as Dialogs + +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 { + + Dialogs.FileDialog { + id: fileDialog + title: i18n("Please choose an audio file") + folder: shortcuts.home + nameFilters: ["Audio Files (*.mp3 *.ogg *.wav)"] + onAccepted: { + kcm.bellSettings.customBellFile = fileDialog.fileUrls[0] + } + } + + QQC2.CheckBox { + id: systemBell + + Kirigami.FormData.label: i18n("Audible Bell:") + text: i18nc("Enable the system bell", "Enable") + + enabled: !kcm.bellSettings.isImmutable("SystemBell") + + checked: kcm.bellSettings.systemBell + onToggled: kcm.bellSettings.systemBell = checked + } + Row { + Kirigami.FormData.label: i18nc("Defines if the system will use a sound system bell", "Audible Bell:") + + QQC2.CheckBox { + + id: customBell + enabled: !kcm.bellSettings.isImmutable("CustomBell") && kcm.bellSettings.systemBell + + checked: kcm.bellSettings.customBell + onToggled: kcm.bellSettings.customBell= checked + } + + QQC2.TextField { + id: textEdit + + text: kcm.bellSettings.customBellFile + + enabled: !kcm.bellSettings.isImmutable("CustomBellFile") && kcm.bellSettings.customBell + + onEditingFinished: kcm.bellSettings.customBellFile = textEdit.text + } + QQC2.Button { + icon.name: "folder" + QQC2.ToolTip.visible: down + QQC2.ToolTip.text: i18n("Search audio file for the system bell") + Accessible.name: i18n("Button search audio file") + enabled: !kcm.bellSettings.isImmutable("CustomBellFile") && kcm.bellSettings.customBell + + onClicked: fileDialog.open() + } + } + Item { + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + id: visibleBell + + Kirigami.FormData.label: i18n("Visual Bell:") + text: i18nc("Enable visual bell", "Enable") + + enabled: !kcm.bellSettings.isImmutable("VisibleBell") + + checked: kcm.bellSettings.visibleBell + onToggled: kcm.bellSettings.visibleBell = checked + } + + QQC2.RadioButton { + id: invertScreen + + text: i18nc("Invert screen on a system bell", "Invert Screen") + + enabled: !kcm.bellSettings.isImmutable("InvertScreen") && kcm.bellSettings.visibleBell + + checked: kcm.bellSettings.invertScreen + onToggled: kcm.bellSettings.invertScreen = checked + } + RowLayout { + enabled: kcm.bellSettings.visibleBell + + QQC2.RadioButton { + id: flashScreen + + text: i18nc("Flash screen on a system bell", "Flash") + + enabled: !kcm.bellSettings.isImmutable("InvertScreen") + + checked: !kcm.bellSettings.invertScreen + onToggled: kcm.bellSettings.invertScreen = !checked + } + KQuickAddons.ColorButton { + text: i18nc("Color of the system bell","Color") + + enabled: !kcm.bellSettings.isImmutable("VisibleBellColor") + + color: kcm.bellSettings.visibleBellColor + onAccepted: kcm.bellSettings.visibleBellColor = color + } + } + QQC2.SpinBox { + Kirigami.FormData.label: i18nc("Duration of the system bell", "Duration:") + + enabled: !kcm.bellSettings.isImmutable("VisibleBellPause") && kcm.bellSettings.visibleBell + + value: kcm.bellSettings.visibleBellPause + onValueModified: kcm.bellSettings.visibleBellPause = value + } + Item { + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + Kirigami.FormData.label: i18nc("Notification Bells", "Notification:") + text: i18n("Bell when a gesture is used to toggle an accessibility feature") + + enabled: !kcm.keyboardSettings.isImmutable("Gestures") + + checked: kcm.keyboardSettings.gestures + onToggled: kcm.keyboardSettings.gestures = checked + } +} 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,119 @@ +/* + * 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 { + QQC2.CheckBox { + id: slowKeys + + Kirigami.FormData.label: i18n("Slow keys:") + text: i18nc("Enable slow keys", "Enable") + + enabled: !kcm.keyboardSettings.isImmutable("SlowKeys") + + checked: kcm.keyboardSettings.slowKeys + onToggled: kcm.keyboardSettings.slowKeys = checked + } + + QQC2.SpinBox { + id: slowKayDelay + + Kirigami.FormData.label: i18nc("Slow keys Delay","Delay:") + + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysDelay") && kcm.keyboardSettings.slowKeys + + onValueChanged: kcm.keyboardSettings.slowKeysDelay = value + } + Item { + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + id: slowKeysPressBeep + + Kirigami.FormData.label: i18n("Use system bell:") + text: i18nc("Use system bell when a key is pressed", "&when a key is pressed") + + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysPressBeep") && kcm.keyboardSettings.slowKeys + + checked: kcm.keyboardSettings.slowKeysPressBeep + onToggled: kcm.keyboardSettings.slowKeysPressBeep = checked + } + QQC2.CheckBox{ + id: slowKeysAcceptBeep + + text: i18nc("Use system bell when a key is accepted", "&when a key is accepted") + + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysAcceptBeep") && kcm.keyboardSettings.slowKeys + + checked: kcm.keyboardSettings.slowKeysAcceptBeep + onToggled: kcm.keyboardSettings.slowKeysAcceptBeep = checked + } + QQC2.CheckBox{ + id: slowKeysRejectBeep + + text: i18nc("Use system bell when a key is rejected", "&when a key is rejected") + + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysRejectBeep") && kcm.keyboardSettings.slowKeys + + checked: kcm.keyboardSettings.slowKeysRejectBeep + onToggled: kcm.keyboardSettings.slowKeysRejectBeep = checked + } + Item { + Kirigami.FormData.isSection: true + } + QQC2.CheckBox { + id: bounceKeys + + Kirigami.FormData.label: i18n("Bounce Keys:") + text: i18nc("Bounce keys enable", "Enable"); + + enabled: !kcm.keyboardSettings.isImmutable("BounceKeys") + + checked: kcm.keyboardSettings.bounceKeys + onToggled: kcm.keyboardSettings.bounceKeys = checked + } + + QQC2.SpinBox { + id: bounceKeysDelay + + Kirigami.FormData.label: i18nc("Bounce keys delay", "Delay:") + + enabled: !kcm.keyboardSettings.isImmutable("BounceKeysDelay") && kcm.keyboardSettings.bounceKeys + + onValueChanged: kcm.keyboardSettings.bounceDelay = value + } + + QQC2.CheckBox { + id: bounceKeysRejectBeep + + text: i18n("Use the system bell whenever a key is rejected") + + enabled: !kcm.keyboardSettings.isImmutable("BounceKeysRejectBeep") && kcm.keyboardSettings.bounceKeys + + checked: kcm.keyboardSettings.bounceKeysRejectBeep + onToggled: 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,121 @@ +/* + * 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 { + QQC2.CheckBox { + Kirigami.FormData.label: i18n("Sticky Keys:") + text: i18nc("Enable sticky keys", "Enable") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeys") + + checked: kcm.keyboardSettings.stickyKeys + onToggled: kcm.keyboardSettings.stickyKeys = checked + } + QQC2.CheckBox { + text: i18nc("Lock sticky keys", "Lock") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysLatch") && kcm.keyboardSettings.stickyKeys + + checked: kcm.keyboardSettings.stickyKeysLatch + onToggled: kcm.keyboardSettings.stickyKeysLatch = checked + } + QQC2.CheckBox { + id: stickyKeysAutoOff + + text: i18n("Disable when two keys are held down") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysAutoOff") && kcm.keyboardSettings.stickyKeys + + checked: kcm.keyboardSettings.stickyKeysAutoOff + onToggled: kcm.keyboardSettings.stickyKeysAutoOff = checked + } + QQC2.CheckBox { + text: i18n("Use system bell when modifier keys are used") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysBeep") && kcm.keyboardSettings.stickyKeys + + checked: kcm.keyboardSettings.stickyKeysBeep + onToggled: kcm.keyboardSettings.stickyKeysBeep = checked + } + + Item { + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + Kirigami.FormData.label: i18n("Sticky and Slow Keys:") + text: i18n("Use gestures to activate") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeys") + + checked: kcm.keyboardSettings.stickyKeys + onToggled: kcm.keyboardSettings.stickyKeys = checked + } + + Row { + QQC2.CheckBox { + text: i18n("Disable after:") + + enabled: !kcm.keyboardSettings.isImmutable("StickyKeysAutoOff") && kcm.keyboardSettings.stickyKeys + + checked: kcm.keyboardSettings.stickyKeysAutoOff + onToggled: kcm.keyboardSettings.stickyKeysAutoOff = checked + + } + QQC2.SpinBox { + enabled: !kcm.keyboardSettings.isImmutable("SlowKeysDelay") && kcm.keyboardSettings.stickyKeys + + value: kcm.keyboardSettings.slowKeysDelay + onValueChanged: kcm.keyboardSettings.slowKeysDelay = value + } + } + QQC2.CheckBox { + Kirigami.FormData.label: i18n("Locking Keys:") + text: i18n("Use system bell when locking keys are toggled") + + enabled: !kcm.keyboardSettings.isImmutable("ToggleKeysBeep") + + checked: kcm.keyboardSettings.toggleKeysBeep + onToggled: kcm.keyboardSettings.toggleKeysBeep = checked + } + QQC2.CheckBox { + text: i18n("Show notification when modifier or locking keys are used") + + enabled: !kcm.keyboardSettings.isImmutable("KeyboardNotifyModifiers") + + checked: kcm.keyboardSettings.keyboardNotifyModifiers + onToggled: kcm.keyboardSettings.keyboardNotifyModifiers = checked + } + QQC2.Button { + id: this + text: i18n("Configure Notifications...") + icon.name: "preferences-desktop-notification" + + onClicked: kcm.configureKNotify(this) + } + +} 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,109 @@ +/* + * 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 { + QQC2.CheckBox { + id: mouseKeys + + Kirigami.FormData.label: i18n("Activation Gestures:") + text: i18n("Enable using keyboard number pad to move cursor") + + enabled: !kcm.mouseSettings.isImmutable("MouseKeys") + + checked: kcm.mouseSettings.mouseKeys + onToggled: kcm.mouseSettings.mouseKeys = checked + } + QQC2.CheckBox { + Kirigami.FormData.label: i18n("When a gesture is used:") + text: i18n("Display a confirmation dialog") + + enabled: !kcm.keyboardSettings.isImmutable("GestureConfirmation") + + checked: kcm.keyboardSettings.gestureConfirmation + onToggled: kcm.keyboardSettings.gestureConfirmation = checked + } + QQC2.CheckBox { + text: i18n("Ring the System Bell") + + enabled: !kcm.keyboardSettings.isImmutable("Gestures") + + checked: kcm.keyboardSettings.gestures + onToggled: kcm.keyboardSettings.gestures = checked + } + QQC2.CheckBox { + text: i18n("Show a notification") + + enabled: !kcm.keyboardSettings.isImmutable("KeyboardNotifyAccess") + + checked: kcm.keyboardSettings.keyboardNotifyAccess + onToggled: kcm.keyboardSettings.keyboardNotifyAccess = checked + } + + Item { + Kirigami.FormData.isSection: true + } + + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration delay:") + + enabled: !kcm.mouseSettings.isImmutable("AccelerationDelay") + + value: kcm.mouseSettings.accelerationDelay + onValueChanged: kcm.mouseSettings.accelerationDelay = value + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Repeat interval:") + + enabled: !kcm.mouseSettings.isImmutable("RepetitionInterval") + + value: kcm.mouseSettings.repetitionInterval + onValueChanged: kcm.mouseSettings.repetitionInterval = value + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration time:") + + enabled: !kcm.mouseSettings.isImmutable("AccelerationTime") + + value: kcm.mouseSettings.accelerationTime + onValueChanged: kcm.mouseSettings.accelerationTime = value + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Maximum speed:") + + enabled: !kcm.mouseSettings.isImmutable("MaxSpeed") + + value: kcm.mouseSettings.maxSpeed + onValueChanged: kcm.mouseSettings.maxSpeed = value + } + QQC2.SpinBox { + Kirigami.FormData.label: i18n("Acceleration profile:") + + enabled: !kcm.mouseSettings.isImmutable("ProfileCurve") + + value: kcm.mouseSettings.profileCurve + onValueChanged: kcm.mouseSettings.profileCurve = value + } +} 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,59 @@ +/* + * 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 { + property var screenReaderInstalled : null + + QQC2.CheckBox { + text: i18n("Enable Screen Reader") + + enabled: !kcm.screenReaderSettings.isImmutable("Enabled") + + checked: kcm.screenReaderSettings.enabled + onToggled: kcm.screenReaderSettings.enabled = checked + } + QQC2.Button { + text: i18n("Launch Orca Screen Reader Configuration...") + + enabled: !kcm.screenReaderSettings.isImmutable("Enabled") && screenReaderInstalled + + onClicked: kcm.screenReaderSettings.launchOrcaConfiguration() + } + QQC2.Label { + text: kcm.orcaLaunchFeedback + } + QQC2.Label { + text: screenReaderInstalled + ? i18n("Please note that you may have to log out \n once to allow the screen reader to work properly.") + : i18n("It appears that you don't have Orca Screen Reader installed, \n please install it before trying to use this feature, \n and restart this configuration panel") + } + + onVisibleChanged: { + if (visible === true && screenReaderInstalled === null) { + screenReaderInstalled = kcm.orcaInstalled() + } + } +} 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,99 @@ +/* + * 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 + + property var elements: [ + { + icon: "preferences-desktop-notification-bell", + title: i18nc("System Bell Configuration", "Bell") + }, + { + icon: "input-keyboard", + title: i18nc("System Modifier Keys Configuration", "Modifier Keys") + }, + { + icon: "preferences-desktop-keyboard", + title: i18nc("System keyboard filters configuration", "Keyboard Filters") + }, + { + icon: "input-mouse", + title: i18nc("System mouse navigation configuration", "Mouse Navigation") + }, + { + icon: "audio-input-microphone", + title: i18nc("System mouse navigation configuration", "Screen Reader") + } + ] + + RowLayout { + anchors.margins: Kirigami.Units.largeSpacing + + QQC2.ScrollView { + id: leftSidePaneBackground + + // This does not work anymore. returns a null value. + Component.onCompleted: leftSidePaneBackground.background.visible = true + + Layout.fillHeight: true + Layout.preferredWidth: parent.width * 0.3 + + ListView { + id: listView + + model: elements + anchors.fill: parent + activeFocusOnTab: true + keyNavigationEnabled: true + + onCurrentIndexChanged: stackView.currentIndex = currentIndex + + delegate: Kirigami.BasicListItem { + width: listView.width + icon: modelData.icon + label: modelData.title + onClicked: listView.forceActiveFocus() + } + } + } + + StackLayout { + id: stackView + + Layout.fillHeight: true + Layout.fillWidth: true + + Bell {} + ModifierKeys {} + KeyboardFilters {} + MouseNavigation {} + ScreenReader {} + } + } +} 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