const char* Cpyfileselect::FolderSelectionDlg(TCommonDialogType dialogType, TDesC& memory, const TDesC& heading, const TDesC& rightRoot, const TDesC& left) { TFileName folder; folder.Append(memory); // Create select folder dialog CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(dialogType); // some dialog customizations: dlg->SetTitleL(heading); dlg->SetRightSoftkeyRootFolderL(rightRoot); // for root folder dlg->SetLeftSoftkeyFileL(left); //dlg->SetLeftSoftkeyFolderL(left); TBool result = EFalse; if (dlg->ExecuteL(folder)) { // we got our folder and finish loop result = ETrue; } delete dlg; if (result) { return descriptorToStringL(folder); } char* emptystring = new (ELeave) char[1]; emptystring[0] = '\0'; return emptystring; }
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); } } } }