usbuis/usbuinotif/src/usbuinotifotgerror.cpp
changeset 8 7e15987c4500
parent 3 47c263f7e521
child 20 a15c582fbf97
child 25 8c311f9acc5e
equal deleted inserted replaced
3:47c263f7e521 8:7e15987c4500
    21 #include <bautils.h>         // BAFL utils (for language file)
    21 #include <bautils.h>         // BAFL utils (for language file)
    22 #include <utf.h>             // Unicode character conversion utilities
    22 #include <utf.h>             // Unicode character conversion utilities
    23 #include <StringLoader.h>    // Localisation stringloader
    23 #include <StringLoader.h>    // Localisation stringloader
    24 #include <AknQueryDialog.h> 
    24 #include <AknQueryDialog.h> 
    25 #include <aknnotewrappers.h>
    25 #include <aknnotewrappers.h>
       
    26 #include <featmgr.h>
    26 
    27 
    27 #include <usbuinotif.h>                     // pck
    28 #include <usbuinotif.h>                     // pck
    28 #include <usbuinotif.rsg>                   // Own resources
    29 #include <usbuinotif.rsg>                   // Own resources
    29 #include "usbuinotifotgerror.h"             // Own class definition
    30 #include "usbuinotifotgerror.h"             // Own class definition
    30 #include "usbuinotifdebug.h"                // Debugging macros
    31 #include "usbuinotifdebug.h"                // Debugging macros
    64     {
    65     {
    65     //Make sure that the request is completed. Note that inside the destructor,
    66     //Make sure that the request is completed. Note that inside the destructor,
    66     //this virtual function call is to local CUsbUiNotifOtgError::Cancel, 
    67     //this virtual function call is to local CUsbUiNotifOtgError::Cancel, 
    67     //not to any possibly derived class implementation. 
    68     //not to any possibly derived class implementation. 
    68     Cancel();
    69     Cancel();
       
    70     delete iDialerWatcher;    
       
    71     delete iQuery;    
    69     }
    72     }
    70 
    73 
    71 void CUsbUiNotifOtgError::ConstructL()
    74 void CUsbUiNotifOtgError::ConstructL()
    72     {
    75     {
    73     CUSBUINotifierBase::ConstructL();
    76     CUSBUINotifierBase::ConstructL();
   131 //
   134 //
   132 void CUsbUiNotifOtgError::RunL()
   135 void CUsbUiNotifOtgError::RunL()
   133     {
   136     {
   134     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL"));
   137     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL"));
   135     TInt returnValue = KErrNone;
   138     TInt returnValue = KErrNone;
   136 
   139     FeatureManager::InitializeLibL();
       
   140     if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) )
       
   141         {    
       
   142         if (!iDialerWatcher)
       
   143             {
       
   144             iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this);
       
   145             }
       
   146         }        
       
   147     FeatureManager::UnInitializeLib(); 
       
   148     iDismissed=EFalse;
   137     DisableKeylock();
   149     DisableKeylock();
   138     SuppressAppSwitching( ETrue );
   150     SuppressAppSwitching( ETrue );
   139 
   151 
   140     //Excute dialog and check return value
   152     //Excute dialog and check return value
   141     returnValue = QueryUserResponseL();
   153     returnValue = QueryUserResponseL();
   142 
   154     if (!iDismissed)
   143     SuppressAppSwitching( EFalse );
   155         {
   144     RestoreKeylock();
   156         SuppressAppSwitching( EFalse );
   145     CompleteMessage( returnValue );
   157         RestoreKeylock();
       
   158         delete iDialerWatcher;
       
   159         iDialerWatcher = NULL;
       
   160         CompleteMessage( returnValue );
       
   161         }
   146 
   162 
   147     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed"));
   163     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed"));
   148     }
   164     }
   149 
   165 
   150 // ----------------------------------------------------------------------------
   166 // ----------------------------------------------------------------------------
   152 // Release all own resources (member variables)
   168 // Release all own resources (member variables)
   153 // ----------------------------------------------------------------------------
   169 // ----------------------------------------------------------------------------
   154 //
   170 //
   155 void CUsbUiNotifOtgError::Cancel()
   171 void CUsbUiNotifOtgError::Cancel()
   156     {
   172     {
   157     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel"));
   173     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel"));    
       
   174     
       
   175     // If dialog is not dismissed this is normal cancel and if query
       
   176     // doesn't exsist notifier is canceled during dismission
       
   177     if (!iDismissed || !iQuery )
       
   178         {        
       
   179         delete iDialerWatcher;
       
   180         iDialerWatcher = NULL;
       
   181         CompleteMessage( KErrCancel );
       
   182         }        
   158     if (iQuery)
   183     if (iQuery)
   159         {
   184         {
   160         delete iQuery;
   185         delete iQuery;
   161         iQuery = NULL;
   186         iQuery = NULL;
   162         }
   187         }
   163     CompleteMessage( KErrCancel );
       
   164 
       
   165     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
   188     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
       
   189     }
       
   190 
       
   191 // ----------------------------------------------------------------------------
       
   192 // CUsbUiNotifOtgError::DialerActivated
       
   193 // Release all own resources (member variables)
       
   194 // ----------------------------------------------------------------------------
       
   195 //
       
   196 void CUsbUiNotifOtgError::DialerActivated()
       
   197     {
       
   198     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()"));
       
   199     if ( iQuery )
       
   200         {
       
   201         iDismissed=ETrue;    
       
   202         Cancel();
       
   203         }    
       
   204     }
       
   205 
       
   206 // ----------------------------------------------------------------------------
       
   207 // CUsbUiNotifOtgError::ReActivateDialog
       
   208 // Release all own resources (member variables)
       
   209 // ----------------------------------------------------------------------------
       
   210 //   
       
   211 void CUsbUiNotifOtgError::ReActivateDialog()
       
   212     {    
       
   213     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()"));
       
   214     if ( !IsActive())
       
   215         {
       
   216         SetActive();
       
   217         iStatus = KRequestPending;
       
   218         TRequestStatus* stat = &iStatus;
       
   219         User::RequestComplete( stat, KErrNone );
       
   220         }
   166     }
   221     }
   167 
   222 
   168 // ----------------------------------------------------------------------------
   223 // ----------------------------------------------------------------------------
   169 // CUsbUiNotifOtgError::QueryUserResponseL
   224 // CUsbUiNotifOtgError::QueryUserResponseL
   170 // Show query dialog. 
   225 // Show query dialog. 
   173 TInt CUsbUiNotifOtgError::QueryUserResponseL()
   228 TInt CUsbUiNotifOtgError::QueryUserResponseL()
   174     {
   229     {
   175     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL"));
   230     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL"));
   176     TInt returnValue = KErrNone;
   231     TInt returnValue = KErrNone;
   177     TInt resourceId = R_USB_QUERY_OTG_ERROR;
   232     TInt resourceId = R_USB_QUERY_OTG_ERROR;
   178 
   233     if (iDismissed)
   179     iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
   234         {
   180 
   235         iQuery = CAknQueryDialog::NewL();
       
   236         }
       
   237     else
       
   238         {
       
   239         iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
       
   240         }
       
   241     
       
   242     
       
   243     iDismissed=EFalse;
   181     if (iCoverDisplaySupported)
   244     if (iCoverDisplaySupported)
   182         {
   245         {
   183         iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError );
   246         iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError );
   184         }
   247         }
   185     HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] );
   248     HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] );