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

📄 autostartappui.cpp

📁 symbian AutoStart,symbian 开机自动运行
💻 CPP
字号:
/*
============================================================================
 Name        : AutoStartAppUi.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Main application UI class (controller)
============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <f32file.h>
#include <s32file.h>
#include <eikmenup.h>
#include <AutoStart.rsg>

#include "AutoStart.pan"
#include "AutoStartAppUi.h"
#include "AutoStartAppView.h"
#include "AutoStart.hrh"
#include "AutoStartdocument.h"
#include "Model.h"


// -----------------------------------------------------------------------------
// CAutoStartAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CAutoStartAppUi::ConstructL()
    {
	CAutoStartDocument* document = static_cast<CAutoStartDocument*>(Document());	
	iModel = document->Model();

    // Initialise app UI with standard value.
    BaseConstructL( EAknEnableSkin );

    // Create view object
    iAppView = CAutoStartAppView::NewL( ClientRect() );
    }
// -----------------------------------------------------------------------------
// CAutoStartAppUi::CAutoStartAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CAutoStartAppUi::CAutoStartAppUi()
    {
    // No implementation required
    }

// -----------------------------------------------------------------------------
// CAutoStartAppUi::~CAutoStartAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CAutoStartAppUi::~CAutoStartAppUi()
    {
    if ( iAppView )
        {
        delete iAppView;
        iAppView = NULL;
        }
    }

// -----------------------------------------------------------------------------
// CAutoStartAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CAutoStartAppUi::HandleCommandL( TInt aCommand )
    {
    switch( aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
			iModel->ExternalizeL();
            Exit();
            break;

		case EAutoStartCmdEnable:
			{
			DoAutoStartEnable();
			break;
			}

        case EAutoStartCmdDisable:
            {
			DoAutoStartDisable();
			break;
            }

        default:
            break;
        }
    }
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CAutoStartAppUi::HandleStatusPaneSizeChange()
	{
	iAppView->SetRect( ClientRect() );	
	} 

TBool CAutoStartAppUi::ProcessCommandParametersL( CApaCommandLine &aCommandLine )
	{
	 if(aCommandLine.OpaqueData().Length() > 0)
		{
		iModel->AutoStart() = EFalse;
		}
	 else 
		{
		iModel->AutoStart() = ETrue;

		// Further check if autostart is enabled. If not, then exit!
		if ( !iModel->AutoStartEnable() )
			Exit();
		}

	if ( iAppView )
		{
		HBufC* on = StringLoader::LoadLC( R_AUTO_START_ON );
		HBufC* off = StringLoader::LoadLC( R_AUTO_START_OFF );
		iAppView->SetTextL( iModel->AutoStart() ? on->Des() : off->Des() );
		CleanupStack::PopAndDestroy( 2 ); // on, off
		}
  
	return CEikAppUi::ProcessCommandParametersL(aCommandLine);
	}

void CAutoStartAppUi::DoAutoStartDisable()
	{
	iModel->AutoStartEnable() = EFalse;
	iModel->ExternalizeL();
	}

void CAutoStartAppUi::DoAutoStartEnable()
	{
	iModel->AutoStartEnable() = ETrue;
	iModel->ExternalizeL();
	}

void CAutoStartAppUi::DynInitMenuPaneL( TInt aResourceId ,CEikMenuPane* aMenuPane )
	{
	if ( aResourceId == R_AUTOSTART_MENU )
		{
		if ( iModel->AutoStartEnable() )
			{
			aMenuPane->SetItemDimmed( EAutoStartCmdEnable, ETrue );
			}
		else 
			{
			aMenuPane->SetItemDimmed( EAutoStartCmdDisable, ETrue );			
			}
		}
	}

⌨️ 快捷键说明

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