Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/mouse.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | |||||
82 | K_PLUGIN_FACTORY(MouseConfigFactory, | 82 | K_PLUGIN_FACTORY(MouseConfigFactory, | ||
83 | registerPlugin<MouseConfig>(); // mouse | 83 | registerPlugin<MouseConfig>(); // mouse | ||
84 | ) | 84 | ) | ||
85 | K_EXPORT_PLUGIN(MouseConfigFactory("kcminput")) | 85 | K_EXPORT_PLUGIN(MouseConfigFactory("kcminput")) | ||
86 | 86 | | |||
87 | MouseConfig::MouseConfig(QWidget *parent, const QVariantList &args) | 87 | MouseConfig::MouseConfig(QWidget *parent, const QVariantList &args) | ||
88 | : KCModule(parent, args) | 88 | : KCModule(parent, args) | ||
89 | { | 89 | { | ||
90 | setQuickHelp(i18n("<h1>Mouse</h1> This module allows you to choose various" | 90 | setupUi(this); | ||
91 | " options for the way in which your pointing device works. Your" | | |||
92 | " pointing device may be a mouse, trackball, or some other hardware" | | |||
93 | " that performs a similar function.")); | | |||
94 | | ||||
95 | QBoxLayout *topLayout = new QVBoxLayout(this); | | |||
96 | topLayout->setMargin(0); | | |||
97 | | ||||
98 | tabwidget = new QTabWidget(this); | | |||
99 | topLayout->addWidget(tabwidget); | | |||
100 | | ||||
101 | generalTab = new KMouseDlg(this); | | |||
102 | QButtonGroup *group = new QButtonGroup(generalTab); | | |||
103 | group->setExclusive(true); | | |||
104 | group->addButton(generalTab->singleClick); | | |||
105 | group->addButton(generalTab->doubleClick); | | |||
106 | | ||||
107 | tabwidget->addTab(generalTab, i18n("&General")); | | |||
108 | | ||||
109 | group = new QButtonGroup(generalTab); | | |||
110 | group->setExclusive(true); | | |||
111 | group->addButton(generalTab->rightHanded,RIGHT_HANDED); | | |||
112 | group->addButton(generalTab->leftHanded,LEFT_HANDED); | | |||
113 | | ||||
114 | connect(group, SIGNAL(buttonClicked(int)), this, SLOT(changed())); | | |||
115 | connect(group, SIGNAL(buttonClicked(int)), this, SLOT(slotHandedChanged(int))); | | |||
116 | | ||||
117 | QString wtstr = i18n("If you are left-handed, you may prefer to swap the" | | |||
118 | " functions of the left and right buttons on your pointing device" | | |||
119 | " by choosing the 'left-handed' option. If your pointing device" | | |||
120 | " has more than two buttons, only those that function as the" | | |||
121 | " left and right buttons are affected. For example, if you have" | | |||
122 | " a three-button mouse, the middle button is unaffected."); | | |||
123 | generalTab->handedBox->setWhatsThis(wtstr); | | |||
124 | | ||||
125 | connect(generalTab->doubleClick, SIGNAL(clicked()), SLOT(changed())); | | |||
126 | | ||||
127 | wtstr = i18n("The default behavior in KDE is to select and activate" | | |||
128 | " icons with a single click of the left button on your pointing" | | |||
129 | " device. This behavior is consistent with what you would expect" | | |||
130 | " when you click links in most web browsers. If you would prefer" | | |||
131 | " to select with a single click, and activate with a double click," | | |||
132 | " check this option."); | | |||
133 | generalTab->doubleClick->setWhatsThis(wtstr); | | |||
134 | 91 | | |||
135 | wtstr = i18n("Activates and opens a file or folder with a single click."); | 92 | handedGroup->setId(rightHanded, 0); | ||
136 | generalTab->singleClick->setWhatsThis(wtstr); | 93 | handedGroup->setId(leftHanded, 1); | ||
137 | 94 | | |||
138 | connect(generalTab->singleClick, SIGNAL(clicked()), this, SLOT(changed())); | 95 | connect(handedGroup, SIGNAL(buttonClicked(int)), this, SLOT(changed())); | ||
96 | connect(handedGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotHandedChanged(int))); | ||||
97 | connect(doubleClick, SIGNAL(clicked()), SLOT(changed())); | ||||
98 | connect(singleClick, SIGNAL(clicked()), this, SLOT(changed())); | ||||
139 | 99 | | |||
140 | // Only allow setting reversing scroll polarity if we have scroll buttons | 100 | // Only allow setting reversing scroll polarity if we have scroll buttons | ||
141 | unsigned char map[20]; | 101 | unsigned char map[20]; | ||
142 | if (QX11Info::isPlatformX11() && XGetPointerMapping(QX11Info::display(), map, 20) >= 5) | 102 | if (QX11Info::isPlatformX11() && XGetPointerMapping(QX11Info::display(), map, 20) >= 5) | ||
143 | { | 103 | { | ||
144 | generalTab->cbScrollPolarity->setEnabled(true); | 104 | cbScrollPolarity->setEnabled(true); | ||
145 | generalTab->cbScrollPolarity->show(); | 105 | cbScrollPolarity->show(); | ||
146 | } | 106 | } | ||
147 | else | 107 | else | ||
148 | { | 108 | { | ||
149 | generalTab->cbScrollPolarity->setEnabled(false); | 109 | cbScrollPolarity->setEnabled(false); | ||
150 | generalTab->cbScrollPolarity->hide(); | 110 | cbScrollPolarity->hide(); | ||
151 | } | 111 | } | ||
152 | connect(generalTab->cbScrollPolarity, SIGNAL(clicked()), this, SLOT(changed())); | 112 | connect(cbScrollPolarity, SIGNAL(clicked()), this, SLOT(changed())); | ||
153 | connect(generalTab->cbScrollPolarity, SIGNAL(clicked()), this, SLOT(slotScrollPolarityChanged())); | 113 | connect(cbScrollPolarity, SIGNAL(clicked()), this, SLOT(slotScrollPolarityChanged())); | ||
154 | 114 | | |||
155 | // Advanced tab | | |||
156 | advancedTab = new QWidget(0); | | |||
157 | advancedTab->setObjectName("Advanced Tab"); | | |||
158 | tabwidget->addTab(advancedTab, i18n("Advanced")); | | |||
159 | | ||||
160 | QFormLayout *formLayout = new QFormLayout; | | |||
161 | formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); | | |||
162 | | ||||
163 | accel = new QDoubleSpinBox(advancedTab); | | |||
164 | accel->setDecimals(1); | | |||
165 | accel->setRange(0.1, 20); | | |||
166 | accel->setSingleStep(0.1); | | |||
167 | accel->setValue(2); | | |||
168 | accel->setSuffix(i18n(" x")); | | |||
169 | accel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
170 | | ||||
171 | formLayout->addRow(i18n("Pointer acceleration:"), accel); | | |||
172 | connect(accel, SIGNAL(valueChanged(double)), this, SLOT(changed())); | 115 | connect(accel, SIGNAL(valueChanged(double)), this, SLOT(changed())); | ||
173 | | ||||
174 | wtstr = i18n("<p>This option allows you to change the relationship" | | |||
175 | " between the distance that the mouse pointer moves on the" | | |||
176 | " screen and the relative movement of the physical device" | | |||
177 | " itself (which may be a mouse, trackball, or some other" | | |||
178 | " pointing device.)</p><p>" | | |||
179 | " A high value for the acceleration will lead to large" | | |||
180 | " movements of the mouse pointer on the screen even when" | | |||
181 | " you only make a small movement with the physical device." | | |||
182 | " Selecting very high values may result in the mouse pointer" | | |||
183 | " flying across the screen, making it hard to control.</p>"); | | |||
184 | accel->setWhatsThis(wtstr); | | |||
185 | | ||||
186 | thresh = new QSpinBox(advancedTab); | | |||
187 | thresh->setRange(0, 20); | | |||
188 | thresh->setSingleStep(1); | | |||
189 | thresh->setValue(2); | | |||
190 | thresh->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
191 | formLayout->addRow(i18n("Pointer threshold:"), thresh); | | |||
192 | connect(thresh, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 116 | connect(thresh, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
193 | connect(thresh, SIGNAL(valueChanged(int)), this, SLOT(slotThreshChanged(int))); | 117 | connect(thresh, SIGNAL(valueChanged(int)), this, SLOT(slotThreshChanged(int))); | ||
194 | slotThreshChanged(thresh->value()); | 118 | slotThreshChanged(thresh->value()); | ||
195 | 119 | | |||
196 | wtstr = i18n("<p>The threshold is the smallest distance that the" | | |||
197 | " mouse pointer must move on the screen before acceleration" | | |||
198 | " has any effect. If the movement is smaller than the threshold," | | |||
199 | " the mouse pointer moves as if the acceleration was set to 1X;</p><p>" | | |||
200 | " thus, when you make small movements with the physical device," | | |||
201 | " there is no acceleration at all, giving you a greater degree" | | |||
202 | " of control over the mouse pointer. With larger movements of" | | |||
203 | " the physical device, you can move the mouse pointer" | | |||
204 | " rapidly to different areas on the screen.</p>"); | | |||
205 | thresh->setWhatsThis(wtstr); | | |||
206 | | ||||
207 | // It would be nice if the user had a test field. | 120 | // It would be nice if the user had a test field. | ||
208 | // Selecting such values in milliseconds is not intuitive | 121 | // Selecting such values in milliseconds is not intuitive | ||
209 | doubleClickInterval = new QSpinBox(advancedTab); | | |||
210 | doubleClickInterval->setRange(100, 2000); | | |||
211 | doubleClickInterval->setSuffix(i18n(" msec")); | | |||
212 | doubleClickInterval->setSingleStep(100); | | |||
213 | doubleClickInterval->setValue(2000); | | |||
214 | doubleClickInterval->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
215 | formLayout->addRow(i18n("Double click interval:"), doubleClickInterval); | | |||
216 | connect(doubleClickInterval, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 122 | connect(doubleClickInterval, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
217 | 123 | | |||
218 | wtstr = i18n("The double click interval is the maximal time" | | |||
219 | " (in milliseconds) between two mouse clicks which" | | |||
220 | " turns them into a double click. If the second" | | |||
221 | " click happens later than this time interval after" | | |||
222 | " the first click, they are recognized as two" | | |||
223 | " separate clicks."); | | |||
224 | doubleClickInterval->setWhatsThis(wtstr); | | |||
225 | | ||||
226 | dragStartTime = new QSpinBox(advancedTab); | | |||
227 | dragStartTime->setRange(100, 2000); | | |||
228 | dragStartTime->setSuffix(i18n(" msec")); | | |||
229 | dragStartTime->setSingleStep(100); | | |||
230 | dragStartTime->setValue(2000); | | |||
231 | dragStartTime->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
232 | formLayout->addRow(i18n("Drag start time:"), dragStartTime); | | |||
233 | connect(dragStartTime, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 124 | connect(dragStartTime, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
234 | 125 | | |||
235 | wtstr = i18n("If you click with the mouse (e.g. in a multi-line" | | |||
236 | " editor) and begin to move the mouse within the" | | |||
237 | " drag start time, a drag operation will be initiated."); | | |||
238 | dragStartTime->setWhatsThis(wtstr); | | |||
239 | | ||||
240 | dragStartDist = new QSpinBox(advancedTab); | | |||
241 | dragStartDist->setRange(1, 20); | | |||
242 | dragStartDist->setSingleStep(1); | | |||
243 | dragStartDist->setValue(20); | | |||
244 | dragStartDist->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
245 | formLayout->addRow(i18n("Drag start distance:"), dragStartDist); | | |||
246 | connect(dragStartDist, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 126 | connect(dragStartDist, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
247 | connect(dragStartDist, SIGNAL(valueChanged(int)), this, SLOT(slotDragStartDistChanged(int))); | 127 | connect(dragStartDist, SIGNAL(valueChanged(int)), this, SLOT(slotDragStartDistChanged(int))); | ||
248 | slotDragStartDistChanged(dragStartDist->value()); | 128 | slotDragStartDistChanged(dragStartDist->value()); | ||
249 | 129 | | |||
250 | wtstr = i18n("If you click with the mouse and begin to move the" | | |||
251 | " mouse at least the drag start distance, a drag" | | |||
252 | " operation will be initiated."); | | |||
253 | dragStartDist->setWhatsThis(wtstr); | | |||
254 | | ||||
255 | wheelScrollLines = new QSpinBox(advancedTab); | | |||
256 | wheelScrollLines->setRange(1, 12); | | |||
257 | wheelScrollLines->setSingleStep(1); | | |||
258 | wheelScrollLines->setValue(3); | | |||
259 | wheelScrollLines->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
260 | formLayout->addRow(i18n("Mouse wheel scrolls by:"), wheelScrollLines); | | |||
261 | connect(wheelScrollLines, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 130 | connect(wheelScrollLines, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
262 | connect(wheelScrollLines, SIGNAL(valueChanged(int)), SLOT(slotWheelScrollLinesChanged(int))); | 131 | connect(wheelScrollLines, SIGNAL(valueChanged(int)), SLOT(slotWheelScrollLinesChanged(int))); | ||
263 | slotWheelScrollLinesChanged(wheelScrollLines->value()); | 132 | slotWheelScrollLinesChanged(wheelScrollLines->value()); | ||
264 | 133 | | |||
265 | wtstr = i18n("If you use the wheel of a mouse, this value determines the number" | | |||
266 | " of lines to scroll for each wheel movement. Note that if this" | | |||
267 | " number exceeds the number of visible lines, it will be ignored" | | |||
268 | " and the wheel movement will be handled as a page up/down movement."); | | |||
269 | wheelScrollLines->setWhatsThis(wtstr); | | |||
270 | | ||||
271 | QHBoxLayout *outerLayout = new QHBoxLayout(advancedTab); | | |||
272 | outerLayout->addLayout(formLayout, 0); | | |||
273 | outerLayout->addStretch(1); | | |||
274 | | ||||
275 | QWidget *keysTab = new QWidget(this); | | |||
276 | keysTab->setObjectName("Mouse Navigation"); | | |||
277 | tabwidget->addTab(keysTab, i18n("Keyboard Navigation")); | | |||
278 | | ||||
279 | formLayout = new QFormLayout; | | |||
280 | formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); | | |||
281 | | ||||
282 | mouseKeys = new QCheckBox(i18n("&Move pointer with keyboard (using the num pad)"), keysTab); | | |||
283 | formLayout->addRow(mouseKeys); | | |||
284 | | ||||
285 | mk_delay = new QSpinBox(keysTab); | | |||
286 | mk_delay->setRange(1, 1000); | | |||
287 | mk_delay->setSingleStep(50); | | |||
288 | mk_delay->setSuffix(i18n(" msec")); | | |||
289 | mk_delay->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
290 | formLayout->addRow(i18n("&Acceleration delay:"), mk_delay); | | |||
291 | | ||||
292 | mk_interval = new QSpinBox(keysTab); | | |||
293 | mk_interval->setRange(1, 1000); | | |||
294 | mk_interval->setSingleStep(10); | | |||
295 | mk_interval->setSuffix(i18n(" msec")); | | |||
296 | mk_interval->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
297 | formLayout->addRow(i18n("R&epeat interval:"), mk_interval); | | |||
298 | | ||||
299 | mk_time_to_max = new QSpinBox(keysTab); | | |||
300 | mk_time_to_max->setRange(100, 10000); | | |||
301 | mk_time_to_max->setSingleStep(200); | | |||
302 | mk_time_to_max->setSuffix(i18n(" msec")); | | |||
303 | mk_time_to_max->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
304 | formLayout->addRow(i18n("Acceleration &time:"), mk_time_to_max); | | |||
305 | | ||||
306 | mk_max_speed = new QSpinBox(keysTab); | | |||
307 | mk_max_speed->setRange(1, 2000); | | |||
308 | mk_max_speed->setSingleStep(20); | | |||
309 | mk_max_speed->setSuffix(i18n(" pixel/sec")); | | |||
310 | mk_max_speed->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
311 | formLayout->addRow(i18n("Ma&ximum speed:"), mk_max_speed); | | |||
312 | | ||||
313 | mk_curve = new QSpinBox(keysTab); | | |||
314 | mk_curve->setRange(-1000, 1000); | | |||
315 | mk_curve->setSingleStep(100); | | |||
316 | mk_curve->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); | | |||
317 | formLayout->addRow(i18n("Acceleration &profile:"), mk_curve); | | |||
318 | | ||||
319 | outerLayout = new QHBoxLayout(keysTab); | | |||
320 | outerLayout->addLayout(formLayout, 0); | | |||
321 | outerLayout->addStretch(1); | | |||
322 | | ||||
323 | connect(mouseKeys, SIGNAL(clicked()), this, SLOT(checkAccess())); | 134 | connect(mouseKeys, SIGNAL(clicked()), this, SLOT(checkAccess())); | ||
324 | connect(mouseKeys, SIGNAL(clicked()), this, SLOT(changed())); | 135 | connect(mouseKeys, SIGNAL(clicked()), this, SLOT(changed())); | ||
325 | connect(mk_delay, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 136 | connect(mk_delay, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
326 | connect(mk_interval, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 137 | connect(mk_interval, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
327 | connect(mk_time_to_max, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 138 | connect(mk_time_to_max, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
328 | connect(mk_max_speed, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 139 | connect(mk_max_speed, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
329 | connect(mk_curve, SIGNAL(valueChanged(int)), this, SLOT(changed())); | 140 | connect(mk_curve, SIGNAL(valueChanged(int)), this, SLOT(changed())); | ||
330 | 141 | | |||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
378 | void MouseConfig::setThreshold(int val) | 189 | void MouseConfig::setThreshold(int val) | ||
379 | { | 190 | { | ||
380 | thresh->setValue(val); | 191 | thresh->setValue(val); | ||
381 | } | 192 | } | ||
382 | 193 | | |||
383 | 194 | | |||
384 | int MouseConfig::getHandedness() | 195 | int MouseConfig::getHandedness() | ||
385 | { | 196 | { | ||
386 | if (generalTab->rightHanded->isChecked()) | 197 | if (rightHanded->isChecked()) | ||
387 | return RIGHT_HANDED; | 198 | return RIGHT_HANDED; | ||
388 | else | 199 | else | ||
389 | return LEFT_HANDED; | 200 | return LEFT_HANDED; | ||
390 | } | 201 | } | ||
391 | 202 | | |||
392 | void MouseConfig::setHandedness(int val) | 203 | void MouseConfig::setHandedness(int val) | ||
393 | { | 204 | { | ||
394 | generalTab->rightHanded->setChecked(false); | 205 | rightHanded->setChecked(false); | ||
395 | generalTab->leftHanded->setChecked(false); | 206 | leftHanded->setChecked(false); | ||
396 | if (val == RIGHT_HANDED) { | 207 | if (val == RIGHT_HANDED) { | ||
397 | generalTab->rightHanded->setChecked(true); | 208 | rightHanded->setChecked(true); | ||
398 | generalTab->mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_rh.png")); | 209 | mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_rh.png")); | ||
399 | } | 210 | } | ||
400 | else { | 211 | else { | ||
401 | generalTab->leftHanded->setChecked(true); | 212 | leftHanded->setChecked(true); | ||
402 | generalTab->mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_lh.png")); | 213 | mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_lh.png")); | ||
403 | } | 214 | } | ||
404 | settings->m_handedNeedsApply = true; | 215 | settings->m_handedNeedsApply = true; | ||
405 | } | 216 | } | ||
406 | 217 | | |||
407 | void MouseConfig::load() | 218 | void MouseConfig::load() | ||
408 | { | 219 | { | ||
409 | KConfig config("kcminputrc"); | 220 | KConfig config("kcminputrc"); | ||
410 | settings->load(&config); | 221 | settings->load(&config); | ||
411 | 222 | | |||
412 | generalTab->rightHanded->setEnabled(settings->handedEnabled); | 223 | rightHanded->setEnabled(settings->handedEnabled); | ||
413 | generalTab->leftHanded->setEnabled(settings->handedEnabled); | 224 | leftHanded->setEnabled(settings->handedEnabled); | ||
414 | if (generalTab->cbScrollPolarity->isEnabled()) | 225 | if (cbScrollPolarity->isEnabled()) | ||
415 | generalTab->cbScrollPolarity->setEnabled(settings->handedEnabled); | 226 | cbScrollPolarity->setEnabled(settings->handedEnabled); | ||
416 | generalTab->cbScrollPolarity->setChecked(settings->reverseScrollPolarity); | 227 | cbScrollPolarity->setChecked(settings->reverseScrollPolarity); | ||
417 | 228 | | |||
418 | setAccel(settings->accelRate); | 229 | setAccel(settings->accelRate); | ||
419 | setThreshold(settings->thresholdMove); | 230 | setThreshold(settings->thresholdMove); | ||
420 | setHandedness(settings->handed); | 231 | setHandedness(settings->handed); | ||
421 | 232 | | |||
422 | doubleClickInterval->setValue(settings->doubleClickInterval); | 233 | doubleClickInterval->setValue(settings->doubleClickInterval); | ||
423 | dragStartTime->setValue(settings->dragStartTime); | 234 | dragStartTime->setValue(settings->dragStartTime); | ||
424 | dragStartDist->setValue(settings->dragStartDist); | 235 | dragStartDist->setValue(settings->dragStartDist); | ||
425 | wheelScrollLines->setValue(settings->wheelScrollLines); | 236 | wheelScrollLines->setValue(settings->wheelScrollLines); | ||
426 | 237 | | |||
427 | generalTab->singleClick->setChecked(settings->singleClick); | 238 | singleClick->setChecked(settings->singleClick); | ||
428 | generalTab->doubleClick->setChecked(!settings->singleClick); | 239 | doubleClick->setChecked(!settings->singleClick); | ||
429 | 240 | | |||
430 | KConfig ac("kaccessrc"); | 241 | KConfig ac("kaccessrc"); | ||
431 | 242 | | |||
432 | KConfigGroup group = ac.group("Mouse"); | 243 | KConfigGroup group = ac.group("Mouse"); | ||
433 | mouseKeys->setChecked(group.readEntry("MouseKeys", false)); | 244 | mouseKeys->setChecked(group.readEntry("MouseKeys", false)); | ||
434 | mk_delay->setValue(group.readEntry("MKDelay", 160)); | 245 | mk_delay->setValue(group.readEntry("MKDelay", 160)); | ||
435 | 246 | | |||
436 | int interval = group.readEntry("MKInterval", 5); | 247 | int interval = group.readEntry("MKInterval", 5); | ||
Show All 25 Lines | 272 | { | |||
462 | settings->accelRate = getAccel(); | 273 | settings->accelRate = getAccel(); | ||
463 | settings->thresholdMove = getThreshold(); | 274 | settings->thresholdMove = getThreshold(); | ||
464 | settings->handed = getHandedness(); | 275 | settings->handed = getHandedness(); | ||
465 | 276 | | |||
466 | settings->doubleClickInterval = doubleClickInterval->value(); | 277 | settings->doubleClickInterval = doubleClickInterval->value(); | ||
467 | settings->dragStartTime = dragStartTime->value(); | 278 | settings->dragStartTime = dragStartTime->value(); | ||
468 | settings->dragStartDist = dragStartDist->value(); | 279 | settings->dragStartDist = dragStartDist->value(); | ||
469 | settings->wheelScrollLines = wheelScrollLines->value(); | 280 | settings->wheelScrollLines = wheelScrollLines->value(); | ||
470 | settings->singleClick = !generalTab->doubleClick->isChecked(); | 281 | settings->singleClick = !doubleClick->isChecked(); | ||
471 | settings->reverseScrollPolarity = generalTab->cbScrollPolarity->isChecked(); | 282 | settings->reverseScrollPolarity = cbScrollPolarity->isChecked(); | ||
472 | 283 | | |||
473 | settings->apply(); | 284 | settings->apply(); | ||
474 | KConfig config("kcminputrc"); | 285 | KConfig config("kcminputrc"); | ||
475 | settings->save(&config); | 286 | settings->save(&config); | ||
476 | 287 | | |||
477 | KConfig ac("kaccessrc"); | 288 | KConfig ac("kaccessrc"); | ||
478 | 289 | | |||
479 | KConfigGroup group = ac.group("Mouse"); | 290 | KConfigGroup group = ac.group("Mouse"); | ||
Show All 15 Lines | |||||
495 | emit changed(false); | 306 | emit changed(false); | ||
496 | } | 307 | } | ||
497 | 308 | | |||
498 | void MouseConfig::defaults() | 309 | void MouseConfig::defaults() | ||
499 | { | 310 | { | ||
500 | setThreshold(2); | 311 | setThreshold(2); | ||
501 | setAccel(2); | 312 | setAccel(2); | ||
502 | setHandedness(RIGHT_HANDED); | 313 | setHandedness(RIGHT_HANDED); | ||
503 | generalTab->cbScrollPolarity->setChecked(false); | 314 | cbScrollPolarity->setChecked(false); | ||
504 | doubleClickInterval->setValue(400); | 315 | doubleClickInterval->setValue(400); | ||
505 | dragStartTime->setValue(500); | 316 | dragStartTime->setValue(500); | ||
506 | dragStartDist->setValue(4); | 317 | dragStartDist->setValue(4); | ||
507 | wheelScrollLines->setValue(3); | 318 | wheelScrollLines->setValue(3); | ||
508 | generalTab->doubleClick->setChecked(!KDE_DEFAULT_SINGLECLICK); | 319 | doubleClick->setChecked(!KDE_DEFAULT_SINGLECLICK); | ||
509 | generalTab->singleClick->setChecked(KDE_DEFAULT_SINGLECLICK); | 320 | singleClick->setChecked(KDE_DEFAULT_SINGLECLICK); | ||
510 | 321 | | |||
511 | mouseKeys->setChecked(false); | 322 | mouseKeys->setChecked(false); | ||
512 | mk_delay->setValue(160); | 323 | mk_delay->setValue(160); | ||
513 | mk_interval->setValue(5); | 324 | mk_interval->setValue(5); | ||
514 | mk_time_to_max->setValue(5000); | 325 | mk_time_to_max->setValue(5000); | ||
515 | mk_max_speed->setValue(1000); | 326 | mk_max_speed->setValue(1000); | ||
516 | mk_curve->setValue(0); | 327 | mk_curve->setValue(0); | ||
517 | 328 | | |||
518 | checkAccess(); | 329 | checkAccess(); | ||
519 | changed(); | 330 | changed(); | ||
520 | } | 331 | } | ||
521 | 332 | | |||
522 | /** No descriptions */ | 333 | /** No descriptions */ | ||
523 | void MouseConfig::slotHandedChanged(int val) | 334 | void MouseConfig::slotHandedChanged(int val) | ||
524 | { | 335 | { | ||
525 | if (val==RIGHT_HANDED) | 336 | if (val==RIGHT_HANDED) | ||
526 | generalTab->mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_rh.png")); | 337 | mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_rh.png")); | ||
527 | else | 338 | else | ||
528 | generalTab->mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_lh.png")); | 339 | mousePix->setPixmap(KStandardDirs::locate("data", "kcminput/pics/mouse_lh.png")); | ||
529 | settings->m_handedNeedsApply = true; | 340 | settings->m_handedNeedsApply = true; | ||
530 | } | 341 | } | ||
531 | 342 | | |||
532 | void MouseSettings::load(KConfig *config, Display *dpy) | 343 | void MouseSettings::load(KConfig *config, Display *dpy) | ||
533 | { | 344 | { | ||
534 | // TODO: what's a good threshold default value | 345 | // TODO: what's a good threshold default value | ||
535 | int threshold = 0; | 346 | int threshold = 0; | ||
536 | int h = RIGHT_HANDED; | 347 | int h = RIGHT_HANDED; | ||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |