commondrm/drmutility/src/DrmUiHandlingImpl.cpp
changeset 84 b09186059647
parent 49 69d8e75812b7
equal deleted inserted replaced
82:a117e284a2c6 84:b09186059647
   422 //
   422 //
   423 DRM::CDrmUiHandlingImpl::~CDrmUiHandlingImpl()
   423 DRM::CDrmUiHandlingImpl::~CDrmUiHandlingImpl()
   424     {
   424     {
   425     DRM::CDrmUiHandlingData* data( PopFront() );
   425     DRM::CDrmUiHandlingData* data( PopFront() );
   426 
   426 
       
   427     // reset the current observer
       
   428     // it may already be deleted so don't do any calls to it.
       
   429     iObserver = NULL;
       
   430 
   427     // Empty the queue:
   431     // Empty the queue:
   428     while ( data )
   432     while ( data )
   429         {
   433         {
   430         // Complete the outstanding requestest with cancel
   434         // Complete the outstanding requestest with cancel
   431         data->iObserver->OperationCompleted( data->iOperationId, KErrCancel );
   435         data->iObserver->OperationCompleted( data->iOperationId, KErrCancel );
  1157         default:
  1161         default:
  1158 
  1162 
  1159             break;
  1163             break;
  1160         }
  1164         }
  1161 
  1165 
  1162     // Complete the client request
  1166     // if the observer exists and it has not been deleted, call complete
  1163     iObserver->OperationCompleted( iOperationId, KErrNone );
  1167     // for the operation and get ready for another round
  1164 
  1168     // this should prevent crashes in case the class is deleted before
       
  1169     // and operation finihes.
       
  1170     
       
  1171     if( iObserver && reinterpret_cast<TInt>(iObserver) != 0xDEDEDEDE )
       
  1172         {
       
  1173         // Complete the client request
       
  1174         iObserver->OperationCompleted( iOperationId, KErrNone );
       
  1175 
       
  1176         // Get ready for another round:
       
  1177         SetActive();
       
  1178 
       
  1179         // complete internal request:
       
  1180         User::RequestComplete( status, KErrNone );
       
  1181         }
       
  1182         
  1165     // destroy the object:
  1183     // destroy the object:
  1166     CleanupStack::PopAndDestroy( data );
  1184     CleanupStack::PopAndDestroy( data );
  1167 
  1185 
  1168     // Get ready for another round:
       
  1169     SetActive();
       
  1170 
       
  1171     // complete internal request:
       
  1172     User::RequestComplete( status, KErrNone );
       
  1173     }
  1186     }
  1174 
  1187 
  1175 // -----------------------------------------------------------------------------
  1188 // -----------------------------------------------------------------------------
  1176 // CDrmUiHandlingImpl::RunError()
  1189 // CDrmUiHandlingImpl::RunError()
  1177 // -----------------------------------------------------------------------------
  1190 // -----------------------------------------------------------------------------
  1834 
  1847 
  1835     // Show that only reason for error was rejected metering.
  1848     // Show that only reason for error was rejected metering.
  1836     TBool onlyMeteringRejection( reason == DRM::EURejectionMetering );
  1849     TBool onlyMeteringRejection( reason == DRM::EURejectionMetering );
  1837     if ( onlyMeteringRejection )
  1850     if ( onlyMeteringRejection )
  1838         {
  1851         {
  1839         // Qt dialog not implemented yet
       
  1840         iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen );
  1852         iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen );
  1841 
  1853 
  1842         CleanupStack::PopAndDestroy( contentId );
  1854         CleanupStack::PopAndDestroy( contentId );
  1843         return;
  1855         return;
  1844         }
  1856         }
  2883     ptr.Set( domainId->Des() );
  2895     ptr.Set( domainId->Des() );
  2884     error = stringAttributeSet.GetValue( EDomainId, ptr );
  2896     error = stringAttributeSet.GetValue( EDomainId, ptr );
  2885     if ( !error )
  2897     if ( !error )
  2886         {
  2898         {
  2887         ptr.Set( riId->Des() );
  2899         ptr.Set( riId->Des() );
  2888         stringAttributeSet.GetValue( EDomainRightsIssuerId, ptr );
  2900         error = stringAttributeSet.GetValue( EDomainRightsIssuerId, ptr );
  2889         if ( !error )
  2901         if ( !error )
  2890             {
  2902             {
  2891             riId8 = HBufC8::NewLC( riId->Length() );
  2903             riId8 = HBufC8::NewLC( riId->Length() );
  2892             riId8->Des().Copy( riId->Des() );
  2904             riId8->Des().Copy( riId->Des() );
  2893             domainId8 = HBufC8::NewLC( domainId->Length() );
  2905             domainId8 = HBufC8::NewLC( domainId->Length() );
  2966         case DRM::EUHCheckRightsActionDefault:
  2978         case DRM::EUHCheckRightsActionDefault:
  2967             {
  2979             {
  2968             if ( RejectReason( aReason ) == DRM::EURejectionMetering )
  2980             if ( RejectReason( aReason ) == DRM::EURejectionMetering )
  2969                 {
  2981                 {
  2970                 // Show that only reason for error was rejected metering.
  2982                 // Show that only reason for error was rejected metering.
  2971                 // Qt dialog not implemented yet
       
  2972                 iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen );
  2983                 iDrmUtilityUi->DisplayNoteL( EConfUnableToOpen );
  2973                 }
  2984                 }
  2974             else
  2985             else
  2975                 {
  2986                 {
  2976                 if ( !GetSilentAndCallL( aObserver, aOperationId, aIntent,
  2987                 if ( !GetSilentAndCallL( aObserver, aOperationId, aIntent,
  3519                 ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue );
  3530                 ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue );
  3520                 }
  3531                 }
  3521             else
  3532             else
  3522                 {
  3533                 {
  3523                 // no rights issuer
  3534                 // no rights issuer
  3524                 // Qt dialog not implemented yet
       
  3525                 iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived );
  3535                 iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived );
  3526                 }
  3536                 }
  3527             }
  3537             }
  3528         else if ( !eta || err || eta == -1 )
  3538         else if ( !eta || err || eta == -1 )
  3529             {
  3539             {
  3548                     {
  3558                     {
  3549                     // get filename
  3559                     // get filename
  3550                     User::LeaveIfError( aContent.GetStringAttribute(
  3560                     User::LeaveIfError( aContent.GetStringAttribute(
  3551                         EFileName, fileName ) );
  3561                         EFileName, fileName ) );
  3552 
  3562 
  3553                     // Qt dialog not implemented yet
       
  3554                     ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName );
  3563                     ret = iDrmUtilityUi->DisplayQueryL( EQueryFileWithNoRightsObj, fileName );
  3555                     }
  3564                     }
  3556                 }
  3565                 }
  3557             else // no rights issuer
  3566             else // no rights issuer
  3558                 {
  3567                 {
  3559                 if ( aReason & EConstraintIndividual )
  3568                 if ( aReason & EConstraintIndividual )
  3560                     {
  3569                     {
  3561                     // Qt dialog not implemented yet
       
  3562                     iDrmUtilityUi->DisplayNoteL( EConfFileLockedForSim );
  3570                     iDrmUtilityUi->DisplayNoteL( EConfFileLockedForSim );
  3563                     }
  3571                     }
  3564                 else
  3572                 else
  3565                     {
  3573                     {
  3566                     iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired );
  3574                     iDrmUtilityUi->DisplayNoteL( EConfLicenceExpired );
  3582                     {
  3590                     {
  3583                     ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue );
  3591                     ret = iDrmUtilityUi->DisplayQueryL( EQueryGetNewLicence, KNoValue );
  3584                     }
  3592                     }
  3585                 else
  3593                 else
  3586                     {
  3594                     {
  3587                     // no rights issuer
  3595                     // no rights issuer 
  3588                     // Qt dialog not implemented yet
       
  3589                     iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived );
  3596                     iDrmUtilityUi->DisplayNoteL( EConfLicenceNotReceived );
  3590                     }
  3597                     }
  3591                 }
  3598                 }
  3592             }
  3599             }
  3593         }
  3600         }
  3798     ptr.Set( domainId->Des() );
  3805     ptr.Set( domainId->Des() );
  3799     error = stringAttributeSet.GetValue( EDomainId, ptr );
  3806     error = stringAttributeSet.GetValue( EDomainId, ptr );
  3800     if ( !error )
  3807     if ( !error )
  3801         {
  3808         {
  3802         ptr.Set( riId->Des() );
  3809         ptr.Set( riId->Des() );
  3803         stringAttributeSet.GetValue( EDomainRightsIssuerId, ptr );
  3810         error = stringAttributeSet.GetValue( EDomainRightsIssuerId, ptr );
  3804         if ( !error )
  3811         if ( !error )
  3805             {
  3812             {
  3806             riId8 = HBufC8::NewLC( riId->Length() );
  3813             riId8 = HBufC8::NewLC( riId->Length() );
  3807             riId8->Des().Copy( riId->Des() );
  3814             riId8->Des().Copy( riId->Des() );
  3808             domainId8 = HBufC8::NewLC( domainId->Length() );
  3815             domainId8 = HBufC8::NewLC( domainId->Length() );
  4099     if ( !SilentRightsAllowedL() )
  4106     if ( !SilentRightsAllowedL() )
  4100         {
  4107         {
  4101         buttonCode = ECancelled;
  4108         buttonCode = ECancelled;
  4102         if ( aShowNotes )
  4109         if ( aShowNotes )
  4103             {
  4110             {
  4104             // Qt dialog not implemented yet
       
  4105             buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue );
  4111             buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue );
  4106             }
  4112             }
  4107         }
  4113         }
  4108     else if ( !(HasDefConn()) )
  4114     else if ( !(HasDefConn()) )
  4109         {
  4115         {
  4110         buttonCode = ECancelled;
  4116         buttonCode = ECancelled;
  4111         if ( aShowNotes )
  4117         if ( aShowNotes )
  4112             {
  4118             {
  4113             // Qt dialog not implemented yet
       
  4114             buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue );
  4119             buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryConnectToActivate, KNoValue );
  4115             }
  4120             }
  4116         }
  4121         }
  4117 
  4122 
  4118     if ( buttonCode == EOk )
  4123     if ( buttonCode == EOk )
  4121         if ( !APs )
  4126         if ( !APs )
  4122             {
  4127             {
  4123             // No AP defined
  4128             // No AP defined
  4124             if ( aShowNotes )
  4129             if ( aShowNotes )
  4125                 {
  4130                 {
  4126                 // Qt dialog not implemented yet
       
  4127                 iDrmUtilityUi->DisplayNoteL( EConfNoAccessPoint );
  4131                 iDrmUtilityUi->DisplayNoteL( EConfNoAccessPoint );
  4128                 }
  4132                 }
  4129             r = KErrCANoRights;
  4133             r = KErrCANoRights;
  4130             }
  4134             }
  4131         else
  4135         else
  4156                     if ( r == KErrCouldNotConnect )
  4160                     if ( r == KErrCouldNotConnect )
  4157                         {
  4161                         {
  4158                         // Connection failed with selected AP
  4162                         // Connection failed with selected AP
  4159                         if ( aShowNotes )
  4163                         if ( aShowNotes )
  4160                             {
  4164                             {
  4161                             // Qt dialog not implemented yet
       
  4162                             iDrmUtilityUi->DisplayNoteL( EConfConnectionFailed );
  4165                             iDrmUtilityUi->DisplayNoteL( EConfConnectionFailed );
  4163                             }
  4166                             }
  4164                         r = KErrCANoRights;
  4167                         r = KErrCANoRights;
  4165                         }
  4168                         }
  4166                     else
  4169                     else
  4174                             // error url is got only if temporary roap error
  4177                             // error url is got only if temporary roap error
  4175 
  4178 
  4176                             if ( errorUrl )
  4179                             if ( errorUrl )
  4177                                 {
  4180                                 {
  4178                                 // ask user whether error url should be opened
  4181                                 // ask user whether error url should be opened
  4179                                 // Qt dialog not implemented yet
       
  4180                                 buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryOpenErrorUrl, KNoValue );
  4182                                 buttonCode = iDrmUtilityUi->DisplayQueryL( EQueryOpenErrorUrl, KNoValue );
  4181 
  4183 
  4182                                 if ( buttonCode == EOk )
  4184                                 if ( buttonCode == EOk )
  4183                                     {
  4185                                     {
  4184                                     // Launch browser
  4186                                     // Launch browser
  4185                                     LaunchBrowserL( errorUrl );
  4187                                     LaunchBrowserL( errorUrl );
  4186                                     }
  4188                                     }
  4187                                 }
  4189                                 }
  4188                             else
  4190                             else
  4189                                 {
  4191                                 {
  4190                                 // Qt dialog not implemented yet
       
  4191                                 iDrmUtilityUi->DisplayNoteL( EConfUnableToUnlock );
  4192                                 iDrmUtilityUi->DisplayNoteL( EConfUnableToUnlock );
  4192                                 }
  4193                                 }
  4193                             CleanupStack::PopAndDestroy( errorUrl );
  4194                             CleanupStack::PopAndDestroy( errorUrl );
  4194                             }
  4195                             }
  4195                         }
  4196                         }