localconnectivityservice/obexreceiveservices/opp/src/oppcontroller.cpp
changeset 1 388a17646e40
parent 0 c3e98f10fcf4
child 5 11d83199e2d9
equal deleted inserted replaced
0:c3e98f10fcf4 1:388a17646e40
   153 	        }
   153 	        }
   154 	    }
   154 	    }
   155 
   155 
   156     iFile = RFile();
   156     iFile = RFile();
   157     iFullPathFilename.Zero();
   157     iFullPathFilename.Zero();
   158     iMsvIdArray.Reset();  
       
   159 	}
   158 	}
   160 
   159 
   161 // ---------------------------------------------------------
   160 // ---------------------------------------------------------
   162 // ObexConnectIndication()
   161 // ObexConnectIndication()
   163 // ---------------------------------------------------------
   162 // ---------------------------------------------------------
   203 // ---------------------------------------------------------
   202 // ---------------------------------------------------------
   204 //
   203 //
   205 void COPPController::TransportDownIndication()
   204 void COPPController::TransportDownIndication()
   206     {
   205     {
   207     TRACE_FUNC
   206     TRACE_FUNC
   208     TRAP_IGNORE(ShowFileReceivedQueryL());
   207     // Remove receiving buffer and files used during file receiving.
       
   208     //
       
   209     delete iObexObject;
       
   210     iObexObject = NULL;
       
   211     TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); 
   209     iFs.Close();
   212     iFs.Close();
   210     }
   213     }
   211 
   214 
   212 // ---------------------------------------------------------
   215 // ---------------------------------------------------------
   213 // PutRequestIndication()
   216 // PutRequestIndication()
   514 	                                                                   iRemoteDeviceName));
   517 	                                                                   iRemoteDeviceName));
   515 	    }
   518 	    }
   516 	TRACE_ASSERT( iMediaType!=ESrcsMediaIrDA, KErrNotSupported);
   519 	TRACE_ASSERT( iMediaType!=ESrcsMediaIrDA, KErrNotSupported);
   517 	if ( retVal == KErrNone)
   520 	if ( retVal == KErrNone)
   518 	    {
   521 	    {
   519 	    TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename, &iMsvIdArray));		    
   522 	    TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename));		    
   520                 
   523                 
   521     if( retVal != KErrNone )
   524     if( retVal != KErrNone )
   522         {
   525         {
   523         TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication AddEntryToInboxL() failed  %d \t" ),retVal ) );                 	
   526         TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication AddEntryToInboxL() failed  %d \t" ),retVal ) );                 	
   524         TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iObexObject, iMsvIdParent));        
   527         TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iObexObject, iMsvIdParent));        
   764         {
   767         {
   765         iWaitDialog->ProcessFinished();
   768         iWaitDialog->ProcessFinished();
   766         delete iWaitDialog;
   769         delete iWaitDialog;
   767         iWaitDialog = NULL;
   770         iWaitDialog = NULL;
   768         }
   771         }
   769     }
       
   770 
       
   771  // ---------------------------------------------------------
       
   772  // ShowFileReceivedQuery()
       
   773  // ---------------------------------------------------------
       
   774  // 
       
   775  void COPPController::ShowFileReceivedQueryL()
       
   776      {
       
   777      // Remove receiving buffer and files used during file receiving.
       
   778      //
       
   779     delete iObexObject;
       
   780     iObexObject = NULL;
       
   781     TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename);    
       
   782     
       
   783     TInt fileCount = iMsvIdArray.Count();     
       
   784     if ( fileCount )
       
   785         {
       
   786         TBool answer = EFalse;        
       
   787         TInt resourceID = R_BT_SAVED_SINGLE;
       
   788         if( fileCount > 1)
       
   789             {
       
   790             resourceID = R_BT_SAVED_MULTIPLE;
       
   791             }
       
   792         answer = TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL(resourceID, iDefaultFolder);
       
   793         
       
   794         TInt sortMethod = 2; // 0 = 'By name' 1 = 'By type' 2 = 'Most recent first' and 3 = 'Largest first'
       
   795         
       
   796          if ( answer && fileCount == 1 )  // User accepts the query
       
   797             {
       
   798             TRAPD( error, TObexUtilsUiLayer::LaunchEditorApplicationL(iMsvIdArray[0]));
       
   799             if ( error != KErrNone )  // File is not supported
       
   800                 {
       
   801                 TObexUtilsUiLayer::LaunchFileManagerL(iFullPathFilename,
       
   802                                                              sortMethod,
       
   803                                                              EFalse);  // EFalse -> start file manager in standalone mode
       
   804                 }         
       
   805             }
       
   806         
       
   807         if ( answer && fileCount > 1 )
       
   808             {
       
   809             // We open the file manager at default folder
       
   810             //
       
   811             TObexUtilsUiLayer::LaunchFileManagerL(iFullPathFilename,
       
   812                                                          sortMethod,
       
   813                                                          EFalse);  // EFalse -> start file manager in standalone mode
       
   814             }
       
   815         iMsvIdArray.Reset();
       
   816         }
       
   817     
       
   818     }
   772     }
   819 
   773 
   820  // ---------------------------------------------------------
   774  // ---------------------------------------------------------
   821   // GetDriveWithMaximumFreeSpace()
   775   // GetDriveWithMaximumFreeSpace()
   822   // ---------------------------------------------------------
   776   // ---------------------------------------------------------