usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp
changeset 25 8c311f9acc5e
parent 3 47c263f7e521
child 23 bb32eca979b3
child 52 831068540b07
child 63 ef2686f7597e
equal deleted inserted replaced
8:7e15987c4500 25:8c311f9acc5e
   161 void CUSBUIQueriesNotifier::RunL()
   161 void CUSBUIQueriesNotifier::RunL()
   162     {
   162     {
   163     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RunL"));
   163     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RunL"));
   164 
   164 
   165     TBool isCancelKey = EFalse;
   165     TBool isCancelKey = EFalse;
       
   166     TBool isErrorQuery = EFalse;
   166     TInt returnValue = KErrNone;
   167     TInt returnValue = KErrNone;
   167     // for cover display support
   168     // for cover display support
   168     TInt coverDialogId = EUSBCoverInvalidDialogId;
   169     TInt coverDialogId = EUSBCoverInvalidDialogId;
   169 
   170 
   170     // Choose text and other query attributes
   171     // Choose text and other query attributes
   171     //
   172     //
   172     HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey );
   173     HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey, isErrorQuery );
   173 
   174 
   174     //check if query text string loading was successful
   175     //check if query text string loading was successful
   175     if (NULL != stringHolder)
   176     if (NULL != stringHolder)
   176         {
   177         {
   177         DisableKeylock();
   178         DisableKeylock();
   178         SuppressAppSwitching( ETrue );
   179         SuppressAppSwitching( ETrue );
   179         returnValue = QueryUserResponseL( *stringHolder, coverDialogId,
   180         returnValue = QueryUserResponseL( *stringHolder, coverDialogId,
   180                 isCancelKey );
   181                 isCancelKey, isErrorQuery );
   181         SuppressAppSwitching( EFalse );
   182         SuppressAppSwitching( EFalse );
   182         RestoreKeylock();
   183         RestoreKeylock();
   183         CleanupStack::PopAndDestroy( stringHolder );
   184         CleanupStack::PopAndDestroy( stringHolder );
   184         }
   185         }
   185     else
   186     else
   217 // CUSBUIQueriesNotifier::QueryUserResponseL
   218 // CUSBUIQueriesNotifier::QueryUserResponseL
   218 // Show query dialog. 
   219 // Show query dialog. 
   219 // ----------------------------------------------------------------------------
   220 // ----------------------------------------------------------------------------
   220 //
   221 //
   221 TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder,
   222 TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder,
   222         TInt aCoverDialogId, TBool aIsCancelKey)
   223         TInt aCoverDialogId, TBool aIsCancelKey, TBool aIsErrorQuery)
   223     {
   224     {
   224     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL"));
   225     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL"));
   225     TInt returnValue = KErrNone;
   226     TInt returnValue = KErrNone;
   226 
   227 
   227     iUSBQueryDlg = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   228     iUSBQueryDlg = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   228 
   229 
   229     // Show dialog with or without the Cancel
   230     // Show dialog with or without the Cancel
   230     //
   231     //
   231     if (aIsCancelKey)
   232     if (aIsErrorQuery) 
       
   233         {
       
   234         // aIsErrorQuery flag is set in GetQueryAttributesLC()
       
   235         // there is no defined QueryDialogError in resources so QueryOTGerror is used (contains Stop icon)
       
   236         iUSBQueryDlg->PrepareLC( R_USB_QUERY_OTG_ERROR );
       
   237         }
       
   238     else if (aIsCancelKey)
   232         {
   239         {
   233         iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITH_CANCEL );
   240         iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITH_CANCEL );
   234         }
   241         }
   235     else
   242     else
   236         {
   243         {
   268 // CUSBUIQueriesNotifier::GetQueryAttributesLC
   275 // CUSBUIQueriesNotifier::GetQueryAttributesLC
   269 // Get query text and the other attributes for the query dialog. 
   276 // Get query text and the other attributes for the query dialog. 
   270 // ----------------------------------------------------------------------------
   277 // ----------------------------------------------------------------------------
   271 //
   278 //
   272 HBufC* CUSBUIQueriesNotifier::GetQueryAttributesLC(TInt& aCoverDialogId,
   279 HBufC* CUSBUIQueriesNotifier::GetQueryAttributesLC(TInt& aCoverDialogId,
   273         TBool& aIsCancelKey)
   280         TBool& aIsCancelKey, TBool& aIsErrorQuery)
   274     {
   281     {
   275     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC"));
   282     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC"));
   276     HBufC* stringHolder = NULL; // The text for the query
   283     HBufC* stringHolder = NULL; // The text for the query
   277     aIsCancelKey = EFalse;
   284     aIsCancelKey = EFalse;
       
   285     aIsErrorQuery = EFalse;
   278     switch (iQueryType)
   286     switch (iQueryType)
   279         {
   287         {
   280         case EUSBStorageMediaFailure:
   288         case EUSBStorageMediaFailure:
   281             {
   289             {
   282                 FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBStorageMediaFailure"));
   290                 FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBStorageMediaFailure"));
   297             {
   305             {
   298                 FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNoMemoryCard"));
   306                 FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNoMemoryCard"));
   299             stringHolder = StringLoader::LoadLC( R_USB_NO_MEMORY_CARD );
   307             stringHolder = StringLoader::LoadLC( R_USB_NO_MEMORY_CARD );
   300             aCoverDialogId = EUSBCoverNoMemoryCard;
   308             aCoverDialogId = EUSBCoverNoMemoryCard;
   301             break;
   309             break;
       
   310             } 
       
   311         case EUSBNotEnoughRam:
       
   312           	{
       
   313             FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNotEnoughRam"));
       
   314             stringHolder = StringLoader::LoadLC( R_USB_ERROR_MEMORY_NOT_ENOUGH );
       
   315             aCoverDialogId = EUSBCoverNoMemoryCard;
       
   316             //set flag to change the icon of querydialog (see QueryUserResponseL())
       
   317             aIsErrorQuery = ETrue;
       
   318             break;
   302             }
   319             }
   303         default:
   320         default:
   304             {
   321             {
   305                 FTRACE( FPrint(
   322                 FTRACE( FPrint(
   306                                 _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),
   323                                 _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),