voicerecorder/AppSrc/CVRAppUI.cpp
branchRCL_3
changeset 29 c9b63fff5abf
parent 25 c6bafb5162d8
equal deleted inserted replaced
27:41fba8bcf7b7 29:c9b63fff5abf
   159 			
   159 			
   160 			}
   160 			}
   161 // for multiple drives
   161 // for multiple drives
   162 #else
   162 #else
   163 
   163 
   164 
   164         TInt memoDrive = VRUtils::MemoDriveL();
       
   165         if (VRUtils::DriveValid(memoDrive))
       
   166             {
       
   167             VRUtils::SetMemoDriveL((TDriveNumber) memoDrive);
       
   168             }
       
   169         else
       
   170             {
       
   171             TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC
       
   172             if (defaultDrive == memoDrive)
       
   173                 {
       
   174                 SetDriveL();
       
   175                 }
       
   176             else
       
   177                 {
       
   178                 if (VRUtils::DriveValid(defaultDrive))
       
   179                     {
       
   180                     VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive);
       
   181                     }
       
   182                 else
       
   183                     {
       
   184                     SetDriveL();
       
   185                     }
       
   186                 }
       
   187             }
       
   188 
       
   189 	    if (CVRUSBStateHanlder::IsUsbActive())
       
   190 	        {
       
   191 	        ShowDialogForWaitUSBPluggingOutL();
       
   192 	        Exit();
       
   193 	        }
       
   194         
       
   195         /***** check if memory is below min value, if yes, close app*****/
       
   196         RFs& fs(CEikonEnv::Static()->FsSession());
       
   197         if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0,
       
   198                 VRUtils::MemoDriveL()))
       
   199             {
       
   200             HBufC* errorText = StringLoader::LoadLC(
       
   201                     R_VR_MEMORY_LOW_STOP_WARNING);
       
   202             CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue);
       
   203             dlg->ExecuteLD(*errorText);
       
   204             CleanupStack::PopAndDestroy(errorText);
       
   205             Exit();
       
   206             }
       
   207         // check memory size end
   165 #endif
   208 #endif
       
   209 
   166 		}
   210 		}
   167 
   211 
   168     CVRRecView* view = CVRRecView::NewLC(R_VR_RECORDER_VIEW,
   212     CVRRecView* view = CVRRecView::NewLC(R_VR_RECORDER_VIEW,
   169             R_VR_RECVIEW_STATES);
   213             R_VR_RECVIEW_STATES);
   170 
   214 
   180         ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid(
   224         ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid(
   181                 EContextRecordNewForRemote), KNullDesC8);
   225                 EContextRecordNewForRemote), KNullDesC8);
   182         }
   226         }
   183 
   227 
   184 	}
   228 	}
       
   229 
       
   230 // ---------------------------------------------------------------------------
       
   231 // Make user insert the SD card, and choose SD card as the memo storage
       
   232 // ---------------------------------------------------------------------------
       
   233 //
       
   234 void CVRAppUi::SetDriveL()
       
   235     {
       
   236     TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL();
       
   237     if ( VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) )
       
   238     	{
       
   239     	VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage );
       
   240     	}
       
   241     else
       
   242         {
       
   243         if (CVRUSBStateHanlder::IsUsbActive())
       
   244             {
       
   245             ShowDialogForWaitUSBPluggingOutL();
       
   246             Exit();
       
   247 
       
   248             }
       
   249         while ( !VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) )
       
   250             {
       
   251             if (!ShowDialogForWaitStorageCardL())
       
   252                 {
       
   253                 Exit();
       
   254                 }
       
   255             }
       
   256         // Come to here when driveRemovableMassStorage is valid
       
   257         VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage );
       
   258         }
       
   259     }
       
   260 
       
   261 // ---------------------------------------------------------------------------
       
   262 // This method show a dialog to warn user to insert the SD card.
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 TBool CVRAppUi::ShowDialogForWaitStorageCardL()
       
   266     {
       
   267     HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC );
       
   268     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   269     TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) );
       
   270     CleanupStack::PopAndDestroy( text );
       
   271 
       
   272     if ( result )
       
   273     	{
       
   274     	return ETrue;
       
   275     	}
       
   276 
       
   277     return EFalse;
       
   278     }
       
   279 
       
   280 
       
   281 TBool CVRAppUi::ShowDialogForWaitUSBPluggingOutL()
       
   282 {
       
   283     HBufC* text = StringLoader::LoadLC(R_QTN_USB_MODE_NOTE_MODE);
       
   284     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   285     TInt result(dlg->ExecuteLD(R_INSERT_F_USB_PLUG_IN_DIALOG, *text));
       
   286     CleanupStack::PopAndDestroy(text);
       
   287     if (result)
       
   288         {
       
   289         return ETrue;
       
   290         }
       
   291     return EFalse;    
       
   292 }
   185 
   293 
   186 // ---------------------------------------------------------------------------
   294 // ---------------------------------------------------------------------------
   187 // CVRAppUi::HandleCommandL
   295 // CVRAppUi::HandleCommandL
   188 // 
   296 // 
   189 // ---------------------------------------------------------------------------
   297 // ---------------------------------------------------------------------------