Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/mousesettings.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 45 | if (backend) { | |||
---|---|---|---|---|---|
46 | backend->load(); | 46 | backend->load(); | ||
47 | auto handedOnServer = backend->handed(); | 47 | auto handedOnServer = backend->handed(); | ||
48 | handedEnabled = handedOnServer != MouseHanded::NotSupported; | 48 | handedEnabled = handedOnServer != MouseHanded::NotSupported; | ||
49 | if (handedEnabled) { | 49 | if (handedEnabled) { | ||
50 | handed = handedOnServer; | 50 | handed = handedOnServer; | ||
51 | } | 51 | } | ||
52 | accel = backend->accelRate(); | 52 | accel = backend->accelRate(); | ||
53 | threshold = backend->threshold(); | 53 | threshold = backend->threshold(); | ||
54 | profile = backend->accelerationProfile(); | ||||
54 | } | 55 | } | ||
55 | 56 | | |||
56 | KConfigGroup group = config->group("Mouse"); | 57 | KConfigGroup group = config->group("Mouse"); | ||
57 | double a = group.readEntry("Acceleration", -1.0); | 58 | double a = group.readEntry("Acceleration", -1.0); | ||
58 | if (a == -1) | 59 | if (a == -1) | ||
59 | accelRate = accel; | 60 | accelRate = accel; | ||
60 | else | 61 | else | ||
61 | accelRate = a; | 62 | accelRate = a; | ||
62 | 63 | | |||
63 | int t = group.readEntry("Threshold", -1); | 64 | int t = group.readEntry("Threshold", -1); | ||
64 | if (t == -1) | 65 | if (t == -1) | ||
65 | thresholdMove = threshold; | 66 | thresholdMove = threshold; | ||
66 | else | 67 | else | ||
67 | thresholdMove = t; | 68 | thresholdMove = t; | ||
68 | 69 | | |||
69 | QString key = group.readEntry("MouseButtonMapping"); | 70 | QString key = group.readEntry("MouseButtonMapping"); | ||
70 | if (key == "RightHanded") | 71 | if (key == "RightHanded") | ||
71 | handed = MouseHanded::Right; | 72 | handed = MouseHanded::Right; | ||
72 | else if (key == "LeftHanded") | 73 | else if (key == "LeftHanded") | ||
73 | handed = MouseHanded::Left; | 74 | handed = MouseHanded::Left; | ||
74 | reverseScrollPolarity = group.readEntry("ReverseScrollPolarity", false); | 75 | reverseScrollPolarity = group.readEntry("ReverseScrollPolarity", false); | ||
76 | currentAccelProfile = group.readEntry("AccelerationProfile"); | ||||
77 | if (currentAccelProfile.isEmpty()) { | ||||
78 | currentAccelProfile = profile; | ||||
79 | } | ||||
75 | handedNeedsApply = false; | 80 | handedNeedsApply = false; | ||
76 | 81 | | |||
77 | // SC/DC/AutoSelect/ChangeCursor | 82 | // SC/DC/AutoSelect/ChangeCursor | ||
78 | group = config->group("KDE"); | 83 | group = config->group("KDE"); | ||
79 | doubleClickInterval = group.readEntry("DoubleClickInterval", 400); | 84 | doubleClickInterval = group.readEntry("DoubleClickInterval", 400); | ||
80 | dragStartTime = group.readEntry("StartDragTime", 500); | 85 | dragStartTime = group.readEntry("StartDragTime", 500); | ||
81 | dragStartDist = group.readEntry("StartDragDist", 4); | 86 | dragStartDist = group.readEntry("StartDragDist", 4); | ||
82 | wheelScrollLines = group.readEntry("WheelScrollLines", 3); | 87 | wheelScrollLines = group.readEntry("WheelScrollLines", 3); | ||
83 | 88 | | |||
84 | singleClick = group.readEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 89 | singleClick = group.readEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | ||
85 | } | 90 | } | ||
86 | 91 | | |||
87 | void MouseSettings::save(KConfig *config) | 92 | void MouseSettings::save(KConfig *config) | ||
88 | { | 93 | { | ||
89 | KSharedConfig::Ptr kcminputProfile = KSharedConfig::openConfig("kcminputrc"); | 94 | KSharedConfig::Ptr kcminputProfile = KSharedConfig::openConfig("kcminputrc"); | ||
90 | KConfigGroup kcminputGroup(kcminputProfile, "Mouse"); | 95 | KConfigGroup kcminputGroup(kcminputProfile, "Mouse"); | ||
91 | kcminputGroup.writeEntry("Acceleration",accelRate); | 96 | kcminputGroup.writeEntry("Acceleration",accelRate); | ||
92 | kcminputGroup.writeEntry("Threshold",thresholdMove); | 97 | kcminputGroup.writeEntry("Threshold",thresholdMove); | ||
93 | if (handed == MouseHanded::Right) { | 98 | if (handed == MouseHanded::Right) { | ||
94 | kcminputGroup.writeEntry("MouseButtonMapping",QString("RightHanded")); | 99 | kcminputGroup.writeEntry("MouseButtonMapping",QString("RightHanded")); | ||
95 | } else { | 100 | } else { | ||
96 | kcminputGroup.writeEntry("MouseButtonMapping",QString("LeftHanded")); | 101 | kcminputGroup.writeEntry("MouseButtonMapping",QString("LeftHanded")); | ||
97 | } | 102 | } | ||
98 | kcminputGroup.writeEntry("ReverseScrollPolarity", reverseScrollPolarity); | 103 | kcminputGroup.writeEntry("ReverseScrollPolarity", reverseScrollPolarity); | ||
104 | kcminputGroup.writeEntry("AccelerationProfile", currentAccelProfile); | ||||
99 | kcminputGroup.sync(); | 105 | kcminputGroup.sync(); | ||
100 | 106 | | |||
101 | KSharedConfig::Ptr profile = KSharedConfig::openConfig("kdeglobals"); | 107 | KSharedConfig::Ptr profile = KSharedConfig::openConfig("kdeglobals"); | ||
102 | KConfigGroup group(profile, "KDE"); | 108 | KConfigGroup group(profile, "KDE"); | ||
103 | group.writeEntry("DoubleClickInterval", doubleClickInterval, KConfig::Persistent); | 109 | group.writeEntry("DoubleClickInterval", doubleClickInterval, KConfig::Persistent); | ||
104 | group.writeEntry("StartDragTime", dragStartTime, KConfig::Persistent); | 110 | group.writeEntry("StartDragTime", dragStartTime, KConfig::Persistent); | ||
105 | group.writeEntry("StartDragDist", dragStartDist, KConfig::Persistent); | 111 | group.writeEntry("StartDragDist", dragStartDist, KConfig::Persistent); | ||
106 | group.writeEntry("WheelScrollLines", wheelScrollLines, KConfig::Persistent); | 112 | group.writeEntry("WheelScrollLines", wheelScrollLines, KConfig::Persistent); | ||
Show All 10 Lines |