meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrconflictpopup.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
child 16 b5fbb9b25d57
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  ESMR Conflict popup implementation
    14 * Description:  ESMR Conflict popup implementation
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 #include "emailtrace.h"
       
    19 #include "cesmrconflictpopup.h"
    17 #include "cesmrconflictpopup.h"
    20 
       
    21 #include <AknInfoPopupNoteController.h>
       
    22 #include <StringLoader.h>
       
    23 #include <eikenv.h>
       
    24 
       
    25 #include "cesmrlayoutmgr.h"
       
    26 #include "mesmrcalentry.h"
    18 #include "mesmrcalentry.h"
    27 #include "mesmrmeetingrequestentry.h"
    19 #include "mesmrmeetingrequestentry.h"
       
    20 
       
    21 #include <akninfopopupnotecontroller.h>
       
    22 #include <stringloader.h>
       
    23 #include <eikenv.h>
    28 #include <esmrgui.rsg>
    24 #include <esmrgui.rsg>
    29 #include <avkon.rsg>
    25 #include <avkon.rsg>
    30 
    26 
       
    27 #include "emailtrace.h"
       
    28 
    31 // Unnamed namespace for local definitions
    29 // Unnamed namespace for local definitions
    32 namespace{
    30 namespace{
    33 
    31 
    34 const TInt KTimeDelayBeforeShow(2000);  // 2 Seconds
    32 const TInt KTimeDelayBeforeShow(0);  // 0 Seconds
    35 const TInt KTimeForView(5000);          // 5 Seconds
    33 const TInt KTimeForView(5000);          // 5 Seconds
    36 const TInt KZero(0);
    34 const TInt KZero(0);
    37 const TInt KTimeStringLength(20);
    35 const TInt KTimeStringLength(20);
    38 const TInt KMaxSummaryLength(25);
    36 const TInt KMaxSummaryLength(25);
    39 
    37 
    42 _LIT( KMessageEnd, ")");
    40 _LIT( KMessageEnd, ")");
    43 _LIT( KStringCont, "...\n");
    41 _LIT( KStringCont, "...\n");
    44 _LIT (KSpace , " " );
    42 _LIT (KSpace , " " );
    45 const TInt KFullTimeStringSize(256);
    43 const TInt KFullTimeStringSize(256);
    46 
    44 
       
    45 void CalEntryPointerArrayCleanup( TAny* aArray )
       
    46     {
       
    47     RPointerArray<CCalEntry>* entryArray =
       
    48         static_cast<RPointerArray<CCalEntry>*>( aArray );
       
    49 
       
    50     entryArray->ResetAndDestroy();
       
    51     entryArray->Close();
       
    52     }
       
    53 
    47 }//namespace
    54 }//namespace
    48 
    55 
    49 // ======== MEMBER FUNCTIONS ========
    56 // ======== MEMBER FUNCTIONS ========
    50 
    57 
    51 // ---------------------------------------------------------------------------
    58 // ---------------------------------------------------------------------------
   110 //
   117 //
   111 void CESMRConflictPopup::PrepareDisplayStringL()
   118 void CESMRConflictPopup::PrepareDisplayStringL()
   112     {
   119     {
   113     FUNC_LOG;
   120     FUNC_LOG;
   114     RPointerArray<CCalEntry> entryArray;
   121     RPointerArray<CCalEntry> entryArray;
   115     CleanupClosePushL( entryArray );
   122     CleanupStack::PushL(
       
   123             TCleanupItem(
       
   124                 CalEntryPointerArrayCleanup,
       
   125                 &entryArray ) );
       
   126     
   116     TInt ret = iEntry->FetchConflictingEntriesL( entryArray );
   127     TInt ret = iEntry->FetchConflictingEntriesL( entryArray );
   117     if( ret == KErrNotFound )
   128     if( ret == KErrNotFound )
   118         {
   129         {
   119         User::Leave( KErrNotFound );
   130         User::Leave( KErrNotFound );
   120         }
   131         }
   129     if (numEnteries != KZero)
   140     if (numEnteries != KZero)
   130         {// there is atleast one entry
   141         {// there is atleast one entry
   131         // get the first conflicting entry and set the string for display
   142         // get the first conflicting entry and set the string for display
   132         meetingTitle    = entryArray[KZero]->SummaryL();
   143         meetingTitle    = entryArray[KZero]->SummaryL();
   133         meetingLocation = entryArray[KZero]->LocationL();
   144         meetingLocation = entryArray[KZero]->LocationL();
       
   145 
       
   146         
       
   147         if ( ( meetingLocation.Length()== 0 ) && ( meetingTitle.Length() == 0 ) )
       
   148         	{
       
   149             // if no title, set unnamed text:
       
   150             HBufC* title = StringLoader::LoadLC ( R_QTN_MEET_REQ_CONFLICT_UNNAMED );
       
   151             meetingTitle.Copy( *title );
       
   152             CleanupStack::PopAndDestroy( title );
       
   153         	}
       
   154         
   134         dispStrLength = meetingTitle.Length() + meetingLocation.Length();
   155         dispStrLength = meetingTitle.Length() + meetingLocation.Length();
   135         startTime   = entryArray[KZero]->StartTimeL().TimeLocalL();
   156         startTime   = entryArray[KZero]->StartTimeL().TimeLocalL();
   136         endTime     = entryArray[KZero]->EndTimeL().TimeLocalL();
   157         endTime     = entryArray[KZero]->EndTimeL().TimeLocalL();
   137         }
   158         }
   138 
   159 
   207         if ( error != KErrNone )
   228         if ( error != KErrNone )
   208             {
   229             {
   209             CEikonEnv::Static()-> // codescanner::eikonenvstatic
   230             CEikonEnv::Static()-> // codescanner::eikonenvstatic
   210                 HandleError(error);
   231                 HandleError(error);
   211             }
   232             }
   212         iNote->SetPositionAndAlignment( CESMRLayoutManager::ConflictPopupPosition(),
   233         
   213                 EHLeftVCenter );
   234         // TODO: use XML layout data. Use this one popup_preview_text_window
       
   235         /*iNote->SetPositionAndAlignment( CESMRLayoutManager::ConflictPopupPosition(),
       
   236                 EHLeftVCenter );*/
   214         iNote->ShowInfoPopupNote();
   237         iNote->ShowInfoPopupNote();
   215     }
   238     }
   216 
   239 
   217 
   240 
   218 // ---------------------------------------------------------------------------
   241 // ---------------------------------------------------------------------------