qtinternetradio/irqsystemeventhandler/src/irqsystemeventhandler_p.cpp
changeset 5 0930554dc389
parent 3 ee64f059b8e1
child 14 896e9dbc5f19
--- a/qtinternetradio/irqsystemeventhandler/src/irqsystemeventhandler_p.cpp	Fri May 14 15:43:29 2010 +0300
+++ b/qtinternetradio/irqsystemeventhandler/src/irqsystemeventhandler_p.cpp	Thu May 27 12:46:34 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Contains logic for watching certain disk's space
+* Description:
 *
 */
 
@@ -19,6 +19,8 @@
 #include "irqsystemeventhandler_p.h"
 #include "irdiskspaceobserver.h"
 #include "iralarmobserver.h"
+#include "irpropertyobserver.h"
+#include "irqlogger.h"
 
 #ifdef USER_DEFINED_DISKSPACE 
 #include <QFile>
@@ -26,9 +28,11 @@
 #include <QStringList> 
 #endif
 
+#define DEFAULT_DISKSPACE_LOW_LEVEL   (3*1024*1024)
 
 IRQSystemEventHandlerPrivate::IRQSystemEventHandlerPrivate(IRQSystemEventHandler *aSystemEventHandler) : q_ptr(aSystemEventHandler),
-                              mAlarmOn(false),mDefaultLevel(3*1024*1024),mAlarmObserver(NULL), mDiskSpaceObserver(NULL)
+                              mAlarmOn(false),mDefaultLevel(DEFAULT_DISKSPACE_LOW_LEVEL),mAlarmObserver(NULL), mDiskSpaceObserver(NULL),
+                              mPropertyObserver(NULL),mErrorCode(0)
 { 
 }
 
@@ -37,6 +41,7 @@
     cancel();
     delete mDiskSpaceObserver;
     delete mAlarmObserver;   
+    delete mPropertyObserver;
 }
 
 bool IRQSystemEventHandlerPrivate::init()
@@ -52,8 +57,9 @@
     }
     else
     {
+        mAlarmObserver = NULL;
         mDiskSpaceObserver = NULL;
-        mAlarmObserver = NULL;
+        mPropertyObserver = NULL;        
     }
     
     
@@ -76,8 +82,10 @@
 void IRQSystemEventHandlerPrivate::initializeL()
 {
     mAlarmObserver = CIRAlarmObserver::NewLC(this);    
-    mDiskSpaceObserver = CIRDiskSpaceObserver::NewL(this);
-    CleanupStack::Pop(mAlarmObserver);
+    mDiskSpaceObserver = CIRDiskSpaceObserver::NewLC(this);
+    mPropertyObserver = CIRPropertyObserver::NewL(this);   
+    CleanupStack::Pop(mDiskSpaceObserver);
+    CleanupStack::Pop(mAlarmObserver);    
 }
 
 void IRQSystemEventHandlerPrivate::cancel()
@@ -103,9 +111,10 @@
     if( mDiskSpaceObserver )
     {
         mDiskSpaceObserver->Start((TInt64)mDefaultLevel);            
-    }    
+    }       
 }
 
+
 bool IRQSystemEventHandlerPrivate::isBelowCriticalLevel(const qint64 aCriticalLevel)
 {
     if( 0 == aCriticalLevel )
@@ -116,6 +125,16 @@
     return mDiskSpaceObserver->IsBelowCriticalLevel((TInt64)aCriticalLevel );
 }
 
+bool IRQSystemEventHandlerPrivate::isCallActive() const
+{
+    return mPropertyObserver->IsCallActive();
+}
+
+int IRQSystemEventHandlerPrivate::getErrorCode() const
+{
+    return mErrorCode;
+}
+
 #ifdef USER_DEFINED_DISKSPACE
 void IRQSystemEventHandlerPrivate::getDiskSpaceCriticalLevel(qint64 & aLevel)
 {
@@ -167,6 +186,36 @@
 {
     emit q_ptr->diskSpaceLowNotification(aCriticalLevel);
 }
+
+void IRQSystemEventHandlerPrivate::callIsActivated()
+{
+    LOG_METHOD;
+    emit q_ptr->callActivated();    
+}
+
+void IRQSystemEventHandlerPrivate::callIsDeactivated()
+{
+    LOG_METHOD;
+    emit q_ptr->callDeactivated();    
+}
+
+void IRQSystemEventHandlerPrivate::errorCallback(int aError)
+{
+    mErrorCode = aError;
+}
+
+void IRQSystemEventHandlerPrivate::headsetIsConnected()
+{
+    LOG_METHOD;    
+    emit q_ptr->headsetConnected();
+}
+
+void IRQSystemEventHandlerPrivate::headsetIsDisconnected()
+{
+    LOG_METHOD;
+    emit q_ptr->headsetDisconnected();
+}
+