|
Nokia N97 SDK Example Applications Guide |
1. About this Example
2. Architecture
3. Design and Implementation
The follow header files are included in the examples:
The CCommonDialogsExSettingsDialog class is inherited from the following classes:
The following functions have been implemented:
..\group>bldmake bldfiles ..\group>abld build winscw udeb
iLabel = new (ELeave) CEikLabel; iLabel->SetContainerWindowL( *this ); iLabel->SetTextL( _L("Example View") ); iToDoLabel = new (ELeave) CEikLabel; iToDoLabel->SetContainerWindowL( *this ); iToDoLabel->SetTextL( _L("Press Options to start") );
Function ShowTextL(const TDesC& aText, const TDesC& aTextSub) Show text message on screen by using label
iLabel->SetTextL(aText); iToDoLabel->SetTextL(aTextSub);
When the application is launched the CCommonDialogsExAppUi class is initialized by the AppUi class. Here are the steps done in the constructor.
iAppContainer = new (ELeave) CCommonDialogsExContainer; iAppContainer->ConstructL( ClientRect() );
Class CCommonDialogsExSettingsDialog is inherited from class CEikDialog and MEikListBoxObserver. In this class you should implement function PreLayoutDynInitL() OkToExitL() ProcessCommandL() from CEikDialog, implement function HandleListBoxEventL() from MEikListBoxObserver.
Function PreLayoutDynInitL() Initializes the dialog's controls before the dialog is sized and layed out.
CAknSettingStyleListBox* listBox = static_cast< CAknSettingStyleListBox* >
( Control( ECommonDialogsExSettingsListboxId ) );
User::LeaveIfNull( listBox );
Create the memory selection item. If your current SDK support Multiple Drive APIs.
if ( iMultiDriveSupport ) { settingItem = new( ELeave ) CAknMemorySelectionSettingItemMultiDrive( iResourceId, iDriveNumber ); } else { settingItem = new( ELeave ) CAknMemorySelectionSettingItem( iResourceId, iMemory ); } CleanupStack::PushL( settingItem );
Set memory selection item's title
itemTitle = iCoeEnv->AllocReadResourceLC( R_STRING_COMMONDIALOGSEX_SET_MEMORY );
settingItem->ConstructL( EFalse, 0, *itemTitle, NULL, 0,
EAknCtPopupSettingList );
CleanupStack::PopAndDestroy(); // itemTitle
Add memo store item to the settings array
iSettingItemArray.AppendL( settingItem );
CleanupStack::Pop(); // settingItem
Set listBox.
CTextListBoxModel* model = listBox->Model();
model->SetItemTextArray( &iSettingItemArray );
model->SetOwnershipType( ELbmDoesNotOwnItemArray );
iSettingItemArray.RecalculateVisibleIndicesL();
listBox->CreateScrollBarFrameL( ETrue );
listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
listBox->HandleItemAdditionL();
listBox->SetListBoxObserver( this );
listBox->UpdateScrollBarsL();
a) Creating memory selection dialogs with case ECommonDialogsExCmd101
CAknMemorySelectionDialog* dlg = CAknMemorySelectionDialog::NewL(
ECFDDialogTypeNormal,
ETrue );
CleanupStack::PushL( dlg );
returnValue = dlg->ExecuteL( iMemory );
Then set the display text.
if( returnValue ) { textMain.Append( KCommonDialogsExSelected ); if ( iMemory == CAknMemorySelectionSettingPage::EPhoneMemory ) { textSub.Append( KCommonDialogsExPhoneMemoryName ); } else { textSub.Append( KCommonDialogsExMemoryCardName ); } } else { textMain.Append( KCommonDialogsExCanceled ); textSub.Append( KCommonDialogsExSpace ); } iAppContainer->ShowTextL( textMain, textSub ); CleanupStack::PopAndDestroy(); //dlg
b) Creating Multiple Drive memory selection dialogs with case ECommonDialogsExCmd102
If your current SDK support Multiple Drive APIs, the dialog will display.
CAknMemorySelectionDialogMultiDrive* dlg =
CAknMemorySelectionDialogMultiDrive::NewL(
ECFDDialogTypeNormal, ETrue );
CleanupStack::PushL( dlg );
returnValue = dlg->ExecuteL( iDrive , &tempRootPath, NULL );
......
CleanupStack::PopAndDestroy();
c) Creating memory settings dialog with case ECommonDialogsExCmd201
CCommonDialogsExSettingsDialog* dlg = CCommonDialogsExSettingsDialog::NewL(0, EFalse); dlg->ExecuteLD( R_COMMONDIALOGSEX_SETTINGS_DIALOG ); textMain.Append( KCommonDialogsExSelected ); textSub.Append( KCommonDialogsExDefaultSetting ); iAppContainer->ShowTextL( textMain, textSub );
d) Creating Multiple Drive memory settings dialog with case ECommonDialogsExCmd202
CCommonDialogsExSettingsDialog* dlg = CCommonDialogsExSettingsDialog::NewL(0, ETrue); dlg->ExecuteLD( R_COMMONDIALOGSEX_SETTINGS_DIALOG ); textMain.Append( KCommonDialogsExSelected ); textSub.Append( KCommonDialogsExMultiSetting ); iAppContainer->ShowTextL( textMain, textSub );
e) Creating file selection dialog with case ECommonDialogsExCmd301
CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL( ECFDDialogTypeSelect );
CleanupStack::PushL( dlg );
returnValue = dlg->ExecuteL( rootFileName );
......
iAppContainer->ShowTextL( textMain, textSub );
CleanupStack::PopAndDestroy();
f) Creating file name prompt dialog with case ECommonDialogsExCmd401
returnValue = CAknFileNamePromptDialog::RunDlgLD(
defaultFileName,
KRootPath );
......
iAppContainer->ShowTextL( textMain, textSub );
|
© Nokia 2009 |