mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
changeset 32 edd273b3192a
parent 27 cbb1bfb7ebfb
child 40 4a1905d205a2
--- a/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Fri May 14 16:21:14 2010 +0300
+++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Thu May 27 13:19:19 2010 +0300
@@ -27,6 +27,7 @@
 #include <mtp/mmtpdataproviderframework.h>
 #include <mtp/mmtpobjectmgr.h>
 #include <mtp/tmtptypeuint32.h>
+#include <e32property.h>    // for RProperty
 
 // for asf mimetype parsing
 #ifdef __WINDOWS_MEDIA
@@ -39,6 +40,7 @@
 #include "tobjectdescription.h"
 #include "mmmtpdplogger.h"
 #include "mmmtpdp_variant.hrh"
+#include "cmmmtpdpaccesssingleton.h"
 
 using namespace ContentAccess;
 
@@ -100,7 +102,8 @@
 #endif // __WINDOWS_MEDIA
             else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
                 {
-                HBufC8* mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() );
+                HBufC8* mime(NULL);
+                TRAP_IGNORE( mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() ) );
                 if ( mime != NULL )
                     {
                     // 3GP
@@ -701,4 +704,36 @@
     return drmStatus;
     }
 
+EXPORT_C void MmMtpDpUtility::SetPSStatus( TMtpPSStatus aStatus )
+    {
+    TBool changeScheduled = EFalse;
+    CMmMtpDpAccessSingleton::CancelActiveToIdleStatusChange();  // cancel any outstanding delay status change
+    
+    if ( aStatus == EMtpPSStatusReadyToSync )
+        {
+        TInt mtpStatus;
+        RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
+        
+        if ( mtpStatus == EMtpPSStatusActive )
+            {
+            CMmMtpDpAccessSingleton::ActiveToIdleStatusChange();
+            changeScheduled = ETrue;
+            }
+        }
+
+    if ( !changeScheduled )
+        DoSetPSStatus( aStatus );
+    }
+
+void MmMtpDpUtility::DoSetPSStatus( TMtpPSStatus aStatus )
+    {
+    TInt mtpStatus;
+    RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
+
+    if ( mtpStatus != aStatus )
+        {
+        TInt err = RProperty::Set( KMtpPSUid, KMtpPSStatus, aStatus );
+        PRINT3( _L("MM MTP <> CRequestProcessor::DoSetPSStatus err = %d, previous = %d, current = %d" ), err , mtpStatus, aStatus);
+        }
+    }
 // end of file