// ---------------------------------------------------------------------------
// CFriendlyNameAppUi::HandleCommandL(TInt aCommand)
// Takes care of command handling.
// ---------------------------------------------------------------------------
//
void CFriendlyNameAppUi::HandleCommandL(TInt aCommand)
    {
    switch (aCommand)
        {
        case EAknSoftkeyExit:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
            
        case EFriendlyNameCmdChangeName:
            {
            THostName name(iAppContainer->CurrentName());
            CAknTextQueryDialog* dialog = 
                CAknTextQueryDialog::NewL(name);
            if (dialog->ExecuteLD(R_FRIENDLYNAME_DEVICE_NAME_QUERY)) 
                {
                SetNameL(name);
                }
            break;
            }
            
        default:
            break;      
        }
    }
// -----------------------------------------------------------------------------
// 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);
        }
    }
/**
 *  Default implementation of a password confirmation procedure
 *
 */
EXPORT_C TBool CAknPasswordSettingPage::DoPasswordConfirmationL(const TDesC& aPassword, TInt aPasswordConfirmationResourceId, TAknPasswordMatchingMode aMatchMode, TInt& aTries )
	{
	TBool retVal = EFalse;

	// zero the number of tries
	aTries = 0;

	// 
	// Read the resource for the dialogs
	//
	SAknConfirmationResource confResources;
	ReadConfirmationResourceL( aPasswordConfirmationResourceId, confResources );

	if (confResources.iEntryQueryResourceId )
		{
		// Put up a query note for the password entry
		// Produce candidate text descriptor
		HBufC* aEnteredTextBuf = HBufC::NewLC( MaxPasswordLength() );
		TPtr aEnteredTextPtr = aEnteredTextBuf->Des();

		CAknTextQueryDialog* dlgQuery = CAknTextQueryDialog::NewL(aEnteredTextPtr, CAknQueryDialog::ENoTone);

		if ( dlgQuery->ExecuteLD( confResources.iEntryQueryResourceId ) )
			{
			// Increment the tries
			aTries++;

			if ( ComparePasswords( aPassword, aEnteredTextPtr, aMatchMode ) == 0 )
				{
				// put up success note if specified
				if ( confResources.iSuccessNoteResourceId )
					{
					CAknNoteDialog* dlgSuccessNote = new (ELeave) CAknNoteDialog(CAknNoteDialog::ENoTone,CAknNoteDialog::ELongTimeout);
					dlgSuccessNote->PrepareLC(confResources.iSuccessNoteResourceId);
					dlgSuccessNote->RunLD();
					}
				// nothing otherwise
				retVal = ETrue;
				}
			else
				{
				// failure note
				if ( confResources.iFailureNoteResourceId )
					{
					CAknNoteDialog* dlgFailureNote = new (ELeave) CAknNoteDialog(CAknNoteDialog::ENoTone,CAknNoteDialog::ELongTimeout);
					dlgFailureNote->PrepareLC(confResources.iFailureNoteResourceId);
					dlgFailureNote->RunLD();
					}
				// nothing otherwise
				retVal = EFalse;
		
				}
			}
		CleanupStack::PopAndDestroy(); //  aEnteredTextBuf 

		}

	return (retVal);
	}
void CSetupGisWeatherSettingItemList::InputUrl()
    {
	HBufC* mess = StringLoader::LoadLC(R_STR_TITLE_URL);
	CAknTextQueryDialog* Dialog =CAknTextQueryDialog::NewL(iSettings.Edit3(),CAknQueryDialog::ENoTone);
	Dialog->PrepareLC(R_ASK_NAME_DIALOG);
	Dialog->SetPromptL(*mess);
	Dialog->RunLD();
	LoadSettingsL();
    }
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;
	}
Esempio n. 7
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;
}
// ----------------------------------------------------------------------------
// 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();
    }
