MCEPrivate::MCEPrivate(QObject *parent)
: QObject(parent),
- m_displayOn(true)
+ m_displayOn(true),
+ m_touchscreenVibrationEnabled(false)
{
qDebug() << __PRETTY_FUNCTION__;
SLOT(setDisplayState(QString)),
SLOT(displayStateError(QDBusError)));
- if (isTouchscreenVibrationEnabled())
+ m_touchscreenVibrationEnabled = isTouchscreenVibrationEnabled();
+
+ if (m_touchscreenVibrationEnabled)
m_dBusInterface->call(MCE_ENABLE_VIBRATOR);
}
{
qDebug() << __PRETTY_FUNCTION__;
- m_dBusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternPowerKeyPress");
+ if (m_touchscreenVibrationEnabled) {
+ m_dBusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternPowerKeyPress");
- const int VIBRATION_TIME = 40; //Vibration time in milliseconds
- QTimer::singleShot(VIBRATION_TIME, this, SLOT(stopVibration()));
+ const int VIBRATION_TIME = 40; //Vibration time in milliseconds
+ QTimer::singleShot(VIBRATION_TIME, this, SLOT(stopVibration()));
+ }
}
MCEPrivate::~MCEPrivate()
{
- qDebug() << __PRETTY_FUNCTION__;
+ qWarning() << __PRETTY_FUNCTION__;
- m_dBusInterface->call(MCE_DISABLE_VIBRATOR);
+ if (m_touchscreenVibrationEnabled)
+ m_dBusInterface->call(MCE_DISABLE_VIBRATOR);
}
/**
* @brief MCEPrivate class.
*
-* Mode Control Entity (MCE) listens changes in phone state.
+* Mode Control Entity (MCE) controls phone and listens changes in phone state.
*/
class MCEPrivate : public QObject
{
* DATA MEMBERS
******************************************************************************/
private:
- bool m_displayOn; ///< Flag for display on/off
- QDBusInterface *m_dBusInterface; ///< D-Bus interface
- MCE *m_parent; ///< Parent object
+ 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
};
#endif // MCEPRIVATE_H