startupservices/Startup/src/StartupUserWelcomeNote.cpp
branchRCL_3
changeset 19 924385140d98
parent 18 0818dd463d41
child 20 c2c61fdca848
equal deleted inserted replaced
18:0818dd463d41 19:924385140d98
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     This class is the container class of the CStartupUerWelcomeNote.
       
    16 *     Is user for showing user selected picture, text or predefined animation.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <aknappui.h>
       
    24 #include <coemain.h>
       
    25 #include <aknnotewrappers.h>
       
    26 #include <AknGlobalNote.h>
       
    27 #include <barsread.h> //use of TResourceReader
       
    28 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    29 #include "startupview.h"
       
    30 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    31 #include <StarterClient.h>     //used for RemoveSplashScreen
       
    32 #include <startup.mbg>
       
    33 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    34 #include <e32const.h>
       
    35 #include "StartupUserWelcomeNote.h"
       
    36 #include <startup.rsg>
       
    37 #include <centralrepository.h>
       
    38 #include <startupdomaincrkeys.h>
       
    39 #include "StartupDefines.h"
       
    40 #include "startup.hrh"
       
    41 #include "StartupAppUi.h"
       
    42 #include "aknSDData.h"
       
    43 
       
    44 // ================= MEMBER FUNCTIONS =======================
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CStartupUseWelcomeNote::ConstructL
       
    48 //
       
    49 // ---------------------------------------------------------------------------
       
    50 void CStartupUserWelcomeNote::ConstructL( const TRect& /*aRect*/ )
       
    51     {
       
    52     TRACES("CStartupUserWelcomeNote::ConstructL()");
       
    53 
       
    54     iAvkonAppUi->StatusPane()->MakeVisible( EFalse );
       
    55 
       
    56 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    57 
       
    58     SetContainerWindowL( iView );
       
    59     iView.SetComponent( *this );
       
    60 
       
    61 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    62 
       
    63     CreateWindowL();
       
    64     iNoteCancelTimer = CPeriodic::NewL( EPriorityNormal );
       
    65 
       
    66 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    67 
       
    68     iBitmap = new(ELeave) CFbsBitmap();
       
    69 
       
    70     //get user selected userwelcomenotetype from Central Repository
       
    71     TInt err = GetUserWelcomeNoteTypeInfo();
       
    72 
       
    73     if( err != KErrNone )
       
    74         {
       
    75         TRACES("CStartupUserWelcomeNote::ConstructL(): Show default note");
       
    76         //in error case default uwn (no note) is shown
       
    77         iNoteType = EDefaultWelcomeNote;
       
    78         iNoteDefaultVariationType = EStartupUWNDefaultNoNote;
       
    79         }
       
    80     //Do some preparations for showing user welcome note later
       
    81     //This makes the starting to show much more quicker
       
    82     switch ( iNoteType )
       
    83         {
       
    84         case ETextWelcomeNote:
       
    85             {
       
    86             TRACES("CStartupUserWelcomeNote::ConstructL(): iNoteType == ETextWelcomeNote");
       
    87             }
       
    88             break;
       
    89         case EImageWelcomeNote:
       
    90             {
       
    91             TRACES("CStartupUserWelcomeNote::ConstructL(): iNoteType == EImageWelcomeNote");
       
    92             TInt errorCode = iBitmap->Load( TPtrC(iNotePath.Ptr()) );
       
    93             TRACES1("CStartupUserWelcomeNote::ConstructL(): Load returned %d", errorCode);
       
    94             if(iStartupAppUi.CoverUISupported())
       
    95                 {
       
    96                 SecondaryDisplay::TWelcomeImage data(TPtrC(iNotePath.Ptr()));
       
    97                 SecondaryDisplay::TWelcomeImagePckg Pckg( data );
       
    98                 iStartupAppUi.RaiseCoverUIEvent( SecondaryDisplay::KCatStartup,
       
    99                                                  SecondaryDisplay::EMsgWelcomeImageEvent,
       
   100                                                  Pckg);
       
   101                 }
       
   102             }
       
   103             break;
       
   104         default:
       
   105             {
       
   106             TRACES("CStartupUserWelcomeNote::ConstructL(): iNoteType == EDefaultWelcomeNote");
       
   107             switch ( iNoteDefaultVariationType )
       
   108                 {
       
   109                 case EStartupUWNDefaultOperatorGraphic:
       
   110                     {
       
   111                     TRACES("CStartupUserWelcomeNote::ConstructL(): iNoteDefaultVariationType == EStartupUWNDefaultOperatorGraphic");
       
   112                     iBitmap->Load( TPtrC(iNoteOperPath.Ptr()) );
       
   113                     if(iStartupAppUi.CoverUISupported())
       
   114                         {
       
   115                         SecondaryDisplay::TWelcomeImage data(TPtrC(iNoteOperPath.Ptr()));
       
   116                         SecondaryDisplay::TWelcomeImagePckg Pckg( data );
       
   117                         iStartupAppUi.RaiseCoverUIEvent( SecondaryDisplay::KCatStartup,
       
   118                                                          SecondaryDisplay::EMsgWelcomeImageEvent,
       
   119                                                          Pckg);
       
   120                         }
       
   121                     }
       
   122                     break;
       
   123                 case EStartupUWNDefaultOperatorText:
       
   124                 case EStartupUWNDefaultNoNote:
       
   125                 default:
       
   126                     {
       
   127                     //nothing preparation
       
   128                     TRACES("CStartupUserWelcomeNote::ConstructL(): iNoteDefaultVariationType == EStartupUWNDefaultOperatorText or EStartupUWNDefaultNoNote");
       
   129                     }
       
   130                     break;
       
   131                 }
       
   132             }
       
   133             break;
       
   134         }
       
   135 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   136     //get information for draw-function
       
   137     iWelcomeNoteType = NoteTypeInformation();
       
   138 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   139 
       
   140     SetRect(iAvkonAppUi->ApplicationRect());
       
   141     ActivateL();
       
   142     TRACES("CStartupUserWelcomeNote::ConstructL(): End");
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CStartupUserWelcomeNote::NewL
       
   147 // Two-phased constructor.
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 CStartupUserWelcomeNote* CStartupUserWelcomeNote::NewL(
       
   151     CStartupAppUi& aStartupAppUi,
       
   152     const TRect& aRect
       
   153 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   154   , CStartupView& aView
       
   155 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   156     )
       
   157     {
       
   158     TRACES("CStartupUserWelcomeNote::NewL()");
       
   159 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   160     CStartupUserWelcomeNote* self = new (ELeave) CStartupUserWelcomeNote( aStartupAppUi, aView );
       
   161 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   162     CStartupUserWelcomeNote* self = new (ELeave) CStartupUserWelcomeNote( aStartupAppUi );
       
   163 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   164     CleanupStack::PushL(self);
       
   165     self->ConstructL(aRect);
       
   166     CleanupStack::Pop();
       
   167     TRACES("CStartupUserWelcomeNote::NewL(): End");
       
   168     return self;
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------
       
   172 // CStartupUserWelcomeNote::CStartupUserWelcomeNote()
       
   173 // ---------------------------------------------------------
       
   174 CStartupUserWelcomeNote::CStartupUserWelcomeNote( CStartupAppUi& aStartupAppUi
       
   175 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   176   , CStartupView& aView
       
   177 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   178  ) :
       
   179 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   180     iView( aView ),
       
   181 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   182     iSplashScreenRemoved( EFalse ),
       
   183 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   184     iStartupAppUi( aStartupAppUi )
       
   185 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   186   , iUserWelcomeNoteShowing( EFalse ),
       
   187     iUserWelcomeNoteCancelled( EFalse)
       
   188 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   189     {
       
   190     TRACES("CStartupUserWelcomeNote::CStartupUserWelcomeNote()");
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CStartupUseWelcomeNote::StartL()
       
   195 // ---------------------------------------------------------------------------
       
   196 void CStartupUserWelcomeNote::StartL()
       
   197     {
       
   198     TRACES("CStartupUserWelcomeNote::StartL()");
       
   199     switch ( iNoteType )
       
   200         {
       
   201         case ETextWelcomeNote:
       
   202             {
       
   203             TRACES("CStartupUserWelcomeNote::StartL(): ETextWelcomeNote");
       
   204             ShowInformationNoteWrapperL();
       
   205             }
       
   206             break;
       
   207         case EImageWelcomeNote:
       
   208             {
       
   209             TRACES("CStartupUserWelcomeNote::StartL(): EImageWelcomeNote");
       
   210             DrawImageWelcomeNote();
       
   211             }
       
   212             break;
       
   213         default:
       
   214             {
       
   215             TRACES("CStartupUserWelcomeNote::StartL(): default");
       
   216             switch ( iNoteDefaultVariationType )
       
   217                 {
       
   218                 case EStartupUWNDefaultOperatorGraphic:
       
   219                     {
       
   220                     TRACES("CStartupUserWelcomeNote::StartL(): EStartupUWNDefaultOperatorGraphic");
       
   221                     DrawImageWelcomeNote();
       
   222                     }
       
   223                     break;
       
   224                 case EStartupUWNDefaultOperatorText:
       
   225                     {
       
   226                     TRACES("CStartupUserWelcomeNote::StartL(): EStartupUWNDefaultOperatorText");
       
   227                     ShowInformationNoteWrapperL();
       
   228                     }
       
   229                     break;
       
   230                 case EStartupUWNDefaultNoNote:
       
   231                 default:
       
   232                     TRACES("CStartupUserWelcomeNote::StartL(): EStartupUWNDefaultNoNote");
       
   233                     break;
       
   234                 }
       
   235             }
       
   236             break;
       
   237         }
       
   238     ControlEnv()->WsSession().Flush(); // force draw of the context
       
   239     TRACES("CStartupUserWelcomeNote::StartL(): End");
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CStartupUserWelcomeNote::NoteTypeInformation()
       
   244 // ---------------------------------------------------------
       
   245 TStartupNoteTypeInformation CStartupUserWelcomeNote::NoteTypeInformation()
       
   246     {
       
   247     TRACES("CStartupUserWelcomeNote::NoteTypeInformation()");
       
   248     if( iNoteType == EDefaultWelcomeNote && iNoteDefaultVariationType == EStartupUWNDefaultNoNote )
       
   249         {
       
   250         TRACES("CStartupUserWelcomeNote::NoteTypeInformation(): End, return EStartupNoNote");
       
   251         return EStartupNoNote;
       
   252         }
       
   253     else if( ( iNoteType == ETextWelcomeNote ) ||
       
   254              ( iNoteType == EDefaultWelcomeNote &&
       
   255                iNoteDefaultVariationType == EStartupUWNDefaultOperatorText ) )
       
   256         {
       
   257         TRACES("CStartupUserWelcomeNote::NoteTypeInformation(): End, return EStartupText");
       
   258         return EStartupText;
       
   259         }
       
   260     else if( ( iNoteType == EImageWelcomeNote ) ||
       
   261                 ( iNoteType == EDefaultWelcomeNote &&
       
   262                   iNoteDefaultVariationType == EStartupUWNDefaultOperatorGraphic ) )
       
   263         {
       
   264         TRACES("CStartupUserWelcomeNote::NoteTypeInformation(): End, return EStartupImage");
       
   265         return EStartupImage;
       
   266         }
       
   267     else
       
   268         {
       
   269         __ASSERT_DEBUG( EFalse, PANIC( EStartupNeverShouldBeHere ) );
       
   270         return EStartupNoNote;
       
   271         }
       
   272     }
       
   273 
       
   274 // ---------------------------------------------------------------------------
       
   275 // CStartupUseWelcomeNote::DrawImageWelcomeNote
       
   276 // ---------------------------------------------------------------------------
       
   277 void CStartupUserWelcomeNote::DrawImageWelcomeNote()
       
   278     {
       
   279     TRACES("CStartupUserWelcomeNote::DrawImageWelcomeNote()");
       
   280 
       
   281     CWindowGc& gc = SystemGc();
       
   282     TInt xDelta=0; // for x coordinates
       
   283     TInt yDelta=0; // for y coordinates
       
   284     TSize bmpSizeInPixels = iBitmap->SizeInPixels();
       
   285     //center image to the center of the screen
       
   286     TRect rect = Rect();
       
   287     xDelta=( rect.Width() - bmpSizeInPixels.iWidth ) / 2;
       
   288     yDelta=( rect.Height() - bmpSizeInPixels.iHeight ) / 2;
       
   289     TPoint pos = TPoint( xDelta , yDelta ); // displacement vector
       
   290     ActivateGc();
       
   291     Window().Invalidate( rect );
       
   292     Window().BeginRedraw( rect );
       
   293     gc.BitBlt( pos, iBitmap ); // CWindowGc member function
       
   294     DrawUtils::ClearBetweenRects(gc, Rect(), TRect(pos,bmpSizeInPixels));
       
   295     Window().EndRedraw();
       
   296     DeactivateGc();
       
   297     TRACES("CStartupUserWelcomeNote::DrawImageWelcomeNote(): End");
       
   298     }
       
   299 
       
   300 // ---------------------------------------------------------------------------
       
   301 // CStartupUseWelcomeNote::~CStartupUserWelcomeNote()
       
   302 // ---------------------------------------------------------------------------
       
   303 CStartupUserWelcomeNote::~CStartupUserWelcomeNote()
       
   304     {
       
   305     TRACES("CStartupUserWelcomeNote::~CStartupUserWelcomeNote()");
       
   306 
       
   307     delete iBitmap;
       
   308 
       
   309 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   310     iView.RemoveComponent();
       
   311 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   312     if( iNoteCancelTimer )
       
   313         {
       
   314         iNoteCancelTimer->Cancel();
       
   315         }
       
   316     delete iNoteCancelTimer;
       
   317 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   318 
       
   319     TRACES("CStartupUserWelcomeNote::~CStartupUserWelcomeNote(): End");
       
   320     }
       
   321 
       
   322 // ---------------------------------------------------------------------------
       
   323 // CStartupUserWelcomeNote::ComponentControl(TInt aIndex)
       
   324 // ---------------------------------------------------------------------------
       
   325 CCoeControl* CStartupUserWelcomeNote::ComponentControl(TInt /*aIndex*/) const
       
   326     {
       
   327     return NULL;
       
   328     }
       
   329 
       
   330 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   331 // ---------------------------------------------------------------------------
       
   332 // CStartupUserWelcomeNote::DrawBlankScreen() const
       
   333 // ---------------------------------------------------------------------------
       
   334 void CStartupUserWelcomeNote::DrawBlankScreen() const
       
   335     {
       
   336     TRACES("CStartupUserWelcomeNote::DrawBlankScreen()");
       
   337     CWindowGc& gc = SystemGc();
       
   338     TRect rect = Rect();
       
   339     gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   340     gc.SetBrushColor(KRgbWhite);
       
   341     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   342     gc.DrawRect(rect);
       
   343     ControlEnv()->WsSession().Flush(); // force draw of the context
       
   344     TRACES("CStartupUserWelcomeNote::DrawBlankScreen(): End");
       
   345     }
       
   346 
       
   347 // ---------------------------------------------------------------------------
       
   348 // CStartupUserWelcomeNote::HandleControlEventL(...)
       
   349 // ---------------------------------------------------------------------------
       
   350 void CStartupUserWelcomeNote::HandleControlEventL(
       
   351         CCoeControl* /*aControl*/,
       
   352         TCoeEvent /*aEventType*/)
       
   353     {
       
   354     //pure virtual from MCoeControlObserver
       
   355     TRACES("CStartupUserWelcomeNote::HandleControlEventL()");
       
   356     }
       
   357 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   358 
       
   359 // ---------------------------------------------------------------------------
       
   360 // CStartupUserWelcomeNote::UserWelcomeNoteType()
       
   361 // ---------------------------------------------------------------------------
       
   362 TStartupWelcomeNoteType CStartupUserWelcomeNote::UserWelcomeNoteType()
       
   363     {
       
   364     return ( iNoteType );
       
   365     }
       
   366 
       
   367 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   368 // ---------------------------------------------------------------------------
       
   369 // CStartupUserWelcomeNote::OfferKeyEventL(...)
       
   370 // ---------------------------------------------------------------------------
       
   371 TKeyResponse CStartupUserWelcomeNote::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
       
   372     {
       
   373     TRACES("CStartupUserWelcomeNote::OfferKeyEventL()");
       
   374     if( iUserWelcomeNoteShowing && !iStartupAppUi.HiddenReset() && !iUserWelcomeNoteCancelled )
       
   375         {
       
   376         // Cancel UWN
       
   377         TRACES("CStartupUserWelcomeNote::OfferKeyEventL(): Timer activated - before");
       
   378         iNoteCancelTimer->Start( 10000, 10000,
       
   379                            TCallBack( iStartupAppUi.DoStopTimingL, &iStartupAppUi ) );
       
   380         iUserWelcomeNoteCancelled = ETrue;
       
   381         TRACES("CStartupUserWelcomeNote::OfferKeyEventL(): Timer activated - after");
       
   382         }
       
   383     TRACES("CStartupUserWelcomeNote::OfferKeyEventL(): End");
       
   384     return EKeyWasConsumed;
       
   385     }
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // CStartupUserWelcomeNote::CancelNoteCancelTimer()
       
   389 // ---------------------------------------------------------------------------
       
   390 void CStartupUserWelcomeNote::CancelNoteCancelTimer()
       
   391     {
       
   392     TRACES("CStartupUserWelcomeNote::CancelNoteCancelTimer()");
       
   393     iNoteCancelTimer->Cancel();
       
   394     TRACES("CStartupUserWelcomeNote::CancelNoteCancelTimer(): End");
       
   395     }
       
   396 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   397 
       
   398 // ---------------------------------------------------------------------------
       
   399 // CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo()
       
   400 // ---------------------------------------------------------------------------
       
   401 TInt CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo()
       
   402     {
       
   403     TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo()");
       
   404     TInt err( KErrGeneral );
       
   405 
       
   406     CRepository* repository(NULL);
       
   407 
       
   408     TRAP( err, repository = CRepository::NewL( KCRUidStartupConf ) );
       
   409     if ( err == KErrNone )
       
   410         {
       
   411         TInt type;
       
   412         TBuf<KStartupTBufMaxLength> atext;
       
   413         TBuf<KStartupTBufMaxLength> apath;
       
   414         TBuf<KStartupTBufMaxLength> aoperatortext;
       
   415         TBuf<KStartupTBufMaxLength> aoperatorpath;
       
   416 
       
   417         err = repository->Get( KStartupWelcomeNoteType, type );
       
   418         TRACES2("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Welcome note type = %d, err = %d", type, err );
       
   419 
       
   420         err = repository->Get( KStartupWelcomeNoteText, atext );
       
   421         TRACES2("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Welcome note text = '%S', err = %d", &atext, err );
       
   422 
       
   423         err = repository->Get( KStartupWelcomeNoteImage, apath );
       
   424         TRACES2("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Welcome note image path = '%S', err = %d", &apath, err);
       
   425 
       
   426         switch (type)
       
   427             {
       
   428             case EDefaultWelcomeNote:
       
   429                 {
       
   430                 TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): EDefaultWelcomeNote");
       
   431                 iNoteType = EDefaultWelcomeNote;
       
   432 
       
   433                 repository->Get( KStartupOperatorNoteImage, aoperatorpath );
       
   434                 TRACES1("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Operator image path: '%S'", &aoperatorpath);
       
   435                 TInt opImageStatus = CheckImage(aoperatorpath);
       
   436                 TRACES1("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Operator image status: %d", opImageStatus);
       
   437 
       
   438                 repository->Get( KStartupOperatorNoteText, aoperatortext );
       
   439                 TRACES1("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Operator text: '%S'", &aoperatortext);
       
   440 
       
   441                 if ( opImageStatus == KErrNone )
       
   442                     {
       
   443                     TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Default note type is EStartupUWNDefaultOperatorGraphic");
       
   444                     iNoteDefaultVariationType = EStartupUWNDefaultOperatorGraphic;
       
   445                     }
       
   446                 else if ( aoperatortext.Length() > 0 )
       
   447                     {
       
   448                     TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Default note type is EStartupUWNDefaultOperatorText");
       
   449                     iNoteDefaultVariationType = EStartupUWNDefaultOperatorText;
       
   450                     }
       
   451                 else
       
   452                     {
       
   453                     TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): Default note type is EStartupUWNDefaultNoNote");
       
   454                     iNoteDefaultVariationType = EStartupUWNDefaultNoNote;
       
   455                     }
       
   456                 }
       
   457                 break;
       
   458             case ETextWelcomeNote:
       
   459                 {
       
   460                 TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): ETextWelcomeNote");
       
   461                 iNoteType = ETextWelcomeNote;
       
   462                 }
       
   463                 break;
       
   464             case EImageWelcomeNote:
       
   465                 {
       
   466                 TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): EImageWelcomeNote");
       
   467                 if (CheckImage(apath) != KErrNone)
       
   468                     {
       
   469                     //in error case default uwn (no note) is shown
       
   470                     iNoteType = EDefaultWelcomeNote;
       
   471                     iNoteDefaultVariationType = EStartupUWNDefaultNoNote;
       
   472                     }
       
   473                 else
       
   474                     {
       
   475                     iNoteType = EImageWelcomeNote;
       
   476                     }
       
   477                 }
       
   478                 break;
       
   479             default:
       
   480                 {
       
   481                 TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): default");
       
   482                 delete repository;
       
   483                 TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): End, return KErrNotFound");
       
   484                 return KErrNotFound;
       
   485                 }
       
   486             }
       
   487         iNoteText = atext;
       
   488         iNotePath = apath;
       
   489         iNoteOperText = aoperatortext;
       
   490         iNoteOperPath = aoperatorpath;
       
   491         }
       
   492 
       
   493     delete repository;
       
   494     TRACES("CStartupUserWelcomeNote::GetUserWelcomeNoteTypeInfo(): End, return KErrNone");
       
   495     return KErrNone;
       
   496     }
       
   497 
       
   498 // ---------------------------------------------------------------------------
       
   499 // CStartupUserWelcomeNote::ShowInformationNoteWrapperL()
       
   500 // ---------------------------------------------------------------------------
       
   501 void CStartupUserWelcomeNote::ShowInformationNoteWrapperL()
       
   502     {
       
   503     TRACES("CStartupUserWelcomeNote::ShowInformationNoteWrapperL()");
       
   504     TRACES1("CStartupUserWelcomeNote::ShowInformationNoteWrapperL(): Note type = %d", iNoteDefaultVariationType);
       
   505 
       
   506     TRequestStatus status;
       
   507     CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   508     if ( iNoteDefaultVariationType == EStartupUWNDefaultOperatorText)
       
   509         {
       
   510         // Set secondary display data if necessary
       
   511         if ( iStartupAppUi.CoverUISupported() )
       
   512             {
       
   513             SecondaryDisplay::TWelcomeNotePckg pckg(TPtrC(iNoteOperText.Ptr()));
       
   514             CAknSDData* sd = CAknSDData::NewL(SecondaryDisplay::KCatStartup, SecondaryDisplay::ECmdShowWelcomeNote, pckg);
       
   515             note->SetSecondaryDisplayData(sd); // ownership to notifier client
       
   516             }
       
   517         TRACES1("CStartupUserWelcomeNote::ShowInformationNoteWrapperL(): Operator text is '%S'", &iNoteOperText);
       
   518         note->ShowNoteL( status, EAknGlobalTextNote, TPtrC(iNoteOperText.Ptr()) );
       
   519         }
       
   520     else
       
   521         {
       
   522         // Set secondary display data if necessary
       
   523         if ( iStartupAppUi.CoverUISupported() )
       
   524             {
       
   525             SecondaryDisplay::TWelcomeNotePckg pckg(TPtrC(iNoteText.Ptr()));
       
   526             CAknSDData* sd = CAknSDData::NewL(SecondaryDisplay::KCatStartup, SecondaryDisplay::ECmdShowWelcomeNote, pckg);
       
   527             note->SetSecondaryDisplayData(sd); // ownership to notifier client
       
   528             }
       
   529         TRACES1("CStartupUserWelcomeNote::ShowInformationNoteWrapperL(): Welcome text is '%S'", &iNoteText);
       
   530         note->ShowNoteL( status, EAknGlobalTextNote, TPtrC(iNoteText.Ptr()) );
       
   531         }
       
   532     User::WaitForRequest( status );
       
   533     CleanupStack::PopAndDestroy(); // note
       
   534     TRACES("CStartupUserWelcomeNote::ShowInformationNoteWrapperL(): End");
       
   535     }
       
   536 
       
   537 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   538 // ---------------------------------------------------------------------------
       
   539 // CStartupUserWelcomeNote::SetUserWelcomeNoteShowing(...)
       
   540 // ---------------------------------------------------------------------------
       
   541 void CStartupUserWelcomeNote::SetUserWelcomeNoteShowing(TBool aValue)
       
   542     {
       
   543     TRACES1("CStartupUserWelcomeNote::SetUserWelcomeNoteShowing(): aValue = %d", aValue);
       
   544     iUserWelcomeNoteShowing = aValue;
       
   545     }
       
   546 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   547 
       
   548 // ---------------------------------------------------------------------------
       
   549 // CStartupUserWelcomeNote::SetUserWelcomeNoteShowing(...)
       
   550 // ---------------------------------------------------------------------------
       
   551 TInt CStartupUserWelcomeNote::CheckImage( const TDesC& aPath)
       
   552     {
       
   553     TRACES("CStartupUserWelcomeNote::CheckImage()");
       
   554     // Check if given welcome image is available
       
   555     RFile welcomeimage;
       
   556     TInt err( KErrNone );
       
   557     RFs fs;
       
   558 
       
   559     // Connect to file server
       
   560     err = fs.Connect();
       
   561     if (err != KErrNone)
       
   562         {
       
   563         TRACES("CStartupUserWelcomeNote::CheckImage(): Unable to connect to file server. Do not show welcome image.");
       
   564         fs.Close();
       
   565         TRACES1("CStartupUserWelcomeNote::CheckImage(): End, return %d", err);
       
   566         return err;
       
   567         }
       
   568 
       
   569     // Open welcome image
       
   570     err = welcomeimage.Open(fs, aPath, EFileRead);
       
   571     if (err != KErrNone)
       
   572         {
       
   573         TRACES("CStartupUserWelcomeNote::CheckImage(): Welcome image does not exists. Do not try to show it.");
       
   574         welcomeimage.Close();
       
   575         fs.Close();
       
   576         TRACES1("CStartupUserWelcomeNote::CheckImage(): End, return %d", err);
       
   577         return err;
       
   578         }
       
   579 
       
   580     welcomeimage.Close();
       
   581     fs.Close();
       
   582     TRACES1("CStartupUserWelcomeNote::CheckImage(): End, return %d", err);
       
   583     return err;
       
   584     }
       
   585 
       
   586 //  End of File
       
   587