// ----------------------------------------------------------------------------- // 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 ); }
// ---------------------------------------------------------- // CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL // Shows the notifier in backround // ---------------------------------------------------------- // void CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL() { FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete()")); //get full path to the DCMO resource file TParse* parser = new (ELeave) TParse; parser->Set(KDcmoResourceFileName(), &KDC_RESOURCE_FILES_DIR, NULL); CleanupStack::PushL(parser); TFileName* fileName = new (ELeave) TFileName; *fileName = parser->FullName(); CleanupStack::PopAndDestroy(parser); CleanupStack::PushL(fileName); //create the resource reader object that we need to use several times CTulStringResourceReader* reader = CTulStringResourceReader::NewL(*fileName); CleanupStack::PushL(reader); //get pointer to the message part of the notifier TPtrC resourceString; resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_DISABLE)); //create descriptor with a max length to fit the localised "disabled" text + new line + "Bluetooth" RBuf content; content.CreateL(resourceString.Length() + KNewLine().Length() + KDefaultBluetoothStringLength); CleanupClosePushL(content); //add resource string and new line character to the content descriptor content.Append(resourceString); content.Append(KNewLine()); //get pointer to the Bluetooth name part of the notifier (can't assume this is actually "Bluetooth" in all languages) resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_BLUETOOTH)); //check that the resource string will fit into the content descriptor TInt requiredLength = content.Length() + resourceString.Length(); if (requiredLength > content.MaxLength()) { //allocate more space in the content descriptor content.ReAllocL(requiredLength); } //add resource string to the content descriptor content.Append(resourceString); //display the notifier and complete iNotifUiUtil->ShowInfoNoteL(content, ECmdBTnotifUnavailable); CompleteMessage(KErrNone); //pop and destroy the content descriptor, resource reader and file name CleanupStack::PopAndDestroy(3, fileName); FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete() complete")); }
void AppendL(RBuf& aBuf, const TDesC& aDes, TBool aQuote) { const TInt requiredSpace = aDes.Length() + ((aBuf.Length() == 0) ? 0 : KEnumSeparator().Length()) + (aQuote ? 2 : 0); if ((aBuf.Length() + requiredSpace) > aBuf.MaxLength()) { aBuf.ReAllocL(Max(aBuf.Length() * 2, aBuf.Length() + requiredSpace)); } if (aBuf.Length() > 0) { aBuf.Append(KEnumSeparator); } if (aQuote) { aBuf.Append(KEnumQuote); } aBuf.Append(aDes); if (aQuote) { aBuf.Append(KEnumQuote); } }
/** 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; }