meetingrequest/mrgui/src/cesmrviewerdialog.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 12 4ce476e64c59
child 17 67369d1b217f
equal deleted inserted replaced
14:b13141f05c3d 16:b5fbb9b25d57
    52 #include <esmrpolicies.rsg>
    52 #include <esmrpolicies.rsg>
    53 #include <aknnotewrappers.h>
    53 #include <aknnotewrappers.h>
    54 #include <eikenv.h>
    54 #include <eikenv.h>
    55 #include <eikappui.h>
    55 #include <eikappui.h>
    56 #include <avkon.hrh>
    56 #include <avkon.hrh>
    57 #include <magnentryui.h>
    57 #include <MAgnEntryUi.h>
    58 #include <eikmenup.h>
    58 #include <eikmenup.h>
    59 #include <calentry.h>
    59 #include <calentry.h>
    60 #include <apgtask.h>
    60 #include <apgtask.h>
    61 #include <apmstd.h>
    61 #include <apmstd.h>
    62 #include <apgcli.h>
    62 #include <apgcli.h>
    63 #include <akndef.h>
    63 #include <AknDef.h>
    64 #include <aknutils.h>
    64 #include <AknUtils.h>
    65 #include <stringloader.h>
    65 #include <StringLoader.h>
    66 #include <eikspane.h>
    66 #include <eikspane.h>
    67 #include <e32keys.h>
    67 #include <e32keys.h>
    68 #include <caleninterimutils2.h>
    68 #include <CalenInterimUtils2.h>
    69 #include <w32std.h>
    69 #include <w32std.h>
    70 
    70 
    71 // DEBUG
    71 // DEBUG
    72 #include "emailtrace.h"
    72 #include "emailtrace.h"
    73 #include "cesmrcaldbmgr.h"
    73 #include "cesmrcaldbmgr.h"
   194         {
   194         {
   195         // Returns the previous title back to titlepane
   195         // Returns the previous title back to titlepane
   196         iTitlePane->Rollback();
   196         iTitlePane->Rollback();
   197         delete iTitlePane;
   197         delete iTitlePane;
   198         }
   198         }
   199     
   199 
   200     delete iESMRSendUI;
   200     delete iESMRSendUI;
   201     delete iLocationPluginHandler;
   201     delete iLocationPluginHandler;
   202     delete iFeatures;
   202     delete iFeatures;
   203 
   203 
   204     // iView is deleted by framework because it uses the
   204     // iView is deleted by framework because it uses the
   238     // Class disables avkon toolbar by default, which
   238     // Class disables avkon toolbar by default, which
   239     // we want in case of non-MR
   239     // we want in case of non-MR
   240     iToolbar = CMRToolbar::NewL();
   240     iToolbar = CMRToolbar::NewL();
   241 
   241 
   242     TRect clientRect;
   242     TRect clientRect;
   243     AknLayoutUtils::LayoutMetricsRect( 
   243     AknLayoutUtils::LayoutMetricsRect(
   244             AknLayoutUtils::EMainPane, 
   244             AknLayoutUtils::EMainPane,
   245             clientRect );
   245             clientRect );
   246 
   246 
   247     TBool responseReady(EFalse);
   247     TBool responseReady(EFalse);
   248     MESMRCalEntry* calEntry = iInfoProvider.EntryL();
   248     MESMRCalEntry* calEntry = iInfoProvider.EntryL();
   249     MESMRMeetingRequestEntry* mrEntry = NULL;
   249     MESMRMeetingRequestEntry* mrEntry = NULL;
   270     // Create focus strategy
   270     // Create focus strategy
   271     iFocusStrategy = CMRFocusStrategyViewer::NewL( *storage );
   271     iFocusStrategy = CMRFocusStrategyViewer::NewL( *storage );
   272     // Give the strategy to the iView
   272     // Give the strategy to the iView
   273 
   273 
   274     // storage ownership is transferred to CESMRView
   274     // storage ownership is transferred to CESMRView
   275     iView = CESMRView::NewL( 
   275     iView = CESMRView::NewL(
   276             storage, 
   276             storage,
   277             *calEntry, 
   277             *calEntry,
   278             clientRect, 
   278             clientRect,
   279             *iFocusStrategy, 
   279             *iFocusStrategy,
   280             *iToolbar,
   280             *iToolbar,
   281             this );
   281             this );
   282     
   282 
   283     iView->SetViewMode( EESMRViewMR );
   283     iView->SetViewMode( EESMRViewMR );
   284 
   284 
   285     if ( calEntry->Entry().SummaryL().Length() == 0 )
   285     if ( calEntry->Entry().SummaryL().Length() == 0 )
   286         {
   286         {
   287         // if no title, set unnamed text:
   287         // if no title, set unnamed text:
   333         {
   333         {
   334         if( !iTitlePane )
   334         if( !iTitlePane )
   335             {
   335             {
   336             iTitlePane = CESMRTitlePaneHandler::NewL( *iEikonEnv );
   336             iTitlePane = CESMRTitlePaneHandler::NewL( *iEikonEnv );
   337             }
   337             }
   338     
   338 
   339         HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv );
   339         HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv );
   340         iTitlePane->SetNewTitle( titleText );
   340         iTitlePane->SetNewTitle( titleText );
   341         CleanupStack::PopAndDestroy( titleText );
   341         CleanupStack::PopAndDestroy( titleText );
   342         }
   342         }
   343 
   343 
   354     iView->InternalizeL();
   354     iView->InternalizeL();
   355     CAknDialog::ActivateL();
   355     CAknDialog::ActivateL();
   356 
   356 
   357     // Needs to be constructed here
   357     // Needs to be constructed here
   358     ConstructToolbarL();
   358     ConstructToolbarL();
   359     
   359 
   360     switch ( iInfoProvider.EntryL()->Type() )
   360     switch ( iInfoProvider.EntryL()->Type() )
   361     	{
   361     	{
   362     	case MESMRCalEntry::EESMRCalEntryMeetingRequest:
   362     	case MESMRCalEntry::EESMRCalEntryMeetingRequest:
   363     		{
   363     		{
   364     		iView->InitialScrollL();
   364     		iView->InitialScrollL();
   365 
   365 
   366             MESMRMeetingRequestEntry* entry =
   366             MESMRMeetingRequestEntry* entry =
   367                 static_cast<MESMRMeetingRequestEntry*>( 
   367                 static_cast<MESMRMeetingRequestEntry*>(
   368                         iInfoProvider.EntryL() );
   368                         iInfoProvider.EntryL() );
   369     		
   369 
   370     		if ( entry->IsOpenedFromMail() )
   370     		if ( entry->IsOpenedFromMail() )
   371     		    {
   371     		    {
   372                 iView->SetNaviArrowStatus(
   372                 iView->SetNaviArrowStatus(
   373                                  iCallback.IsCommandAvailable(
   373                                  iCallback.IsCommandAvailable(
   374                                         EESMRCmdMailPreviousMessage ),
   374                                         EESMRCmdMailPreviousMessage ),
   620                         {
   620                         {
   621                         break;
   621                         break;
   622                         }
   622                         }
   623                     }
   623                     }
   624                 }
   624                 }
   625             
   625 
   626             // If entry is recurring, we want to ask from user, if 
   626             // If entry is recurring, we want to ask from user, if
   627             // single instance or whole series will be forwarded
   627             // single instance or whole series will be forwarded
   628             if( aCommand == EESMRCmdForwardAsMail && 
   628             if( aCommand == EESMRCmdForwardAsMail &&
   629             		iInfoProvider.EntryL()->IsRecurrentEventL() )
   629             		iInfoProvider.EntryL()->IsRecurrentEventL() )
   630             	{
   630             	{
   631 				SetRecurrenceModRuleL(
   631 				SetRecurrenceModRuleL(
   632 					*( iInfoProvider.EntryL() ),
   632 					*( iInfoProvider.EntryL() ),
   633 					CESMRListQuery::EESMRForwardThisOccurenceOrSeriesQuery );
   633 					CESMRListQuery::EESMRForwardThisOccurenceOrSeriesQuery );
   714 			}
   714 			}
   715         case EMRCmdHideAttachmentIndicator:
   715         case EMRCmdHideAttachmentIndicator:
   716             {
   716             {
   717             iView->ProcessEditorCommandL( EMRCmdHideAttachmentIndicator );
   717             iView->ProcessEditorCommandL( EMRCmdHideAttachmentIndicator );
   718             }
   718             }
   719             break;            
   719             break;
   720         default:
   720         default:
   721         	{
   721         	{
   722             if ( aCommand >= EESMRCmdActionMenuFirst &&
   722             if ( aCommand >= EESMRCmdActionMenuFirst &&
   723             	 aCommand < EESMRCmdActionMenuLast )
   723             	 aCommand < EESMRCmdActionMenuLast )
   724                 {
   724                 {
   819         case EESMRCmdRemoveFromCalendar:
   819         case EESMRCmdRemoveFromCalendar:
   820             {
   820             {
   821             res = HandleMRExitL( aButtonId );
   821             res = HandleMRExitL( aButtonId );
   822             break;
   822             break;
   823             }
   823             }
   824             
   824 
   825         default:
   825         default:
   826             {
   826             {
   827             if(iExitTriggered)
   827             if(iExitTriggered)
   828                 {
   828                 {
   829                 res = ETrue;
   829                 res = ETrue;
   892                 iExitTriggered = ETrue;
   892                 iExitTriggered = ETrue;
   893                 retValue = ETrue;
   893                 retValue = ETrue;
   894                 }
   894                 }
   895             }
   895             }
   896         }
   896         }
   897     
   897 
   898     return retValue;
   898     return retValue;
   899     }
   899     }
   900 
   900 
   901 // ---------------------------------------------------------------------------
   901 // ---------------------------------------------------------------------------
   902 // CESMRViewerDialog::ExitDialog
   902 // CESMRViewerDialog::ExitDialog
   929 //
   929 //
   930 void CESMRViewerDialog::DynInitToolbarL (
   930 void CESMRViewerDialog::DynInitToolbarL (
   931         TInt /*aResourceId*/,
   931         TInt /*aResourceId*/,
   932         CAknToolbar* /*aToolbar*/ )
   932         CAknToolbar* /*aToolbar*/ )
   933 	{
   933 	{
   934 	// TODO: Not implemented yet
   934 
   935 	}
   935 	}
   936 
   936 
   937 // ---------------------------------------------------------------------------
   937 // ---------------------------------------------------------------------------
   938 // CESMRViewerDialog::OfferToolbarEventL
   938 // CESMRViewerDialog::OfferToolbarEventL
   939 // ---------------------------------------------------------------------------
   939 // ---------------------------------------------------------------------------
  1322         {
  1322         {
  1323         if ( R_MR_VIEWER_MENU == aResourceId )
  1323         if ( R_MR_VIEWER_MENU == aResourceId )
  1324             {
  1324             {
  1325             const CESMRPolicy& currentPolicy(
  1325             const CESMRPolicy& currentPolicy(
  1326                     iInfoProvider.PolicyProvider().CurrentPolicy() );
  1326                     iInfoProvider.PolicyProvider().CurrentPolicy() );
  1327             
  1327 
  1328             aMenuPane->SetItemDimmed(
  1328             aMenuPane->SetItemDimmed(
  1329                     EESMRCmdMailDelete,
  1329                     EESMRCmdMailDelete,
  1330                     !iCallback.IsCommandAvailable(
  1330                     !iCallback.IsCommandAvailable(
  1331                             EESMRCmdMailDelete) );
  1331                             EESMRCmdMailDelete) );
  1332             aMenuPane->SetItemDimmed(
  1332             aMenuPane->SetItemDimmed(
  1535         TUid uid = {0};
  1535         TUid uid = {0};
  1536         MESMRBuilderExtension* extension =
  1536         MESMRBuilderExtension* extension =
  1537                 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) );
  1537                 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) );
  1538 
  1538 
  1539         MESMRCalEntry* calEntry = iInfoProvider.EntryL();
  1539         MESMRCalEntry* calEntry = iInfoProvider.EntryL();
  1540         
  1540 
  1541         if ( extension && MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type())
  1541         if ( extension && MESMRCalEntry::EESMRCalEntryMeetingRequest == calEntry->Type())
  1542             {
  1542             {
  1543             // Static cast is safe here. We know for sure that entry is MR
  1543             // Static cast is safe here. We know for sure that entry is MR
  1544             MESMRMeetingRequestEntry* mrEntry =
  1544             MESMRMeetingRequestEntry* mrEntry =
  1545                     static_cast<MESMRMeetingRequestEntry*>( calEntry );
  1545                     static_cast<MESMRMeetingRequestEntry*>( calEntry );
  1723 // ---------------------------------------------------------------------------
  1723 // ---------------------------------------------------------------------------
  1724 //
  1724 //
  1725 void CESMRViewerDialog::HandleFieldEventL( const MESMRFieldEvent& aEvent )
  1725 void CESMRViewerDialog::HandleFieldEventL( const MESMRFieldEvent& aEvent )
  1726     {
  1726     {
  1727     FUNC_LOG;
  1727     FUNC_LOG;
  1728     
  1728 
  1729     MESMRFieldEvent::TEventType type( aEvent.Type() );
  1729     MESMRFieldEvent::TEventType type( aEvent.Type() );
  1730     
  1730 
  1731     if ( MESMRFieldEvent::EESMRFieldCommandEvent == type )
  1731     if ( MESMRFieldEvent::EESMRFieldCommandEvent == type )
  1732         {
  1732         {
  1733         ProcessCommandEventL( aEvent );
  1733         ProcessCommandEventL( aEvent );
  1734         }
  1734         }
  1735     else if ( MESMRFieldEvent::EESMRFieldChangeEvent == type ) 
  1735     else if ( MESMRFieldEvent::EESMRFieldChangeEvent == type )
  1736         {
  1736         {
  1737         ProcessFieldEventL( aEvent );
  1737         ProcessFieldEventL( aEvent );
  1738         }
  1738         }
  1739     }
  1739     }
  1740 
  1740 
  1820          {
  1820          {
  1821          // This is meeting request
  1821          // This is meeting request
  1822          mrEntry = static_cast<MESMRMeetingRequestEntry*>( calEntry );
  1822          mrEntry = static_cast<MESMRMeetingRequestEntry*>( calEntry );
  1823 
  1823 
  1824          TBool openedFromEmail( mrEntry->IsOpenedFromMail() );
  1824          TBool openedFromEmail( mrEntry->IsOpenedFromMail() );
  1825          
  1825 
  1826          // If entry is opened from mail, contains remote attachments and
  1826          // If entry is opened from mail, contains remote attachments and
  1827          // mailbox is MfE, we show the query.
  1827          // mailbox is MfE, we show the query.
  1828          if ( openedFromEmail && mrEntry->ContainsRemoteAttachmentsL() &&
  1828          if ( openedFromEmail && mrEntry->ContainsRemoteAttachmentsL() &&
  1829         		 mrEntry->CurrentPluginL() == EESMRActiveSync )
  1829         		 mrEntry->CurrentPluginL() == EESMRActiveSync )
  1830              {
  1830              {
  1854 // ---------------------------------------------------------------------------
  1854 // ---------------------------------------------------------------------------
  1855 //
  1855 //
  1856 void CESMRViewerDialog::ConstructToolbarL()
  1856 void CESMRViewerDialog::ConstructToolbarL()
  1857     {
  1857     {
  1858     FUNC_LOG;
  1858     FUNC_LOG;
  1859     if( iInfoProvider.EntryL()->Type() == 
  1859     if( iInfoProvider.EntryL()->Type() ==
  1860             MESMRCalEntry::EESMRCalEntryMeetingRequest )
  1860             MESMRCalEntry::EESMRCalEntryMeetingRequest )
  1861         {
  1861         {
  1862         MESMRMeetingRequestEntry* entry =
  1862         MESMRMeetingRequestEntry* entry =
  1863             static_cast<MESMRMeetingRequestEntry*>( 
  1863             static_cast<MESMRMeetingRequestEntry*>(
  1864                     iInfoProvider.EntryL() );
  1864                     iInfoProvider.EntryL() );
  1865         
  1865 
  1866         if( !entry->OccursInPastL() && 
  1866         if( !entry->OccursInPastL() &&
  1867                 !entry->IsEntryOutOfDateL() && 
  1867                 !entry->IsEntryOutOfDateL() &&
  1868                     !entry->IsMeetingCancelledL() )
  1868                     !entry->IsMeetingCancelledL() )
  1869             {
  1869             {
  1870             if ( entry->RoleL()== EESMRRoleRequiredAttendee ||
  1870             if ( entry->RoleL()== EESMRRoleRequiredAttendee ||
  1871                         entry->RoleL()== EESMRRoleOptionalAttendee )
  1871                         entry->RoleL()== EESMRRoleOptionalAttendee )
  1872                 {
  1872                 {
  1873                 TSize screenSize = 
  1873                 TSize screenSize =
  1874                         iEikonEnv->ScreenDevice()->SizeInPixels();
  1874                         iEikonEnv->ScreenDevice()->SizeInPixels();
  1875             
  1875 
  1876                 TBool isVGA( EFalse );
  1876                 TBool isVGA( EFalse );
  1877                 if( ( screenSize.iHeight == KVGAOneSide || 
  1877                 if( ( screenSize.iHeight == KVGAOneSide ||
  1878                         screenSize.iWidth == KVGAOneSide ) && 
  1878                         screenSize.iWidth == KVGAOneSide ) &&
  1879                             ( screenSize.iHeight == KVGAOtherSide || 
  1879                             ( screenSize.iHeight == KVGAOtherSide ||
  1880                               screenSize.iWidth == KVGAOtherSide ) && 
  1880                               screenSize.iWidth == KVGAOtherSide ) &&
  1881                               screenSize.iHeight != screenSize.iWidth )
  1881                               screenSize.iHeight != screenSize.iWidth )
  1882                     {
  1882                     {
  1883                     isVGA = ETrue;
  1883                     isVGA = ETrue;
  1884                     }
  1884                     }
  1885 
  1885 
  1890                     // is attendee
  1890                     // is attendee
  1891                     iToolbar->SetObserver( this );
  1891                     iToolbar->SetObserver( this );
  1892                     iToolbar->InitializeToolbarL(
  1892                     iToolbar->InitializeToolbarL(
  1893                             CMRToolbar::EMRViewerAttendee );
  1893                             CMRToolbar::EMRViewerAttendee );
  1894                     iToolbar->ShowToolbar( ETrue );
  1894                     iToolbar->ShowToolbar( ETrue );
  1895                     
  1895 
  1896                     // Toolbar created, relayouting needed
  1896                     // Toolbar created, relayouting needed
  1897                     iView->ReLayout();
  1897                     SizeChanged();
  1898                     }
  1898                     }
  1899                 }
  1899                 }
  1900             }        
  1900             }
  1901         }
  1901         }
  1902     }
  1902     }
  1903 
  1903 
  1904 // ---------------------------------------------------------------------------
  1904 // ---------------------------------------------------------------------------
  1905 // CESMRViewerDialog::ProcessCommandEventL
  1905 // CESMRViewerDialog::ProcessCommandEventL
  1906 // ---------------------------------------------------------------------------
  1906 // ---------------------------------------------------------------------------
  1907 //
  1907 //
  1908 void CESMRViewerDialog::ProcessCommandEventL( const MESMRFieldEvent& aEvent )
  1908 void CESMRViewerDialog::ProcessCommandEventL( const MESMRFieldEvent& aEvent )
  1909     {
  1909     {
  1910     FUNC_LOG;
  1910     FUNC_LOG;
  1911     
  1911 
  1912     TInt* command = static_cast< TInt* >( aEvent.Param( 0 ) );
  1912     TInt* command = static_cast< TInt* >( aEvent.Param( 0 ) );
  1913 
  1913 
  1914     switch ( *command )
  1914     switch ( *command )
  1915         {
  1915         {
  1916         case EESMRCmdRestoreMiddleSoftKey:
  1916         case EESMRCmdRestoreMiddleSoftKey:
  1952            break;
  1952            break;
  1953         default:
  1953         default:
  1954             {
  1954             {
  1955             break;
  1955             break;
  1956             }
  1956             }
  1957         }    
  1957         }
  1958     }
  1958     }
  1959 
  1959 
  1960 // ---------------------------------------------------------------------------
  1960 // ---------------------------------------------------------------------------
  1961 // CESMRViewerDialog::ProcessFieldEventL
  1961 // CESMRViewerDialog::ProcessFieldEventL
  1962 // ---------------------------------------------------------------------------
  1962 // ---------------------------------------------------------------------------
  1963 //
  1963 //
  1964 void CESMRViewerDialog::ProcessFieldEventL( const MESMRFieldEvent& aEvent )
  1964 void CESMRViewerDialog::ProcessFieldEventL( const MESMRFieldEvent& aEvent )
  1965     {
  1965     {
  1966     FUNC_LOG;    
  1966     FUNC_LOG;
  1967     iView->ProcessEventL( aEvent );
  1967     iView->ProcessEventL( aEvent );
  1968     }
  1968     }
  1969     
  1969 
  1970 // EOF
  1970 // EOF