// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->DoSelectCurrentItemL();
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    dialog->ConstructL();
    
    RDesWriteStream stream;
    CleanupClosePushL( stream );
    HBufC8* hbuf = HBufC8::NewL( KHBufSize );
    CleanupStack::PushL( hbuf );
    TPtr8 ptr = hbuf->Des();
    stream.Open( ptr );
    dialog->DoWriteInternalStateL( stream );
    stream.CommitL();
    stream.Close();  
    CleanupStack::PopAndDestroy( KFour );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    TPointerEvent event;
    event.iType = TPointerEvent::EButton1Down;
    event.iModifiers = 0;
    TPoint eventPos( 10, 30 );
    event.iPosition = eventPos;
    event.iParentPosition = eventPos;
    dialog->HandlePointerEventL( event );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemActioned );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemClicked );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventPenDownOnItem );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    
    CAknSetStyleListBox* editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NULL( editorControl );
    
    dialog->ConstructL();
    
    editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NOT_NULL( editorControl );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
        new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL( CStifItemParser& /*aItem*/ )
    {
    TAknDesCArrayDecorator* decorator = new( ELeave ) TAknDesCArrayDecorator();
    CleanupStack::PushL( decorator );
    
    CDesCArrayFlat* arr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( arr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    
    arr->AppendL( tom );
    arr->AppendL( jack );
    arr->AppendL( mary );
    
    decorator->SetArray( arr );
    TBuf<KBufSize> buffer( KTestString );
    decorator->SetDecorationText( buffer );
    
    TInt count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KThree, count );
    
    TInt numberofarray( KZero );
    TBool flag = decorator->DecoratedIndex( numberofarray );
    STIF_ASSERT_EQUALS( KThree, numberofarray );
    STIF_ASSERT_FALSE( flag );
    
    decorator->SetActive( ETrue );
    count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KFour, count );
    
    TPtrC returnText = decorator->MdcaPoint( KZero );
    STIF_ASSERT_TRUE( returnText == tom );
    
    CleanupStack::PopAndDestroy( arr );
    CleanupStack::PopAndDestroy( decorator );
    return KErrNone;
    }
Exemple #8
0
// Handles a command issued by the user.
void cl_handler(char* buffer, fs_node_t *fs_root) {
  if (strcmp(buffer,"beep") == 0) {
    beep();
  }
  else if (strcmp(buffer,"clear") == 0) {
    monitor_clear();
  }
  else if (strcmp(buffer,"contents") == 0) {
    file_disp(fs_root);
  }
  else if (strcmp(buffer,"cpu") == 0) {
    detect_cpu();
  }
  else if (strcmp(buffer,"fork") == 0) {
    fork_disp();
  }
  else if (strcmp(buffer,"furelise") == 0) {
    felise();
  }
  else if (strcmp(buffer,"help") == 0) {
    help_disp();
  }
  else if (strcmp(buffer,"hibernate") == 0) {
    
	// Define variables
	byte temp;
	
	// Disable interrupts
	cli();
	
	// Clear all keyboard buffers (output and command buffers)
    do {
		
		// Empty user data
        temp = inb(0x64);
        
        // Empty keyboard data
        if (check_flag(temp, 0) != 0) {
			inb(0x60);
		}
		
    }
    
    while (check_flag(temp, 1) != 0);
	
	// Check for Advanced Power Management
	check_apm();
	
	// Initialize Advanced Power Management
	init_apm();
	
	// Send hibernation command
	suspend();
	
	// Halt the cpu if failed
	halt();
    
  }
  else if (strcmp(buffer,"logo") == 0) {
    logo_disp();
  }
  else if (strcmp(buffer,"ls") == 0) {
    dir_disp(fs_root);
  }
  else if (strcmp(buffer,"mary") == 0) {
    mary();
  }
  else if (strcmp(buffer,"mouse") == 0) {
	// Initialize the mouse
    init_mouse();
    // output current coordinates
    //monitor_write_dec(getcoords());
  }
  else if (strcmp(buffer,"nosound") == 0) {
    nosound();
  }
  else if (strcmp(buffer,"reboot") == 0) {
    reboot();
  }
  else if (strcmp(buffer,"shutdown") == 0) {
	
	// Define variables
	byte temp;
	
	// Disable interrupts
	cli();
	
	// Clear all keyboard buffers (output and command buffers)
    do {
		
		// Empty user data
        temp = inb(0x64);
        
        // Empty keyboard data
        if (check_flag(temp, 0) != 0) {
			inb(0x60);
		}
		
    }
    
    while (check_flag(temp, 1) != 0);
	
	// Check for Advanced Power Management
	check_apm();
	
	// Initialize Advanced Power Management
	init_apm();
	
	// Send shutdown command
	shutdown();
	
	// Halt the cpu if failed
	halt();
    
  }
  else if (strcmp(buffer,"sleep") == 0) {
	
	// Define variables
	byte temp;
	
	// Disable interrupts
	cli();
	
	// Clear all keyboard buffers (output and command buffers)
    do {
		
		// Empty user data
        temp = inb(0x64);
        
        // Empty keyboard data
        if (check_flag(temp, 0) != 0) {
			inb(0x60);
		}
		
    }
    
    while (check_flag(temp, 1) != 0);
	
	// Check for Advanced Power Management
	check_apm();
	
	// Initialize Advanced Power Management
	init_apm();
	
	// Send standby command
	standby();
	
	// Halt the cpu if failed
	halt();
    
  }
  else if (strcmp(buffer,"time") == 0) {
    time_disp();
  }
  else if (strcmp(buffer,"twinkle") == 0) {
    twinkle();
  }
  else if (strcmp(buffer,"usermode") == 0) {
    umode_disp(fs_root);
  }
  else if (strcmp(buffer,"version") == 0) {
    version_disp();
  }
  else if (strcmp(buffer,"vga") == 0) {
    VgaTest();
  }
  else if (strcmp(buffer,"wait") == 0) {
    timer_wait(250000);
  }
  else {
    printf("Unknown command: ");
    printf(buffer);
    printf("\n");
  }
}