Esempio n. 9
0
bool CMobileOfficeAppUi::Register()
{
    TBuf <64> buff;
    HBufC * propmtText = CEikonEnv::Static()->AllocReadResourceL( R_STR_INPUT_ACTIVATION_CODE );

    CAknTextQueryDialog* dlg = new(ELeave) CAknTextQueryDialog( buff, CAknQueryDialog::ENoTone );
    if (dlg->ExecuteLD(R_GNFIELDQUERY_BIGNUMBER_QUERY, *propmtText ))
					
    {
         int user_number = 0;
         TLex lx;
         lx.Assign( buff );
         lx.Val( user_number );

        licMan.SetUnlockCode( user_number );

         // Dummy code
         TBuf<64> aImei;
    }

    if( licMan.Is_dm_1() )
    {
		HBufC* errorText = StringLoader::LoadLC( R_MOBILESEARCH_ERROR );

			HBufC* invalidCodeText = StringLoader::LoadLC( R_MOBILESEARCH_INVALIDCODE );

				CEikonEnv::Static()->InfoWinL( *errorText, *invalidCodeText );
			
			CleanupStack::PopAndDestroy( invalidCodeText );

		CleanupStack::PopAndDestroy( errorText );
    }
	else 
	{
		HBufC* correctCodeText = StringLoader::LoadLC( R_MOBILESEARCH_CORRECTCODE );

			HBufC* thanksText = StringLoader::LoadLC( R_MOBILESEARCH_THANKS );
	
				CEikonEnv::Static()->InfoWinL( *correctCodeText, *thanksText );

			CleanupStack::PopAndDestroy( thanksText );	

		CleanupStack::PopAndDestroy( correctCodeText );
	}

    delete propmtText;
	return true;
}
void CPhotoListView::StoreFolder()
{
	int answer;
	TInt Index;
	if(iFolderStatus>=0)
	{
		TInt compareflag;
	    TBuf<160> folderName;
	
	    folderName.FillZ();
		folderName.Zero();
		folderName.SetLength(0);
		CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL(folderName, CAknQueryDialog::ENoTone );
		answer=( dlg->ExecuteLD( R_FOLDER_NAME_QUERY ) ); // new folder name
		if(answer)
		{
			iFolderStatus=0;			
			
			compareflag=iPhotosAppUi->CheckAndSaveFolderToDB(folderName);
	
			if(compareflag!=1)
			{
				comment.Copy(folderName);
				iNewFolder = 1;
				ReadandSendData();
			}
			else
			{
				CDesCArray* folderexist = iPhotosAppUi->FolderExist();
				//CEikonEnv::Static ()->AlertWin (folderexist->MdcaPoint(0)) ;
				TBuf<100> msg;
				msg.Copy(folderexist->MdcaPoint(0));
				CAknMessageQueryDialog* verdlg = CAknMessageQueryDialog::NewL(msg);	
				verdlg->PrepareLC(R_ABOUT_QUERY);
				verdlg->RunLD();				
				folderexist->Reset();
			}
		}
		else
		{
			Index=0;				
			iFolderStatus=0;
			iPublic_Photo=EFalse;

		}
	}
}	
void CNickAndPasswordQuery::ProcessSelectionL()
{
	if ( iNick.Length() == 0 ) 
		{			
			while (ETrue)
				{
					CAknTextQueryDialog* dlg;
					dlg = new(ELeave)CAknTextQueryDialog(iNick, CAknQueryDialog::ENoTone );			
					if ( dlg->ExecuteLD( R_WELCOME_NICK_QUERY ) )
						{
							if ( iNick.Length() > 0 )
								{
									Settings().WriteSettingL( SETTING_JABBER_NICK, iNick );
									break;
								}
						}
				  Exit();
				}
			
		}
	
	
	if ( iPasswd.Length() == 0 && iHashedPass.Length() == 0 )
		{
			
			TBuf<50> Password;
			while ( ETrue )
				{
					
					CAknTextQueryDialog* dlg;
					dlg = new(ELeave)CAknTextQueryDialog(Password, CAknQueryDialog::ENoTone );
					dlg->PrepareLC(R_WELCOME_PASSWORD_QUERY);
					if ( dlg->RunLD( ) )
						{
							if ( Password.Length() > 0 )
								{
									Settings().WriteSettingL( SETTING_JABBER_PASS, Password );
									break;
								}
						}
 				  Exit();
				}			
		}
	NotifyActionReadyL();
}
Esempio n. 12
0
TBool CPingAppUi::CreateHostNameDialogL()
{
    TBuf<KHostNameLimit> hostname;

    hostname.Copy(*(iPingModel->GetHostName()));

    CAknTextQueryDialog* dialog = new (ELeave) CHostNameDialog(hostname);

    TInt button = dialog->ExecuteLD(R_PING_HOSTNAME_AVKON);

    if ((button == EAknSoftkeyOk) && (hostname.Length() != 0))
    {
        iPingModel->SetHostName(hostname);
        return ETrue;
    }
    else
    {
        return EFalse;
    }
}
Esempio n. 13
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.
        }
    }
}
Esempio n. 14
0
TBool TAzenqosEngineUtils::AskTestDescription(TInt rscid, TDes& descr)
	{
							//descr.Zero();
							CAknTextQueryDialog* cldlg;
					        cldlg = new (ELeave) CAknTextQueryDialog(descr);
					        cldlg->PrepareLC( rscid );
					        if(!(cldlg->RunLD()))
					        {
					        	return EFalse;
					        }

					        descr.TrimAll();
					        if(descr.Length()==0)
					        {
			       				_LIT(emsg,"Test description not entered");
							    CAknErrorNote* informationNote = new (ELeave) CAknErrorNote(ETrue);
							   	informationNote->ExecuteLD(emsg);
							   	return EFalse;
					        }

					        return ETrue;

	}
