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,31 @@ # KI18N Translation Domain for this library +# KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmaccess\") set(kcm_access_PART_SRCS kcmaccess.cpp ) - -ki18n_wrap_ui(kcm_access_PART_SRCS - accessibility.ui -) - add_library(kcm_access MODULE ${kcm_access_PART_SRCS}) +# needed for krdb +qt5_add_dbus_interface(kcm_access_PART_SRCS ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml klauncher_iface) + target_link_libraries(kcm_access - Qt5::X11Extras + Qt5::DBus KF5::KCMUtils + KF5::CoreAddons + KF5::Declarative + KF5::GuiAddons KF5::I18n - KF5::KIOCore - KF5::KIOWidgets - KF5::NotifyConfig + KF5::NewStuff + KF5::QuickAddons KF5::WindowSystem + Qt5::X11Extras + KF5::NotifyConfig ${X11_LIBRARIES} ) -install(TARGETS kcm_access DESTINATION ${KDE_INSTALL_PLUGINDIR}) +kcoreaddons_desktop_to_json(kcm_access "kcmaccess.desktop") -########### install files ############### +install(FILES kcmaccess.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS kcm_access DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms) -install( FILES kcmaccess.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) +kpackage_install_package(package kcm_access kcms) diff --git a/kcms/access/accessibility.ui b/kcms/access/accessibility.ui --- a/kcms/access/accessibility.ui +++ b/kcms/access/accessibility.ui @@ -14,7 +14,7 @@ - 0 + 5 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,209 @@ #ifndef __kcmaccess_h__ #define __kcmaccess_h__ +#include +#include +#include -#include -#include "ui_accessibility.h" - -class KAccessConfig : public KCModule +class KAccessConfig : public KQuickAddons::ConfigModule { Q_OBJECT + Q_PROPERTY(int timeoutDelay READ timeoutDelay WRITE setTimeoutDelay NOTIFY timeoutDelayChanged) + Q_PROPERTY(int bounceKeysDelay READ bounceKeysDelay WRITE setBounceKeysDelay NOTIFY bounceKeysDelayChanged) + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + Q_PROPERTY(int slowKeysDelay READ slowKeysDelay WRITE setSlowKeysDelay NOTIFY slowKeysDelayChanged) + Q_PROPERTY(int mouseKeyDelay READ mouseKeyDelay WRITE setMouseKeyDelay NOTIFY mouseKeyDelayChanged) + Q_PROPERTY(int mouseKeyInterval READ mouseKeyInterval WRITE setMouseKeyInterval NOTIFY mouseKeyIntervalChanged) + Q_PROPERTY(int mouseKeyTimeToMax READ mouseKeyTimeToMax WRITE setMouseKeyTimeToMax NOTIFY mouseKeyTimeToMaxChanged) + Q_PROPERTY(int mouseKeyMaxSpeed READ mouseKeyMaxSpeed WRITE setMouseKeyMaxSpeed NOTIFY mouseKeyMaxSpeedChanged) + Q_PROPERTY(int mouseKeyCurve READ mouseKeyCurve WRITE setMouseKeyCurve NOTIFY mouseKeyCurveChanged) + Q_PROPERTY(bool systemBell READ systemBell WRITE setSystemBell NOTIFY systemBellChanged) + Q_PROPERTY(bool customBell READ customBell WRITE setCustomBell NOTIFY customBellChanged) + Q_PROPERTY(bool visibleBell READ visibleBell WRITE setVisibleBell NOTIFY visibleBellChanged) + Q_PROPERTY(bool invertScreen READ invertScreen WRITE setInvertScreen NOTIFY invertScreenChanged) + Q_PROPERTY(bool flashScreen READ flashScreen WRITE setFlashScreen NOTIFY flashScreenChanged) + Q_PROPERTY(bool slowKeys READ slowKeys WRITE setSlowKeys NOTIFY slowKeysChanged) + Q_PROPERTY(bool slowKeysPressBeep READ slowKeysPressBeep WRITE setSlowKeysPressBeep NOTIFY slowKeysPressBeepChanged) + Q_PROPERTY(bool slowKeysAcceptBeep READ slowKeysAcceptBeep WRITE setSlowKeysAcceptBeep NOTIFY slowKeysAcceptBeepChanged) + Q_PROPERTY(bool slowKeysRejectBeep READ slowKeysRejectBeep WRITE setSlowKeysRejectBeep NOTIFY slowKeysRejectBeepChanged) + Q_PROPERTY(bool bounceKeys READ bounceKeys WRITE setBounceKeys NOTIFY bounceKeysChanged) + Q_PROPERTY(bool bounceKeysRejectBeep READ bounceKeysRejectBeep WRITE setBounceKeysRejectBeep NOTIFY bounceKeysRejectBeepChanged) + Q_PROPERTY(bool stickyKeys READ stickyKeys WRITE setStickyKeys NOTIFY stickyKeysChanged) + Q_PROPERTY(bool stickyKeysLock READ stickyKeysLock WRITE setStickyKeysLock NOTIFY stickyKeysLockChanged) + Q_PROPERTY(bool stickyKeysAutoOff READ stickyKeysAutoOff WRITE setStickyKeysAutoOff NOTIFY stickyKeysAutoOffChanged) + Q_PROPERTY(bool stickyKeysBeep READ stickyKeysBeep WRITE setStickyKeysBeep NOTIFY stickyKeysBeepChanged) + Q_PROPERTY(bool toggleKeysBeep READ toggleKeysBeep WRITE setToggleKeysBeep NOTIFY toggleKeysBeepChanged) + Q_PROPERTY(bool keyboardNotifyModifiers READ keyboardNotifyModifiers WRITE setKeyboardNotifyModifiers NOTIFY keyboardNotifyModifiersChanged) + Q_PROPERTY(bool gestures READ gestures WRITE setGestures NOTIFY gesturesChanged) + Q_PROPERTY(bool timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged) + Q_PROPERTY(bool accessXBeep READ accessXBeep WRITE setAccessXBeep NOTIFY accessXBeepChanged) + Q_PROPERTY(bool gestureConfirmation READ gestureConfirmation WRITE setGestureConfirmation NOTIFY gestureConfirmationChanged) + Q_PROPERTY(bool keyboardNotifyAccess READ keyboardNotifyAccess WRITE setKeyboardNotifyAccess NOTIFY keyboardNotifyAccessChanged) + Q_PROPERTY(bool mouseKeys READ mouseKeys WRITE setMouseKeys NOTIFY mouseKeysChanged) + Q_PROPERTY(bool screenReaderEnabled READ screenReaderEnabled WRITE setScreenReaderEnabled NOTIFY screenReaderEnabledChanged) + Q_PROPERTY(QString soundEdit READ soundEdit WRITE setSoundEdit NOTIFY soundEditChanged) + Q_PROPERTY(QColor colorButton READ colorButton WRITE setColorButton NOTIFY colorButtonChanged) 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: + int timeoutDelay () const; + int bounceKeysDelay () const; + int duration () const; + int slowKeysDelay () const; + int mouseKeyDelay () const; + int mouseKeyInterval () const; + int mouseKeyTimeToMax () const; + int mouseKeyMaxSpeed () const; + int mouseKeyCurve () const; + bool systemBell () const; + bool customBell () const; + bool visibleBell () const; + bool invertScreen () const; + bool flashScreen () const; + bool slowKeys () const; + bool slowKeysPressBeep () const; + bool slowKeysAcceptBeep () const; + bool slowKeysRejectBeep () const; + bool bounceKeys () const; + bool bounceKeysRejectBeep() const; + bool stickyKeys () const; + bool stickyKeysLock () const; + bool stickyKeysAutoOff () const; + bool stickyKeysBeep () const; + bool toggleKeysBeep () const; + bool keyboardNotifyModifiers() const; + bool gestures () const; + bool timeout () const; + bool accessXBeep () const; + bool gestureConfirmation () const; + bool keyboardNotifyAccess () const; + bool mouseKeys () const; + bool screenReaderEnabled () const; + QString soundEdit () const; + QColor colorButton () const; + +public Q_SLOTS: + void setTimeoutDelay (int value); + void setBounceKeysDelay (int value); + void setDuration (int value); + void setSlowKeysDelay (int value); + void setMouseKeyDelay (int value); + void setMouseKeyInterval (int value); + void setMouseKeyTimeToMax (int value); + void setMouseKeyMaxSpeed (int value); + void setMouseKeyCurve (int value); + void setSystemBell (bool value); + void setCustomBell (bool value); + void setVisibleBell (bool value); + void setInvertScreen (bool value); + void setFlashScreen (bool value); + void setSlowKeys (bool value); + void setSlowKeysPressBeep (bool value); + void setSlowKeysAcceptBeep (bool value); + void setSlowKeysRejectBeep (bool value); + void setBounceKeys (bool value); + void setBounceKeysRejectBeep (bool value); + void setStickyKeys (bool value); + void setStickyKeysLock (bool value); + void setStickyKeysAutoOff (bool value); + void setStickyKeysBeep (bool value); + void setToggleKeysBeep (bool value); + void setKeyboardNotifyModifiers (bool value); + void setGestures (bool value); + void setTimeout (bool value); + void setAccessXBeep (bool value); + void setGestureConfirmation (bool value); + void setKeyboardNotifyAccess (bool value); + void setMouseKeys (bool value); + void setScreenReaderEnabled (bool value); + void setSoundEdit (QString value); + void setColorButton (QColor value); - void configChanged(); - void checkAccess(); - void invertClicked(); - void flashClicked(); - void selectSound(); - void changeFlashScreenColor(); +Q_SIGNALS: + void timeoutDelayChanged (int value); + void bounceKeysDelayChanged (int value); + void durationChanged (int value); + void slowKeysDelayChanged (int value); + void mouseKeyDelayChanged (int value); + void mouseKeyIntervalChanged (int value); + void mouseKeyTimeToMaxChanged (int value); + void mouseKeyMaxSpeedChanged (int value); + void mouseKeyCurveChanged (int value); + void systemBellChanged (bool value); + void customBellChanged (bool value); + void visibleBellChanged (bool value); + void invertScreenChanged (bool value); + void flashScreenChanged (bool value); + void slowKeysChanged (bool value); + void slowKeysPressBeepChanged (bool value); + void slowKeysAcceptBeepChanged (bool value); + void slowKeysRejectBeepChanged (bool value); + void bounceKeysChanged (bool value); + void bounceKeysRejectBeepChanged (bool value); + void stickyKeysChanged (bool value); + void stickyKeysLockChanged (bool value); + void stickyKeysAutoOffChanged (bool value); + void stickyKeysBeepChanged (bool value); + void toggleKeysBeepChanged (bool value); + void keyboardNotifyModifiersChanged(bool value); + void gesturesChanged (bool value); + void timeoutChanged (bool value); + void accessXBeepChanged (bool value); + void gestureConfirmationChanged (bool value); + void keyboardNotifyAccessChanged (bool value); + void mouseKeysChanged (bool value); + void screenReaderEnabledChanged (bool value); + void soundEditChanged (QString value); + void colorButtonChanged (QColor value); + +protected Q_SLOTS: void configureKNotify(); void launchOrcaConfiguration(); private: - Ui::access ui; + int _timeoutDelay ; + int _bounceKeysDelay ; + int _duration ; + int _slowKeysDelay ; + int _mouseKeyDelay ; + int _mouseKeyInterval ; + int _mouseKeyTimeToMax ; + int _mouseKeyMaxSpeed ; + int _mouseKeyCurve ; + bool _systemBell ; + bool _customBell ; + bool _visibleBell ; + bool _invertScreen ; + bool _bounceKeysRejectBeep; + bool _flashScreen ; + bool _slowKeys ; + bool _slowKeysPressBeep ; + bool _slowKeysAcceptBeep ; + bool _slowKeysRejectBeep ; + bool _bounceKeys ; + bool _bounceKeysRejectBee; + bool _stickyKeys ; + bool _stickyKeysLock ; + bool _stickyKeysAutoOff ; + bool _stickyKeysBeep ; + bool _toggleKeysBeep ; + bool _keyboardNotifyModifiers; + bool _gestures ; + bool _timeout ; + bool _accessXBeep ; + bool _gestureConfirmation; + bool _keyboardNotifyAccess; + bool _mouseKeys ; + bool _screenReaderEnabled; + QString _soundEdit ; + QColor _colorButton ; }; diff --git a/kcms/access/kcmaccess.cpp b/kcms/access/kcmaccess.cpp --- a/kcms/access/kcmaccess.cpp +++ b/kcms/access/kcmaccess.cpp @@ -33,18 +33,17 @@ #include #include #include -#include +#include #include #include - +#include #include #include #define XK_MISCELLANY #define XK_XKB_KEYS #include -K_PLUGIN_FACTORY(KAccessConfigFactory, registerPlugin();) -K_EXPORT_PLUGIN(KAccessConfigFactory("kcmaccess")) +K_PLUGIN_FACTORY_WITH_JSON(KCMColorsFactory, "kcmaccess.json", registerPlugin();) QString mouseKeysShortcut(Display *display) { @@ -156,66 +155,18 @@ return result; } -KAccessConfig::KAccessConfig(QWidget *parent, const QVariantList& args) - : KCModule(parent, args) +KAccessConfig::KAccessConfig(QObject *parent, const QVariantList& args) + : KQuickAddons::ConfigModule(parent, args) { 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 -------------------------------------------- - +#if 0 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" @@ -226,222 +177,161 @@ "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); +#endif } - 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") }; 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)); + //ui.orcaLaunchFeedbackLabel->setText(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\"")); + // 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)); + _systemBell = cg.readEntry("SystemBell", true); + _customBell = cg.readEntry("ArtsBell", false); + _soundEdit = cg.readPathEntry("ArtsBellFile", QString()); + _visibleBell = cg.readEntry("VisibleBell", false); + _invertScreen = cg.readEntry("VisibleBellInvert", true); + _flashScreen = !_invertScreen; + _colorButton = cg.readEntry("VisibleBellColor", QColor(Qt::red)); + _duration = 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)); + _stickyKeys = keyboardGroup.readEntry("StickyKeys", false); + _stickyKeysLock = keyboardGroup.readEntry("StickyKeysLatch", true); + _stickyKeysAutoOff= keyboardGroup.readEntry("StickyKeysAutoOff", false); + _stickyKeysBeep = keyboardGroup.readEntry("StickyKeysBeep", true); + _toggleKeysBeep = keyboardGroup.readEntry("ToggleKeysBeep", false); + _keyboardNotifyModifiers = keyboardGroup.readEntry("kNotifyModifiers", false); + _slowKeysDelay = keyboardGroup.readEntry("SlowKeysDelay", 500); + _slowKeys = keyboardGroup.readEntry("SlowKeys", false); + _slowKeysPressBeep = keyboardGroup.readEntry("SlowKeysPressBeep", true); + _slowKeysAcceptBeep = keyboardGroup.readEntry("SlowKeysAcceptBeep", true); + _slowKeysRejectBeep = keyboardGroup.readEntry("SlowKeysRejectBeep", true); + _bounceKeys = keyboardGroup.readEntry("BounceKeys", false); + _bounceKeysDelay = keyboardGroup.readEntry("BounceKeysDelay", 500); + _bounceKeysRejectBeep = keyboardGroup.readEntry("BounceKeysRejectBeep", true); + _gestures = keyboardGroup.readEntry("Gestures", false); + _timeout = keyboardGroup.readEntry("AccessXTimeout", false); + _timeoutDelay = keyboardGroup.readEntry("AccessXTimeoutDelay", 30); + _accessXBeep = keyboardGroup.readEntry("AccessXBeep", true); + _gestureConfirmation = keyboardGroup.readEntry("GestureConfirmation", false); + _keyboardNotifyAccess = 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); + _mouseKeys = mouseGroup.readEntry("MouseKeys", false); + _mouseKeyDelay = mouseGroup.readEntry("MKDelay", 160); + _mouseKeyInterval = mouseGroup.readEntry("MKInterval", 5); // 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); + // What?! + int time_to_max = mouseGroup.readEntry("MKTimeToMax", (5000 + _mouseKeyInterval / 2 ) / _mouseKeyInterval); + time_to_max = mouseGroup.readEntry("MK-TimeToMax", time_to_max*_mouseKeyInterval); + _mouseKeyTimeToMax = 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; + long max_speed = mouseGroup.readEntry("MKMaxSpeed", _mouseKeyInterval); + max_speed = max_speed * 1000 / _mouseKeyInterval; if (max_speed > 2000) { max_speed = 2000; } max_speed = mouseGroup.readEntry("MK-MaxSpeed", int(max_speed)); - ui.mk_max_speed->setValue(max_speed); + _mouseKeyMaxSpeed = max_speed; - ui.mk_curve->setValue(mouseGroup.readEntry("MKCurve", 0)); + _mouseKeyCurve = mouseGroup.readEntry("MKCurve", 0); KConfigGroup screenReaderGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "ScreenReader"); - ui.screenReaderEnabled->setChecked(screenReaderGroup.readEntry("Enabled", false)); - - checkAccess(); - - emit changed(false); + _screenReaderEnabled = screenReaderGroup.readEntry("Enabled", 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("SystemBell", _systemBell); + cg.writeEntry("ArtsBell", _customBell); + cg.writePathEntry("ArtsBellFile", _soundEdit); - cg.writeEntry("VisibleBell", ui.visibleBell->isChecked()); - cg.writeEntry("VisibleBellInvert", ui.invertScreen->isChecked()); - cg.writeEntry("VisibleBellColor", ui.colorButton->color()); + cg.writeEntry("VisibleBell", _visibleBell); + cg.writeEntry("VisibleBellInvert", _invertScreen); + cg.writeEntry("VisibleBellColor", _colorButton); - cg.writeEntry("VisibleBellPause", ui.duration->value()); + cg.writeEntry("VisibleBellPause", _duration); 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("StickyKeys", _stickyKeys); + keyboardGroup.writeEntry("StickyKeysLatch", _stickyKeysLock); + keyboardGroup.writeEntry("StickyKeysAutoOff", _stickyKeysAutoOff); + keyboardGroup.writeEntry("StickyKeysBeep", _stickyKeysBeep); + keyboardGroup.writeEntry("ToggleKeysBeep", _toggleKeysBeep); + keyboardGroup.writeEntry("kNotifyModifiers", _keyboardNotifyModifiers); - 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("SlowKeys", _slowKeys); + keyboardGroup.writeEntry("SlowKeysDelay", _slowKeysDelay); + keyboardGroup.writeEntry("SlowKeysPressBeep", _slowKeysPressBeep); + keyboardGroup.writeEntry("SlowKeysAcceptBeep", _slowKeysAcceptBeep); + keyboardGroup.writeEntry("SlowKeysRejectBeep", _slowKeysRejectBeep); - keyboardGroup.writeEntry("BounceKeys", ui.bounceKeys->isChecked()); - keyboardGroup.writeEntry("BounceKeysDelay", ui.bounceKeysDelay->value()); - keyboardGroup.writeEntry("BounceKeysRejectBeep", ui.bounceKeysRejectBeep->isChecked()); + keyboardGroup.writeEntry("BounceKeys", _bounceKeys); + keyboardGroup.writeEntry("BounceKeysDelay", _bounceKeysDelay); + keyboardGroup.writeEntry("BounceKeysRejectBeep", _bounceKeysRejectBeep); - 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()); + keyboardGroup.writeEntry("Gestures", _gestures); + keyboardGroup.writeEntry("AccessXTimeout", _timeout); + keyboardGroup.writeEntry("AccessXTimeoutDelay", _timeoutDelay); + keyboardGroup.writeEntry("AccessXBeep", _accessXBeep); + keyboardGroup.writeEntry("GestureConfirmation", _gestureConfirmation); + keyboardGroup.writeEntry("kNotifyAccess", _keyboardNotifyAccess); 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()); + const int interval = _mouseKeyInterval; + mouseGroup.writeEntry("MouseKeys", _mouseKeys); + mouseGroup.writeEntry("MKDelay", _mouseKeyDelay); 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.writeEntry("MK-TimeToMax", _mouseKeyTimeToMax); + mouseGroup.writeEntry("MKTimeToMax", (_mouseKeyTimeToMax + interval/2)/interval); + mouseGroup.writeEntry("MK-MaxSpeed", _mouseKeyMaxSpeed); + mouseGroup.writeEntry("MKMaxSpeed", (_mouseKeyMaxSpeed*interval + 500)/1000); + mouseGroup.writeEntry("MKCurve", _mouseKeyCurve); mouseGroup.sync(); KConfigGroup screenReaderGroup(KSharedConfig::openConfig(QStringLiteral("kaccessrc")), "ScreenReader"); - screenReaderGroup.writeEntry("Enabled", ui.screenReaderEnabled->isChecked()); + screenReaderGroup.writeEntry("Enabled", _screenReaderEnabled); - if (ui.systemBell->isChecked() || - ui.customBell->isChecked() || - ui.visibleBell->isChecked()) { + if (_systemBell || _customBell || _visibleBell) { KConfig _cfg(QStringLiteral("kdeglobals"), KConfig::NoGlobals); KConfigGroup cfg(&_cfg, "General"); cfg.writeEntry("UseSystemBell", true); @@ -452,106 +342,55 @@ // 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() { - 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); -} - - -void KAccessConfig::invertClicked() -{ - 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); + _systemBell = true; + _customBell = false; + _soundEdit = QString(); + + _visibleBell = false; + _invertScreen = true; + _flashScreen = false; + _colorButton = QColor(Qt::red); + + _duration = 500; + + _slowKeys = false; + _slowKeysDelay = 500; + _slowKeysPressBeep = true; + _slowKeysAcceptBeep = true; + _slowKeysRejectBeep = true; + + _bounceKeys = false; + _bounceKeysDelay = 500; + _bounceKeysRejectBeep = true; + + _stickyKeys = false; + _stickyKeysLock = true; + _stickyKeysAutoOff = false; + _stickyKeysBeep = true; + _toggleKeysBeep = false; + _keyboardNotifyModifiers = false; + + _gestures = false; + _timeout = false; + _timeoutDelay = 30; + + _accessXBeep = true; + _gestureConfirmation = true; + _keyboardNotifyAccess = false; + + _mouseKeys = false; + _mouseKeyDelay = 160; + _mouseKeyInterval = 5; + _mouseKeyTimeToMax = 5000; + _mouseKeyMaxSpeed = 1000; + _mouseKeyCurve = 0; + + _screenReaderEnabled = false; } extern "C" @@ -565,5 +404,51 @@ } } -#include "kcmaccess.moc" +//---- +#define DEFINE_PROPERTY_METHODS(Type, Getter, Setter) \ +void KAccessConfig::set##Setter(Type value) { \ + if (_##Getter != value) { \ + _##Getter = value; \ + Q_EMIT Getter##Changed(value); \ + } \ +} \ +Type KAccessConfig:: Getter () const { return _##Getter ; } + + + DEFINE_PROPERTY_METHODS(int, timeoutDelay , TimeoutDelay ) + DEFINE_PROPERTY_METHODS(int, bounceKeysDelay , BounceKeysDelay ) + DEFINE_PROPERTY_METHODS(int, duration , Duration ) + DEFINE_PROPERTY_METHODS(int, slowKeysDelay , SlowKeysDelay ) + DEFINE_PROPERTY_METHODS(int, mouseKeyDelay , MouseKeyDelay ) + DEFINE_PROPERTY_METHODS(int, mouseKeyInterval , MouseKeyInterval ) + DEFINE_PROPERTY_METHODS(int, mouseKeyTimeToMax , MouseKeyTimeToMax ) + DEFINE_PROPERTY_METHODS(int, mouseKeyMaxSpeed , MouseKeyMaxSpeed ) + DEFINE_PROPERTY_METHODS(int, mouseKeyCurve , MouseKeyCurve ) + DEFINE_PROPERTY_METHODS(bool, systemBell , SystemBell ) + DEFINE_PROPERTY_METHODS(bool, customBell , CustomBell ) + DEFINE_PROPERTY_METHODS(bool, visibleBell , VisibleBell ) + DEFINE_PROPERTY_METHODS(bool, invertScreen , InvertScreen ) + DEFINE_PROPERTY_METHODS(bool, flashScreen , FlashScreen ) + DEFINE_PROPERTY_METHODS(bool, slowKeys , SlowKeys ) + DEFINE_PROPERTY_METHODS(bool, slowKeysPressBeep , SlowKeysPressBeep ) + DEFINE_PROPERTY_METHODS(bool, slowKeysAcceptBeep , SlowKeysAcceptBeep ) + DEFINE_PROPERTY_METHODS(bool, slowKeysRejectBeep , SlowKeysRejectBeep ) + DEFINE_PROPERTY_METHODS(bool, bounceKeys , BounceKeys ) + DEFINE_PROPERTY_METHODS(bool, bounceKeysRejectBeep, BounceKeysRejectBeep) + DEFINE_PROPERTY_METHODS(bool, stickyKeys , StickyKeys ) + DEFINE_PROPERTY_METHODS(bool, stickyKeysLock , StickyKeysLock ) + DEFINE_PROPERTY_METHODS(bool, stickyKeysAutoOff , StickyKeysAutoOff ) + DEFINE_PROPERTY_METHODS(bool, stickyKeysBeep , StickyKeysBeep ) + DEFINE_PROPERTY_METHODS(bool, toggleKeysBeep , ToggleKeysBeep ) + DEFINE_PROPERTY_METHODS(bool, keyboardNotifyModifiers , KeyboardNotifyModifiers) + DEFINE_PROPERTY_METHODS(bool, gestures , Gestures ) + DEFINE_PROPERTY_METHODS(bool, timeout , Timeout ) + DEFINE_PROPERTY_METHODS(bool, accessXBeep , AccessXBeep ) + DEFINE_PROPERTY_METHODS(bool, gestureConfirmation , GestureConfirmation ) + DEFINE_PROPERTY_METHODS(bool, keyboardNotifyAccess , KeyboardNotifyAccess) + DEFINE_PROPERTY_METHODS(bool, mouseKeys , MouseKeys ) + DEFINE_PROPERTY_METHODS(bool, screenReaderEnabled , ScreenReaderEnabled ) + DEFINE_PROPERTY_METHODS(QString, soundEdit , SoundEdit ) + DEFINE_PROPERTY_METHODS(QColor, colorButton , ColorButton ) +#include "kcmaccess.moc" 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,65 @@ +/* + * 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.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 + +ColumnLayout { + QQC2.GroupBox { + id: activationGestures + text: i18n("Activation Gestures") + ColumnLayout { + QQC2.GroupBox { + text: i18n("Use gestures for activating sticky keys and slow keys") + } + QQC2.GroupBox { + text: i18n("Turn sticky keys and slow keys off after a certain period of inactivity.") + } + QQC2.SpinBox { + id: inactivityThreshould + } + } + } + + QQC2.GroupBox { + id: notification + text: i18n("Notification") + + ColumnLayout { + QQC2.GroupBox { + text: i18n("Use the system bell whenever a gesture is used to toggle an accessibility feature") + } + QQC2.GroupBox { + text: i18n("Show a confirmation dialog whenever a keyboard accessibility feature is toggled") + } + QQC2.GroupBox { + text: i18n("Use Plasma's notification mechanism whenever a keyboard accessibility feature is toggled") + } + QQC2.PushButton { + text: i18n("Configure Notifications") + } + } + } +} 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,85 @@ +/* + * 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.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 + +ColumnLayout { + QQC2.GroupBox { + id: audibleBell + text: i18n("Audible Bell") + + ColumnLayout { + QQC2.CheckBox { + id: systemBell + text: i18n("Use system bell") + } + QQC2.CheckBox { + id: customBell + text: i18n("Use custom bell") + } + RowLayout { + QQC2.TextField { + placeholderText: i18n("Sound to play"); + } + QQC2.Button { + texT: i18n("Browse") + } + } + } + } + + QQC2.GroupBox { + id: visualBell + text: i18n("Visual Bell") + ColumnLayout { + QQC2.CheckBox { + id: useVisualBell + text: i18n("Use visual bell") + } + QQC2.RadioButton { + id: invertScreen + text: i18n("Invert Screen") + } + RowLayout { + QQC2.RadioButton { + id: flashScreen + text: i18n("Flash") + } + Rectanble { // Should be a color picker. + color: "black"; + } + } + RowLayout { + QQC2.Label { + text: i18n("Duration") + } + QQC2.SpinBox { + id: 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,75 @@ +/* + * 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.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 + +ColumnLayout { + QQC2.GroupBox { + id: slowKeys + ColumnLayout { + RowLayout { + QQC2.CheckBox { + id: useSlowKeys + text: i18n("Use Slow Keys") + } + QQC2.SpinBox { + id: slowKayDelay + } + } + QQC2.CheckBox { + id: atKeyPressed + text: i18n("&Use system bell whenever a key is pressed") + } + QQC2.CheckBox{ + id: atKeyAccepted + text: i18n("&Use system bell whenever a key is accepted") + } + QQC2.CheckBox{ + id: atKeyRejected + text: i18n("&Use system bell whenever a key is rejected") + } + } + } + QQC2.GroupBox { + id: bounceKeys + text: i18n("Bounce Keys") + ColumnLayout { + RowLayout { + QQC2.CheckBox { + id: useBounceKeys + text: i18n("Use bounce keys"); + } + QQC2.SpinBox { + id: bounceDelay + } + } + QQC2.CheckBox { + id: useSystemBellK + text: i18n("Use the system bell whenever a key is rejected") + } + } + } +} 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,69 @@ +/* + * 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.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 + +ColumnLayout { + GroupBox { + id: stickyKeys + text: i18n("Sticky Keys") + ColumnLayout { + QQC2.CheckBox { + id: useStickyKeys + text: i18n("Use sticky keys") + } + QQC2.CheckBox { + id: lockStickyKeys + text: i18n("Lock sticky keys") + } + QQC.CheckBox { + id: turnOffSticky + text: i18n("Turn off sticky keys when two keys are pressed continuously") + } + QQC2.CheckBox { + id: useSystemBellModifier + text: i18n("Use system bell whenever a modifier gets latched, locked or unlocked") + } + } + } + GroupBox { + id: lockingKeys + text: i18n("Locking Keys") + ColumnLayout { + QQC2.CheckBox { + id: useSystemBellKey + text: i18n("Use system bell whenever a locking key gets activated or deactivated") + } + QQC2.CheckBox { + id: usePlasmaNotification + text: i18n("Use Plasma's notification mechanism for modifier or locking key state changes") + } + QQC2.Button { + text: i18n("Configure Notifications") + } + } + } +} 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,82 @@ +/* + * 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.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 + +ColumnLayout { + QQC2.GroupBox { + id: activationGestures + text: i18n("Activation Gestures") + ColumnLayout { + QQC2.CheckBox { + text: i18n("&Move pointer with keyboard (using the num pad)") + } + RowLayout { + QQC2.Label { + text: i18n("&Acceleration delay:") + } + QQC2.SpinBox { + + } + } + RowLayout { + QQC2.Label { + text: i18n("R&epeat interval:") + } + QQC2.SpinBox { + + } + } + + RowLayout { + QQC2.Label { + text: i18n("Acceleration &time:") + } + QQC2.SpinBox { + + } + } + + RowLayout { + QQC2.Label { + text: i18n("Ma&ximum speed:") + } + QQC2.SpinBox { + + } + } + + RowLayout { + QQC2.Label { + text: i18n("Acceleration &profile:") + } + QQC2.SpinBox { + + } + } + } + } +} 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,46 @@ +/* + * 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.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 + +ColumnLayout { + QQC2.GroupBox { + id: activationGestures + text: i18n("Activation Gestures") + ColumnLayout { + QQC2.CheckBox { + text: i18n("Screen reader enabled") + + } + QQC2.PushButton { + text: i18n("Launch Orca Configuration"); + } + QQC2.Label { + text: i18n("Please note that you may have to log out 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,67 @@ +/* + * 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.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 { + ColumnLayout { + QQC2.TabBar { + id: tabBar + Layout.fillWidth: true + + QQC2.TabButton { text: i18n("Bell") } + QQC2.TabButton { text: i18n("Modifier Keys") } + QQC2.TabButton { text: i18n("Keyboard Filters") } + QQC2.TabButton { text: i18n("Activation Gestures") } + QQC2.TabButton { text: i18n("Mouse Navigation") } + QQC2.TabButton { text: i18n("Screen Reader") } + } + StackLayout { + Layout.fillWidth: true + Layout.fillHeight: true + currentIndex: tabBar.currentIndex + + Bell { + + } + ModifierKeys { + + } + KeyboardFilters { + + } + ActivationGestures { + + } + 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=kcm_access +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-KDE-ServiceTypes=Plasma/Generic +X-Plasma-API=declarativeappletscript + +X-Plasma-MainScript=ui/main.qml diff --git a/kcms/colors/CMakeLists.txt b/kcms/colors/CMakeLists.txt --- a/kcms/colors/CMakeLists.txt +++ b/kcms/colors/CMakeLists.txt @@ -21,9 +21,9 @@ KF5::I18n KF5::KIOCore KF5::KIOWidgets - KF5::NewStuff KF5::QuickAddons KF5::WindowSystem + Qt5::X11Extras ) if(X11_FOUND)