void CNamedViewSubSession::ChangeSortOrderL(const RMessage2& aMessage) { RContactViewSortOrder newSortOrder; TContactViewPreferences contactsToInclude; UnpackageSortOrderL(aMessage,newSortOrder,contactsToInclude); View().ChangeSortOrderL(newSortOrder); newSortOrder.Close(); }
void CNamedViewSubSession::ConstructL(const RMessage2& aMessage) { CViewSubSessionBase::ConstructL(); // Read sort order. RContactViewSortOrder sortOrder; CleanupClosePushL(sortOrder); TContactViewPreferences contactsToInclude; TUid sortPluginImplUid; HBufC8* sortPluginName = UnpackageSortOrderAndPluginDetailsLC(aMessage,sortOrder,contactsToInclude,sortPluginImplUid); // Create a descriptor of the correct length. HBufC* nameBuf=HBufC::NewLC(aMessage.GetDesLengthL(2)); TPtr wideNameBufPtr(nameBuf->Des()); // Extract the name of the view from the message. aMessage.ReadL(2, wideNameBufPtr); // Open view using name provided. iView = &iViewManager.OpenNamedViewL(wideNameBufPtr,sortOrder,*this,contactsToInclude,sortPluginImplUid,*sortPluginName); CleanupStack::PopAndDestroy(3,&sortOrder); // nameBuf, sortPluginName, sortOrder sortOrder.Close(); }
void CTestMachine::StepNamedRemoteViewsL() { const TContactViewPreferences viewPrefs = TContactViewPreferences(EUnSortedAtEnd | EContactsOnly); _LIT(KNamedRemoteView, "NamedRemoteView"); RContactViewSortOrder theNameSurnSortOrder; theNameSurnSortOrder.AppendL(KUidContactFieldGivenName); theNameSurnSortOrder.AppendL(KUidContactFieldFamilyName); theNameSurnSortOrder.AppendL(KUidContactFieldPrefixName); //Contains order numbers for given name BEGIN_ASYNC_TEST //Actions: Create named remote view a reverse sorting plugin. Check sorting order. iNamedRemoteView = CContactNamedRemoteView::NewL(*this, KNamedRemoteView, *iDb,iSurnNameSortOrder,viewPrefs, KReverseSortPlugin); WAIT_EVENT(1) //Expected Result: Named remote view must be created - sorting order must be reverse. test.Printf(_L("Named Remote View:\n")); CheckViewOrderL(iNamedRemoteView, ETrue); test.Printf(_L("\n\n")); //Actions: Create another instance of the named remote view with the same name, // but without a sorting plugin this time. Check sorting order. TESTTRAP(iNamedRemoteView2 = CContactNamedRemoteView::NewL(*this, KNamedRemoteView, *iDb, iSurnNameSortOrder,viewPrefs)); WAIT_EVENT(2) //Expected Result: When we create another named remote view with the name of existing view // - another copy of the view will not be created, instead will receive the handle //to existing view. That is why sort order should be as first time - reverse. test.Printf(_L("Another Copy of Named Remote View:\n")); CheckViewOrderL(iNamedRemoteView2, ETrue); test.Printf(_L("\n\n")); //Actions: Change the sort order of the named remote view to sort on // Name and then Surname of the contacts. Check sorting for both handles of the view. iNamedRemoteView2->ChangeSortOrderL(theNameSurnSortOrder); WAIT_EVENTS(3,4) //2 EUnavailable and 2 EOrderChanged //Expected Result: Both instances of the view must be sorted in reverse order on //Names and Surnames of the contacts. test.Printf(_L("First Copy of Named Remote View:\n")); CheckViewOrderL(iNamedRemoteView, ETrue); test.Printf(_L("\n\n")); test.Printf(_L("Another Copy of Named Remote View:\n")); CheckViewOrderL(iNamedRemoteView2, ETrue); test.Printf(_L("\n\n")); ///////////////////////////////////////// //Actions: Create a Find view on top of the first instance of named remote view, //using "Ma" search string iFindDesArray =new(ELeave)CPtrC16Array(1); _LIT(KMa,"Ma"); iFindDesArray->AppendL(TPtrC(KMa)); iNamedRemoteFindView= CContactFindView::NewL(*iDb,*iNamedRemoteView,*this,iFindDesArray); WAIT_EVENT(4) //Expected Result: Check the order of entries in the find view - it must be reverse, // sorting on Names and Surnames test.Printf(_L("NamedRemoteFind View created:\n")); CheckViewOrderL(iNamedRemoteFindView, ETrue); test.Printf(_L("\n\n")); ///////////////////////////////////////// //Actions: Create a Find view on top of the second instance of named remote view, // using "el" search string iFindDesArray->Reset(); _LIT(Kel,"el"); iFindDesArray->AppendL(TPtrC(Kel)); iNamedRemoteFindView2 = CContactFindView::NewL(*iDb,*iNamedRemoteView2,*this,iFindDesArray); WAIT_EVENT(5) //Expected Result: Check the order of entries in the find view - it must be reverse, //sorting on Names and Surnames test.Printf(_L("NamedRemoteFind View 2 created:\n")); CheckViewOrderL(iNamedRemoteFindView2, ETrue); test.Printf(_L("\n\n")); CloseView(iNamedRemoteFindView); CloseView(iNamedRemoteFindView2); CloseView(iNamedRemoteView); CloseView(iNamedRemoteView2); iFindDesArray->Reset(); delete iFindDesArray; iFindDesArray = NULL; END_ASYNC_TEST theNameSurnSortOrder.Close(); }