#include <QString>
#include <QDebug>
#include <QTimer>
+#include <QFile>
+#include <QtXml/QDomDocument>
#include <mce/dbus-names.h>
#include <mce/mode-names.h>
SLOT(setDisplayState(QString)),
SLOT(displayStateError(QDBusError)));
- m_dBusInterface->call(MCE_ENABLE_VIBRATOR);
+ if (isTouchscreenVibrationEnabled())
+ m_dBusInterface->call(MCE_ENABLE_VIBRATOR);
}
void MCEPrivate::displayStateChanged(const QDBusMessage &message)
}
}
+bool MCEPrivate::isTouchscreenVibrationEnabled()
+{
+ QDomDocument doc("document");
+ QFile file("/var/lib/gconf/system/osso/dsm/vibra/\%gconf.xml");
+
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+ if (!doc.setContent(&file)) {
+ file.close();
+ return false;
+ }
+
+ file.close();
+
+ QDomNodeList domNodeList = doc.elementsByTagName("entry");
+
+ if (domNodeList.count() == 1) {
+ QDomElement element = domNodeList.at(0).toElement();
+ return QVariant(element.attribute("value", "false")).toBool();
+ } else {
+ return false;
+ }
+}
+
void MCEPrivate::stopVibration()
{
qDebug() << __PRETTY_FUNCTION__;
*/
void vibrationFeedback();
+private:
+ /**
+ * @brief Is the touchscreen vibration enabled.
+ *
+ * Reads settings from file.
+ * @return true if enabled, false otherwise
+ */
+ bool isTouchscreenVibrationEnabled();
+
private slots:
/**
* @brief Slot for display state changed.
engine/mceprivate.cpp
HEADERS += network/networkhandlerprivate.h \
engine/mceprivate.h
- QT += dbus
+ QT += dbus xml
CONFIG += icd2 qdbus
SOURCES += gps/gpspositionprivateliblocation.cpp \
gps/liblocationwrapper.cpp \