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