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

📄 aknexquerycontainer.cpp

📁 symbian中询问对话框生成的源代码 适合初学者使用。
💻 CPP
📖 第 1 页 / 共 5 页
字号:

// ----------------------------------------------------------------------------
// CAknExQueryContainer::PhoneLayoutFromControlByLayoutOrNull()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::PhoneLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> temp;
    CAknTextQueryDialog* dlg = new ( ELeave )
        CAknTextQueryDialog( temp, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_PHONENUMBER_QUERY );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CEikEdwin* edwin = static_cast<CEikEdwin*>
           ( control->ControlByLayoutOrNull( EStaticSizeDataLayout ) );

    if ( edwin )
        {
        edwin->SetTextL( &KAknExQueryDefaultPhoneNumber );
        }

    dlg->RunLD();
    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::CodeLayoutFromControlByLayoutOrNull()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::CodeLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> temp;
    CAknTextQueryDialog* dlg = new ( ELeave )
        CAknTextQueryDialog( temp, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_CODE_QUERY );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CEikSecretEditor* secretEd = static_cast<CEikSecretEditor*>
           ( control->ControlByLayoutOrNull( ECodeLayout ) );

    if ( secretEd )
        {
        secretEd->SetText( *&KAknExQueryDefaultDataText );
        }

    dlg->RunLD();
    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::DateLayoutFromControlByLayoutOrNull()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::DateLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> temp;
    TTime initialValue;
    iCoeEnv->ReadResource( temp, R_AKNEXQUERY_DATE_INITIAL_VALUE );
    initialValue.Set( temp );

    CAknTimeQueryDialog* dlg = CAknTimeQueryDialog::NewL(
        initialValue, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_DATE_QUERY );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CEikDateEditor* dateEdwin = static_cast<CEikDateEditor*>
           ( control->ControlByLayoutOrNull( EDateLayout ) );

    if ( dateEdwin )
        {
        TTime setValue;
        iCoeEnv->ReadResource( temp, R_AKNEXQUERY_DATE_INITIAL_VALUE2 );
        setValue.Set( temp );
        dateEdwin->SetDate( setValue );
        }

    dlg->RunLD();
    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::TimeLayoutFromControlByLayoutOrNull()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::TimeLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> temp;
    TTime initialValue;
    iCoeEnv->ReadResource( temp, R_AKNEXQUERY_TIME_INITIAL_VALUE );
    initialValue.Set( temp );

    CAknTimeQueryDialog* dlg = CAknTimeQueryDialog::NewL(
        initialValue, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_TIME_QUERY );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CEikTimeEditor* timeEdwin = static_cast<CEikTimeEditor*>
           ( control->ControlByLayoutOrNull( ETimeLayout ) );

    if ( timeEdwin )
        {
        TTime setValue;
        iCoeEnv->ReadResource( temp, R_AKNEXQUERY_TIME_INITIAL_VALUE2 );
        setValue.Set( temp );
        timeEdwin->SetTime( setValue );
        }

    dlg->RunLD();
    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::DurationLayoutFromControlByLayoutOrNull()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::DurationLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TTimeIntervalSeconds duration;

    CAknDurationQueryDialog* dlg =
        CAknDurationQueryDialog::NewL( duration, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_DURATION_LAYOUT );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CEikDurationEditor* durationEdwin = static_cast<CEikDurationEditor*>
           ( control->ControlByLayoutOrNull( EDurationLayout ) );

    if ( durationEdwin )
        {
        TTimeIntervalSeconds setValue( 3600 );
        durationEdwin->SetDuration( setValue );
        }

    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::NumberLayoutFromControlByLayoutOrNull()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::NumberLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TInt value( 0 );

    CAknNumberQueryDialog*  dlg =
        CAknNumberQueryDialog::NewL( value, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT );

    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    CAknIntegerEdwin* numberEdwin = static_cast<CAknIntegerEdwin*>
           ( control->ControlByLayoutOrNull( ENumberLayout ) );

    if ( numberEdwin )
        {
        numberEdwin->SetUnsetValue( 0 );
        }
    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::PinLayoutFromControlByLayoutOrNull()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::PinLayoutFromControlByLayoutOrNull()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> text;

    CAknTextQueryDialog*  dlg = new ( ELeave )
        CAknTextQueryDialog( text, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_PIN_QUERY );

    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::DoRemoveEditorIndicator()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::DoRemoveEditorIndicator()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    CAknTextQueryDialog* dlg = new ( ELeave ) CAknTextQueryDialog(
        iTextData, CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_DATA_QUERY_NO_WAIT );
    dlg->RemoveEditorIndicator();
    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::SetImageL()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::SetImageL()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_CONFIRMATION_QUERY );
    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );
    control->SetImageL( KAknExQueryMbmFilePath,
        EMbmAknexqueryIndicato, EMbmAknexqueryIndicatom );
    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::SetAnimationL()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::SetAnimationL()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );

    dlg->PrepareLC( R_AKNEXQUERY_CONFIRMATION_NO_ICON_QUERY );
    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( dlg->ControlOrNull( EGeneralQuery ) );

    control->SetAnimationL( R_QGN_NOTE_OK_ANIM );
    dlg->RunLD();

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::SetAndCancelAnimationL()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::SetAndCancelAnimationL()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    iQueryDialog = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );

    iQueryDialog->PrepareLC( R_AKNEXQUERY_CONFIRMATION_NO_ICON_QUERY );
    CAknQueryControl* control =
        static_cast<CAknQueryControl*>( iQueryDialog->ControlOrNull( EGeneralQuery ) );

    control->SetAnimationL( R_QGN_NOTE_OK_ANIM );
    StartTimerL( 1200000, 50000000, ECancelQueryAnim );
    iQueryDialog->RunLD(); // Wait until query is dismissed.
    DeleteTimer();
    iQueryDialog = NULL;
    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::ChangeMaxHightL()
//
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::ChangeMaxHightL()
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    CEikTextListBox* list = new ( ELeave ) CAknSinglePopupMenuStyleListBox;
    CleanupStack::PushL( list );

    CAknPopupList* popupList = CAknPopupList::NewL(
       list,
       R_AVKON_SOFTKEYS_SELECT_CANCEL,
       AknPopupLayouts::EMenuWindow );

    CleanupStack::PushL( popupList );

    popupList->SetMaximumHeight( 2 );

    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
    list->CreateScrollBarFrameL( ETrue );
    list->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    CDesCArray* items =
			iCoeEnv->ReadDesCArrayResourceL( R_AKNEXQUERY_SUB_POPUP_DATA );

    CTextListBoxModel* model = list->Model();
    model->SetItemTextArray( items );
    model->SetOwnershipType( ELbmOwnsItemArray );

    popupList->ExecuteLD();
    CleanupStack::Pop(); // popupList
    CleanupStack::PopAndDestroy(); // list

    iDisplayDialog = EFalse;
    }

// ----------------------------------------------------------------------------
// CAknExQueryContainer::ShowDeleteConfirmationQueryL()
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::ShowDeleteConfirmationQueryL()
	{
    iDisplayDialog = ETrue;
	SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    HBufC* prompt = StringLoader::LoadLC(
		R_AKNEXQUERY_COMMON_CONF_DELETE, KAknExQueryItText );

    CAknQueryDialog* dlg = CAknQueryDialog::NewL();

	dlg->SetPromptL( prompt->Des() );
    dlg->ExecuteLD( R_AKNEXQUERY_CONFIRMATION_QUERY );

	CleanupStack::PopAndDestroy(); //prompt

    iDisplayDialog = EFalse;
	}
// End of File

⌨️ 快捷键说明

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