uifw/AknGlobalUI/OldStyleNotif/Src/AknSoftNotificationPlugin.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   407 
   407 
   408 // C++ default constructor can NOT contain any code, that
   408 // C++ default constructor can NOT contain any code, that
   409 // might leave.
   409 // might leave.
   410 //
   410 //
   411 CAknSoftNotificationSubject::CAknSoftNotificationSubject(
   411 CAknSoftNotificationSubject::CAknSoftNotificationSubject(
   412     MAknKeyLockController* aKeyLockController,
   412     CAknGlobalNoteSubject* aGlobalNoteController )
   413     CAknGlobalNoteSubject* aGlobalNoteController)
   413     : iGlobalNoteController( aGlobalNoteController ), 
   414 :iKeyLockController(aKeyLockController), 
   414       iNotificationsSaved( ETrue ), // We'll have to assume there are saved notifications on startup
   415     iGlobalNoteController(aGlobalNoteController), 
   415       iUniqueIdCounter( KMinimumUniqueId )
   416     iNotificationsSaved(ETrue), // We'll have to assume there are saved notifications on startup
       
   417     iUniqueIdCounter(KMinimumUniqueId)
       
   418     {
   416     {
   419     iMessagingRepository = NULL;
   417     iMessagingRepository = NULL;
   420     iDynamicSoftNoteManager = CAknDynamicSoftNoteEventManager::UniqueInstance();
   418     iDynamicSoftNoteManager = CAknDynamicSoftNoteEventManager::UniqueInstance();
   421     __ASSERT_ALWAYS(iDynamicSoftNoteManager != NULL, User::Invariant());
   419     __ASSERT_ALWAYS(iDynamicSoftNoteManager != NULL, User::Invariant());
   422     }
   420     }
   423 
   421 
   424 // EPOC default constructor can leave.
   422 // EPOC default constructor can leave.
   425 void CAknSoftNotificationSubject::ConstructL()
   423 void CAknSoftNotificationSubject::ConstructL()
   426     {
   424     {
   427     iKeyLockController->AddObserverL(this);
       
   428 
       
   429     iSoftNoteEntryList = new(ELeave)CArrayFixFlat<TSoftNoteEntry>(KSoftNoteGranularity);
   425     iSoftNoteEntryList = new(ELeave)CArrayFixFlat<TSoftNoteEntry>(KSoftNoteGranularity);
   430     iGlobalNoteController->SetSoftNoteObserver(this);
   426     iGlobalNoteController->SetSoftNoteObserver(this);
   431     // Set initial state to 'non-idle'
   427     // Set initial state to 'non-idle'
   432     iGlobalNoteController->SetMaxDisplayPriorityL(KMinimumSoftNotePriority);
   428     iGlobalNoteController->SetMaxDisplayPriorityL(KMinimumSoftNotePriority);
   433 
   429 
   469         iCustomNoteParamsStack = params;
   465         iCustomNoteParamsStack = params;
   470         }
   466         }
   471 
   467 
   472     delete iIdle;
   468     delete iIdle;
   473     delete iCoverClient;
   469     delete iCoverClient;
   474     
       
   475     if(iKeyLockController)
       
   476         {
       
   477         iKeyLockController->RemoveObserver(this);
       
   478         }    
       
   479 
   470 
   480     if ( iMessagingRepository )
   471     if ( iMessagingRepository )
   481         {
   472         {
   482         delete iMessagingRepository;
   473         delete iMessagingRepository;
   483         iMessagingRepository = NULL;
   474         iMessagingRepository = NULL;
   484         }
   475         }
   485     }
   476     }
   486 
   477 
   487 // Two-phased constructor.
   478 // Two-phased constructor.
   488 CAknSoftNotificationSubject* CAknSoftNotificationSubject::NewL(
   479 CAknSoftNotificationSubject* CAknSoftNotificationSubject::NewL(
   489     MAknKeyLockController* aKeyLockController,
       
   490     CAknGlobalNoteSubject* aGlobalNoteController )
   480     CAknGlobalNoteSubject* aGlobalNoteController )
   491     {
   481     {
   492     CAknSoftNotificationSubject* self = new (ELeave) CAknSoftNotificationSubject(
   482     CAknSoftNotificationSubject* self = new (ELeave) CAknSoftNotificationSubject(
   493         aKeyLockController, 
   483         aGlobalNoteController );
   494         aGlobalNoteController);
       
   495         
   484         
   496     CleanupStack::PushL( self );
   485     CleanupStack::PushL( self );
   497     self->ConstructL();
   486     self->ConstructL();
   498     CleanupStack::Pop( self);
   487     CleanupStack::Pop( self );
   499     return self;
   488     return self;
   500     }
   489     }
   501 
   490   
   502 // ---------------------------------------------------------
       
   503 // CAknSoftNotificationSubject::KeyLockStatusChange
       
   504 // ---------------------------------------------------------
       
   505 //
       
   506 void CAknSoftNotificationSubject::KeyLockStatusChange(TKeyLockStatus aStatus)
       
   507     {
       
   508     if ( aStatus == EKeyLockEnabled )
       
   509         {
       
   510         iKeysLocked = ETrue;
       
   511         }
       
   512     else if ( aStatus == EKeyLockDisabled )
       
   513         {
       
   514         iKeysLocked = EFalse;
       
   515         }
       
   516         
       
   517     if ( iGroupedNote && iGroupedNote->ListBox())
       
   518         {
       
   519         if ( aStatus == EKeyLockEnabled )
       
   520             {
       
   521             iGroupedNote->ListBox()->View()->ItemDrawer()->SetFlags(
       
   522                 CListItemDrawer::EDisableHighlight);
       
   523                 
       
   524             iGroupedNote->DrawDeferred();
       
   525             }
       
   526         else if ( aStatus == EKeyLockDisabled )
       
   527             {
       
   528             iGroupedNote->ListBox()->View()->ItemDrawer()->ClearFlags(
       
   529                 CListItemDrawer::EDisableHighlight);
       
   530                 
       
   531             iGroupedNote->DrawDeferred();
       
   532             }
       
   533         }
       
   534     }    
       
   535 
   491 
   536 // ---------------------------------------------------------
   492 // ---------------------------------------------------------
   537 // CAknSoftNotificationSubject::Release()
   493 // CAknSoftNotificationSubject::Release()
   538 //
   494 //
   539 // (other items were commented in a header).
   495 // (other items were commented in a header).
  1649 
  1605 
  1650     note->ExecuteLD( R_GROUPED_SOFT_NOTIFICATION );
  1606     note->ExecuteLD( R_GROUPED_SOFT_NOTIFICATION );
  1651 
  1607 
  1652     delete iGroupedNote;
  1608     delete iGroupedNote;
  1653     iGroupedNote = note;
  1609     iGroupedNote = note;
  1654     if ( iKeysLocked && note )
       
  1655         {
       
  1656         iGroupedNote->ListBox()->View()->ItemDrawer()->SetFlags(
       
  1657             CListItemDrawer::EDisableHighlight );
       
  1658         }
       
  1659     }
  1610     }
  1660 
  1611 
  1661 // ---------------------------------------------------------
  1612 // ---------------------------------------------------------
  1662 // CAknSoftNotificationSubject::MessageNotifierShown()
  1613 // CAknSoftNotificationSubject::MessageNotifierShown()
  1663 // ---------------------------------------------------------
  1614 // ---------------------------------------------------------
  2321         }
  2272         }
  2322     return EFalse;
  2273     return EFalse;
  2323     }
  2274     }
  2324 
  2275 
  2325 
  2276 
  2326 TBool CAknSoftNotificationSubject::AutoLockEnabled()
       
  2327     {
       
  2328     return EFalse;
       
  2329     }
       
  2330 
       
  2331 void CAknSoftNotificationSubject::AddNewCustomNoteL(
  2277 void CAknSoftNotificationSubject::AddNewCustomNoteL(
  2332     RReadStream& readStream, TInt aCount, TBool aNewNote )
  2278     RReadStream& readStream, TInt aCount, TBool aNewNote )
  2333     {
  2279     {
  2334     AddNewCustomNoteL((RDesReadStream&)readStream, aCount, aNewNote );
  2280     AddNewCustomNoteL((RDesReadStream&)readStream, aCount, aNewNote );
  2335     }
  2281     }