meetingrequest/mrgui/src/cesmrview.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 12 4ce476e64c59
child 18 6b8f3b30d0ec
equal deleted inserted replaced
14:b13141f05c3d 16:b5fbb9b25d57
    13 *
    13 *
    14 * Description:  ESMR UI Container class
    14 * Description:  ESMR UI Container class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // <cmail> custom sw help files not avilable in Cmail
       
    19 //#include <fscale.hlp.hrh> //for custom_sw helps
       
    20 //#include <fsmr.hlp.hrh> //for custom_sw helps
       
    21 // </cmail>
       
    22 #include "cesmrview.h"
    18 #include "cesmrview.h"
    23 #include "mesmrmeetingrequestentry.h"
    19 #include "mesmrmeetingrequestentry.h"
    24 #include "esmrinternaluid.h"
    20 #include "esmrinternaluid.h"
    25 #include "cesmrtitlepane.h"
    21 #include "cesmrtitlepane.h"
    26 #include "cesmrfield.h"
    22 #include "cesmrfield.h"
    38 #include "mesmrfieldevent.h"
    34 #include "mesmrfieldevent.h"
    39 #include "cesmrgenericfieldevent.h"
    35 #include "cesmrgenericfieldevent.h"
    40 
    36 
    41 #include <eiklabel.h>
    37 #include <eiklabel.h>
    42 #include <avkon.hrh>
    38 #include <avkon.hrh>
    43 #include <magnentryui.h>
    39 #include <MAgnEntryUi.h>
    44 #include <stringloader.h>
    40 #include <StringLoader.h>
    45 #include <gulcolor.h>
    41 #include <gulcolor.h>
    46 #include <eikimage.h>
    42 #include <eikimage.h>
    47 #include <esmrgui.rsg>
    43 #include <esmrgui.rsg>
    48 #include <akniconutils.h>
    44 #include <AknIconUtils.h>
    49 #include <eikenv.h>
    45 #include <eikenv.h>
    50 #include <aknsconstants.h>
    46 #include <AknsConstants.h>
    51 #include <aknutils.h>
    47 #include <AknUtils.h>
    52 #include <aknsdrawutils.h>
    48 #include <AknsDrawUtils.h>
    53 #include <aknsbasicbackgroundcontrolcontext.h>
    49 #include <AknsBasicBackgroundControlContext.h>
    54 #include <hlplch.h>
    50 #include <hlplch.h>
    55 #include <csxhelp/cmail.hlp.hrh>
    51 #include <csxhelp/cmail.hlp.hrh>
    56 #include <touchfeedback.h>
    52 #include <touchfeedback.h>
    57 #include <akntoolbar.h>
    53 #include <akntoolbar.h>
    58 #include <eikcolib.h>
    54 #include <eikcolib.h>
    59 #include <featdiscovery.h>
    55 #include <featdiscovery.h>
    60 #include <bldvariant.hrh>
    56 #include <bldvariant.hrh>
    61 #include <layoutmetadata.cdl.h>
    57 #include <layoutmetadata.cdl.h>
    62 
    58 
    63 #include "emailtrace.h"
    59 #include "emailtrace.h"
    64 
       
    65 
       
    66 // <cmail> Removed profiling. </cmail>
       
    67 
       
    68 
    60 
    69 // ======== MEMBER FUNCTIONS ========
    61 // ======== MEMBER FUNCTIONS ========
    70 
    62 
    71 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    72 // CESMRView::CESMRView()
    64 // CESMRView::CESMRView()
   212                     }
   204                     }
   213                     
   205                     
   214                 delete iAttachmentIndicator;
   206                 delete iAttachmentIndicator;
   215                 iAttachmentIndicator = NULL;
   207                 iAttachmentIndicator = NULL;
   216                 
   208                 
   217                 ReLayout();
   209                 SizeChanged();
   218                 }            
   210                 }            
   219             }
   211             }
   220             break;
   212             break;
   221         default://forward to fields
   213         default://forward to fields
   222         	{
   214         	{
   315                     LaunchHelpL( KFS_VIEWER_HLP_MEETING_REQ_VIEW );
   307                     LaunchHelpL( KFS_VIEWER_HLP_MEETING_REQ_VIEW );
   316                     }
   308                     }
   317                 else
   309                 else
   318                     {
   310                     {
   319                     // Only viewer from Mail supported
   311                     // Only viewer from Mail supported
   320                     // TODO: Change to KFS_VIEWER_HLP_MR_RECEIVED
   312                     LaunchHelpL( KFS_VIEWER_HLP_MR_RECEIVED );
   321                     // when help id is released on wk9 platform
       
   322                     LaunchHelpL( KFS_VIEWER_HLP_MEETING_REQ_VIEW );
       
   323                     }
   313                     }
   324                 }
   314                 }
   325             else if ( mrEntry->RoleL() == EESMRRoleOrganizer )
   315             else if ( mrEntry->RoleL() == EESMRRoleOrganizer )
   326                 {
   316                 {
   327                 LaunchHelpL( KFSCA_HLP_VIEWER_ORGANIZER );
   317                 LaunchHelpL( KFSCA_HLP_VIEWER_ORGANIZER );
   662     // If list pane is not yet constructed, no point in layouting anything
   652     // If list pane is not yet constructed, no point in layouting anything
   663     if( !iListPane )
   653     if( !iListPane )
   664         {
   654         {
   665         return;
   655         return;
   666         }
   656         }
   667             
   657     
   668     TRect containerRect( Rect() );
   658     // Remove possible intersection with toolbar from container rect
       
   659     TRect containerRect( ContainerRect() );
       
   660     
       
   661     // Now toolbar does not intersect with view, so it must not be taken
       
   662     // into account when calculating other component layouts.
       
   663     containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() );
   669     
   664     
   670     // Get the rect of stripe.
   665     // Get the rect of stripe.
   671     TAknLayoutRect stripeLayoutRect =
   666     TAknLayoutRect stripeLayoutRect =
   672         NMRLayoutManager::GetLayoutRect( containerRect,
   667         NMRLayoutManager::GetLayoutRect( containerRect,
   673                 NMRLayoutManager::EMRLayoutStripe );
   668                 NMRLayoutManager::EMRLayoutStripe );
   680                 NMRLayoutManager::GetLayoutRect( containerRect,
   675                 NMRLayoutManager::GetLayoutRect( containerRect,
   681                         NMRLayoutManager::EMRLayoutListArea );
   676                         NMRLayoutManager::EMRLayoutListArea );
   682         TRect listareaRect( listareaLayoutRect.Rect() );
   677         TRect listareaRect( listareaLayoutRect.Rect() );
   683 
   678 
   684         // List panes default rect needs to be modified due to
   679         // List panes default rect needs to be modified due to
   685         // possible toolbar, scrollbar and calendar indication stripe
   680         // scrollbar and calendar indication stripe
   686         
   681         
   687         // Remove stripe width from list pane width
   682         // Remove stripe width from list pane width
   688         listareaRect.iTl.iX += iStripeRect.Width();
   683         listareaRect.iTl.iX += iStripeRect.Width();
   689         
       
   690         // Remove toolbar width from list pane width
       
   691         listareaRect.iBr.iX -= iToolbar.Rect().Width();
       
   692         
   684         
   693         if( iScrollBar )
   685         if( iScrollBar )
   694            {
   686            {
   695            TAknLayoutRect scrollareaLayoutRect =
   687            TAknLayoutRect scrollareaLayoutRect =
   696                NMRLayoutManager::GetLayoutRect( containerRect,
   688                NMRLayoutManager::GetLayoutRect( containerRect,
   697                        NMRLayoutManager::EMRLayoutScrollBar );
   689                        NMRLayoutManager::EMRLayoutScrollBar );
   698            TRect scrollareaRect( scrollareaLayoutRect.Rect() );
   690            TRect scrollareaRect( scrollareaLayoutRect.Rect() );
   699            // Scroll bar's height is always the same as listpane's height
   691            // Scroll bar's height is always the same as listpane's height
   700            scrollareaRect.SetHeight( listareaRect.Height() );
   692            scrollareaRect.SetHeight( listareaRect.Height() );
   701            
   693            
   702            // Scrollbar needs to be moved to the left side of possible
       
   703            // toolbar
       
   704            scrollareaRect.Move( -iToolbar.Rect().Width(), 0 );
       
   705            iScrollBar->SetRect( scrollareaRect );
   694            iScrollBar->SetRect( scrollareaRect );
   706            
   695            
   707            // Remove scroll bar width from list area's width
   696            // Remove scroll bar width from list area's width
   708            listareaRect.iBr.iX -= iScrollBar->Rect().Width();
   697            listareaRect.iBr.iX -= iScrollBar->Rect().Width();
   709            }
   698            }
   742                 if( iScrollBar )
   731                 if( iScrollBar )
   743                     {
   732                     {
   744                     scrollWidth = iScrollBar->Rect().Width();
   733                     scrollWidth = iScrollBar->Rect().Width();
   745                     }
   734                     }
   746                 
   735                 
   747                 naviArrowRightRect.Move( 
   736                 naviArrowRightRect.Move( scrollWidth, 0 );
   748                         -( iToolbar.Rect().Width() + scrollWidth ), 0 );
       
   749     
   737     
   750                 iNaviArrowRight->SetRect( naviArrowRightRect );
   738                 iNaviArrowRight->SetRect( naviArrowRightRect );
   751                 }
   739                 }
   752             }
   740             }
   753         else
   741         else
   764                        NMRLayoutManager::EMRLayoutListArea );
   752                        NMRLayoutManager::EMRLayoutListArea );
   765         TRect listareaRect( listareaLayoutRect.Rect() );
   753         TRect listareaRect( listareaLayoutRect.Rect() );
   766         
   754         
   767         // The listPane's area should be:
   755         // The listPane's area should be:
   768         // X: Should subtract the width of stripe
   756         // X: Should subtract the width of stripe
   769         // Y: Should subtract the height of MRToolbar
       
   770         listareaRect.iTl.iX += iStripeRect.Width();
   757         listareaRect.iTl.iX += iStripeRect.Width();
   771         listareaRect.iBr.iY -= iToolbar.Rect().Height();
       
   772                 
   758                 
   773         iListPane->SetRect( listareaRect );
   759         iListPane->SetRect( listareaRect );
   774         
   760         
   775         if( iScrollBar )
   761         if( iScrollBar )
   776            {
   762            {
   797             
   783             
   798                 // Left arrow needs to be moved right the amount of
   784                 // Left arrow needs to be moved right the amount of
   799                 // stripe width in portrait
   785                 // stripe width in portrait
   800                 naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
   786                 naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
   801                 
   787                 
   802                 // Left arrow needs to be moved up the amount of
       
   803                 // possible toolbar height in portrait
       
   804                 naviArrowLeftRect.Move( 0, -iToolbar.Rect().Height() );
       
   805                 
       
   806                 iNaviArrowLeft->SetRect( naviArrowLeftRect );
   788                 iNaviArrowLeft->SetRect( naviArrowLeftRect );
   807                 }
   789                 }
   808             
   790             
   809             if( iNaviArrowRight )
   791             if( iNaviArrowRight )
   810                 {
   792                 {
   815             
   797             
   816                 // Right arrow needs to be moved right the amount of
   798                 // Right arrow needs to be moved right the amount of
   817                 // stripe width in portrait
   799                 // stripe width in portrait
   818                 naviArrowRightRect.Move( iStripeRect.Width(), 0 );
   800                 naviArrowRightRect.Move( iStripeRect.Width(), 0 );
   819                 
   801                 
   820                 // Right arrow needs to be moved up the amount of
       
   821                 // possible toolbar height in portrait
       
   822                 naviArrowRightRect.Move( 0, -iToolbar.Rect().Height() );
       
   823                 
       
   824                 
       
   825                 iNaviArrowRight->SetRect( naviArrowRightRect );
   802                 iNaviArrowRight->SetRect( naviArrowRightRect );
   826                 }
   803                 }
   827             }
   804             }
   828         else
   805         else
   829             {
   806             {
   994             }
   971             }
   995         case KEikDynamicLayoutVariantSwitch:
   972         case KEikDynamicLayoutVariantSwitch:
   996         case KAknLocalZoomLayoutSwitch:
   973         case KAknLocalZoomLayoutSwitch:
   997             {
   974             {
   998             SizeChanged();
   975             SizeChanged();
   999             DrawNow();
       
  1000             break;
   976             break;
  1001             }
   977             }
  1002         default:
   978         default:
  1003             {
   979             {
  1004             break;
   980             break;
  1104 TESMRViewMode CESMRView::GetViewMode()
  1080 TESMRViewMode CESMRView::GetViewMode()
  1105 	{
  1081 	{
  1106     FUNC_LOG;
  1082     FUNC_LOG;
  1107 	return iViewMode;
  1083 	return iViewMode;
  1108 	}
  1084 	}
  1109 
       
  1110 // ---------------------------------------------------------------------------
       
  1111 // CESMRView::ReLayout
       
  1112 // ---------------------------------------------------------------------------
       
  1113 //
       
  1114 void CESMRView::ReLayout()
       
  1115     {
       
  1116     FUNC_LOG;
       
  1117     SizeChanged();
       
  1118     }
       
  1119 
  1085 
  1120 // ---------------------------------------------------------------------------
  1086 // ---------------------------------------------------------------------------
  1121 // CESMRView::ProcessEventL
  1087 // CESMRView::ProcessEventL
  1122 // ---------------------------------------------------------------------------
  1088 // ---------------------------------------------------------------------------
  1123 //
  1089 //
  1159                     static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) );
  1125                     static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) );
  1160             
  1126             
  1161             iAttachmentIndicator->SetTextL( value->StringValue() );            
  1127             iAttachmentIndicator->SetTextL( value->StringValue() );            
  1162             iAttachmentIndicator->MakeVisible( ETrue );
  1128             iAttachmentIndicator->MakeVisible( ETrue );
  1163             
  1129             
  1164             ReLayout();        
  1130             SizeChanged();        
  1165             }
  1131             }
  1166         }
  1132         }
  1167     }
  1133     }
  1168 
  1134 
  1169 // ---------------------------------------------------------------------------
  1135 // ---------------------------------------------------------------------------
  1170 // CESMRView::CalculateAttachmentIndicatorLayout
  1136 // CESMRView::CalculateAttachmentIndicatorLayout
  1171 // ---------------------------------------------------------------------------
  1137 // ---------------------------------------------------------------------------
  1172 //
  1138 //
  1173 TRect CESMRView::CalculateAttachmentIndicatorLayout()
  1139 TRect CESMRView::CalculateAttachmentIndicatorLayout()
  1174     {
  1140     {
  1175     TRect containerRect( Rect() );
  1141     TRect containerRect( ContainerRect() );
  1176     
  1142     
  1177     TAknLayoutRect naviArrowLeftLayoutRect =
  1143     TAknLayoutRect naviArrowLeftLayoutRect =
  1178             NMRLayoutManager::GetLayoutRect( containerRect,
  1144             NMRLayoutManager::GetLayoutRect( containerRect,
  1179                     NMRLayoutManager::EMRLayoutMRNaviArrowLeft );    
  1145                     NMRLayoutManager::EMRLayoutMRNaviArrowLeft );    
  1180     TRect naviArrowLeftRect = naviArrowLeftLayoutRect.Rect();
  1146     TRect naviArrowLeftRect = naviArrowLeftLayoutRect.Rect();
  1192         if( iScrollBar )
  1158         if( iScrollBar )
  1193             {
  1159             {
  1194             scrollWidth = iScrollBar->Rect().Width();
  1160             scrollWidth = iScrollBar->Rect().Width();
  1195             }
  1161             }
  1196         
  1162         
  1197         naviArrowRightRect.Move( 
  1163         naviArrowRightRect.Move( scrollWidth, 0 );    
  1198                 -( iToolbar.Rect().Width() + scrollWidth ), 0 );    
       
  1199         }
  1164         }
  1200     else
  1165     else
  1201         {
  1166         {
  1202         // Left arrow needs to be moved right the amount of
  1167         // Left arrow needs to be moved right the amount of
  1203         // stripe width in portrait
  1168         // stripe width in portrait
  1204         naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
  1169         naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
  1205         naviArrowLeftRect.Move( 0, -iToolbar.Rect().Height() );
  1170         
  1206 
       
  1207         TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect();
  1171         TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect();
  1208         
  1172         
  1209         naviArrowRightRect.Move( iStripeRect.Width(), 0 );
  1173         naviArrowRightRect.Move( iStripeRect.Width(), 0 );
  1210         naviArrowRightRect.Move( 0, -iToolbar.Rect().Height() );        
       
  1211         }   
  1174         }   
  1212 
  1175 
  1213     // Get height for one row 
  1176     // Get height for one row 
  1214     TAknLayoutRect rowLayout = 
  1177     TAknLayoutRect rowLayout = 
  1215         NMRLayoutManager::GetLayoutRect( 
  1178         NMRLayoutManager::GetLayoutRect( 
  1216                 containerRect, NMRLayoutManager::EMRLayoutTextEditorIcon );
  1179                 containerRect, NMRLayoutManager::EMRLayoutTextEditorIcon );
  1217     TRect rowRect( rowLayout.Rect() );
  1180     TRect rowRect( rowLayout.Rect() );
  1218     
  1181     
  1219     TRect attachmentIndicatorRect;
  1182     TRect attachmentIndicatorRect;
  1220     /*attachmentIndicatorRect.iTl = 
       
  1221             TPoint( naviArrowLeftRect.iBr.iX, 
       
  1222                     naviArrowLeftRect.iBr.iY - rowRect.Height() ); */
       
  1223     
  1183     
  1224     attachmentIndicatorRect.iTl = 
  1184     attachmentIndicatorRect.iTl = 
  1225                 TPoint( naviArrowLeftRect.iBr.iX, 
  1185                 TPoint( naviArrowLeftRect.iBr.iX, 
  1226                         naviArrowLeftRect.iBr.iY - naviArrowLeftRect.Height() );    
  1186                         naviArrowLeftRect.iBr.iY - naviArrowLeftRect.Height() );    
  1227     
  1187     
  1230                     naviArrowLeftRect.iBr.iY );
  1190                     naviArrowLeftRect.iBr.iY );
  1231     
  1191     
  1232     return attachmentIndicatorRect;
  1192     return attachmentIndicatorRect;
  1233     }
  1193     }
  1234 
  1194 
       
  1195 // ---------------------------------------------------------------------------
       
  1196 // CESMRView::ContainerRect
       
  1197 // ---------------------------------------------------------------------------
       
  1198 //
       
  1199 TRect CESMRView::ContainerRect() const
       
  1200     {
       
  1201     // Remove possible intersection with toolbar from container rect
       
  1202     TRect containerRect( PositionRelativeToScreen(), Rect().Size() );
       
  1203     TRect toolbar( iToolbar.Rect() );
       
  1204     if ( containerRect.Intersects( toolbar ) )
       
  1205         {
       
  1206         toolbar.Intersection( containerRect );
       
  1207         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1208             {
       
  1209             containerRect.SetWidth( containerRect.Width() - toolbar.Width() );
       
  1210             }
       
  1211         else
       
  1212             {
       
  1213             containerRect.SetHeight( containerRect.Height() - toolbar.Height() );
       
  1214             }
       
  1215         }
       
  1216     // Now toolbar does not intersect with view, so it must not be taken
       
  1217     // into account when calculating other component layouts.
       
  1218     containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() );
       
  1219     
       
  1220     return containerRect;
       
  1221     }
       
  1222 
  1235 // EOF
  1223 // EOF