calendarui/views/src/calennativeview.cpp
branchRCL_3
changeset 13 0f07cd1b5772
parent 5 42814f902fe6
child 27 55d60436f00b
equal deleted inserted replaced
12:38571fd2a704 13:0f07cd1b5772
    41 #include <calencommands.hrh>
    41 #include <calencommands.hrh>
    42 #include <calenservices.h>
    42 #include <calenservices.h>
    43 #include <calsession.h>
    43 #include <calsession.h>
    44 #include <calenviewutils.h>
    44 #include <calenviewutils.h>
    45 #include <calcalendarinfo.h>
    45 #include <calcalendarinfo.h>
       
    46 #include <caleninstanceid.h>            // TCalenInstanceId
       
    47 
    46 
    48 
    47 #include "calendarui_debug.h"           // Debug.
    49 #include "calendarui_debug.h"           // Debug.
    48 #include "CalendarVariant.hrh"
    50 #include "CalendarVariant.hrh"
    49 #include "calennativeview.h"
    51 #include "calennativeview.h"
    50 #include "calencontainer.h"
    52 #include "calencontainer.h"
    54 #include "CleanupResetAndDestroy.h"
    56 #include "CleanupResetAndDestroy.h"
    55 #include "CalenPaths.h"
    57 #include "CalenPaths.h"
    56 #include "calendar.hrh"
    58 #include "calendar.hrh"
    57 #include "CalenUid.h"
    59 #include "CalenUid.h"
    58 #include "CalendarPrivateCRKeys.h"
    60 #include "CalendarPrivateCRKeys.h"
       
    61 #include "multicaluidialog.h"
    59 
    62 
    60 const TInt KAbbreviatedWeekNames[] =
    63 const TInt KAbbreviatedWeekNames[] =
    61     {
    64     {
    62     R_QTN_WEEK_TWO_CHARS_MO,
    65     R_QTN_WEEK_TWO_CHARS_MO,
    63     R_QTN_WEEK_TWO_CHARS_TU,
    66     R_QTN_WEEK_TWO_CHARS_TU,
   111     delete iMenuName;
   114     delete iMenuName;
   112     delete iSettingsName;
   115     delete iSettingsName;
   113     
   116     
   114     delete iSPUtils;
   117     delete iSPUtils;
   115 
   118 
       
   119     if( iAsyncCallback )
       
   120         {
       
   121         iAsyncCallback->Cancel();
       
   122         delete iAsyncCallback;
       
   123         iAsyncCallback = NULL;
       
   124         }
       
   125     
   116     TRACE_EXIT_POINT;
   126     TRACE_EXIT_POINT;
   117     }
   127     }
   118 
   128 
   119 // ----------------------------------------------------------------------------
   129 // ----------------------------------------------------------------------------
   120 // CCalenNativeView::SetStatusPaneFromActiveContextL(
   130 // CCalenNativeView::SetStatusPaneFromActiveContextL(
   506         {
   516         {
   507         aMenuBar->StopDisplayingMenuBar();
   517         aMenuBar->StopDisplayingMenuBar();
   508         }
   518         }
   509     
   519     
   510     TRACE_EXIT_POINT;
   520     TRACE_EXIT_POINT;
       
   521     }
       
   522 
       
   523 // ----------------------------------------------------------------------------
       
   524 // CCalenNativeView::CopytoCalendarsL
       
   525 // From CAknView
       
   526 // Return the UID of the day view
       
   527 // (other items were commented in a header)
       
   528 // ----------------------------------------------------------------------------
       
   529 //
       
   530 void CCalenNativeView::CopyToCalendarsL()
       
   531     {
       
   532     TRACE_ENTRY_POINT;
       
   533     
       
   534     iAsyncCallback->CallBack();
       
   535     
       
   536     TRACE_EXIT_POINT;
       
   537     }
       
   538 
       
   539 // ----------------------------------------------------------------------------
       
   540 // CCalenNativeView::AsyncCopyToCalendarsL
       
   541 // From CAknView
       
   542 // Return the UID of the day view
       
   543 // (other items were commented in a header)
       
   544 // ----------------------------------------------------------------------------
       
   545 //
       
   546 TInt CCalenNativeView::AsyncCopyToCalendarsL( TAny* aThisPtr )
       
   547     {
       
   548     TRACE_ENTRY_POINT;
       
   549     
       
   550     static_cast<CCalenNativeView*>(aThisPtr)->CopyEntryToCalendarsL();
       
   551     
       
   552     TRACE_EXIT_POINT;
       
   553     return 0;
       
   554 
       
   555     }
       
   556 
       
   557 // ----------------------------------------------------------------------------
       
   558 // CCalenNativeView::CopyEntryToCalendarsL
       
   559 // From CAknView
       
   560 // Return the UID of the day view
       
   561 // (other items were commented in a header)
       
   562 // ----------------------------------------------------------------------------
       
   563 //
       
   564 void CCalenNativeView::CopyEntryToCalendarsL()
       
   565     {
       
   566     TRACE_ENTRY_POINT;
       
   567     
       
   568     // Create settings own titlepane and navipane, and swap with existing ones
       
   569     CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
   570 
       
   571     // Hide the toolbar before we display settings menu
       
   572     MCalenToolbar* toolbar = iServices.ToolbarOrNull();
       
   573     if(toolbar)
       
   574         {
       
   575         toolbar->SetToolbarVisibilityL(EFalse);  
       
   576         }
       
   577     iSPUtils->UnderLineTitleText( EFalse );
       
   578 
       
   579     // Titlepane
       
   580     CAknTitlePane* newtp = new( ELeave ) CAknTitlePane();
       
   581     CleanupStack::PushL( newtp );
       
   582     CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp );
       
   583     CleanupStack::Pop( newtp ); // ownership is passed to statuspane
       
   584     TRect oldRect( 0, 0, 0, 0 );
       
   585     if( oldtp )
       
   586         {
       
   587         CleanupStack::PushL( oldtp );
       
   588         oldRect = oldtp->Rect();
       
   589         CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle ));
       
   590         newtp->SetContainerWindowL( *ctrl );
       
   591         newtp->ConstructL();
       
   592         newtp->SetRect(oldRect);
       
   593         newtp->ActivateL();
       
   594         }        
       
   595 
       
   596     // NaviPane
       
   597     CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer();
       
   598     CleanupStack::PushL( newnp );
       
   599     CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp );
       
   600     CleanupStack::Pop( newnp ); // ownership is passed to statuspane
       
   601     if( oldnp )
       
   602         {
       
   603         CleanupStack::PushL( oldnp );
       
   604         oldRect = oldnp->Rect();
       
   605         CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
       
   606         newnp->SetContainerWindowL( *ctrl );
       
   607         newnp->ConstructL();
       
   608         newnp->SetRect( oldRect );
       
   609         newnp->PushDefaultL();
       
   610         newnp->ActivateL();
       
   611         }
       
   612 
       
   613     MCalenContext& context = iServices.Context();
       
   614     TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
       
   615 
       
   616     CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId);
       
   617     CleanupStack::PushL(entry);
       
   618 
       
   619     RPointerArray<CCalEntry> calentryArray;
       
   620     calentryArray.Append( entry );
       
   621 
       
   622     // Launch the Calendar List Dialiog.
       
   623     CMultiCalUiDialog* calenDbListDialog = CMultiCalUiDialog::NewLC(calentryArray, EFalse);
       
   624     TInt err = KErrNone;
       
   625     // Execute.
       
   626     TRAP( err,calenDbListDialog->LaunchL() );
       
   627     CleanupStack::PopAndDestroy( calenDbListDialog );
       
   628 
       
   629     iSPUtils->UnderLineTitleText( EFalse );
       
   630     // Unhide the toolbar when settings is closed
       
   631     if(toolbar)
       
   632         {
       
   633         toolbar->SetToolbarVisibilityL(ETrue); 
       
   634         }
       
   635     
       
   636     CleanupStack::Pop(entry);
       
   637     calentryArray.ResetAndDestroy(); 
       
   638     
       
   639     // When setting is closed, swap back old titlepane and navipane
       
   640     if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) )
       
   641         {
       
   642         CleanupStack::Pop( oldnp );
       
   643         delete newnp;
       
   644         oldnp->ActivateL();
       
   645         }
       
   646 
       
   647     if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) )
       
   648         {
       
   649         CleanupStack::Pop( oldtp );
       
   650         delete newtp;
       
   651         oldtp->ActivateL();
       
   652         }
       
   653     
       
   654     BeginRepopulationL();
       
   655     
       
   656     TRACE_EXIT_POINT;
       
   657     
   511     }
   658     }
   512 
   659 
   513 // ----------------------------------------------------------------------------
   660 // ----------------------------------------------------------------------------
   514 // C++ constructor can NOT contain any code, that
   661 // C++ constructor can NOT contain any code, that
   515 // might leave.
   662 // might leave.
   564     iServices.RegisterForNotificationsL( this,notificationArray);
   711     iServices.RegisterForNotificationsL( this,notificationArray);
   565     
   712     
   566     notificationArray.Reset();
   713     notificationArray.Reset();
   567     
   714     
   568     iCommandProcessing = EFalse;
   715     iCommandProcessing = EFalse;
       
   716     TCallBack callback(CCalenNativeView::AsyncCopyToCalendarsL,this);
       
   717     iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
   569 
   718 
   570     TRACE_EXIT_POINT;
   719     TRACE_EXIT_POINT;
   571     }
   720     }
   572 
   721 
   573 // ----------------------------------------------------------------------------
   722 // ----------------------------------------------------------------------------