// -----------------------------------------------------------------------------
// CLandmarksCategoriesView::RenameCategoryL
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CLandmarksCategoriesView::RenameCategoryL()
    {
    // Fetch existing category name
    CPosLandmarkCategory* category = 
        iEngine->CategoryLC(iContainer->CurrentCategoryId());
    TPtrC categoryName;
    category->GetCategoryName(categoryName);
    TBuf<KPosLmMaxCategoryNameLength> newCategoryName;
    newCategoryName.Insert(0, categoryName);

    // Create and initialize dialog
    CAknTextQueryDialog* queryDialog = 
        CAknTextQueryDialog::NewL(newCategoryName);
    queryDialog->SetMaxLength(KPosLmMaxCategoryNameLength);
    CleanupStack::PushL(queryDialog);

    // Create and set title
    HBufC* title = 
        iCoeEnv->AllocReadResourceAsDes16LC(R_LMREFAPP_CATEGORY_NAME);
    queryDialog->SetPromptL(*title);
    CleanupStack::PopAndDestroy(title);

    // Launch dialog
    TBool dialogAccepted = queryDialog->ExecuteLD(R_LMREFAPP_RENAME_QUERY);
    CleanupStack::Pop(queryDialog);
    if (dialogAccepted)
        {
        // Update category name
        category->SetCategoryNameL(newCategoryName);
        iEngine->UpdateCategoryL(*category);
        }

    CleanupStack::PopAndDestroy(category);
    }
// -----------------------------------------------------------------------------
// CLandmarksCategoriesView::AddCategoryL
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CLandmarksCategoriesView::AddCategoryL()
    {
    // Create and initialize dialog
    TBuf<KPosLmMaxCategoryNameLength> categoryName;
    CAknTextQueryDialog* queryDialog = CAknTextQueryDialog::NewL(categoryName);
    queryDialog->SetMaxLength(KPosLmMaxCategoryNameLength);
    CleanupStack::PushL(queryDialog);

    // Create and set title
    HBufC* title = 
        iCoeEnv->AllocReadResourceAsDes16LC(R_LMREFAPP_NEW_CATEGORY);
    queryDialog->SetPromptL(*title);
    CleanupStack::PopAndDestroy(title);

    // Launch dialog
    TBool dialogDismissed = queryDialog->ExecuteLD(R_LMREFAPP_RENAME_QUERY);
    CleanupStack::Pop(queryDialog);
    if (dialogDismissed)
        {
        // Create and add a new category with user defined name.
        CPosLandmarkCategory* newCategory = CPosLandmarkCategory::NewLC();
        newCategory->SetCategoryNameL(categoryName);
        iEngine->AddCategoryL(*newCategory);
        CleanupStack::PopAndDestroy(newCategory);
        }
    }
예제 #3
0
TBool ShowInputDlgL(const TInt& aTextResourceId,TDes& aText)
	{
	HBufC* prompt = StringLoader::LoadLC( aTextResourceId );
	CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( aText );
	
	dlg->SetPromptL(prompt->Des());
	dlg->SetMaxLength(KMaxName);
	TInt retCode( dlg->ExecuteLD( R_DIALOG_INPUT ));
	
	CleanupStack::PopAndDestroy(); //prompt
	return retCode;
	}
예제 #4
0
int CAppView::TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints) {
	if(iEngine->IsDrawing())
		iEngine->StopDrawing();
	outText.Copy(inText);
	CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog(outText);
	CleanupStack::PushL(dlg);
	dlg->SetPromptL(title);
	dlg->SetPredictiveTextInputPermitted(true);
	dlg->SetMaxLength(outText.MaxLength());
	TBool answer = dlg->ExecuteLD(R_TEXTBOX_QUERY);
	CleanupStack::Pop(dlg);
	return answer ? 1 : 0;
}
예제 #5
0
// ----------------------------------------------------------------------------
// CAknExQueryContainer::ShowDataQueryL()
// Display of Data Query.
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::ShowDataQueryL(
    const TInt aQueryResourceId,
    const TInt aTextResourceId,
    const TInt aPromptResourceId,
    const TInt aMaxLength,
    const TBool aDisplayFlag )
    {
    iDisplayDialog = ETrue;
    SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );

    TBuf<KAknExQueryTextBufLength> textData;
    if ( aTextResourceId )
        {
        iCoeEnv->ReadResource( textData, aTextResourceId );
        }

    CAknTextQueryDialog* dlg;
    if ( !aPromptResourceId )
        {
        dlg = new ( ELeave )CAknTextQueryDialog(
            textData, CAknQueryDialog::ENoTone );
        }
    else
        {
        TBuf<KAknExQueryTextBufLength> prompt;
        iCoeEnv->ReadResource( prompt, aTextResourceId );
        dlg = CAknTextQueryDialog::NewL(
            textData, CAknQueryDialog::ENoTone );
        CleanupStack::PushL( dlg );
        dlg->SetPromptL( prompt );
        CleanupStack::Pop(); // dlg
        }

    if ( aMaxLength )
        {
        dlg->SetMaxLength( aMaxLength );
        }

    TBool answer( dlg->ExecuteLD( aQueryResourceId ) );

    if ( aDisplayFlag && answer )
        {
        iLabelResultMessage->SetTextL( textData );
        }

    iDisplayDialog = EFalse;

    DrawNow();
    }
