meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrconflictpopup.cpp
branchRCL_3
changeset 80 726fba06891a
parent 64 3533d4323edc
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
    27 #include <AknUtils.h>
    27 #include <AknUtils.h>
    28 #include <aknlayoutscalable_avkon.cdl.h>
    28 #include <aknlayoutscalable_avkon.cdl.h>
    29 #include <layoutmetadata.cdl.h>
    29 #include <layoutmetadata.cdl.h>
    30 
    30 
    31 #include "emailtrace.h"
    31 #include "emailtrace.h"
       
    32 #include "cesmrcaluserutil.h"
    32 
    33 
    33 // Unnamed namespace for local definitions
    34 // Unnamed namespace for local definitions
    34 namespace{
    35 namespace{
    35 
    36 
    36 const TInt KTimeDelayBeforeShow(0);  // 0 Seconds
    37 const TInt KTimeDelayBeforeShow(0);  // 0 Seconds
    41 const TInt KPortraitWindowVariety( 4 );
    42 const TInt KPortraitWindowVariety( 4 );
    42 const TInt KLandscapeWindowVariety( 7 );
    43 const TInt KLandscapeWindowVariety( 7 );
    43 const TInt KTextLineVariety( 5 );
    44 const TInt KTextLineVariety( 5 );
    44 
    45 
    45 const TInt KNumTitleLines( 1 );
    46 const TInt KNumTitleLines( 1 );
    46 const TInt KNumLocationLines( 2 );
    47 const TInt KNumLocationLines( 1 );
    47 
    48 
    48 /**
    49 /**
    49  * Clips given text and allocates new buffer if needed.
    50  * Clips given text and allocates new buffer if needed.
    50  * @param aSource text to clip
    51  * @param aSource text to clip
    51  * @param aNumLines number of popup note lines available for visual text.
    52  * @param aNumLines number of popup note lines available for visual text.
   115         }
   116         }
   116 
   117 
   117     return text;
   118     return text;
   118     }
   119     }
   119 
   120 
   120 
   121 /**
       
   122  * Judge is one CCalEntry is a all day event
       
   123  * @param aEntry the entry be checked
       
   124  * @return ETure if it is a all day event
       
   125  */
       
   126 TBool IsAllDayEventL( CCalEntry& aEntry )
       
   127     {
       
   128     FUNC_LOG;
       
   129     CESMRCalUserUtil* entryUtil = CESMRCalUserUtil::NewLC( aEntry );
       
   130     TBool allDayEvent( entryUtil->IsAlldayEventL() );
       
   131     CleanupStack::PopAndDestroy( entryUtil );
       
   132     return allDayEvent;
       
   133     }
   121 }//namespace
   134 }//namespace
   122 
   135 
   123 // ======== MEMBER FUNCTIONS ========
   136 // ======== MEMBER FUNCTIONS ========
   124 
   137 
   125 // ---------------------------------------------------------------------------
   138 // ---------------------------------------------------------------------------
   191     TInt ret = iEntry->FetchConflictingEntriesL( entryArray );
   204     TInt ret = iEntry->FetchConflictingEntriesL( entryArray );
   192     if( ret == KErrNotFound )
   205     if( ret == KErrNotFound )
   193         {
   206         {
   194         User::Leave( KErrNotFound );
   207         User::Leave( KErrNotFound );
   195         }
   208         }
   196 
   209     // Record the blank rows.
       
   210     TInt blankRow = 0;
   197     // Pointer descriptor for R_QTN_MEET_REQ_CONFLICT_UNNAMED
   211     // Pointer descriptor for R_QTN_MEET_REQ_CONFLICT_UNNAMED
   198     TPtrC unnamedTitle( KNullDesC );
   212     TPtrC unnamedTitle( KNullDesC );
   199 
   213 
   200     // Actual title to shown in popup
   214     // Actual title to shown in popup
   201     TPtrC meetingTitle( KNullDesC );
   215     TPtrC meetingTitle( KNullDesC );
   224             meetingTitle.Set( unnamedTitle );
   238             meetingTitle.Set( unnamedTitle );
   225             }
   239             }
   226 
   240 
   227         startTime = entryArray[ 0 ]->StartTimeL().TimeLocalL();
   241         startTime = entryArray[ 0 ]->StartTimeL().TimeLocalL();
   228         endTime = entryArray[ 0 ]->EndTimeL().TimeLocalL();
   242         endTime = entryArray[ 0 ]->EndTimeL().TimeLocalL();
       
   243         
       
   244         //If the first entry is a all day event, it should be show as 
       
   245         //12:00Am - 11:59Pm, so we should subtract one min from end time.
       
   246         if ( IsAllDayEventL( *entryArray[ 0 ] ) )
       
   247             {
       
   248             endTime	-= TTimeIntervalMinutes( 1 );
       
   249             }
   229         }
   250         }
   230 
   251 
   231     HBufC*  conflictLabel = StringLoader::LoadLC(
   252     HBufC*  conflictLabel = StringLoader::LoadLC(
   232             R_QTN_MEET_REQ_CONFLICTS_WITH_LABEL,
   253             R_QTN_MEET_REQ_CONFLICTS_WITH_LABEL,
   233             env );
   254             env );
   287         if ( locationBuf )
   308         if ( locationBuf )
   288             {
   309             {
   289             CleanupStack::PushL( locationBuf );
   310             CleanupStack::PushL( locationBuf );
   290             meetingLocation.Set( *locationBuf );
   311             meetingLocation.Set( *locationBuf );
   291             }
   312             }
   292         strings->AppendL( meetingLocation );
   313         if ( meetingLocation.Length() > 0 )
       
   314         	{
       
   315             strings->AppendL( meetingLocation );
       
   316         	}
       
   317         else
       
   318         	{
       
   319             blankRow++ ;
       
   320         	}
       
   321     
   293         }
   322         }
   294     else
   323     else
   295         {
   324         {
       
   325         blankRow++;
   296         // Prepare location
   326         // Prepare location
   297         locationBuf = ClipTextL(
   327         locationBuf = ClipTextL(
   298                 meetingLocation,
   328                 meetingLocation, KNumLocationLines );
   299                 KNumTitleLines + KNumLocationLines );
       
   300         if ( locationBuf )
   329         if ( locationBuf )
   301             {
   330             {
   302             CleanupStack::PushL( locationBuf );
   331             CleanupStack::PushL( locationBuf );
   303             meetingLocation.Set( *locationBuf );
   332             meetingLocation.Set( *locationBuf );
   304             }
   333             }
   305         strings->AppendL( meetingLocation );
   334         if ( meetingLocation.Length() > 0 )
       
   335         	{
       
   336             strings->AppendL( meetingLocation );
       
   337         	}
       
   338         else
       
   339         	{
       
   340             blankRow++;
       
   341         	}
       
   342         }
       
   343     HBufC* otherconflictBuf = NULL ;
       
   344     if( entryArray.Count() == 2)
       
   345     	{
       
   346          otherconflictBuf = StringLoader::LoadLC(
       
   347         		 R_MEET_REQ_CONFLICT_OTHERCONFLICT_SINGULAR_FORMAT,
       
   348         		 entryArray.Count()-1,
       
   349                     env );
       
   350          strings->AppendL( *otherconflictBuf );
       
   351     	}
       
   352     else if ( entryArray.Count() > 2 )
       
   353     	{
       
   354          otherconflictBuf = StringLoader::LoadLC(
       
   355     		R_MEET_REQ_CONFLICT_OTHERCONFLICT_FORMAT,
       
   356     		entryArray.Count()-1,
       
   357     		env );
       
   358          strings->AppendL( *otherconflictBuf );
       
   359     	}
       
   360     else
       
   361     	{
       
   362         blankRow++;
       
   363     	}
       
   364     
       
   365     while( blankRow )
       
   366     	{
   306         strings->AppendL( KNullDesC() );
   367         strings->AppendL( KNullDesC() );
   307         }
   368         blankRow-- ;
   308 
   369     	}
   309     HBufC* displayString = StringLoader::LoadLC(
   370     HBufC* displayString = StringLoader::LoadLC(
   310             R_MEET_REQ_CONFLICT_TEXT_FORMAT,
   371             R_MEET_REQ_CONFLICT_TEXT_FORMAT,
   311             *strings,
   372             *strings,
   312             env );
   373             env );
   313 
   374 
   317     // Set display string to popup note
   378     // Set display string to popup note
   318     iNote->SetTextL( *displayString );
   379     iNote->SetTextL( *displayString );
   319 
   380 
   320     // Clean allocated buffers
   381     // Clean allocated buffers
   321     CleanupStack::PopAndDestroy( displayString );
   382     CleanupStack::PopAndDestroy( displayString );
       
   383     if ( otherconflictBuf )
       
   384     	{
       
   385         CleanupStack::PopAndDestroy( otherconflictBuf );
       
   386     	}
   322     if ( locationBuf )
   387     if ( locationBuf )
   323         {
   388         {
   324         CleanupStack::PopAndDestroy( locationBuf );
   389         CleanupStack::PopAndDestroy( locationBuf );
   325         }
   390         }
   326     if ( titleBuf )
   391     if ( titleBuf )