meetingrequest/mrgui/src/cesmrglobalnote.cpp
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Edit before send list pop-up query
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "emailtrace.h"
       
    21 #include "cesmrglobalnote.h"
       
    22 #include "esmrhelper.h"//locateresourcefile
       
    23 //<cmail>
       
    24 #include "esmrdef.h"
       
    25 //</cmail>
       
    26 #include <AknGlobalNote.h>
       
    27 #include <bautils.h>
       
    28 #include <esmrgui.rsg>
       
    29 #include <eikenv.h>
       
    30 #include <avkon.hrh>
       
    31 #include <data_caging_path_literals.hrh>
       
    32 
       
    33 // CONSTANTS
       
    34 // Unnamed namespace for local definitions
       
    35 namespace {
       
    36 
       
    37 _LIT(KResourceFileName,"esmrgui.rsc");
       
    38 
       
    39 } // namespace
       
    40 
       
    41 // ======== MEMBER FUNCTIONS ========
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CESMRGlobalNote::CESMRGlobalNote
       
    45 // C++ default constructor can NOT contain any code, that
       
    46 // might leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 CESMRGlobalNote::CESMRGlobalNote(
       
    50             TESMGlobalNoteType aType)
       
    51 :   iType(aType)
       
    52     {
       
    53     FUNC_LOG;
       
    54     // Do nothing
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CESMRGlobalNote::~CESMRGlobalNote
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CESMRGlobalNote::~CESMRGlobalNote()
       
    62     {
       
    63     FUNC_LOG;
       
    64     iEnv->DeleteResourceFile(iResourceOffset);    
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CESMRGlobalNote::NewL
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CESMRGlobalNote* CESMRGlobalNote::NewL(
       
    72         TESMGlobalNoteType aType)
       
    73     {
       
    74     FUNC_LOG;
       
    75     CESMRGlobalNote* self =
       
    76             new (ELeave) CESMRGlobalNote(aType);
       
    77     CleanupStack::PushL( self );
       
    78     self->ConstructL( );
       
    79     CleanupStack::Pop( self );
       
    80     return self;
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CESMRGlobalNote::ConstructL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void CESMRGlobalNote::ConstructL()
       
    88     {
       
    89     FUNC_LOG;
       
    90     TFileName filename;    
       
    91     iEnv = CEikonEnv::Static();// codescanner::eikonenvstatic
       
    92 
       
    93     ESMRHelper::LocateResourceFile(
       
    94             KResourceFileName,
       
    95             KDC_RESOURCE_FILES_DIR,
       
    96             filename,
       
    97             &iEnv->FsSession() );
       
    98 
       
    99 
       
   100     //for localization
       
   101     BaflUtils::NearestLanguageFile(iEnv->FsSession(),filename); 
       
   102     iResourceOffset = iEnv->AddResourceFileL(filename);
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CESMRGlobalNote::ExecuteL
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 EXPORT_C void CESMRGlobalNote::ExecuteL(TESMGlobalNoteType aType)
       
   110     {
       
   111     FUNC_LOG;
       
   112     CESMRGlobalNote* query = CESMRGlobalNote::NewL( aType );
       
   113     CleanupStack::PushL(query);
       
   114     query->ExecuteLD();
       
   115     CleanupStack::Pop(query);
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CESMRGlobalNote::NoteType
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 TAknGlobalNoteType CESMRGlobalNote::NoteType()
       
   123     {
       
   124     FUNC_LOG;
       
   125     TAknGlobalNoteType type(EAknGlobalInformationNote);
       
   126     switch ( iType )
       
   127         {
       
   128         case EESMRCorruptedMR:
       
   129             {
       
   130             type = EAknGlobalErrorNote;
       
   131             break;
       
   132             }
       
   133         case EESMRCalenLaterDate: // FALLTHROUGH
       
   134         case EESMREndsBeforeStarts: // FALLTHROUGH
       
   135         case EESMREntryEndEarlierThanItStart: // FALLTHROUGH
       
   136         case EESMRRepeatEndEarlierThanItStart: // FALLTHROUGH
       
   137         case EESMRAlarmAlreadyPassed: // FALLTHROUGH
       
   138         case EESMRDiffMoreThanMonth: // FALLTHROUGH
       
   139         case EESMREntrySaved: // FALLTHROUGH
       
   140         case EESMRTodoEntrySaved: // FALLTHROUGH
       
   141         case EESMRRepeatDifferentStartAndEndDate:
       
   142         case EESMRRepeatReSchedule:
       
   143         case EESMRCannotDisplayMuchMore:
       
   144             {
       
   145             type = EAknGlobalInformationNote;
       
   146             break;
       
   147             }
       
   148         default:
       
   149             {
       
   150             break;
       
   151             }
       
   152         }
       
   153     return type;
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CESMRGlobalNote::NoteTextLC
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 HBufC* CESMRGlobalNote::NoteTextLC()
       
   161     {
       
   162     FUNC_LOG;
       
   163     HBufC* noteText = NULL;
       
   164     switch ( iType )
       
   165         {
       
   166         case EESMRCorruptedMR:
       
   167             {
       
   168             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   169                                 R_QTN_MEET_REQ_CORRUPTED_NOTE);
       
   170             break;
       
   171             }
       
   172         case EESMREndsBeforeStarts:
       
   173             {
       
   174             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   175                             R_QTN_MEET_REQ_INFO_NOTE_ENDS_BEFORE);
       
   176             break;
       
   177             }
       
   178         case EESMRCalenLaterDate:
       
   179             {
       
   180             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   181                             R_QTN_MEET_REQ_LATER_DATE);
       
   182             break;
       
   183             }
       
   184         case EESMREntryEndEarlierThanItStart:
       
   185             {
       
   186             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   187                             R_QTN_MEET_REQ_INFO_NOTE_ENDS_BEFORE );
       
   188             break;
       
   189             }
       
   190         case EESMRRepeatEndEarlierThanItStart:
       
   191             {
       
   192             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   193                             R_QTN_CALENDAR_INFO_REPEAT_INVALID );
       
   194             break;
       
   195             }
       
   196         case EESMRAlarmAlreadyPassed:
       
   197             {
       
   198             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   199                             R_QTN_CALENDAR_ALARM_PASSED );
       
   200             break;
       
   201             }
       
   202         case EESMRDiffMoreThanMonth:
       
   203             {
       
   204             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   205                             R_QTN_CALENDAR_ALARM_DIFFERENCE );
       
   206             break;
       
   207             }
       
   208         case EESMREntrySaved:
       
   209             {
       
   210             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   211                             R_QTN_MEET_REQ_NOTE_SAVED );
       
   212             break;
       
   213             }
       
   214         case EESMRTodoEntrySaved:
       
   215             {
       
   216             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   217                             R_QTN_MEET_REQ_TODO_SAVED );
       
   218             break;
       
   219             }
       
   220         case EESMRRepeatDifferentStartAndEndDate:
       
   221             {
       
   222             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   223                     R_QTN_MEET_REQ_INFO_START_END_DATE );
       
   224             }
       
   225             break;
       
   226         case EESMRRepeatReSchedule:
       
   227             {
       
   228             noteText = iEnv->AllocReadResourceAsDes16LC(
       
   229                     R_MEET_REQ_RESCHEDULE_INSTANCE );
       
   230             }
       
   231             break;
       
   232         case EESMRCannotDisplayMuchMore:
       
   233         	{
       
   234         	noteText = iEnv->AllocReadResourceAsDes16LC(
       
   235                     R_QTN_MEET_REQ_LONG_DESCRIPTION );
       
   236         	}
       
   237             break;
       
   238         default:
       
   239             {
       
   240             break;
       
   241             }
       
   242         }
       
   243     return noteText;
       
   244     }
       
   245 
       
   246 // -----------------------------------------------------------------------------
       
   247 // CESMRGlobalNote::ExecuteLD
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 void CESMRGlobalNote::ExecuteLD()
       
   251     {
       
   252     FUNC_LOG;
       
   253     CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   254     HBufC* noteText = NoteTextLC();
       
   255 
       
   256     note->ShowNoteL(
       
   257             NoteType(),
       
   258             *noteText );
       
   259 
       
   260     CleanupStack::PopAndDestroy( noteText );
       
   261     noteText = NULL;
       
   262 
       
   263     CleanupStack::PopAndDestroy( note );
       
   264     note = NULL;
       
   265 
       
   266     // Deleting 'this' object because this id D-method.
       
   267     delete this;
       
   268     }
       
   269 
       
   270 // EOF
       
   271