153 // |
148 // |
154 void CVRRecView::CVRRecViewModelActivator::DoCancel() |
149 void CVRRecView::CVRRecViewModelActivator::DoCancel() |
155 { |
150 { |
156 } |
151 } |
157 |
152 |
158 // --------------------------------------------------------------------------- |
|
159 // CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator |
|
160 // |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator( CVRRecViewModel* aModel) |
|
164 :CAsyncOneShot(EPriorityNormal), iModel(aModel) |
|
165 { |
|
166 |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator |
|
171 // |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator() |
|
175 { |
|
176 Cancel(); |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator |
|
181 // |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 void CVRRecView::CVRRecViewDialogActivator::SetDialogType(TDialogTypeID aType) |
|
185 { |
|
186 iType = aType; |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CVRRecView::CVRRecViewDialogActivator::SetViewContexts |
|
191 // |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CVRRecView::CVRRecViewDialogActivator::SetViewContexts(TVRRecViewContexts aContext) |
|
195 { |
|
196 iContext = aContext; |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CVRRecView::CVRRecViewDialogActivator::DoCancel |
|
201 // |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 void CVRRecView::CVRRecViewDialogActivator::DoCancel() |
|
205 { |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // CVRRecView::CVRRecViewNoteActivator::RunL |
|
210 // |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 void CVRRecView::CVRRecViewDialogActivator::RunL() |
|
214 { |
|
215 if(iType == EDialogForWaitStorageCard) |
|
216 { |
|
217 TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); |
|
218 while ( !VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) |
|
219 { |
|
220 if (!ShowDialogForWaitStorageCardL()) |
|
221 { |
|
222 iModel->SendExitEvent(); |
|
223 } |
|
224 } |
|
225 // Come to here when driveRemovableMassStorage is valid |
|
226 VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); |
|
227 |
|
228 /***** check if memory is below min value, if yes, close app*****/ |
|
229 RFs& fs(CEikonEnv::Static()->FsSession()); |
|
230 if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) |
|
231 { |
|
232 HBufC* errorText = StringLoader::LoadLC( |
|
233 R_VR_MEMORY_LOW_STOP_WARNING); |
|
234 CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); |
|
235 dlg->ExecuteLD(*errorText); |
|
236 CleanupStack::PopAndDestroy(errorText); |
|
237 iModel->SendExitEvent(); |
|
238 } |
|
239 // check memory size end |
|
240 |
|
241 // To activate view model |
|
242 iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); |
|
243 iModel->SetIsDriveReady(ETrue); |
|
244 iModel->EnterContextL( iContext ); |
|
245 iModel->ActivateL(); |
|
246 } |
|
247 else if(iType == EDialogForWaitUSBPluggingOut) |
|
248 { |
|
249 ShowDialogForWaitUSBPluggingOutL(); |
|
250 iModel->SendExitEvent(); |
|
251 } |
|
252 } |
|
253 |
153 |
254 // --------------------------------------------------------------------------- |
154 // --------------------------------------------------------------------------- |
255 // CVRRecView::NewLC |
155 // CVRRecView::NewLC |
256 // |
156 // |
257 // --------------------------------------------------------------------------- |
157 // --------------------------------------------------------------------------- |
825 iActivationContainer->ConstructL( ClientRect() ); |
724 iActivationContainer->ConstructL( ClientRect() ); |
826 CAknViewAppUi* appUi = AppUi(); |
725 CAknViewAppUi* appUi = AppUi(); |
827 appUi->AddToViewStackL( *this, iActivationContainer ); |
726 appUi->AddToViewStackL( *this, iActivationContainer ); |
828 iActivationContainer->ActivateL(); |
727 iActivationContainer->ActivateL(); |
829 |
728 |
830 iDialogActivator = new( ELeave ) CVRRecViewDialogActivator(iModel); |
|
831 CheckDriveState(); |
|
832 |
|
833 // Activate model in correct context asynchronically. |
729 // Activate model in correct context asynchronically. |
834 // iContainer will be activated trough callback after model activation |
730 // iContainer will be activated trough callback after model activation |
835 TCallBack cb(ActivationCallBack, this); |
731 TCallBack cb(ActivationCallBack, this); |
836 iContext = static_cast<TVRRecViewContexts> (aCustomMessageId.iUid); |
732 iModelActivator->Activate( |
837 iDialogActivator->SetViewContexts(iContext); |
733 static_cast<TVRRecViewContexts> (aCustomMessageId.iUid), cb); |
838 iModelActivator->Activate(iContext , cb); |
|
839 |
734 |
840 // Construct the real container |
735 // Construct the real container |
841 iContainer = new (ELeave) CVRRecViewContainer; |
736 iContainer = new (ELeave) CVRRecViewContainer; |
842 iContainer->ConstructL(ClientRect(), iModel, iModel, iModel, this); |
737 iContainer->ConstructL(ClientRect(), iModel, iModel, iModel, this); |
843 iContainer->SetKeyObserver(iModel); |
738 iContainer->SetKeyObserver(iModel); |
844 iContainer->SetVolumeChangeObserver(iModel); |
739 iContainer->SetVolumeChangeObserver(iModel); |
845 } |
740 } |
846 |
741 |
847 // --------------------------------------------------------------------------- |
|
848 // CVRRecView::CheckDriveState |
|
849 // |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CVRRecView::CheckDriveState() |
|
853 { |
|
854 TInt memoDrive = VRUtils::MemoDriveL(); |
|
855 if (VRUtils::DriveValid(memoDrive)) |
|
856 { |
|
857 VRUtils::SetMemoDriveL((TDriveNumber) memoDrive); |
|
858 } |
|
859 else |
|
860 { |
|
861 TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC |
|
862 if (defaultDrive == memoDrive) |
|
863 { |
|
864 SetDriveL(); |
|
865 } |
|
866 else |
|
867 { |
|
868 if (VRUtils::DriveValid(defaultDrive)) |
|
869 { |
|
870 VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive); |
|
871 } |
|
872 else |
|
873 { |
|
874 SetDriveL(); |
|
875 } |
|
876 } |
|
877 } |
|
878 |
|
879 |
|
880 if (iModel->GetIsDriveReady() && CVRUSBStateHanlder::IsUsbActive()) |
|
881 { |
|
882 iModel->SetIsDriveReady(EFalse); |
|
883 iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); |
|
884 iDialogActivator->Call(); |
|
885 } |
|
886 |
|
887 |
|
888 if(iModel->GetIsDriveReady()) |
|
889 { |
|
890 /***** check if memory is below min value, if yes, close app*****/ |
|
891 RFs& fs(CEikonEnv::Static()->FsSession()); |
|
892 if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) |
|
893 { |
|
894 HBufC* errorText = StringLoader::LoadLC( |
|
895 R_VR_MEMORY_LOW_STOP_WARNING); |
|
896 CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); |
|
897 dlg->ExecuteLD(*errorText); |
|
898 CleanupStack::PopAndDestroy(errorText); |
|
899 iModel->SendExitEvent(); |
|
900 } |
|
901 // check memory size end |
|
902 } |
|
903 } |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // Make user insert the SD card, and choose SD card as the memo storage |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 void CVRRecView::SetDriveL() |
|
910 { |
|
911 TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); |
|
912 if ( VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) |
|
913 { |
|
914 VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); |
|
915 } |
|
916 else |
|
917 { |
|
918 iModel->SetIsDriveReady(EFalse); |
|
919 if (CVRUSBStateHanlder::IsUsbActive()) |
|
920 { |
|
921 iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); |
|
922 iDialogActivator->Call(); |
|
923 } |
|
924 else |
|
925 { |
|
926 iDialogActivator->SetDialogType(EDialogForWaitStorageCard); |
|
927 iDialogActivator->Call(); |
|
928 } |
|
929 } |
|
930 } |
|
931 |
|
932 // --------------------------------------------------------------------------- |
|
933 // This method show a dialog to warn user to insert the SD card. |
|
934 // --------------------------------------------------------------------------- |
|
935 // |
|
936 TBool CVRRecView::ShowDialogForWaitStorageCardL() |
|
937 { |
|
938 HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC ); |
|
939 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
940 TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) ); |
|
941 CleanupStack::PopAndDestroy( text ); |
|
942 |
|
943 if ( result ) |
|
944 { |
|
945 return ETrue; |
|
946 } |
|
947 return EFalse; |
|
948 } |
|
949 |
742 |
950 // --------------------------------------------------------------------------- |
743 // --------------------------------------------------------------------------- |
951 // CVRRecView::SetFileHandle |
744 // CVRRecView::SetFileHandle |
952 // |
745 // |
953 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |