btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp
changeset 42 b72428996822
parent 32 19bd632b5100
child 47 9e2a905b887f
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include    <avkon.hrh>                    // AVKON components
       
    21 #include    "BIPController.h"
    20 #include    "BIPController.h"
    22 #include    "BIPCapabilityHandler.h"
    21 #include    "BIPCapabilityHandler.h"
    23 #include    "BIPImageHandler.h"
    22 #include    "BIPImageHandler.h"
    24 
    23 
    25 
    24 
    26 #include    <e32base.h>
    25 #include    <e32base.h>
    27 #include    <StringLoader.h>               // Series 60 localisation stringloader
       
    28 #include    <obexutilsmessagehandler.h>
    26 #include    <obexutilsmessagehandler.h>
    29 #include    <obexutilsuilayer.h>
       
    30 #include    <obexutilsdialog.h>
       
    31 #include    <UiklafInternalCRKeys.h>
       
    32 #include    <Obexutils.rsg>
       
    33 #include    <sysutil.h>
    27 #include    <sysutil.h>
    34 #include    <bautils.h>
    28 #include    <bautils.h>
    35 #include    <driveinfo.h>                   
    29 #include    <driveinfo.h>                   
    36 #include    <AknWaitDialog.h>
       
    37 #include    <btengdomaincrkeys.h> 
    30 #include    <btengdomaincrkeys.h> 
    38 #include    <e32math.h> 
    31 #include    <e32math.h> 
    39 #include    <es_sock.h>
    32 #include    <es_sock.h>
    40 #include    <bt_sock.h>
    33 #include    <bt_sock.h>
    41 #include    <msvids.h>
    34 #include    <msvids.h>
    42 #include    "debug.h"
    35 #include    "debug.h"
       
    36 #include    <bluetoothdevicedialogs.h>
       
    37 #include <hbtextresolversymbian.h>
    43         
    38         
    44 // CONSTANTS
    39 // CONSTANTS
    45 _LIT8(KBipCapabilityType, "x-bt/img-capabilities\0");
    40 _LIT8(KBipCapabilityType, "x-bt/img-capabilities\0");
    46 
    41 const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3
    47 
       
    48 const TInt    KBufferSize = 0x10000;  // 64 kB
    42 const TInt    KBufferSize = 0x10000;  // 64 kB
       
    43 _LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" );
       
    44 _LIT(KLocFileName, "btdialogs_");
       
    45 _LIT(KPath, "z:/resource/qt/translations/");  
       
    46 
    49 
    47 
    50 // ================= MEMBER FUNCTIONS =======================
    48 // ================= MEMBER FUNCTIONS =======================
    51 
    49 
    52 CBIPController* CBIPController::NewL()
    50 CBIPController* CBIPController::NewL()
    53     {
    51     {
    78     iLowMemoryActiveMMC = CObexUtilsPropertyNotifier::NewL(this, ECheckMMCMemory);
    76     iLowMemoryActiveMMC = CObexUtilsPropertyNotifier::NewL(this, ECheckMMCMemory);
    79     iDevMan = CBTEngDevMan::NewL(this);
    77     iDevMan = CBTEngDevMan::NewL(this);
    80     iResultArray = new(ELeave) CBTDeviceArray(1);
    78     iResultArray = new(ELeave) CBTDeviceArray(1);
    81     // Get default folder from CenRep 
    79     // Get default folder from CenRep 
    82     TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder, iCenRepFolder);
    80     TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder, iCenRepFolder);
       
    81     iDialog = CObexUtilsDialog::NewL(this);
       
    82     TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath);
       
    83     if (!ok) 
       
    84         {
       
    85         User::Leave( KErrNotFound );
       
    86         }
    83     TRACE_FUNC_EXIT
    87     TRACE_FUNC_EXIT
    84     }
    88     }
    85 
    89 
    86 // ---------------------------------------------------------
    90 // ---------------------------------------------------------
    87 // ~CBIPController()
    91 // ~CBIPController()
    94     delete iBIPCapabilityHandler;    
    98     delete iBIPCapabilityHandler;    
    95     delete iBIPImageHandler;    
    99     delete iBIPImageHandler;    
    96     delete iLowMemoryActiveCDrive;    
   100     delete iLowMemoryActiveCDrive;    
    97     delete iLowMemoryActiveMMC;    
   101     delete iLowMemoryActiveMMC;    
    98     delete iBuf;
   102     delete iBuf;
    99     delete iProgressDialog;
       
   100     delete iWaitDialog;
       
   101     delete iBTObject;
   103     delete iBTObject;
   102     delete iDevMan;
   104     delete iDevMan;
   103     if (iResultArray)
   105     if (iResultArray)
   104         {
   106         {
   105         iResultArray->ResetAndDestroy();
   107         iResultArray->ResetAndDestroy();
   106         delete iResultArray;
   108         delete iResultArray;
   107         }
   109         }
   108     iFs.Close();
   110     iFs.Close();
       
   111     delete iDialog;
       
   112     delete iProgressDialog;
   109     TRACE_FUNC_EXIT    
   113     TRACE_FUNC_EXIT    
   110     }
   114     }
   111 
   115 
   112 // ---------------------------------------------------------
   116 // ---------------------------------------------------------
   113 // ErrorIndication()
   117 // ErrorIndication()
   141         if(iBTObject)
   145         if(iBTObject)
   142             {
   146             {
   143             iBTObject->Reset();
   147             iBTObject->Reset();
   144             }
   148             }
   145         CancelTransfer();
   149         CancelTransfer();
   146         TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( R_BT_FAILED_TO_RECEIVE));
   150 
   147         }
   151         TRAP_IGNORE( 
       
   152                 HBufC* note = HbTextResolverSymbian::LoadLC(_L("txt_bt_dpophead_receiving_failed"));
       
   153                 iDialog->ShowErrorNoteL(note->Des());
       
   154                 CleanupStack::PopAndDestroy(note); 
       
   155                 );
       
   156         } 
   148     delete iBuf;
   157     delete iBuf;
   149     iBuf = NULL;
   158     iBuf = NULL;
   150     
   159     
   151     iBTTransferState = ETransferIdle;
   160     iBTTransferState = ETransferIdle;
   152     TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject,iMsvIdParent));
   161     TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject,iMsvIdParent));
   195 
   204 
   196 // ---------------------------------------------------------
   205 // ---------------------------------------------------------
   197 // ObexConnectIndication()
   206 // ObexConnectIndication()
   198 // ---------------------------------------------------------
   207 // ---------------------------------------------------------
   199 //
   208 //
   200 TInt CBIPController::ObexConnectIndication( const TObexConnectInfo& /*aRemoteInfo*/, const TDesC8& /*aInfo*/ )
   209 TInt CBIPController::ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo )
   201     {
   210     {
   202     TRACE_FUNC
   211     TRACE_FUNC
       
   212     
       
   213     (void) aRemoteInfo;
       
   214     (void) aInfo;
   203     
   215     
   204     // Get remote device socket address and bluetooth name
   216     // Get remote device socket address and bluetooth name
   205     // Remote bluetooth name will be displayed in the new message in inbox.
   217     // Remote bluetooth name will be displayed in the new message in inbox.
   206     //
   218     //
   207     TSockAddr addr;
   219     TSockAddr addr;
   221 
   233 
   222 // ---------------------------------------------------------
   234 // ---------------------------------------------------------
   223 // ObexDisconnectIndication()
   235 // ObexDisconnectIndication()
   224 // ---------------------------------------------------------
   236 // ---------------------------------------------------------
   225 //
   237 //
   226 void CBIPController::ObexDisconnectIndication(const TDesC8& /*aInfo*/)
   238 void CBIPController::ObexDisconnectIndication(const TDesC8& aInfo)
   227     {
   239     {
   228     TRACE_FUNC
   240     TRACE_FUNC
       
   241     (void) aInfo;
   229     }
   242     }
   230 
   243 
   231 // ---------------------------------------------------------
   244 // ---------------------------------------------------------
   232 // TransportDownIndication()
   245 // TransportDownIndication()
   233 // ---------------------------------------------------------
   246 // ---------------------------------------------------------
   239     //
   252     //
   240     delete iBTObject;
   253     delete iBTObject;
   241     iBTObject = NULL;
   254     iBTObject = NULL;
   242     TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename));  
   255     TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename));  
   243     iFs.Close();
   256     iFs.Close();
       
   257     iFileCount = 0;
   244     }
   258     }
   245 
   259 
   246 // ---------------------------------------------------------
   260 // ---------------------------------------------------------
   247 // PutRequestIndication()
   261 // PutRequestIndication()
   248 // ---------------------------------------------------------
   262 // ---------------------------------------------------------
   254     iBTTransferState = ETransferPut;
   268     iBTTransferState = ETransferPut;
   255     
   269     
   256     // Checking if backup is running now - if backup process is active, then we
   270     // Checking if backup is running now - if backup process is active, then we
   257     // need to cancel transfer - otherwise phone will freeze during receiving
   271     // need to cancel transfer - otherwise phone will freeze during receiving
   258     // data
   272     // data
   259     if ( TObexUtilsUiLayer::IsBackupRunning() )
   273     if ( IsBackupRunning() )
   260         {
   274         {
   261         TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer."));
   275         TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer."));
   262         iBTTransferState = ETransferPutInitError;
   276         iBTTransferState = ETransferPutInitError;
   263         return NULL;
   277         return NULL;
   264         }
   278         }
   306                 {
   320                 {
   307                 return KErrGeneral;
   321                 return KErrGeneral;
   308                 }
   322                 }
   309             if(!capacity)
   323             if(!capacity)
   310                 {
   324                 {
   311                 TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY));
   325                 //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY));
       
   326                 //todo: Need to use Localized string.
       
   327                 _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again.");
       
   328                 TRAP_IGNORE(iDialog->ShowErrorNoteL(KText));
       
   329     
   312                 return KErrDiskFull;
   330                 return KErrDiskFull;
   313                 }
   331                 }
   314             }
   332             }
   315         if(iBTObject->Name().Length() > KMaxFileName)
   333         if(iBTObject->Name().Length() > KMaxFileName)
   316             {
   334             {
   324         iBTTransferState = ETransferPut;
   342         iBTTransferState = ETransferPut;
   325         
   343         
   326         // Now we need to either create (in the first instance) or update the dialog on the UI.
   344         // Now we need to either create (in the first instance) or update the dialog on the UI.
   327         if(ReceivingIndicatorActive())
   345         if(ReceivingIndicatorActive())
   328             {
   346             {
   329             UpdateReceivingIndicator();
   347             TRAPD(err, UpdateReceivingIndicatorL());
       
   348             if(err < KErrNone)
       
   349                 {
       
   350                 return err;
       
   351                 }
   330             }
   352             }
   331         else if(!iNoteDisplayed)
   353         else if(!iNoteDisplayed)
   332             {
   354             {
   333             // No note launched yet, so try to launch
   355             // No note launched yet, so try to launch
   334             TRAPD(err, LaunchReceivingIndicatorL());
   356             TRAPD(err, LaunchReceivingIndicatorL());
   356     else
   378     else
   357         {
   379         {
   358         retVal = HandlePutCompleteIndication();
   380         retVal = HandlePutCompleteIndication();
   359         iBTTransferState = ETransferIdle;
   381         iBTTransferState = ETransferIdle;
   360         CloseReceivingIndicator();
   382         CloseReceivingIndicator();
       
   383         iFileCount++;
   361         }
   384         }
   362     TRACE_FUNC_EXIT
   385     TRACE_FUNC_EXIT
   363     return retVal;
   386     return retVal;
   364     }
   387     }
   365 
   388 
   418 
   441 
   419 // ---------------------------------------------------------
   442 // ---------------------------------------------------------
   420 // SetPathIndication()
   443 // SetPathIndication()
   421 // ---------------------------------------------------------
   444 // ---------------------------------------------------------
   422 //
   445 //
   423 TInt CBIPController::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, 
   446 TInt CBIPController::SetPathIndication( const CObex::TSetPathInfo& aPathInfo, 
   424                                         const TDesC8& /*aInfo*/)
   447                                         const TDesC8& aInfo)
   425     {
   448     {
   426     TRACE_FUNC
   449     TRACE_FUNC
   427     // SetPath is not implemented in BIP - so following IrOBEX guidance, return
   450     // SetPath is not implemented in BIP - so following IrOBEX guidance, return
   428     // the Forbidden response code.
   451     // the Forbidden response code.
       
   452     (void) aPathInfo;
       
   453     (void) aInfo;
       
   454     
   429     return KErrIrObexRespForbidden;
   455     return KErrIrObexRespForbidden;
   430     }
   456     }
   431 
   457 
   432 /**
   458 /**
   433 * This function is implementation for mixin-class for Obexutils.
   459 * This function is implementation for mixin-class for Obexutils.
   502     
   528     
   503     // If iDrive is at critical space level, we immediately show out_of_memory.
   529     // If iDrive is at critical space level, we immediately show out_of_memory.
   504     //
   530     //
   505     if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, iDrive))
   531     if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, iDrive))
   506         {
   532         {
   507         TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY));
   533         //TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY));
       
   534         //todo: Need to use Localized string.
       
   535         _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again.");
       
   536         TRAP_IGNORE(iDialog->ShowErrorNoteL(KText));
       
   537     
   508         User::Leave(KErrGeneral);
   538         User::Leave(KErrGeneral);
   509         }
   539         }
   510     
   540     
   511     iBTObject = CObexBufObject::NewL(NULL);    
   541     iBTObject = CObexBufObject::NewL(NULL);    
   512     
   542     
   737         return;
   767         return;
   738         }
   768         }
   739     
   769     
   740     if(iTotalSizeByte > 0)
   770     if(iTotalSizeByte > 0)
   741         {
   771         {
   742         iProgressDialog = CGlobalProgressDialog::NewL(this);  
       
   743         if(iReceivingFileName.Length() > 0)
   772         if(iReceivingFileName.Length() > 0)
   744             {
   773             {
   745             iProgressDialog->ShowProgressDialogNameSizeL(iReceivingFileName, iTotalSizeByte);
   774             iProgressDialog = CHbDeviceDialogSymbian::NewL();
       
   775             iProgressDialog->SetObserver(this);
       
   776     
       
   777             CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL();
       
   778             CleanupStack::PushL(variantMap);
       
   779             
       
   780             TInt dialogIdx = TBluetoothDialogParams::EReceiveProgress;
       
   781             CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), 
       
   782                                                                 CHbSymbianVariant::EInt );
       
   783             CleanupStack::PushL(dialogType);
       
   784             TBuf16<6> dialogTypeKey;
       
   785             dialogTypeKey.Num(TBluetoothDialogParams::EDialogType);
       
   786             User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType));
       
   787             CleanupStack::Pop(dialogType);
       
   788             
       
   789             CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), 
       
   790                                                                 CHbSymbianVariant::EDes );
       
   791             CleanupStack::PushL(deviceName);
       
   792             TBuf16<6> deviceNameKey;
       
   793             deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName);
       
   794             User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName));
       
   795             CleanupStack::Pop(deviceName);
       
   796             
       
   797             CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), 
       
   798                                                                 CHbSymbianVariant::EDes );
       
   799             CleanupStack::PushL(fileName);
       
   800             TBuf16<6> fileNameKey;
       
   801             fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName);
       
   802             User::LeaveIfError(variantMap->Add(fileNameKey, fileName));
       
   803             CleanupStack::Pop(fileName);
       
   804             
       
   805             CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, 
       
   806                                                                 CHbSymbianVariant::EInt );
       
   807             CleanupStack::PushL(fileSz);
       
   808             TBuf16<6> fileSzKey;
       
   809             fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize);
       
   810             User::LeaveIfError(variantMap->Add(fileSzKey, fileSz));
       
   811             CleanupStack::Pop(fileSz);
       
   812             
       
   813             CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, 
       
   814                                                                 CHbSymbianVariant::EInt );
       
   815             CleanupStack::PushL(fileCnt);
       
   816             TBuf16<6> fileCntKey;
       
   817             fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount);
       
   818             User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt));
       
   819             CleanupStack::Pop(fileCnt);
       
   820         
       
   821             iDialogActive = ETrue;
       
   822             iProgressDialog->Show( KBTDevDialogId(), *variantMap, this );
       
   823             CleanupStack::PopAndDestroy(variantMap);
   746             }
   824             }
   747         else
   825         else
   748             {
   826             {
   749             iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA);
   827             // TODO
       
   828             iDialogActive = ETrue;
   750             }
   829             }
   751         }
   830         }
   752     else
   831     else
   753         {
   832         {
   754         iWaitDialog = CGlobalDialog::NewL(this);
   833         iDialogActive = ETrue;
   755         iWaitDialog->ShowNoteDialogL(R_BT_RECEIVING_DATA, ETrue);
   834         /*
   756         }
   835          * TODO - The functionality provided by CGlobalDialog will be removed
   757     }
   836          * TODO - and this will be provided by CGlobalProgressDialog.
   758 
   837          */
   759 void CBIPController::UpdateReceivingIndicator()
   838         
       
   839         }
       
   840     }
       
   841 
       
   842 void CBIPController::UpdateReceivingIndicatorL()
   760     {
   843     {
   761     if(iProgressDialog)
   844     if(iProgressDialog)
   762         {
   845         {
   763         iProgressDialog->UpdateProgressDialog(iBTObject->BytesReceived(), iTotalSizeByte);
   846         CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL();
   764         }
   847         CleanupStack::PushL(variantMap);
   765     // else we are using a wait note, so no "need" to update
   848         
   766     }
   849         TInt bytesReceived = iBTObject->BytesReceived();
   767 
   850         CHbSymbianVariant* progress = CHbSymbianVariant::NewL( (TAny*) &bytesReceived, CHbSymbianVariant::EInt );
   768 void CBIPController::HandleGlobalProgressDialogL( TInt aSoftkey )
   851         CleanupStack::PushL(progress);
   769     {
   852         User::LeaveIfError(variantMap->Add(_L("progress"), progress));
   770     TRACE_FUNC
   853         CleanupStack::Pop(progress);
   771     
   854         
   772     if(aSoftkey == EAknSoftkeyCancel)
   855         iProgressDialog->Update(*variantMap);
   773         {
   856         CleanupStack::PopAndDestroy(variantMap);
   774         CancelTransfer();
       
   775         }
       
   776     else if(aSoftkey == EAknSoftkeyHide)
       
   777         {
       
   778         CloseReceivingIndicator(EFalse); // Don't reset state as only hiding
       
   779         }
       
   780     }
       
   781 
       
   782 void CBIPController::HandleGlobalNoteDialogL( TInt aSoftkey )
       
   783     {
       
   784     TRACE_FUNC
       
   785     
       
   786     if( aSoftkey == EAknSoftkeyCancel )
       
   787         {
       
   788         CancelTransfer();
       
   789         }
       
   790     else if( aSoftkey == EAknSoftkeyHide)
       
   791         {
       
   792         CloseReceivingIndicator(EFalse); // Don't reset state as only hiding
       
   793         }
   857         }
   794     }
   858     }
   795 
   859 
   796 void CBIPController::CloseReceivingIndicator(TBool aResetDisplayedState)
   860 void CBIPController::CloseReceivingIndicator(TBool aResetDisplayedState)
   797     {
   861     {
   800         {
   864         {
   801         iNoteDisplayed = EFalse;
   865         iNoteDisplayed = EFalse;
   802         }
   866         }
   803     if(iProgressDialog)
   867     if(iProgressDialog)
   804         {
   868         {
   805         iProgressDialog->ProcessFinished();
   869         iProgressDialog->Cancel();
       
   870         iDialogActive = EFalse;
   806         delete iProgressDialog;
   871         delete iProgressDialog;
   807         iProgressDialog = NULL;
   872         iProgressDialog = NULL;
   808         }
       
   809     if(iWaitDialog)
       
   810         {
       
   811         iWaitDialog->ProcessFinished();
       
   812         delete iWaitDialog;
       
   813         iWaitDialog = NULL;
       
   814         }
   873         }
   815     }
   874     }
   816  
   875  
   817  // ---------------------------------------------------------
   876  // ---------------------------------------------------------
   818  // GetDriveWithMaximumFreeSpace()
   877  // GetDriveWithMaximumFreeSpace()
   867  // COPPController::HandleDevManComplete
   926  // COPPController::HandleDevManComplete
   868  // Callback from devman
   927  // Callback from devman
   869  // ----------------------------------------------------------
   928  // ----------------------------------------------------------
   870  //    
   929  //    
   871  // 
   930  // 
   872  void CBIPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/)
   931  void CBIPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray)
   873     {
   932     {
       
   933     (void) aDeviceArray;
       
   934      
   874     if ( aErr == KErrNone )
   935     if ( aErr == KErrNone )
   875         {
   936         {
   876         if ( iResultArray->Count())
   937         if ( iResultArray->Count())
   877             {
   938             {
   878             iRemoteDeviceName.Zero();
   939             iRemoteDeviceName.Zero();
   888                 }
   949                 }
   889             }
   950             }
   890         }
   951         }
   891     }
   952     }
   892  
   953  
       
   954  TBool CBIPController::IsBackupRunning()
       
   955     {
       
   956     const TUint32 KFileManagerBkupStatus = 0x00000001;
       
   957     
       
   958     TInt status = EFileManagerBkupStatusUnset;
       
   959     TBool retValue = EFalse;
       
   960     TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus,
       
   961                               status );
       
   962     if ( err == KErrNone )
       
   963         {
       
   964         if ( status == EFileManagerBkupStatusBackup || 
       
   965              status == EFileManagerBkupStatusRestore )
       
   966             {
       
   967             TSecureId fileManagerSecureId( KFileManagerUID3 );
       
   968             //only returning ETrue if backup process is still active
       
   969             retValue = ProcessExists( fileManagerSecureId );
       
   970             }
       
   971         }
       
   972    
       
   973     return retValue;
       
   974     }
       
   975  
       
   976  TBool CBIPController::ProcessExists( const TSecureId& aSecureId )
       
   977      {
       
   978      _LIT( KFindPattern, "*" );
       
   979      TFindProcess finder(KFindPattern);
       
   980      TFullName processName;
       
   981      while( finder.Next( processName ) == KErrNone )
       
   982          {
       
   983          RProcess process;
       
   984          if ( process.Open( processName ) == KErrNone )
       
   985              {
       
   986              TSecureId processId( process.SecureId() );
       
   987              process.Close();
       
   988              if( processId == aSecureId )
       
   989                  {
       
   990                  return ETrue;
       
   991                  }
       
   992              }
       
   993          }
       
   994      return EFalse;
       
   995      }
       
   996  
       
   997  void CBIPController::DialogDismissed(TInt aButtonId)
       
   998      {
       
   999      (void) aButtonId;
       
  1000      }
       
  1001 
       
  1002  void CBIPController::DataReceived(CHbSymbianVariantMap& aData)
       
  1003      {
       
  1004      if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0)
       
  1005          {
       
  1006          TInt val = *(static_cast<TInt*>(aData.Get(_L("actionResult"))->Data()));
       
  1007          if(!val)
       
  1008              {
       
  1009              //Cancel has been clicked
       
  1010              CancelTransfer();
       
  1011              }
       
  1012          else
       
  1013              {
       
  1014              //Hide has been clicked
       
  1015              CloseReceivingIndicator(EFalse);
       
  1016              }
       
  1017          }
       
  1018      }
       
  1019  
       
  1020  void CBIPController::DeviceDialogClosed(TInt aCompletionCode)
       
  1021      {
       
  1022      (void) aCompletionCode;
       
  1023      }
       
  1024 
       
  1025  
   893 //////////////////////////// Global part ////////////////////////////
  1026 //////////////////////////// Global part ////////////////////////////
   894 
  1027 
   895 //  End of File
  1028 //  End of File