Sunday, October 5, 2008

Some Tips on Making Application Embeddable

Change App_reg.rss
make embeddability=KAppEmbeddable

To obtain the file name argument we need to override OpenFileL of document class.

To pass an file name argument to such a exe:
TDataType dType(TUid::Uid(EmbedableAppUid));
CDocumentHandler *handler = CDocumentHandler::NewL();
_LIT(KFileName, "c:\data\d.txt");
handler->OpenFileEmbeddedL(KFileName, dType);

Sunday, August 17, 2008

CActive Object Example

CActive Objects example demonstrates how to use CActive Objects.

.mmp
LIBRARY euser.lib

.h
Include this e32base.h
class CActiveExample: public CActive
virtual void RunL();

.cpp
CActiveExample::CActiveExample():
CActive(CActive::EPriorityStandard) //Init the active object in constructor

CActiveScheduler::Add( this ); //Starts the active scheduler

//Make the asynchronous call
SetActive();//Sets the active object

Implement RunL() method.

Destructor add Cancel();

Friday, August 15, 2008

Show CAknWaitDialog Code

Following code can be used to show wait dialog when we dont know how much we need to wait for a particular asynchronous event to happen.

.mmp file
Add the following lib files avkon.lib eikcdlg.lib eikctl.lib

.rss file
Add the following lines for the wait dialog resource
RESOURCE DIALOG WaitDialog
{
flags = EAknWaitNoteFlags | EEikDialogFlagNotifyEsc;
buttons=R_AVKON_SOFTKEYS_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtNote;
id = EGeneralNote;
control = AVKON_NOTE
{
layout = EWaitLayout;
singular_label=" Please Wait...";
animation = R_QGN_GRAF_WAIT_BAR_ANIM;
};
}
};
}

.h file
Include this <aknwaitdialog.h>

The following lines will allow to create a wait dialog.
CAknWaitDialog *iDialog;

Class having this needs to implement MProgressDialogCallback to get the cancel callback.

Method that needs to be overridden is DialogDismissedL.

.cpp file
The following lines will shows a dialog and calls DialogDismissedL when canceled.

iDialog = new(ELeave)CAknWaitDialog(
(REINTERPRET_CAST(CEikDialog**,&iDialog)));
iDialog->SetCallback(this);
iDialog->SetTone( CAknNoteDialog::EConfirmationTone );
iDialog->SetTextL(_L("Download..."));
iDialog->ExecuteLD(WAITDIALOG);

Picture