Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpad/src/kcm/libinput/touchpadconfiglibinput.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | |||||
108 | { | 108 | { | ||
109 | // in case of critical init error in backend, don't try | 109 | // in case of critical init error in backend, don't try | ||
110 | if (m_initError) { | 110 | if (m_initError) { | ||
111 | return; | 111 | return; | ||
112 | } | 112 | } | ||
113 | 113 | | |||
114 | if (!m_backend->getConfig()) { | 114 | if (!m_backend->getConfig()) { | ||
115 | m_errorMessage->setMessageType(KMessageWidget::Error); | 115 | m_errorMessage->setMessageType(KMessageWidget::Error); | ||
116 | m_errorMessage->setText(i18n("Error while loading values. See logs for more informations. Please restart Touchpad KCM.")); | 116 | m_errorMessage->setText(i18n("Error while loading values. See logs for more informations. Please restart this configuration module.")); | ||
117 | m_errorMessage->animatedShow(); | 117 | m_errorMessage->animatedShow(); | ||
118 | } else { | 118 | } else { | ||
119 | if (!m_backend->touchpadCount()) { | 119 | if (!m_backend->touchpadCount()) { | ||
120 | m_errorMessage->setMessageType(KMessageWidget::Information); | 120 | m_errorMessage->setMessageType(KMessageWidget::Information); | ||
121 | m_errorMessage->setText(i18n("No touchpad found. Connect touchpad now.")); | 121 | m_errorMessage->setText(i18n("No touchpad found. Connect touchpad now.")); | ||
122 | m_errorMessage->animatedShow(); | 122 | m_errorMessage->animatedShow(); | ||
123 | } | 123 | } | ||
124 | } | 124 | } | ||
125 | QMetaObject::invokeMethod(m_view->rootObject(), "syncValuesFromBackend"); | 125 | QMetaObject::invokeMethod(m_view->rootObject(), "syncValuesFromBackend"); | ||
126 | } | 126 | } | ||
127 | 127 | | |||
128 | void TouchpadConfigLibinput::save() | 128 | void TouchpadConfigLibinput::save() | ||
129 | { | 129 | { | ||
130 | if (!m_backend->applyConfig()) { | 130 | if (!m_backend->applyConfig()) { | ||
131 | m_errorMessage->setMessageType(KMessageWidget::Error); | 131 | m_errorMessage->setMessageType(KMessageWidget::Error); | ||
132 | m_errorMessage->setText(i18n("Not able to save all changes. See logs for more informations. Please restart Touchpad KCM and try again.")); | 132 | m_errorMessage->setText(i18n("Not able to save all changes. See logs for more informations. Please restart this configuration module and try again.")); | ||
133 | m_errorMessage->animatedShow(); | 133 | m_errorMessage->animatedShow(); | ||
134 | } else { | 134 | } else { | ||
135 | hideErrorMessage(); | 135 | hideErrorMessage(); | ||
136 | } | 136 | } | ||
137 | // load newly written values | 137 | // load newly written values | ||
138 | load(); | 138 | load(); | ||
139 | // in case of error, config still in changed state | 139 | // in case of error, config still in changed state | ||
140 | emit m_parent->changed(m_backend->isChangedConfig()); | 140 | emit m_parent->changed(m_backend->isChangedConfig()); | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | void TouchpadConfigLibinput::defaults() | 143 | void TouchpadConfigLibinput::defaults() | ||
144 | { | 144 | { | ||
145 | // in case of critical init error in backend, don't try | 145 | // in case of critical init error in backend, don't try | ||
146 | if (m_initError) { | 146 | if (m_initError) { | ||
147 | return; | 147 | return; | ||
148 | } | 148 | } | ||
149 | 149 | | |||
150 | if (!m_backend->getDefaultConfig()) { | 150 | if (!m_backend->getDefaultConfig()) { | ||
151 | m_errorMessage->setMessageType(KMessageWidget::Error); | 151 | m_errorMessage->setMessageType(KMessageWidget::Error); | ||
152 | m_errorMessage->setText(i18n("Error while loading default values. Not all or none options could be set to their default values.")); | 152 | m_errorMessage->setText(i18n("Error while loading default values. Failed to set some options to their default values.")); | ||
153 | m_errorMessage->animatedShow(); | 153 | m_errorMessage->animatedShow(); | ||
154 | } | 154 | } | ||
155 | } | 155 | } | ||
156 | 156 | | |||
157 | void TouchpadConfigLibinput::onChange() | 157 | void TouchpadConfigLibinput::onChange() | ||
158 | { | 158 | { | ||
159 | if (!m_backend->touchpadCount()) { | 159 | if (!m_backend->touchpadCount()) { | ||
160 | return; | 160 | return; | ||
161 | } | 161 | } | ||
162 | hideErrorMessage(); | 162 | hideErrorMessage(); | ||
163 | emit m_parent->changed(m_backend->isChangedConfig()); | 163 | emit m_parent->changed(m_backend->isChangedConfig()); | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | void TouchpadConfigLibinput::onTouchpadAdded(bool success) | 166 | void TouchpadConfigLibinput::onTouchpadAdded(bool success) | ||
167 | { | 167 | { | ||
168 | QQuickItem *rootObj = m_view->rootObject(); | 168 | QQuickItem *rootObj = m_view->rootObject(); | ||
169 | 169 | | |||
170 | if (!success) { | 170 | if (!success) { | ||
171 | m_errorMessage->setMessageType(KMessageWidget::Error); | 171 | m_errorMessage->setMessageType(KMessageWidget::Error); | ||
172 | m_errorMessage->setText(i18n("Error while adding newly connected device. Please reconnect it and restart Touchpad KCM.")); | 172 | m_errorMessage->setText(i18n("Error while adding newly connected device. Please reconnect it and restart this configuration module.")); | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | int activeIndex; | 175 | int activeIndex; | ||
176 | if (m_backend->touchpadCount() == 1) { | 176 | if (m_backend->touchpadCount() == 1) { | ||
177 | // if no touchpad was connected previously, show the new device and hide the no-device-message | 177 | // if no touchpad was connected previously, show the new device and hide the no-device-message | ||
178 | activeIndex = 0; | 178 | activeIndex = 0; | ||
179 | hideErrorMessage(); | 179 | hideErrorMessage(); | ||
180 | } else { | 180 | } else { | ||
Show All 39 Lines |