📄 mmsexampleappui.cpp
字号:
/*
* ============================================================================
* Name : CFileListAppUi from FileListAppUi.cpp
* Part of : FileList
* Created : 04.11.2006 by Forum Nokia
* Version : 2.0
* Copyright: Nokia Corporation
* ============================================================================
*/
// INCLUDE FILES
#include "MMSExampleAppUi.h"
#include "MMSExampleContainer.h"
#include <MMSExample.rsg>
#include "MMSExample.hrh"
#include <avkon.hrh>
#include <eikmenup.h>
#define KEnableSkinFlag 0x1000
#define KMessagingUID3 0x100058C5 //messaging uid
#define KMessagingListViewID 0x02
#define KInboxUID 0x1002 //inbox uid
#define KSentUID 0x1005 //sentbox uid
/*
-----------------------------------------------------------------------------
CMMSExampleAppUi::ConstructL()
2nd phase constructor
-----------------------------------------------------------------------------
*/
void CMMSExampleAppUi::ConstructL()
{
#ifdef __SERIES60_3X__
BaseConstructL(EAknEnableSkin);
#else
BaseConstructL(KEnableSkinFlag);
#endif
iAppContainer = new (ELeave) CMMSExampleContainer;
iAppContainer->SetMopParent(this);
iAppContainer->ConstructL(ClientRect());
AddToStackL( iAppContainer );
}
// ----------------------------------------------------
// CMMSExampleAppUi::~CMMSExampleAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CMMSExampleAppUi::~CMMSExampleAppUi()
{
if (iAppContainer)
{
RemoveFromStack( iAppContainer );
delete iAppContainer;
iAppContainer = NULL;
}
}
/*
-----------------------------------------------------------------------------
CMMSExampleAppUi::HandleCommandL(TInt aCommand)
Handle the menu commands
-----------------------------------------------------------------------------
*/
void CMMSExampleAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EMMSExampleCmdSend:
CmdSendL();
break;
case EMMSExampleCmdOpenInbox:
CmdOpenMessagingL();
break;
case EMMSExampleCmdOpenSent:
CmdOpenMessagingL();
break;
case EAknSoftkeyBack:
case EEikCmdExit:
case EClose:
CmdExit();
break;
default:
break;
}
}
/*
-----------------------------------------------------------------------------
CMMSExampleAppUi::CmdSendL()
Initialize Communications and then send the multimedia message.
-----------------------------------------------------------------------------
*/
void CMMSExampleAppUi::CmdSendL()
{
if (!iAppContainer->InitializeCommunicationsL())
{
_LIT(KError, "Problems in creating message.");
iAppContainer->EchoL(KError);
return;
}
if (!iAppContainer->SendMessageL())
{
_LIT(KSendingError, "Problems in sending message.");
iAppContainer->EchoL(KSendingError);
return;
}
}
/*
-----------------------------------------------------------------------------
CMMSExampleAppUi::CmdOpenMessagingL()
Opening the S60 messaging application.
-----------------------------------------------------------------------------
*/
void CMMSExampleAppUi::CmdOpenMessagingL()
{
TVwsViewId id = TVwsViewId( TUid::Uid(KMessagingUID3),TUid::Uid(KMessagingListViewID) );
_LIT8(KEmpty, "");
#ifdef __WINS__ //Emulator used
ActivateViewL( id, TUid::Uid( KSentUID ),KEmpty);
#else //Device used
ActivateViewL( id, TUid::Uid( KInboxUID ),KEmpty);
#endif
}
/*
------------------------------------------------------------------------------
CMMSExampleAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
This function is called by the EIKON framework just before it displays
a menu pane. Its default implementation is empty, and by overriding it,
the application can set the state of menu items dynamically according
to the state of application data.
------------------------------------------------------------------------------
*/
void CMMSExampleAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
{
if (aResourceId == R_MMSEXAMPLE_OPTIONS_MENU)
{
#ifdef __WINS__
aMenuPane->SetItemDimmed(EMMSExampleCmdOpenInbox, ETrue);
#else
aMenuPane->SetItemDimmed(EMMSExampleCmdOpenSent, ETrue);
#endif
}
}
/*
---------------------------------------------------------
CMMSExampleAppUi::HandleStatusPaneSizeChange()
Called by framework when resource is changed.
---------------------------------------------------------
*/
void CMMSExampleAppUi::HandleStatusPaneSizeChange()
{
CAknAppUi::HandleStatusPaneSizeChange(); //call to upper class
if(iAppContainer)
iAppContainer->SetRect( ClientRect() );
}
/*
---------------------------------------------------------
CMMSExampleAppUi::CmdExit()
Exit program.
---------------------------------------------------------
*/
void CMMSExampleAppUi::CmdExit()
{
PrepareToExit();
Exit();
}
//EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -