Commit c4cb1b10afb18aaecfc23a46c7d6755a26e8d2b5

  • avatar
  • swiesner <swiesner @283d02a7-25f6-0310…ecb5cbfe19da.>
  • Mon Mar 15 14:20:46 CET 2010
Disable coasting configuration, if both edge scrolling options are disabled

git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/playground/utils/synaptiks@1103603 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
  
153153 ui.setupUi(this);
154154 QDBusInterface touchpad("org.kde.synaptiks", "/Touchpad",
155155 "org.kde.Touchpad");
156 if (!touchpad.isValid()) {
157 return;
158 }
159156 QDBusReply<int> fingers = touchpad.call("fingerDetection");
160157 if (fingers.isValid()) {
161158 if (fingers.value() < 2) {
160160 ui.kcfg_VerticalTwoFingerScrolling->setEnabled(false);
161161 }
162162 }
163 this->connect(ui.kcfg_HorizontalEdgeScrolling, SIGNAL(toggled(bool)),
164 SLOT(disableCoastingConfiguration()));
165 this->connect(ui.kcfg_VerticalEdgeScrolling, SIGNAL(toggled(bool)),
166 SLOT(disableCoastingConfiguration()));
167}
168
169void ScrollingPage::disableCoastingConfiguration() {
170 QRegExp pattern("kcfg_.+EdgeScrolling");
171 QList<QCheckBox*> edgeScrollingOptions =
172 this->findChildren<QCheckBox*>(pattern);
173 Q_ASSERT(edgeScrollingOptions.size() == 2);
174 bool edgeScrollingEnabled = false;
175 foreach (const QCheckBox *option, edgeScrollingOptions) {
176 edgeScrollingEnabled |= option->isChecked();
177 if (edgeScrollingEnabled)
178 break;
179 }
180 QGroupBox *kcfg_Coasting = this->findChild<QGroupBox*>("kcfg_Coasting");
181 Q_ASSERT(kcfg_Coasting);
182 kcfg_Coasting->setEnabled(edgeScrollingEnabled);
163183}
164184
165185TappingPage::TappingPage(QWidget *parent):
  
7676
7777 public:
7878 ScrollingPage(QWidget *parent=0);
79
80 public Q_SLOTS:
81 void disableCoastingConfiguration();
7982 };
8083
8184 class TappingPage: public QWidget {