uifw/AvKon/src/AknNoteDialog.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 18 0aa5fbdfbc30
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    44 #include <avkondomainpskeys.h>
    44 #include <avkondomainpskeys.h>
    45 #include <aknglobalpopupprioritycontroller.h>
    45 #include <aknglobalpopupprioritycontroller.h>
    46 #endif
    46 #endif
    47 
    47 
    48 #include <AknTasHook.h> // for testability hooks
    48 #include <AknTasHook.h> // for testability hooks
       
    49 #include "akntrace.h"
    49 const TInt EEikDialogFlagSleeping   =0x20000;
    50 const TInt EEikDialogFlagSleeping   =0x20000;
    50 
    51 
    51 // -----------------------------------------------------------------------------
    52 // -----------------------------------------------------------------------------
    52 // Finds out if this control belongs to the window group that is in focus.
    53 // Finds out if this control belongs to the window group that is in focus.
    53 // This information can be used to skip effects when the window group is
    54 // This information can be used to skip effects when the window group is
   179 //////////////////////////////////////////////////////////////////////
   180 //////////////////////////////////////////////////////////////////////
   180 
   181 
   181 EXPORT_C CAknNoteDialog::CAknNoteDialog() : CEikDialog(),
   182 EXPORT_C CAknNoteDialog::CAknNoteDialog() : CEikDialog(),
   182     iTimeoutInMicroseconds(ENoTimeout), iTone(ENoTone)
   183     iTimeoutInMicroseconds(ENoTimeout), iTone(ENoTone)
   183     {
   184     {
       
   185     _AKNTRACE_FUNC_ENTER;
   184     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
   186     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
       
   187     _AKNTRACE_FUNC_EXIT;
   185     }
   188     }
   186 
   189 
   187 EXPORT_C CAknNoteDialog::CAknNoteDialog(const TTone& aTone, const TTimeout& aTimeout) :
   190 EXPORT_C CAknNoteDialog::CAknNoteDialog(const TTone& aTone, const TTimeout& aTimeout) :
   188     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iTone(aTone)
   191     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iTone(aTone)
   189     {
   192     {
       
   193     _AKNTRACE_FUNC_ENTER;
       
   194     _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout);
   190     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
   195     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
       
   196     _AKNTRACE_FUNC_EXIT;
   191     }
   197     }
   192 
   198 
   193 EXPORT_C CAknNoteDialog::CAknNoteDialog(CEikDialog** aSelfPtr,const TTone& aTone, const TTimeout& aTimeout) :
   199 EXPORT_C CAknNoteDialog::CAknNoteDialog(CEikDialog** aSelfPtr,const TTone& aTone, const TTimeout& aTimeout) :
   194     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iSelfPtr(aSelfPtr), iTone(aTone)
   200     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iSelfPtr(aSelfPtr), iTone(aTone)
   195      {
   201      {
       
   202      _AKNTRACE_FUNC_ENTER;
       
   203      _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout);
   196      AKNTASHOOK_ADD( this, "CAknNoteDialog" );
   204      AKNTASHOOK_ADD( this, "CAknNoteDialog" );
       
   205      _AKNTRACE_FUNC_EXIT;
   197      }
   206      }
   198 
   207 
   199 EXPORT_C CAknNoteDialog::~CAknNoteDialog()
   208 EXPORT_C CAknNoteDialog::~CAknNoteDialog()
   200     {
   209     {
       
   210     _AKNTRACE_FUNC_ENTER;
   201     AKNTASHOOK_REMOVE();
   211     AKNTASHOOK_REMOVE();
   202 // FIXME: Experimental heuristics for determining popup type
   212 // FIXME: Experimental heuristics for determining popup type
   203 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   213 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   204 
   214 
   205     if ( GfxTransEffect::IsRegistered( this ) )
   215     if ( GfxTransEffect::IsRegistered( this ) )
   223         iSelfPtr = NULL;
   233         iSelfPtr = NULL;
   224         }
   234         }
   225 
   235 
   226     delete iControlAttributes;
   236     delete iControlAttributes;
   227     delete iNoteExtension;
   237     delete iNoteExtension;
       
   238     _AKNTRACE_FUNC_EXIT;
   228     }
   239     }
   229 
   240 
   230 EXPORT_C void CAknNoteDialog::SetTimeout(const TTimeout& aTimeout)
   241 EXPORT_C void CAknNoteDialog::SetTimeout(const TTimeout& aTimeout)
   231     {
   242     {
   232     iTimeoutInMicroseconds = aTimeout;
   243     iTimeoutInMicroseconds = aTimeout;
   380     return EKeyWasConsumed;
   391     return EKeyWasConsumed;
   381     }
   392     }
   382 
   393 
   383 EXPORT_C void CAknNoteDialog::LayoutAndDraw()
   394 EXPORT_C void CAknNoteDialog::LayoutAndDraw()
   384     {
   395     {
       
   396     _AKNTRACE_FUNC_ENTER;
   385     if (IsActivated())
   397     if (IsActivated())
   386         {
   398         {
   387         TRect screenRect = iAvkonAppUi->ApplicationRect();
   399         TRect screenRect = iAvkonAppUi->ApplicationRect();
   388         SetSizeAndPosition(PreferredSize( screenRect.Size()/*TSize(AKN_LAYOUT_WINDOW_screen.iW,AKN_LAYOUT_WINDOW_screen.iH)*/));
   400         SetSizeAndPosition(PreferredSize( screenRect.Size()/*TSize(AKN_LAYOUT_WINDOW_screen.iW,AKN_LAYOUT_WINDOW_screen.iH)*/));
   389         DrawNow();
   401         DrawNow();
   395             {
   407             {
   396             RDebug::Print(_L("CAknNoteDialog allowing opt. draw, %d"), (TUint)this );            
   408             RDebug::Print(_L("CAknNoteDialog allowing opt. draw, %d"), (TUint)this );            
   397             attr->AllowOptimizedDrawing();
   409             attr->AllowOptimizedDrawing();
   398             }
   410             }
   399         }
   411         }
       
   412     _AKNTRACE_FUNC_EXIT;
   400     }
   413     }
   401 
   414 
   402 EXPORT_C TInt CAknNoteDialog::RunLD()
   415 EXPORT_C TInt CAknNoteDialog::RunLD()
   403     {
   416     {
       
   417     _AKNTRACE_FUNC_ENTER;
   404     PlayTone();
   418     PlayTone();
   405     ReportUserActivity();
   419     ReportUserActivity();
   406 
   420 
   407 // FIXME: Experimental heuristics for finding out popup context from image/animation
   421 // FIXME: Experimental heuristics for finding out popup context from image/animation
   408 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS    
   422 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS    
   412         {
   426         {
   413         GfxTransEffect::Register( this, TUid::Uid( uid ) );
   427         GfxTransEffect::Register( this, TUid::Uid( uid ) );
   414         CAknTransitionUtils::RemoveData( ( TInt )NoteControl() );
   428         CAknTransitionUtils::RemoveData( ( TInt )NoteControl() );
   415         }
   429         }
   416 #endif
   430 #endif
   417         
   431 
       
   432     _AKNTRACE_FUNC_EXIT;    
   418     return CEikDialog::RunLD();
   433     return CEikDialog::RunLD();
   419     }
   434     }
   420 
   435 
   421 EXPORT_C TInt CAknNoteDialog::StaticDeleteL(TAny *aThis)
   436 EXPORT_C TInt CAknNoteDialog::StaticDeleteL(TAny *aThis)
   422     {
   437     {
       
   438     _AKNTRACE_FUNC_ENTER;
   423     CAknNoteDialog* self = REINTERPRET_CAST(CAknNoteDialog*,aThis);
   439     CAknNoteDialog* self = REINTERPRET_CAST(CAknNoteDialog*,aThis);
   424         
   440         
   425 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS           
   441 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS           
   426     if ( self->IsVisible() && GfxTransEffect::IsRegistered( self ) &&
   442     if ( self->IsVisible() && GfxTransEffect::IsRegistered( self ) &&
   427         IsFocusedWindowGroup( self ) )
   443         IsFocusedWindowGroup( self ) )
   476             self->iTimer->Cancel();
   492             self->iTimer->Cancel();
   477         self->OkToExitL(KErrCancel);
   493         self->OkToExitL(KErrCancel);
   478         self->ExitSleepingDialog();
   494         self->ExitSleepingDialog();
   479         self->NoteControl()->Reset();
   495         self->NoteControl()->Reset();
   480         }
   496         }
       
   497     _AKNTRACE_FUNC_EXIT;
   481     return EFalse;
   498     return EFalse;
   482     }
   499     }
   483 
   500 
   484 
   501 
   485 EXPORT_C void CAknNoteDialog::SetSizeAndPosition( const TSize& aSize )
   502 EXPORT_C void CAknNoteDialog::SetSizeAndPosition( const TSize& aSize )
   486     {
   503     {
       
   504     _AKNTRACE_FUNC_ENTER;
   487     SetBorder( TGulBorder::ENone );
   505     SetBorder( TGulBorder::ENone );
   488     CAknNoteControl* note = NoteControl();
   506     CAknNoteControl* note = NoteControl();
   489     if (note)
   507     if (note)
   490         {
   508         {
   491         if (!ControlAttributes()->IsLayoutNeeded()) // if we have a note control, there must be attributes also
   509         if (!ControlAttributes()->IsLayoutNeeded()) // if we have a note control, there must be attributes also
   507             AknLayoutUtils::LayoutControl(this, mainPane, dialogLay);
   525             AknLayoutUtils::LayoutControl(this, mainPane, dialogLay);
   508             }
   526             }
   509    
   527    
   510         ControlAttributes()->SetLayoutDone();                
   528         ControlAttributes()->SetLayoutDone();                
   511         }
   529         }
       
   530     _AKNTRACE_FUNC_EXIT;
   512     }
   531     }
   513 
   532 
   514 EXPORT_C void CAknNoteDialog::PreLayoutDynInitL()
   533 EXPORT_C void CAknNoteDialog::PreLayoutDynInitL()
   515     {
   534     {
   516     TransferControlAttributes();
   535     TransferControlAttributes();
   659 #endif
   678 #endif
   660 
   679 
   661 
   680 
   662 EXPORT_C void CAknNoteDialog::HandleResourceChange(TInt aType)
   681 EXPORT_C void CAknNoteDialog::HandleResourceChange(TInt aType)
   663     {
   682     {
       
   683     _AKNTRACE_FUNC_ENTER;
   664     if(aType==KEikDynamicLayoutVariantSwitch)
   684     if(aType==KEikDynamicLayoutVariantSwitch)
   665         {
   685         {
   666         if (!IsVisible())
   686         if (!IsVisible())
   667         	{
   687         	{
   668         	// a invisible note dialog is assumed to be a sleeping dialog
   688         	// a invisible note dialog is assumed to be a sleeping dialog
   695             NoteControl()->Layout();
   715             NoteControl()->Layout();
   696             }
   716             }
   697         }
   717         }
   698 
   718 
   699     CEikDialog::HandleResourceChange(aType);
   719     CEikDialog::HandleResourceChange(aType);
       
   720     _AKNTRACE_FUNC_EXIT;
   700     }
   721     }
   701 
   722 
   702 /**
   723 /**
   703  * Deprecated methods
   724  * Deprecated methods
   704  */
   725  */
   829 //------------------------------------------------------------------------------
   850 //------------------------------------------------------------------------------
   830 //
   851 //
   831 
   852 
   832 EXPORT_C void CAknNoteDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   853 EXPORT_C void CAknNoteDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   833     {
   854     {
       
   855     _AKNTRACE_FUNC_ENTER;
   834     if ( AknLayoutUtils::PenEnabled() )
   856     if ( AknLayoutUtils::PenEnabled() )
   835         {
   857         {
   836         CCoeControl* ctrl = GrabbingComponent();
   858         CCoeControl* ctrl = GrabbingComponent();
   837         CCoeControl::HandlePointerEventL(aPointerEvent);
   859         CCoeControl::HandlePointerEventL(aPointerEvent);
   838         
   860         
   857                         }
   879                         }
   858                     }
   880                     }
   859                 }
   881                 }
   860             }
   882             }
   861         }
   883         }
       
   884     _AKNTRACE_FUNC_EXIT;
   862     }
   885     }
   863 
   886 
   864 
   887 
   865 EXPORT_C void* CAknNoteDialog::ExtensionInterface( TUid /*aInterface*/ ) 
   888 EXPORT_C void* CAknNoteDialog::ExtensionInterface( TUid /*aInterface*/ ) 
   866     { 
   889     {