1468 |
1475 |
1469 |
1476 |
1470 |
1477 |
1471 //__UHEAP_MARKEND; |
1478 //__UHEAP_MARKEND; |
1472 } |
1479 } |
|
1480 |
|
1481 |
|
1482 |
|
1483 TInt CTestProvider :: AddOneContactNewFieldsL() |
|
1484 { |
|
1485 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
1486 |
|
1487 TInt pos = 0; |
|
1488 pMap->InsertL(KContactId, TLiwVariant( _L(""))); |
|
1489 CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); |
|
1490 fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); |
|
1491 |
|
1492 fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); |
|
1493 |
|
1494 pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); |
|
1495 |
|
1496 CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); |
|
1497 fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); |
|
1498 |
|
1499 fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); |
|
1500 |
|
1501 pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); |
|
1502 |
|
1503 CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); |
|
1504 |
|
1505 fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); |
|
1506 |
|
1507 fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); |
|
1508 |
|
1509 pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); |
|
1510 |
|
1511 CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); |
|
1512 anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); |
|
1513 anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
1514 pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); |
|
1515 |
|
1516 |
|
1517 CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); |
|
1518 dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); |
|
1519 dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
1520 pMap->InsertL(KDate, TLiwVariant(dateMap)); |
|
1521 |
|
1522 |
|
1523 |
|
1524 CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); |
|
1525 fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); |
|
1526 |
|
1527 fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); |
|
1528 |
|
1529 pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); |
|
1530 |
|
1531 CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); |
|
1532 fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); |
|
1533 |
|
1534 fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); |
|
1535 |
|
1536 pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); |
|
1537 |
|
1538 CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); |
|
1539 CLiwList* list = CLiwDefaultList::NewL(); |
|
1540 list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); |
|
1541 list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); |
|
1542 fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); |
|
1543 |
|
1544 fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); |
|
1545 |
|
1546 pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); |
|
1547 |
|
1548 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
1549 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
1550 |
|
1551 inList ->AppendL( paramContentType ); |
|
1552 inList ->AppendL( paramAddData ); |
|
1553 |
|
1554 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); |
|
1555 |
|
1556 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
1557 TLiwVariant err = param->Value(); |
|
1558 TInt code = err.AsTInt32(); |
|
1559 |
|
1560 |
|
1561 pMap->DecRef(); |
|
1562 fieldMap->DecRef(); |
|
1563 fieldMap->DecRef(); |
|
1564 |
|
1565 inList->Reset(); |
|
1566 outList->Reset(); |
|
1567 if(code == SErrNone) |
|
1568 { |
|
1569 return KErrNone; |
|
1570 } |
|
1571 return KErrGeneral; |
|
1572 } |
|
1573 |
|
1574 |
|
1575 TInt CTestProvider :: GetListNewFieldsTestSync(CStifItemParser& /*aItem */) |
|
1576 { |
|
1577 LoadService(); |
|
1578 TInt addRes = AddOneContactNewFieldsL(); |
|
1579 if(addRes != KErrNone) |
|
1580 { |
|
1581 return KErrGeneral; |
|
1582 } |
|
1583 |
|
1584 _LIT8(KFilter, "Filter"); |
|
1585 _LIT8(KSearchVal, "SearchVal"); |
|
1586 TInt iResult = KErrNone; |
|
1587 TInt pos = 0; |
|
1588 |
|
1589 //const TLiwGenericParam paramGetListSortOrder; |
|
1590 |
|
1591 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
1592 inList ->AppendL( paramContentType ); |
|
1593 |
|
1594 CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
1595 CleanupStack::PushL(map); |
|
1596 map->InsertL(KSearchVal,_L("Barbie")); |
|
1597 |
|
1598 const TLiwGenericParam paramData(KFilter, TLiwVariant(map)); |
|
1599 inList ->AppendL( paramData ); |
|
1600 |
|
1601 iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, 0, NULL); |
|
1602 |
|
1603 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
1604 TLiwVariant err = param->Value(); |
|
1605 TInt code = err.AsTInt32(); |
|
1606 |
|
1607 if(code == SErrNone) |
|
1608 { |
|
1609 TInt pos = 0; |
|
1610 TBuf<255> firstName; |
|
1611 TBuf<255> secName; |
|
1612 TBuf<255> callerObjImg; |
|
1613 TBuf<255> Note; |
|
1614 TLiwVariant cntId; |
|
1615 TLiwVariant mapfield; |
|
1616 TLiwVariant firstname; |
|
1617 TLiwVariant secname; |
|
1618 TLiwVariant callerobjimg; |
|
1619 TLiwVariant xspidarr; |
|
1620 TLiwVariant note; |
|
1621 TLiwVariant entry; |
|
1622 const CLiwMap* map = NULL; |
|
1623 const CLiwMap* mapField = NULL; |
|
1624 const CLiwList* xspid = NULL; |
|
1625 |
|
1626 param = outList->FindFirst(pos, KReturnValue); |
|
1627 TLiwVariant iterator = param->Value(); |
|
1628 CLiwIterable* iter = iterator.AsIterable(); |
|
1629 if(iter->NextL(entry)) |
|
1630 { |
|
1631 map = entry.AsMap(); |
|
1632 TInt count1 = map->Count(); |
|
1633 map->FindL(KContactId, cntId); |
|
1634 TPtrC8 ptr = cntId.AsData(); |
|
1635 if(map->FindL(KFirstName,mapfield)) |
|
1636 mapField = mapfield.AsMap(); |
|
1637 |
|
1638 TInt count = mapField->Count(); |
|
1639 firstname.Reset(); |
|
1640 mapField->FindL(KFieldValue,firstname); |
|
1641 firstName = firstname.AsDes(); |
|
1642 if(firstName.CompareF(_L("Barbie")) != 0) |
|
1643 { |
|
1644 iResult = KErrGeneral; |
|
1645 } |
|
1646 |
|
1647 if(map->FindL(KSecondName,mapfield)) |
|
1648 mapField = mapfield.AsMap(); |
|
1649 count = mapField->Count(); |
|
1650 mapField->FindL(KFieldValue,secname); |
|
1651 secName = secname.AsDes(); |
|
1652 if(secName.CompareF(_L("Doll")) != 0) |
|
1653 { |
|
1654 iResult = KErrGeneral; |
|
1655 } |
|
1656 |
|
1657 if(map->FindL(KCallerObjImg,mapfield)) |
|
1658 mapField = mapfield.AsMap(); |
|
1659 count = mapField->Count(); |
|
1660 mapField->FindL(KFieldValue,callerobjimg); |
|
1661 callerObjImg = callerobjimg.AsDes(); |
|
1662 if(callerObjImg.CompareF(_L("C:\\data\\images\\pic.jpg")) != 0) |
|
1663 { |
|
1664 iResult = KErrGeneral; |
|
1665 } |
|
1666 if(map->FindL(KNote,mapfield)) |
|
1667 mapField = mapfield.AsMap(); |
|
1668 count = mapField->Count(); |
|
1669 mapField->FindL(KFieldValue,note); |
|
1670 Note = note.AsDes(); |
|
1671 if(Note.CompareF(_L("Lead role in Barbie, the island princess")) != 0) |
|
1672 { |
|
1673 iResult = KErrGeneral; |
|
1674 } |
|
1675 |
|
1676 if(map->FindL(KXSPID,mapfield)) |
|
1677 mapField = mapfield.AsMap(); |
|
1678 //count = mapField->Count(); |
|
1679 mapField->FindL(KFieldValue,xspidarr); |
|
1680 xspid = xspidarr.AsList(); |
|
1681 TInt xspidcount = xspid->Count(); |
|
1682 for(TInt index =0;index < xspidcount; index++) |
|
1683 { |
|
1684 TLiwVariant xspidVal; |
|
1685 if(xspid->AtL(index,xspidVal)) |
|
1686 { |
|
1687 TPtrC ptrVal = xspidVal.AsDes(); |
|
1688 if(ptrVal.CompareF(_L("Yahoo:Barbie@yahoo.co.in")) != 0 && ptrVal.CompareF(_L("Google:Barbie@gmail.com")) != 0) |
|
1689 { |
|
1690 iResult = KErrGeneral; |
|
1691 break; |
|
1692 } |
|
1693 } |
|
1694 } |
|
1695 |
|
1696 } |
|
1697 } |
|
1698 |
|
1699 CleanupStack::Pop(map); |
|
1700 map->DecRef(); |
|
1701 inList->Reset(); |
|
1702 outList->Reset(); |
|
1703 return iResult; |
|
1704 } |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 TInt CTestProvider :: AddContactNewFieldsSynTest(CStifItemParser& /*aItem */) |
|
1710 { |
|
1711 LoadService(); |
|
1712 |
|
1713 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
1714 |
|
1715 TInt pos = 0; |
|
1716 pMap->InsertL(KContactId, TLiwVariant( _L(""))); |
|
1717 CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); |
|
1718 fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); |
|
1719 |
|
1720 fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); |
|
1721 |
|
1722 pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); |
|
1723 |
|
1724 CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); |
|
1725 fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); |
|
1726 |
|
1727 fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); |
|
1728 |
|
1729 pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); |
|
1730 |
|
1731 CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); |
|
1732 |
|
1733 fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); |
|
1734 |
|
1735 fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Sister of Princess Barbie"))); |
|
1736 |
|
1737 pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); |
|
1738 |
|
1739 |
|
1740 CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); |
|
1741 anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); |
|
1742 anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
1743 pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); |
|
1744 |
|
1745 |
|
1746 CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); |
|
1747 dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); |
|
1748 dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
1749 pMap->InsertL(KDate, TLiwVariant(dateMap)); |
|
1750 |
|
1751 |
|
1752 CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); |
|
1753 fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); |
|
1754 |
|
1755 fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); |
|
1756 |
|
1757 pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); |
|
1758 |
|
1759 CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); |
|
1760 fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); |
|
1761 |
|
1762 fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); |
|
1763 |
|
1764 pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); |
|
1765 |
|
1766 CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); |
|
1767 CLiwList* list = CLiwDefaultList::NewL(); |
|
1768 list->AppendL(TLiwVariant(_L("Yahoo:kelly@yahoo.co.in"))); |
|
1769 list->AppendL(TLiwVariant(_L("Google:kelly@gmail.com"))); |
|
1770 fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); |
|
1771 |
|
1772 fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); |
|
1773 |
|
1774 pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
1781 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
1782 |
|
1783 inList ->AppendL( paramContentType ); |
|
1784 inList ->AppendL( paramAddData ); |
|
1785 |
|
1786 |
|
1787 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); |
|
1788 |
|
1789 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
1790 TLiwVariant err = param->Value(); |
|
1791 TInt code = err.AsTInt32(); |
|
1792 |
|
1793 |
|
1794 |
|
1795 if(code == SErrNone) |
|
1796 { |
|
1797 pos =0; |
|
1798 param = outList->FindFirst( pos, KReturnValue ); |
|
1799 |
|
1800 TLiwVariant cntId = param->Value(); |
|
1801 |
|
1802 TPtrC idVal = cntId.AsDes(); |
|
1803 if(idVal.Compare(KNullDesC) != 0) |
|
1804 { |
|
1805 pMap->DecRef(); |
|
1806 fieldMap->DecRef(); |
|
1807 fieldMap->DecRef(); |
|
1808 |
|
1809 inList->Reset(); |
|
1810 outList->Reset(); |
|
1811 return KErrNone; |
|
1812 } |
|
1813 else |
|
1814 { |
|
1815 pMap->DecRef(); |
|
1816 fieldMap->DecRef(); |
|
1817 fieldMap->DecRef(); |
|
1818 |
|
1819 inList->Reset(); |
|
1820 outList->Reset(); |
|
1821 return KErrGeneral; |
|
1822 } |
|
1823 } |
|
1824 pMap->DecRef(); |
|
1825 fieldMap->DecRef(); |
|
1826 fieldMap->DecRef(); |
|
1827 |
|
1828 inList->Reset(); |
|
1829 outList->Reset(); |
|
1830 return KErrGeneral; |
|
1831 } |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 TInt CTestProvider :: AddGroupSynTest(CStifItemParser& /*aItem*/) |
|
1837 { |
|
1838 LoadService(); |
|
1839 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
1840 TInt pos = 0; |
|
1841 |
|
1842 pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb"))); |
|
1843 pMap->InsertL(KGroupId, TLiwVariant(_L8(""))); |
|
1844 pMap->InsertL(KGroupLabel, TLiwVariant(_L("TestAddSyncGroup"))); |
|
1845 |
|
1846 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group"))); |
|
1847 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
1848 |
|
1849 inList ->AppendL( paramContentType ); |
|
1850 inList ->AppendL( paramAddData ); |
|
1851 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); |
|
1852 |
|
1853 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
1854 TLiwVariant err = param->Value(); |
|
1855 TInt code = err.AsTInt32(); |
|
1856 |
|
1857 |
|
1858 if(code == SErrNone) |
|
1859 { |
|
1860 pos =0; |
|
1861 param = outList->FindFirst( pos, KReturnValue ); |
|
1862 |
|
1863 TLiwVariant cntId = param->Value(); |
|
1864 |
|
1865 TPtrC idVal = cntId.AsDes(); |
|
1866 if(idVal.Compare(KNullDesC) != 0) |
|
1867 { |
|
1868 |
|
1869 inList->Reset(); |
|
1870 outList->Reset(); |
|
1871 return KErrNone; |
|
1872 } |
|
1873 else |
|
1874 { |
|
1875 |
|
1876 inList->Reset(); |
|
1877 outList->Reset(); |
|
1878 return KErrGeneral; |
|
1879 } |
|
1880 } |
|
1881 |
|
1882 inList->Reset(); |
|
1883 outList->Reset(); |
|
1884 return KErrGeneral; |
|
1885 |
|
1886 } |