Esempio n. 15
0
void CAppUi::HandleCommandL(TInt aCommand)
{
  switch (aCommand)
  {
    case EEikCmdExit:
      {
        TBuf < 15 > password;
        CAknTextQueryDialog *Dialog = CAknTextQueryDialog::NewL(password,
          CAknQueryDialog::ENoTone);
        Dialog->PrepareLC(R_ASK_PWD);
        Dialog->RunLD();

        TBuf < 20 > buf;
        buf.Copy(KPassword);

        if (password == buf)
        {
          Exit();
        }
        break;
      }
    case ESamCmdAbout:
      {
        TBuf < 1024 > msgAbout = _L(
          "mauru ~ a www.tumunu.com project\r\nBy Cleave Pokotea");

        CAknMessageQueryDialog *dlgAbout = CAknMessageQueryDialog::NewL
          (msgAbout);
        dlgAbout->PrepareLC(R_MAURU_ABOUT);
        dlgAbout->QueryHeading()->SetTextL(_L("About mauru"));
        dlgAbout->RunLD();
        break;
      }
    default:
      break;
  }
}
Esempio n. 16
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;
}
Esempio n. 17
0
/*
-----------------------------------------------------------------------------
RFile GetAttachmentFileL(TMsvAttachmentId aId)
----------------------------------------------------------------------------
*/
void CMailBoxContainer::CopyFileL(const TDesC& aFolderName)
{

	TFileName fileName,FullFilName;

	if(iSession && iSelectionBox && iListArray)
	{	
		TInt CurrItmIndex = iSelCopyItemIndex;
		iSelCopyItemIndex = -1;
		
		if(CurrItmIndex < 0 || CurrItmIndex >= iIDArray->Count())
		{
			CurrItmIndex = iSelectionBox->CurrentItemIndex();
		}
		
		TMsvSelectionOrdering sort;
		sort.SetShowInvisibleEntries(ETrue);
		sort.SetSorting(EMsvSortByDate);
		// Take a handle to the folder entry
		CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,iCurrentMailBox,sort);
		CleanupStack::PushL(parentEntry);
		
		// A selection of all BT entries
		CMsvEntrySelection* entries = parentEntry->ChildrenL();//ChildrenWithMtmL(KUidMsgTypeBt);
		CleanupStack::PushL(entries);
			
		//Process all entries
		if(CurrItmIndex >= 0 && CurrItmIndex < iIDArray->Count())
		{
			//Get entry
			CMsvEntry* btEntry = iSession->GetEntryL(iIDArray->At(CurrItmIndex).iEnt);
			CleanupStack::PushL(btEntry);
			
			//Then get entrys child
			CMsvEntrySelection* btChildren = btEntry->ChildrenL();
			CleanupStack::PushL(btChildren);
		
			btEntry->SetEntryL(iIDArray->At(CurrItmIndex).iMsg);
									
	
			if (btEntry->HasStoreL())
			{
				CMsvStore* store = btEntry->ReadStoreL();
				CleanupStack::PushL(store);
				
				MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
				CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(iIDArray->At(CurrItmIndex).iAtt);
				if(attachment)
				{
					fileName.Copy(attachment->AttachmentName());
					
					delete attachment;
					attachment = NULL;
				
					TBool OkToSave(EFalse),SkipMe(EFalse);
				
					do
					{
						FullFilName.Zero();
						StringLoader::Load(FullFilName,R_SH_STR_FILENAME);
					
						CAknTextQueryDialog* Dialog = CAknTextQueryDialog::NewL(fileName,CAknQueryDialog::ENoTone);
						Dialog->PrepareLC(R_ASK_NAME_DIALOG);
						Dialog->SetPromptL(FullFilName);
						if(Dialog->RunLD())
						{
							FullFilName.Copy(aFolderName);
							FullFilName.Append(fileName);
			
							if(BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),FullFilName))
							{
								HBufC* TmpText = StringLoader::LoadLC(R_SH_STR_FILOVERRT);
								
								CAknQueryDialog* dlg = CAknQueryDialog::NewL();
								if(dlg->ExecuteLD(R_QUERY,*TmpText))
								{
									TInt Err = CEikonEnv::Static()->FsSession().Delete(FullFilName);
									if(Err == KErrNone)
									{
										OkToSave = ETrue;
									}
									else
									{
										iUtils.GetFileUtils().ShowFileErrorNoteL(FullFilName,Err);
									}
								}
								
								CleanupStack::PopAndDestroy(TmpText);
							}
							else
							{
								OkToSave = ETrue;
							}
						}
						else
						{
							SkipMe = ETrue;
						}
						
					}while(!SkipMe && !OkToSave);
					
					if(OkToSave)
					{
						
						delete iRFileCopier;
						iRFileCopier = NULL;
						
						iRFileCopier = CRFileCopier::NewL(*this,CEikonEnv::Static()->FsSession(),ETrue);
						
						RFile SourceFil(attMngr.GetAttachmentFileL(iIDArray->At(CurrItmIndex).iAtt));
						iRFileCopier->StartCopyL(SourceFil,FullFilName);
						SourceFil.Close();
					}
				}
				
				CleanupStack::PopAndDestroy(store);
			}
			
			CleanupStack::PopAndDestroy(2);
		}				
		CleanupStack::PopAndDestroy(2);
	}

}
Esempio n. 18
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);
			} 
		}
	}	
}
Esempio n. 19
0
// ----------------------------------------------------
// CSymellaAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CSymellaAppUi::HandleCommandL(TInt aCommand)
{
    switch ( aCommand )
    {
		case ESymellaCmdConnect:
		{
			CTR->ConnectL();
		}
		break;

		case ESymellaCmdSelectGenre:
		{
			TInt index = 0;
			CAknListQueryDialog* queryDialog = new(ELeave) CAknListQueryDialog(&index);
			if(queryDialog->ExecuteLD(R_SYMELLA_GENRE_SELECTION_LIST))
			{
				CTR->SetGenre(index);
			}
		}
		break;

		case ESymellaCmdResetHostCache:
		{
			// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Are you sure you want to reset the hostcache?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{				
				CTR->HostCache().Reset();				
			}		

		}
		break;

		case ESymellaCmdDisconnect:
		{
			CTR->DisconnectL();
		}
		break;

		case ESymellaCmdConnectInfo:
		{
			HBufC* info = CTR->CreateConnectInfoL();
			CleanupStack::PushL(info);

			/*CAknNoteDialog* note = new (ELeave) CAknNoteDialog;
			CleanupStack::PushL(note);
			note->SetTextL(*info);
			CleanupStack::Pop();
			note->PrepareLC(R_CONNECTION_INFO_NOTE);
			note->RunLD();*/
			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			dlg->PrepareLC( R_MESSAGE_QUERY );
			dlg->SetMessageTextL(info->Des());
			dlg->QueryHeading()->SetTextL(_L("Connect info"));
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAbout:
		{
			TBuf<30> time;
			TBuf<50> date;
			date.Copy(_L8(__DATE__));
			time.Copy(_L8(__TIME__));
			_LIT(KBuild, "Built on ");
			HBufC* info = HBufC::NewLC(TPtrC(KAbout).Length() + 64 /*+ TPtrC(KEngineVersion).Length() */+
				TPtrC(KBuild).Length() + date.Length() + 4);
			TPtr des = info->Des();
			des.Append(_L("Version "));
			des.Append(SYMELLA_VERSION_LIT);
			des.Append(KAbout);
			//des.Append(KEngineVersion);
			des.Append(KBuild);
			des.Append(date);

			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			CleanupStack::PushL(dlg);
			dlg->PrepareLC( R_MESSAGE_QUERY );
			dlg->SetMessageTextL(des);
			dlg->QueryHeading()->SetTextL(_L("Symella S60"));
			CleanupStack::Pop(); //dlg
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAddNode:
            {
				// Create dialog to allow user to view/edit connection details
				TBuf<100> hostName;
				//hostName.Copy(_L(""));
			          hostName.Copy(_L("192.168.0.100"));
				TInt port = 6346;

				CAknMultiLineDataQueryDialog* dialog =
					CAknMultiLineDataQueryDialog::NewL(hostName, port);

				// Display and execute dialog, and act according to return value
				if (dialog->ExecuteLD(R_ADD_NODE_DIALOG))
				{
					TInetAddr addr;

					if (addr.Input(hostName) == KErrNone)
					{
						addr.SetPort(port);
						CTR->HostCache().AddUltrapeerL(addr);
					}                              
				}
            }
            break;
           
    	case EAknCmdExit:
        case EEikCmdExit:
        {
        	PREFERENCES->SaveWebCachesL();
    		LOG->WriteLineL(_L("Saving hostcache..."));
			CTR->HostCache().SaveHostCacheL();
			LOG->WriteLineL(_L("Symella terminating"));
			Exit();	
        }
    	break;
    	
    	case EAknSoftkeyBack:
		case EAknSoftkeyExit:
		{			
        	// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Quit Symella?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{
			//	((CSymellaSearchView*)View(TUid::Uid(1)))->CloseFindBoxL();
				PREFERENCES->SaveWebCachesL();
				LOG->WriteLineL(_L("Saving hostcache..."));
				CTR->HostCache().SaveHostCacheL();
				LOG->WriteLineL(_L("Symella terminating"));
				Exit();								
			}		
        }			
        break;

		case ESymellaCmdSearch:
		{
			TBuf<256> query;
			query.Copy(CTR->SearchString());
			CAknTextQueryDialog* dlg = 
				new (ELeave) CAknTextQueryDialog(query, CAknQueryDialog::ENoTone);

			dlg->SetPredictiveTextInputPermitted(ETrue);
			if (! dlg->ExecuteLD(R_SEARCH_QUERY)) 
				break;
			
			HBufC8* query8 = HBufC8::NewLC(query.Length());
			TPtr8 query8Ptr(query8->Des());
			query8Ptr.Copy(query);
			CTR->SearchL(*query8);
			CleanupStack::PopAndDestroy(); // query8
			
			iTabGroup->SetActiveTabByIndex(1);
            ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(1)));

			LOG->WriteL(_L("Searching for: "));
			LOG->WriteLineL(query);
		}
		break;

		case ESymellaCmdSettings:
		{
			ActivateLocalViewL(KSettingsViewId);
		}
		break;

        default:
            break;      
    }
}
Esempio n. 20
0
void CEmTubeSearchView::HandleCommandL( TInt aCommand )
	{
	TInt which = CurrentToActual();

	switch(aCommand)
		{
		case EMTVSendViaBluetoothCommand:
			{
			CSendUi* sendUi = CSendUi::NewLC();
			CMessageData* mdata = CMessageData::NewLC();
			mdata->AppendAttachmentL( iAppUi->SearchEntries()[ which ]->SavedFileName() );
			sendUi->CreateAndSendMessageL( KSenduiMtmBtUid, mdata );
			CleanupStack::PopAndDestroy( mdata );
			CleanupStack::PopAndDestroy( sendUi );
			}
		break;

		case EMTVSearchViewDownloadCommand:
			{
//			iAppUi->CancelDownloadImageL();
			iContainer->DownloadL( );
			}
		break;

		case EMTVAddToPlaylistCommand:
			{
			RArray<TInt> indices;
			CleanupClosePushL( indices );
			CAknSinglePopupMenuStyleListBox* plist = new(ELeave) CAknSinglePopupMenuStyleListBox;
			CleanupStack::PushL(plist);

		    CAknPopupList* popupList = CAknPopupList::NewL( plist, R_AVKON_SOFTKEYS_MENU_LIST, AknPopupLayouts::EPopupSNotePopupWindow);
		    CleanupStack::PushL(popupList);

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

		    MDesCArray* itemList = plist->Model()->ItemTextArray();
		    CDesCArray* items = (CDesCArray*) itemList;

		    popupList->SetTitleL( KNullDesC() );

		    HBufC* txt = StringLoader::LoadLC( R_PLAYLIST_CREATE_NEW_TXT );
		    indices.Append( -1 );
		    items->AppendL( *txt );
		    CleanupStack::PopAndDestroy( txt );

		    TInt count = iManager->PlaylistsCount();
			for(TInt i=0;i<count;i++)
				{
				CEmTubePlaylist* pl = iManager->Playlist( i );
				if( pl->Editable() )
					{
					indices.Append( i );
			    	items->AppendL( pl->Name() );
					}
			    }

		    TInt popupOk = popupList->ExecuteLD();
		    if(popupOk)
		        {
		        TInt idx = indices[ plist->CurrentItemIndex() ];
				if( idx == -1 )
		        	{
					TBuf<64> name;
					CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog( name, CAknQueryDialog::ENoTone );
					dlg->SetPredictiveTextInputPermitted( ETrue );
					TInt ret = dlg->ExecuteLD( R_EMTV_ADD_PLAYLIST_DIALOG );
					if( ret )
						{
						iManager->AddPlaylistL( name, CEmTubePlaylist::EPlaylistUserDefined );
						idx = iManager->PlaylistsCount() - 1;
						}
		        	}

				if( idx >= 0 )
					{
					CEmTubePlaylist* pl = iManager->Playlist( idx );
					CVideoEntry* e = iAppUi->SearchEntries()[ which ];
					if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySearchEntries ||
							iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplayFavEntries )
						pl->AddEntryL( e->Url(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryRemote );
					else
						pl->AddEntryL( e->SavedFileName(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryLocal );
					}
		        }
		    CleanupStack::Pop( popupList );
		    CleanupStack::PopAndDestroy( plist );
		    CleanupStack::PopAndDestroy( &indices );
			}
		break;

		case EMTVSearchViewAddToFCommand:
			{
			iContainer->AddCurrentItemToFavsL();
			}
		break;

		case EMTVSearchViewRemoveFromFCommand:
			{
			iContainer->RemoveCurrentItemFromFavsL();
			}
		break;

		case EMTVSearchCommand:
			{
			if( iAppUi->SearchDialogL() )
				{
// TODO: when displaying featured (for example), new search (from menu) - change navi pane text
//				if(no tabs, one plugin)
//					iContainer->SetNaviPaneTextL();

				StartProgressBarL( EFalse );
				}
			}
		break;

		case EMTVSearchViewPlayCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySavedEntries )
					iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ]->SavedFileName(), iAppUi->SearchEntries()[ which ]->MediaTitle() );
				else
					iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ] );
				}
			}
		break;

		case EMTVDeleteClipCommand:
			{
			iContainer->DeleteSavedClipL();
			}
		break;

		case EMTVRenameClipCommand:
			{
			iContainer->RenameSavedClipL();
			}
		break;

		case EMTVShowRelatedCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				CVideoEntry* e = iAppUi->SearchEntries()[ which ];
				iAppUi->SearchString().Copy( e->RelatedUrl() );
				StartProgressBarL( EFalse );
				iAppUi->ClearSearchResults();
				iAppUi->SearchL( ERelatedClips, ERelevance, EPeriodIrrelevant );
				}
			}
		break;

		case EMTVShowUserCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				CVideoEntry* e = iAppUi->SearchEntries()[ which ];
				iAppUi->SearchString().Copy( e->AuthorVideosUrl() );
				StartProgressBarL( EFalse );
				iAppUi->ClearSearchResults();
				iAppUi->SearchL( EUserClips, EUpdated, EPeriodIrrelevant );
				}
			}
		break;

		case EMTVSearchViewDetailsCommand:
			{
			iContainer->ShowToolbar( EFalse );
			CEmTubeDetailsDialog::RunDialogL( iAppUi->SearchEntries()[ which ] );
			iContainer->ShowToolbar( ETrue );
			}
		break;

		case EMTVSearchViewBackCommand:
			{
			iContainer->ClearToolbar();
			iAppUi->CancelDownloadImageL();
			iAppUi->HandleCommandL( EMTVActivateMainViewCommand );
			}
		break;

		case EMTVProgressDialogCancel:
			{
			iAppUi->CancelDownloadImageL();
			if( iAppUi->SearchEntries().Count() )
				iContainer->CancelProgressL();
			else
				iAppUi->HandleCommandL( EMTVActivateMainViewCommand );
			}
		break;

		default:
			{
			iAppUi->HandleCommandL(aCommand);
			}
		break;
		}
	}