⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smscryptosymbiancppuiappui.cpp

📁 symbian 发送短信例子 S60 SMS Sample
💻 CPP
字号:
/*
* ============================================================================
*  Name     : SMSCryptoSymbianCppUIAppUi.cpp
*  Part of  : Open C SMS Crypto Example
*  Created  : 05/25/2007 by Forum Nokia
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

#include <eikmenub.h>
#include <akncontext.h>
#include <akntitle.h>
#include <SMSCryptoSymbianCppUI.rsg>

#include "SMSCryptoSymbianCppUIAppUi.h"
#include "SMSCryptoSymbianCppUI.hrh"
#include "SMSCryptoSymbianCppUIListBox.hrh"
#include "SMSCryptoSymbianCppUIListBoxView.h"
#include "SMSCryptoSymbianCppUITextEditor.hrh"
#include "SMSCryptoSymbianCppUITextEditorView.h"

/**
 * Construct the CSMSCryptoSymbianCppUIAppUi instance
 */ 
CSMSCryptoSymbianCppUIAppUi::CSMSCryptoSymbianCppUIAppUi()
	{
	
	}

/** 
 * The appui's destructor removes the container from the control
 * stack and destroys it.
 */
CSMSCryptoSymbianCppUIAppUi::~CSMSCryptoSymbianCppUIAppUi()
	{
	
	}

void CSMSCryptoSymbianCppUIAppUi::InitializeContainersL()
	{
	iSMSCryptoSymbianCppUIListBoxView = CSMSCryptoSymbianCppUIListBoxView::NewL();
	AddViewL( iSMSCryptoSymbianCppUIListBoxView );
	SetDefaultViewL( *iSMSCryptoSymbianCppUIListBoxView );
	iSMSCryptoSymbianCppUITextEditorView = CSMSCryptoSymbianCppUITextEditorView::NewL();
	AddViewL( iSMSCryptoSymbianCppUITextEditorView );
	}

/**
 * Handle a command for this appui (override)
 * @param aCommand command id to be handled
 */
void CSMSCryptoSymbianCppUIAppUi::HandleCommandL( TInt aCommand )
	{
	TBool commandHandled = EFalse;
	switch ( aCommand )
		{ // code to dispatch to the AppUi's menu and CBA commands is generated here
		case ESMSCryptoSymbianCppUIListBoxViewNew_MessageMenuItemCommand:
		CCoeAppUi::ActivateViewL( iSMSCryptoSymbianCppUITextEditorView->ViewId() );
			break;

		case ESMSCryptoSymbianCppUITextEditorViewBackMenuItemCommand:
		CCoeAppUi::ActivateViewL( iSMSCryptoSymbianCppUIListBoxView->ViewId() );
			break;

		case ESMSCryptoSymbianCppUIListBoxViewQuitMenuItemCommand:
		Exit();
			break;
		
		default:
			break;
		}
	
		
	if ( !commandHandled ) 
		{
		if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
			{
			Exit();
			}
		}

	}

/** 
 * Override of the HandleResourceChangeL virtual function
 */
void CSMSCryptoSymbianCppUIAppUi::HandleResourceChangeL( TInt aType )
	{
	CAknViewAppUi::HandleResourceChangeL( aType );
	}
				
/** 
 * Override of the HandleKeyEventL virtual function
 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not
 * @param aKeyEvent 
 * @param aType 
 */
TKeyResponse CSMSCryptoSymbianCppUIAppUi::HandleKeyEventL(
		const TKeyEvent& aKeyEvent,
		TEventCode /*aType*/ )
	{
	// The inherited HandleKeyEventL is private and cannot be called
	
	if ( aKeyEvent.iCode == EKeyOK )
		{
		iSMSCryptoSymbianCppUIListBoxView->OpenSMSL();
		return EKeyWasConsumed;
		}
	
	return EKeyWasNotConsumed;
	}

/** 
 * Override of the HandleViewDeactivation virtual function
 *
 * @param aViewIdToBeDeactivated 
 * @param aNewlyActivatedViewId 
 */
void CSMSCryptoSymbianCppUIAppUi::HandleViewDeactivation( 
		const TVwsViewId& aViewIdToBeDeactivated, 
		const TVwsViewId& aNewlyActivatedViewId )
	{
	CAknViewAppUi::HandleViewDeactivation( 
			aViewIdToBeDeactivated, 
			aNewlyActivatedViewId );
	}

/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CSMSCryptoSymbianCppUIAppUi::ConstructL()
	{
	BaseConstructL( EAknEnableSkin );
	InitializeContainersL();
	}

/**
 * Save a given SMS message for further use
 */
void CSMSCryptoSymbianCppUIAppUi::SetSMSL( TBuf<bufSize> aBuf )
	{
	iBuf = aBuf;
	CCoeAppUi::ActivateViewL( iSMSCryptoSymbianCppUITextEditorView->ViewId() );
	}

/**
 * Return a previously saved SMS
 */
TBuf<bufSize> CSMSCryptoSymbianCppUIAppUi::GetSMSL()
	{
	return iBuf;
	}

/**
 * Clear SMS
 */
void CSMSCryptoSymbianCppUIAppUi::ClearSMSL()
	{
	_LIT(KEmpty, "");
	iBuf = KEmpty;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -