S60 3rd Edition SDK for Symbian OS
Example Applications Guide

BrCtlSampleAppDialogsProvider.cpp

00001 /*
00002 * ============================================================================
00003 *  Name        : BrCtlSampleAppDialogsProvider.cpp
00004 *  Part of     : BrCtlSampleApp
00005 *  Interface   : Browser Control API
00006 *  Description : Override dialogs provided by the Browser Control
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include "BrCtlSampleAppDialogsProvider.h"
00018 #include "BrCtlSampleAppQueryDialog.h"
00019 #include "BrCtlSampleAppContainer.h"
00020 
00021 #include <eiklabel.h>  // for example label control
00022 #include <avkon.hrh>
00023 #include <BrCtlSampleApp.rsg>
00024 #include "brctlsampleapp.hrh"
00025 #include <BrCtlInterface.h>
00026 #include <CHARCONV.H>
00027 #include <gdi.h>
00028 #include <bitdev.h>
00029 #include <aknmessagequerydialog.h>              // DialogAlertL
00030 
00031 // ================= MEMBER FUNCTIONS =======================
00032 
00033 // ---------------------------------------------------------
00034 // CBrCtlSampleAppDialogsProvider::DialogAlertL
00035 // ---------------------------------------------------------
00036 //
00037 void 
00038 CBrCtlSampleAppDialogsProvider::DialogAlertL(const TDesC& aTitle, const TDesC& aMessage)
00039     {
00040     _LIT(KEndMessage, "\n\n");
00041     HBufC* messagebody = HBufC::NewLC( aMessage.Length()+2 );
00042     messagebody->Des().Append( aMessage );
00043     messagebody->Des().Append(KEndMessage);
00044 
00045     HBufC* header = HBufC::NewLC( aTitle.Length() );
00046         header->Des().Append( aTitle );
00047 
00048     CAknMessageQueryDialog* dialog = 
00049                             CAknMessageQueryDialog::NewL( *messagebody );
00050 
00051     dialog->PrepareLC( R_AVKON_MESSAGE_QUERY_DIALOG );
00052     dialog->ButtonGroupContainer().MakeCommandVisible( 
00053                                                                                                         EAknSoftkeyCancel, EFalse );
00054 
00055     dialog->QueryHeading()->SetTextL( *header );
00056 
00057     dialog->RunLD();
00058 
00059     CleanupStack::PopAndDestroy( 2 );  // header , messagebody 
00060     }
00061 
00062 // ---------------------------------------------------------
00063 // CBrCtlSampleAppDialogsProvider::ConstructL
00064 // ---------------------------------------------------------
00065 //
00066 void CBrCtlSampleAppDialogsProvider::ConstructL( CBrCtlSampleAppContainer* aContainer)
00067     {
00068     iContainer = aContainer;
00069     }
00070 
00071 // ---------------------------------------------------------
00072 // CBrCtlSampleAppDialogsProvider::~CBrCtlSampleAppDialogsProvider
00073 // ---------------------------------------------------------
00074 //
00075 CBrCtlSampleAppDialogsProvider::~CBrCtlSampleAppDialogsProvider()
00076     {
00077     }
00078 
00079 // ---------------------------------------------------------
00080 // CBrCtlSampleAppDialogsProvider::NewL
00081 // ---------------------------------------------------------
00082 //
00083 CBrCtlSampleAppDialogsProvider* CBrCtlSampleAppDialogsProvider::NewL(CBrCtlSampleAppContainer* aContainer)
00084 {
00085   CBrCtlSampleAppDialogsProvider* self = new(ELeave)CBrCtlSampleAppDialogsProvider;
00086   CleanupStack::PushL(self);
00087   self->ConstructL(aContainer);
00088   CleanupStack::Pop();
00089   return self;
00090 }
00091 
00092 // End of File  
00093 

© Nokia 2006

Back to top