Added touchscreen enabled flag.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 30 Jul 2010 08:59:42 +0000 (11:59 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 30 Jul 2010 08:59:42 +0000 (11:59 +0300)
src/engine/mce.h
src/engine/mceprivate.cpp
src/engine/mceprivate.h

index d053e81..df8c2bb 100644 (file)
@@ -29,7 +29,7 @@ class MCEPrivate;
 /**
 * @brief MCE class.
 *
-* Mode Control Entity (MCE) listens changes in phone state.
+* Mode Control Entity (MCE) controls phone and listens changes in phone state.
 */
 class MCE : public QObject
 {
index 4a0c9b2..1816e9a 100644 (file)
@@ -37,7 +37,8 @@ static QDBusConnection dBusConnection = QDBusConnection::systemBus();
 
 MCEPrivate::MCEPrivate(QObject *parent)
     : QObject(parent),
-      m_displayOn(true)
+      m_displayOn(true),
+      m_touchscreenVibrationEnabled(false)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -53,7 +54,9 @@ MCEPrivate::MCEPrivate(QObject *parent)
                                       SLOT(setDisplayState(QString)),
                                       SLOT(displayStateError(QDBusError)));
 
-    if (isTouchscreenVibrationEnabled())
+    m_touchscreenVibrationEnabled = isTouchscreenVibrationEnabled();
+
+    if (m_touchscreenVibrationEnabled)
         m_dBusInterface->call(MCE_ENABLE_VIBRATOR);
 }
 
@@ -130,15 +133,18 @@ void MCEPrivate::vibrationFeedback()
 {
     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);
 }
index 11fb32d..b63107a 100644 (file)
@@ -30,7 +30,7 @@ class MCE;
 /**
 * @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
 {
@@ -111,9 +111,10 @@ private slots:
  * 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