本文整理汇总了C++中CMsvEntry::AddObserverL方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvEntry::AddObserverL方法的具体用法?C++ CMsvEntry::AddObserverL怎么用?C++ CMsvEntry::AddObserverL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvEntry
的用法示例。
在下文中一共展示了CMsvEntry::AddObserverL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestMessageDuringSendingL
void TestMessageDuringSendingL()
{
theUtils->Start(_L("Message During Sending Progress"));
CleanMailFolder(KMsvDraftEntryId);
CleanMailFolder(KMsvSentEntryId);
// Create a message.
RSendAsMessage message;
CleanupClosePushL(message);
theUtils->WriteComment(_L("Create a message."));
CreateSendMessageL(message);
CTestActive* testActive = new(ELeave) CTestActive;
CleanupStack::PushL(testActive);
CTestProgressActive* testProgress = new(ELeave) CTestProgressActive(message);
CleanupStack::PushL(testProgress);
CSentEntryObserver* sentObserver = new(ELeave) CSentEntryObserver(testProgress->iStatus);
CleanupStack::PushL(sentObserver);
CDummyObserver* ob1 = new(ELeave) CDummyObserver;
CleanupStack::PushL(ob1);
CMsvSession* session = CMsvSession::OpenSyncL(*ob1);
CleanupStack::PushL(session);
CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvGlobalOutBoxIndexEntryId,
TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
CleanupStack::PushL(cEntry);
cEntry->AddObserverL(*sentObserver);
theUtils->WriteComment(_L("Begin sending the created message."));
message.SendMessage(testActive->iStatus);
theUtils->WriteComment(_L("Get progress on message."));
testActive->StartL();
testProgress->StartL();
CActiveScheduler::Start();
theUtils->WriteComment(_L("Check progress."));
test(testProgress->iProgress.iState == CMsvSendOperation::ESendStateWaitingToSend);
test(testProgress->iProgress.iProgressMax == 0);
test(testProgress->iProgress.iError == 0);
CleanupStack::PopAndDestroy(7, &message); // cEntry, session, ob1, sendObserver, testProgress, testActive, message
theUtils->Complete();
}
示例2: TestMultipleNotifsL
LOCAL_C void TestMultipleNotifsL()
{
CMultipleSessionObserver* ob = new(ELeave) CMultipleSessionObserver;
CleanupStack::PushL(ob);
CMsvSession* session = CMsvSession::OpenSyncL(*ob);
CleanupStack::PushL(session);
CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
CleanupStack::PushL(cEntry);
CEntryObserver* entryOb1=new (ELeave) CEntryObserver;
CleanupStack::PushL(entryOb1);
cEntry->AddObserverL(*entryOb1);
CTestActive* active = new (ELeave) CTestActive;
CleanupStack::PushL(active);
CMsvOperation* operation;
CMsvEntrySelection* selection;
// create folders to work under
TMsvEntry folder1;
folder1.iDescription.Set(KShortDescription);
folder1.iDetails.Set(KShortDetails);
folder1.iType = KUidMsvFolderEntry;
folder1.iMtm = KUidMsvLocalServiceMtm;
folder1.iServiceId = KMsvLocalServiceIndexEntryId;
TMsvEntry folder2;
folder2.iDescription.Set(KShortDescription);
folder2.iDetails.Set(KShortDetails);
folder2.iType = KUidMsvFolderEntry;
folder2.iMtm = KUidMsvLocalServiceMtm;
folder2.iServiceId = KMsvLocalServiceIndexEntryId;
TMsvEntry folder3;
folder3.iDescription.Set(KShortDescription);
folder3.iDetails.Set(KShortDetails);
folder3.iType = KUidMsvFolderEntry;
folder3.iMtm = KUidMsvLocalServiceMtm;
folder3.iServiceId = KMsvLocalServiceIndexEntryId;
// create all th entries
TMsvEntry entry;
entry.iDescription.Set(KShortDescription);
entry.iDetails.Set(KShortDetails);
entry.iType = KUidMsvFolderEntry;
entry.iMtm = KUidMsvLocalServiceMtm;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
// create folder 2 & 3
cEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
CreateEntry(folder2, *cEntry, KErrNone, *entryOb1);
CreateEntry(folder3, *cEntry, KErrNone, *entryOb1);
TMsvLocalOperationProgress prog;
TInt max = 2*TMsvPackedChangeNotification::KMsvPackedChangeLimit+4;
for (TInt count=1; count<=max; count++)
{
test.Printf(_L("."));
// create another entry under folder 2
cEntry->SetEntryL(folder2.Id());
CreateEntry(entry, *cEntry, KErrNone, *entryOb1);
// create folder1
cEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
CreateEntry(folder1, *cEntry, KErrNone, *entryOb1);
// test
cEntry->SetEntryL(folder3.Id());
selection = cEntry->ChildrenL();
test(selection->Count()==0);
delete selection;
// copy all entries to folder 3
ob->Start(MMsvSessionObserver::EMsvEntriesCreated, folder3.Id());
cEntry->SetEntryL(folder2.Id());
selection = cEntry->ChildrenL();
test(selection->Count()==count);
active->StartL();
operation = cEntry->CopyL(*selection, folder3.Id(), active->iStatus);
delete selection;
CActiveScheduler::Start(); // operation complete
test(operation->iStatus.Int()==KErrNone);
test(operation->Mtm()==KUidMsvLocalServiceMtm);
test(operation->Service()==KMsvLocalServiceIndexEntryId);
prog = McliUtils::GetLocalProgressL(*operation);
test(prog.iTotalNumberOfEntries==count);
test(prog.iNumberCompleted==count);
test(prog.iNumberFailed==0);
test(prog.iError==KErrNone);
delete operation;
operation=NULL;
// test
cEntry->SetEntryL(folder3.Id());
selection = cEntry->ChildrenL();
test(selection->Count()==count);
//.........这里部分代码省略.........