当前位置: 首页>>代码示例>>C++>>正文


C++ TMsvEntry::Parent方法代码示例

本文整理汇总了C++中TMsvEntry::Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ TMsvEntry::Parent方法的具体用法?C++ TMsvEntry::Parent怎么用?C++ TMsvEntry::Parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMsvEntry的用法示例。


在下文中一共展示了TMsvEntry::Parent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateEntry

/**
Creates a new entry as a child of the current context.

Ownership of the created entry is given to the process with the specified SID.

The parent ID and entry ID are set by the Message Server.

@param	aEntry
Index entry value for the new entry

@param	aOwnerId
The SID of the process that will own the create entry.

@param aBulk
A boolean value to indicate whether this is part of a bulk operation. (ETrue = bulk)

@return
KErrNone - success; KErrNoMemory - a memory allocation failed;
KErrNotSupported - aEntry is invalid
*/
EXPORT_C TInt CMsvServerEntry::CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId, TBool aBulk)
	{
	__ASSERT_DEBUG(iEntry.Id()!=KMsvNullIndexEntryId, PanicServer(EMsvEntryWithNoContext2));
	aEntry.SetParent(iEntry.Id());
	__ASSERT_DEBUG(MsvUtils::ValidEntry(aEntry, ETrue), PanicServer(EMsvBadEntryContents));

	// if valid - try to create the new child
	TInt error;
	if (iEntry.Id()==KMsvNullIndexEntryId || !MsvUtils::ValidEntry(aEntry, ETrue))
		error = KErrNotSupported;
	else
		{
		error = iServer.AddEntry(aEntry, aOwnerId, ETrue, aBulk);

		// if the child was created,then notify everyone, otherwise reset the parent
		if (error)
			aEntry.SetParent(KMsvNullIndexEntryId);
		else
			{
			if (!aBulk)
				{
				iServer.NotifyChanged(EMsvEntriesCreated, aEntry.Id(), aEntry.Parent());
				}
			iEntry.SetOwner(ETrue);
			}
		}

	return error;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:49,代码来源:MSVENTRY.CPP

示例2: DeleteEntryL

/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CSMSSender::DeleteEntryL(TMsvEntry& aMsvEntry)
    {
    // Take a handle to the parent entry
    CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession, aMsvEntry.Parent(), TMsvSelectionOrdering());

    CleanupStack::PushL(parentEntry);

    // here parentEntry is the Sent folder (must be so that we can call DeleteL) 
    iOperation = parentEntry->DeleteL(aMsvEntry.Id(), iStatus);

    CleanupStack::PopAndDestroy(parentEntry);

    SetActive();
    }
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:18,代码来源:SMS_Sender.cpp

示例3: TestReadOnlyDeletionL

LOCAL_C void TestReadOnlyDeletionL()
	{
	CDummyObserver* ob = new(ELeave)CDummyObserver;
	CleanupStack::PushL(ob);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);

	// Create an entry
	TMsvEntry entry;
	entry.iType = KUidMsvMessageEntry;
	entry.iMtm = KUidMsvLocalServiceMtm;
	entry.iServiceId = KMsvLocalServiceIndexEntryId;
	cEntry->CreateL(entry);

	// Generate name of attachment
	cEntry->SetEntryL(entry.Id());
	TFileName fileName;

	fileName.Append(_L("Test"));
	CMsvStore* store = cEntry->EditStoreL();
	CleanupStack::PushL(store);

	CAsyncWaiter* waiter = CAsyncWaiter::NewL();
	CleanupStack::PushL(waiter);
	CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
	CleanupStack::PushL(attachment);
	fileName.Append(_L("Test"));
	attachment->SetAttachmentNameL(fileName);
	RFile file;
	store->AttachmentManagerL().CreateAttachmentL(fileName, file, attachment, waiter->iStatus);
	CleanupStack::Pop(attachment); // ownership passed
	waiter->StartAndWait();
	User::LeaveIfError(waiter->Result());
	CleanupStack::PopAndDestroy(waiter);
	
	CleanupClosePushL(file);
	User::LeaveIfError(file.Write(_L8("some text")));
	User::LeaveIfError(file.SetAtt(KEntryAttReadOnly, KEntryAttNormal));
	CleanupStack::PopAndDestroy(2, store); // file, store

	// Now try and delete the file
	cEntry->SetEntryL(entry.Parent());
	cEntry->DeleteL(entry.Id());

	CleanupStack::PopAndDestroy(3); // cEntry, session, ob
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:50,代码来源:t_defect.cpp

