usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp
changeset 4 7e15987c4500
parent 3 47c263f7e521
child 16 d895b6d953c9
equal deleted inserted replaced
3:47c263f7e521 4:7e15987c4500
    73 // CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier
    73 // CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier
    74 // C++ default constructor can NOT contain any code, that
    74 // C++ default constructor can NOT contain any code, that
    75 // might leave.
    75 // might leave.
    76 // ----------------------------------------------------------------------------
    76 // ----------------------------------------------------------------------------
    77 //
    77 //
    78 CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier()
    78 CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier(): 
       
    79     iNoteVisible(EFalse)
    79     {
    80     {
    80     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor"));
    81     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor"));
    81     }
    82     }
    82 
    83 
    83 // ----------------------------------------------------------------------------
    84 // ----------------------------------------------------------------------------
   143 // ----------------------------------------------------------------------------
   144 // ----------------------------------------------------------------------------
   144 //
   145 //
   145 void CUSBUICableConnectedNotifier::RunL()
   146 void CUSBUICableConnectedNotifier::RunL()
   146     {
   147     {
   147     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL"));
   148     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL"));
   148 
   149     iNoteVisible = ETrue;
   149     DisableKeylock();
   150     DisableKeylock();
   150     SuppressAppSwitching(ETrue);
   151     SuppressAppSwitching(ETrue);
   151     RunQueryL();
   152     RunQueryL();
   152     SuppressAppSwitching(EFalse);
   153     SuppressAppSwitching(EFalse);
   153     RestoreKeylock();
   154     RestoreKeylock();
   161 // ----------------------------------------------------------------------------
   162 // ----------------------------------------------------------------------------
   162 //
   163 //
   163 void CUSBUICableConnectedNotifier::Cancel()
   164 void CUSBUICableConnectedNotifier::Cancel()
   164     {
   165     {
   165     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() "));
   166     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() "));
   166 
   167     // Not allowed to cancel this one before note is closed.
       
   168     if ( iNoteVisible )
       
   169         {
       
   170         iNoteWaiter.Start();    
       
   171         }
       
   172         
   167     CompleteMessage(KErrCancel);
   173     CompleteMessage(KErrCancel);
   168     CUSBUINotifierBase::Cancel();
   174     CUSBUINotifierBase::Cancel();
   169 
   175 
   170     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed"));
   176     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed"));
   171     }
   177     }
   210    CleanupStack::PushL(description);
   216    CleanupStack::PushL(description);
   211   
   217   
   212    TFileName usbUiIconFilename( KFileDrive );
   218    TFileName usbUiIconFilename( KFileDrive );
   213    usbUiIconFilename += KDC_APP_BITMAP_DIR;
   219    usbUiIconFilename += KDC_APP_BITMAP_DIR;
   214    usbUiIconFilename += KUSBUIconFileName;
   220    usbUiIconFilename += KUSBUIconFileName;
       
   221    iNoteVisible = ETrue;
   215    CAknDiscreetPopup::ShowGlobalPopupL(*header,*description,  KAknsIIDQgnPropUsb, AknIconUtils::AvkonIconFileName(),
   222    CAknDiscreetPopup::ShowGlobalPopupL(*header,*description,  KAknsIIDQgnPropUsb, AknIconUtils::AvkonIconFileName(),
   216            EMbmAvkonQgn_prop_usb, EMbmAvkonQgn_prop_usb_mask,KAknDiscreetPopupDurationLong, EUSBUICmdDiscreetTapped,( MEikCommandObserver* ) this);
   223            EMbmAvkonQgn_prop_usb, EMbmAvkonQgn_prop_usb_mask,KAknDiscreetPopupDurationLong, EUSBUICmdDiscreetTapped,( MEikCommandObserver* ) this);    
   217  
   224    
   218     CompleteMessage(KErrCancel);
       
   219     CleanupStack::PopAndDestroy(description);
   225     CleanupStack::PopAndDestroy(description);
   220     CleanupStack::PopAndDestroy(header);
   226     CleanupStack::PopAndDestroy(header);
   221    
   227    
   222     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
   228     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
   223     }
   229     }
   250         case EUSBUICmdDiscreetTapped:
   256         case EUSBUICmdDiscreetTapped:
   251             {
   257             {
   252             TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUSBUIUid));
   258             TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUSBUIUid));
   253             CreateChosenViewL(KUSBExe(),uidtype);  
   259             CreateChosenViewL(KUSBExe(),uidtype);  
   254             }
   260             }
       
   261         case EAknDiscreetPopupCmdClose:                
       
   262             if ( iNoteWaiter.IsStarted() )
       
   263                 {
       
   264                 iNoteWaiter.AsyncStop();
       
   265                 }
       
   266             iNoteVisible = EFalse;    
       
   267             CompleteMessage( KErrCancel );                    
   255             break;
   268             break;
   256         default:
   269         default:
   257                   
   270                   
   258         break;
   271         break;
   259             }
   272             }