// ----------------------------------------------------------------------------- // CMoveObject::MoveObjectL // Move object operation // ----------------------------------------------------------------------------- // void CMoveObject::MoveObjectL() { PRINT( _L( "MM MTP => CMoveObject::MoveObjectL" ) ); TMTPResponseCode responseCode = EMTPRespCodeOK; GetParametersL(); RBuf newObjectName; newObjectName.CreateL( KMaxFileName ); newObjectName.CleanupClosePushL(); // + newObjectName newObjectName = *iDest; TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); TParsePtrC fileNameParser( suid ); if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) <= newObjectName.MaxLength() ) { newObjectName.Append( fileNameParser.NameAndExt() ); responseCode = CanMoveObjectL( suid, newObjectName ); if ( responseCode == EMTPRespCodeOK ) MoveFileL( newObjectName ); } else // Destination is not appropriate for the full path name shouldn't be longer than 255 responseCode = EMTPRespCodeInvalidDataset; SendResponseL( responseCode ); CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName PRINT1( _L( "MM MTP <= CMoveObject::MoveObjectL responseCode = 0x%x" ), responseCode ); }
/** Copy object operation @return the object handle of the resulting object. */ TMTPResponseCode CMTPImageDpCopyObject::CopyObjectL(TUint32& aNewHandle) { OstTraceFunctionEntry0( CMTPIMAGEDPCOPYOBJECT_COPYOBJECTL_ENTRY ); TMTPResponseCode responseCode = EMTPRespCodeOK; aNewHandle = KMTPHandleNone; GetParametersL(); iNewFileName.Append(*iDest); const TDesC& oldFileName = iSrcObjectInfo->DesC(CMTPObjectMetaData::ESuid); TParsePtrC fileNameParser(oldFileName); if((iNewFileName.Length() + fileNameParser.NameAndExt().Length()) <= iNewFileName.MaxLength()) { iNewFileName.Append(fileNameParser.NameAndExt()); responseCode = CanCopyObjectL(oldFileName, iNewFileName); } else { responseCode = EMTPRespCodeGeneralError; } if(responseCode == EMTPRespCodeOK) { aNewHandle = CopyFileL(oldFileName, iNewFileName); } OstTraceFunctionExit0( CMTPIMAGEDPCOPYOBJECT_COPYOBJECTL_EXIT ); return responseCode; }
// ========================================================================== // METHOD: Initialize // // DESIGN: // ========================================================================== TBool CDebugLogTlsData::Initialize() { TInt returnValue = ( iFs.Connect() == KErrNone ); if( returnValue ) { // Request notification of directory adds/deletes in the logs directory. iFs.NotifyChange( ENotifyDir, iStatus, KDebugLogsBaseDirectory ); SetActive(); // Dynamically create the name of the log files based on the application name // and thread ID. This will eliminate multiple processes/thread usage of // this debug logging infrastructure from scribbling each others traces. RProcess thisProcess; RThread thisThread; // The file name is the process name followed by the thread ID. TParsePtrC fileNameParser( thisProcess.FileName() ); iFileName.Copy( fileNameParser.Name() ); iFileName.Append( KUnderscore ); iFileName.Append( thisThread.Name() ); iFileName.Append( KDebugLogFileExt ); } // end if return returnValue; } // END Initialize
void CZipFileDecompressor::DecompressNextMemberL(CZipFileMember& aMember) { __ASSERT_ALWAYS(!iUncompressedFile.SubSessionHandle(), User::Invariant()); __ASSERT_ALWAYS(!iUncompressedData, User::Invariant()); //Ignore entries that has zero uncompressed size. //(This includes e.g. directories) if (aMember.UncompressedSize() > 0) { const TChar KDirectorySeparator('\\'); TUint32 uncompressedSize = aMember.UncompressedSize(); HBufC8* uncompressedData = HBufC8::NewLC(uncompressedSize); RZipFileMemberReaderStream* readerStream; User::LeaveIfError(iZipFile->GetInputStreamL(&aMember, readerStream)); CleanupStack::PushL(readerStream); TPtr8 uncompressedDataPtr = uncompressedData->Des(); User::LeaveIfError(readerStream->Read(uncompressedDataPtr, uncompressedDataPtr.MaxLength())); CleanupStack::PopAndDestroy(readerStream); HBufC* fileName = aMember.Name()->AllocLC(); TPtr fileNamePtr= fileName->Des(); TInt lastDirectorySeparator = fileName->LocateReverse(KDirectorySeparator); if (lastDirectorySeparator >= 0) { fileNamePtr = fileName->Mid(lastDirectorySeparator+1); } TParsePtr fileNameParser(fileNamePtr); User::LeaveIfError(iUncompressedFile.Replace(iFileServer, fileNameParser.NameAndExt(), EFileWrite)); CleanupStack::PopAndDestroy(fileName); CleanupStack::Pop(uncompressedData); iUncompressedData = uncompressedData; iUncompressedFile.Write(*iUncompressedData, iStatus); SetActive(); } else { iStatus = KRequestPending; SetActive(); TRequestStatus* ownStatus = &iStatus; User::RequestComplete(ownStatus, KErrNone); } }
void sfxFrame::OnResultsListCtrlBeginDrag(wxListEvent& event) { // First find index of selected item (if any). int index = ResultsListCtrl->GetNextItem ( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if(index < 0) { return; } wxFileDataObject* data = new wxFileDataObject(); wxString fileName = m_model.searchedFileNameAt(index); StatusBar1->SetLabel(fileName); data->AddFile(fileName); wxDropSource dragSource(this); dragSource.SetData(*data); wxDragResult dragResult = dragSource.DoDragDrop(); wxDELETE(data); if(dragResult == wxDragCopy) { // If they drag a file, they are sure they wanna use 'em. // No need to keep pestering a user with more of the same. m_sound.Stop(); // Auto copy file if a directory is defined for this and user actually copied something. if(m_saveFolder.Length()) { wxFileName fileNameParser(fileName); wxString destination = m_saveFolder + fileNameParser.GetName() + _(".wav"); wxCopyFile(fileName, destination, true); } } }
/** move object operations @return A valid MTP response code. */ TMTPResponseCode CMTPMoveObject::MoveObjectL() { OstTraceFunctionEntry0( CMTPMOVEOBJECT_MOVEOBJECTL_ENTRY ); TMTPResponseCode responseCode = EMTPRespCodeOK; GetParametersL(); RBuf newObjectName; newObjectName.CreateL(KMaxFileName); newObjectName.CleanupClosePushL(); newObjectName = *iDest; const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); TParsePtrC fileNameParser(suid); // Check if the object is a folder or a file. if(!iIsFolder) { if((newObjectName.Length() + fileNameParser.NameAndExt().Length()) <= newObjectName.MaxLength()) { newObjectName.Append(fileNameParser.NameAndExt()); } responseCode = CanMoveObjectL(suid, newObjectName); } else // It is a folder. { TFileName rightMostFolderName; LEAVEIFERROR(BaflUtils::MostSignificantPartOfFullName(suid, rightMostFolderName), OstTraceExt1( TRACE_ERROR, DUP1_CMTPMOVEOBJECT_MOVEOBJECTL, "extract most significant part of %S failed", suid)); if((newObjectName.Length() + rightMostFolderName.Length() + 1) <= newObjectName.MaxLength()) { newObjectName.Append(rightMostFolderName); // Add backslash. _LIT(KBackSlash, "\\"); newObjectName.Append(KBackSlash); } } iNewRootFolder = newObjectName.AllocL(); OstTraceExt1( TRACE_NORMAL, CMTPMOVEOBJECT_MOVEOBJECTL, "%S", *iNewRootFolder ); if(responseCode == EMTPRespCodeOK) { delete iFileMan; iFileMan = NULL; iFileMan = CFileMan::NewL(iFramework.Fs()); if(!iIsFolder) { MoveFileL(newObjectName); } else { MoveFolderL(); SendResponseL(responseCode); } } CleanupStack::PopAndDestroy(); // newObjectName. OstTraceFunctionExit0( CMTPMOVEOBJECT_MOVEOBJECTL_EXIT ); return responseCode; }