示例4: DeleteUserFolderL

// -----------------------------------------------------------------------------
// CMmsAdapterMsvApi::DeleteUserFolderL
// -----------------------------------------------------------------------------
//
 TInt CMmsAdapterMsvApi::DeleteUserFolderL( TMsvId aUid )
    {
    TRACE_FUNC_ENTRY;
    
    CMsvEntry* entry = iSession.GetEntryL(aUid);
    CleanupStack::PushL(entry);
    
    TMsvEntry tEntry = entry->Entry();
    TMsvId parent = tEntry.Parent();        
    
    if ( tEntry.iType != KUidMsvFolderEntry || parent != KMsvMyFoldersEntryIdValue )
        {
        LOGGER_WRITE( "Not correct folder" );
        CleanupStack::PopAndDestroy(entry);
        LOGGER_LEAVEFN( "MsvApi::DeleteUserFolderL" );
        return KErrNotSupported;
        }
        
    CMsvEntrySelection* children = entry->ChildrenL();
    TInt count = children->Count();
    delete children;
    
    if ( count > 0 )
        {
        LOGGER_WRITE( "Folder not empty" );
        CleanupStack::PopAndDestroy( entry );
        LOGGER_LEAVEFN( "MsvApi::DeleteUserFolderL" );
        return KErrInUse;
        }
        
    tEntry.SetReadOnly( EFalse );
    entry->ChangeL( tEntry );
    
    entry->SetEntryL( parent );
    entry->DeleteL( aUid );
    
    CleanupStack::PopAndDestroy( entry );
    TRACE_FUNC_EXIT;
    return KErrNone;
    }   
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:44,代码来源:mmsadaptermsvapi.cpp

示例5: PrepareStoreL

// ----------------------------------------------------------------------------
// CIpsPlgNewChildPartFromFileOperation::PrepareStoreL
// ----------------------------------------------------------------------------
//
void CIpsPlgNewChildPartFromFileOperation::PrepareStoreL()
    {
    CMsvEntry* cAtta = iMsvSession.GetEntryL( iNewAttachmentId );
    CleanupStack::PushL( cAtta );
    TBool parentToMultipartAlternative( EFalse );
    if( cAtta->HasStoreL() )
        {
        CMsvStore* store = cAtta->EditStoreL();
        CleanupStack::PushL( store );
        CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
        
        if( store->IsPresentL( KUidMsgFileMimeHeader ) )
            {
            mimeHeader->RestoreL( *store );
            CDesC8Array& array = mimeHeader->ContentTypeParams();
            array.AppendL( KMethod );
            parentToMultipartAlternative = ETrue;
            
            if( iContentType->Des().Find( KMimeTextCalRequest ) != KErrNotFound )
                {    
                array.AppendL( KRequest );
                }
            else if( iContentType->Des().Find( KMimeTextCalResponse ) != KErrNotFound )
                {
                array.AppendL( KResponse );
                }
            else if( iContentType->Des().Find( KMimeTextCalCancel ) != KErrNotFound ) 
                {
                array.AppendL( KCancel );
                }
            else
                {
                parentToMultipartAlternative = EFalse;
                }
            mimeHeader->StoreWithoutCommitL( *store );
            store->CommitL();
            }
        
        CleanupStack::PopAndDestroy( 2, store );
        }

    if( parentToMultipartAlternative &&
        iFilePath->Find( KFileExtensionICS ) != KErrNotFound )
        {        
        TMsvEntry tAttaEntry = cAtta->Entry();
        TMsvId id = tAttaEntry.Parent();
        CMsvEntry* cParent = iMsvSession.GetEntryL( id );
        CleanupStack::PushL( cParent );
        
        TMsvEmailEntry tEntry = cParent->Entry();
        tEntry.SetMessageFolderType( EFolderTypeAlternative );
        
        // Do async again if needed

        iOperation = cParent->ChangeL( tEntry, iStatus );
        CleanupStack::PopAndDestroy( cParent );
        CleanupStack::PopAndDestroy( cAtta );
        }
    else
        {
        CleanupStack::PopAndDestroy( cAtta );
        iStatus = KRequestPending;
        TRequestStatus* status = &iStatus;
        User::RequestComplete(status,KErrNone);
        }
    iStep = EStoreMessagePart; // Next step
    SetActive();
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:72,代码来源:ipsplgnewchildpartfromfileoperation.cpp


注:本文中的TMsvEntry::Parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。