예제 #6
0
int CAppView::TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints) {
	int resourceId;
	int type = constraints & 0xFFF;
	switch(type) {
	case MA_TB_TYPE_ANY:
		resourceId = R_TEXTBOX_QUERY;
		break;
	case MA_TB_TYPE_EMAILADDR:
	case MA_TB_TYPE_NUMERIC:
	case MA_TB_TYPE_PHONENUMBER:
	case MA_TB_TYPE_URL:
	case MA_TB_TYPE_DECIMAL:
	case MA_TB_TYPE_SINGLE_LINE:
		resourceId = R_TEXTBOX_QUERY_SINGLE_LINE;
		break;
	default:
		return MA_TB_RES_TYPE_UNAVAILABLE;
	}

	if(iEngine->IsDrawing())
		iEngine->StopDrawing();

	outText.Copy(inText);
	CAknTextQueryDialog* dlg = new (ELeave) CMyAknTextQueryDialog(outText);
	CleanupStack::PushL(dlg);
	dlg->SetPromptL(title);
	dlg->SetMaxLength(outText.MaxLength());

	if(type == MA_TB_TYPE_NUMERIC || type == MA_TB_TYPE_PHONENUMBER || type == MA_TB_TYPE_DECIMAL)
		dlg->SetDefaultInputMode(EAknEditorNumericInputMode);

	bool predict = (constraints & (MA_TB_FLAG_PASSWORD | MA_TB_FLAG_SENSITIVE |
		MA_TB_FLAG_NON_PREDICTIVE)) == 0;
	if(!(type == MA_TB_TYPE_ANY || type == MA_TB_TYPE_SINGLE_LINE))
		predict = false;
	dlg->SetPredictiveTextInputPermitted(predict);

	TBool answer = dlg->ExecuteLD(resourceId);
	CleanupStack::Pop(dlg);
	return answer ? 1 : 0;
}
예제 #7
0
//Man dead 以后,还没切换到Award以前,看是否需要祝贺
void CRS_ManContainer::Congratulation()
{
    if (iData->iPlayerInfo.IsBrokeAwardRecord(iData->iFloor))
    {
        iGfxTimer->Pause();
        iCongratulationPlayer->Play();
        TBuf<30> oName;
        TBuf<30> oTitle(_L("Enter your name:"));
        CAknTextQueryDialog* oDlg = new (ELeave) CAknTextQueryDialog(oName, oTitle);
        oDlg->PrepareLC(R_DEMO_DATA_QUERY);
        oDlg->SetMaxLength(15);
        if (oDlg->RunLD())
        {
            if (oName.Length() > 0)
            {
                iData->iPlayerInfo.UpdatePlayerList(iData->iFloor, oName);
            }
            // ok pressed, text is the descriptor containing the entered text // in the editor.
        }
    }
}
예제 #8
0
void CAafAppCameraView::SaveCapturedImageL()
{
	if (IsImageCaptured())
	{
		TFileName filePath(KNullDesC);
		
		// Create select memory dialog
		CAknMemorySelectionDialog* memDlg = 
			CAknMemorySelectionDialog::NewL(ECFDDialogTypeSave, ETrue);
		CAknMemorySelectionDialog::TMemory memory = 
			CAknMemorySelectionDialog::EPhoneMemory;

		// Create select folder dialog
		CAknFileSelectionDialog* dlg = 
			CAknFileSelectionDialog::NewL(ECFDDialogTypeCopy);

		// some dialog customizations:
		CEikonEnv* eikonEnv = CEikonEnv::Static();

		HBufC* stringHolder = StringLoader::LoadL(R_SELECT_FOLDER_DIALOG, eikonEnv );

		dlg->SetTitleL(*stringHolder);

		// Free dynamically allocated memory
		delete stringHolder;
		stringHolder = NULL;

		stringHolder = StringLoader::LoadL(R_BACK, eikonEnv );

		dlg->SetRightSoftkeyRootFolderL(*stringHolder); // for root folder

		// Free dynamically allocated memory
		delete stringHolder;
		stringHolder = NULL;

		TBool result = EFalse;

		for (;;)
		{
			if ( memDlg->ExecuteL(memory) == CAknFileSelectionDialog::ERightSoftkey )
			{
				// cancel selection
				break;
			}

			if (memory == CAknMemorySelectionDialog::EMemoryCard)
			{
				// Open images folder
				filePath = PathInfo::MemoryCardRootPath();
				filePath.Append(PathInfo::ImagesPath());
			}
			else
			{
				// Open images folder
				filePath = PathInfo::PhoneMemoryRootPath();
				filePath.Append(PathInfo::ImagesPath());
			}

			
			if (dlg->ExecuteL(filePath))
			{
				// we got our folder and finish loop
				result = ETrue;
				break;
			}
		}

		delete memDlg;
		delete dlg;

		if (filePath.Length() > 0)
		{
			// The descriptor used for the editor 
			TBuf<255> fileName; 
			// create dialog instance  
			CAknTextQueryDialog* dlgFilename = new( ELeave )CAknTextQueryDialog( fileName); 
			// Prepares the dialog, constructing it from the specified resource 
			dlgFilename->PrepareLC( R_FILENAME_QUERY ); 
			// Sets the maximum length of the text editor 
			dlgFilename->SetMaxLength(255); 
			// Launch the dialog 
			if (dlgFilename->RunLD()) 
			{ 
				// ok pressed,  text is the descriptor containing the entered text 
				// in the editor.
				filePath.Append(fileName);

				// ensure that saved file would have .jpg extension
				if (filePath.Right(4).Compare(KJpgExt) != 0)
					filePath.Append(KJpgExt);

				iContainer->SaveImage(filePath);
			} 
		}
	}	
}