MCEPrivate::MCEPrivate(QObject *parent)
: QObject(parent),
- m_displayOn(true),
- m_touchscreenVibrationEnabled(false)
+ m_displayOn(true)
{
qDebug() << __PRETTY_FUNCTION__;
m_dBusInterface->callWithCallback(MCE_DISPLAY_STATUS_GET, QList<QVariant>(), this,
SLOT(setDisplayState(QString)),
SLOT(displayStateError(QDBusError)));
-
- m_touchscreenVibrationEnabled = isTouchscreenVibrationEnabled();
}
void MCEPrivate::displayStateChanged(const QDBusMessage &message)
bool MCEPrivate::isTouchscreenVibrationEnabled()
{
- QDomDocument doc("document");
+ QDomDocument doc;
QFile file("/var/lib/gconf/system/osso/dsm/vibra/\%gconf.xml");
if (!file.open(QIODevice::ReadOnly))
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;
+ for (int i = 0; i < domNodeList.count(); ++i) {
+
+ QDomElement element = domNodeList.at(i).toElement();
+
+ if ((!element.isNull()) && (element.hasAttribute("name")) &&
+ (element.attribute("name") == "touchscreen_vibra_enabled")) {
+
+ return QVariant(element.attribute("value", "false")).toBool();
+ }
}
+
+ return false;
}
void MCEPrivate::stopVibration()
{
qDebug() << __PRETTY_FUNCTION__;
- if (m_touchscreenVibrationEnabled) {
+ if (isTouchscreenVibrationEnabled()) {
m_dBusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternPowerKeyPress");
const int VIBRATION_TIME = 40; //Vibration time in milliseconds
******************************************************************************/
private:
bool m_displayOn; ///< Flag for display on/off
- bool m_touchscreenVibrationEnabled; ///< Flag for toucscreen vibration enabled
QDBusInterface *m_dBusInterface; ///< D-Bus interface
MCE *m_parent; ///< Parent object
};