33 #include "xmluicontroller.h" |
33 #include "xmluicontroller.h" |
34 #include "xmlnodeidgenerator.h" |
34 #include "xmlnodeidgenerator.h" |
35 #include "aixmluiconstants.h" |
35 #include "aixmluiconstants.h" |
36 #include "aifweventhandler.h" |
36 #include "aifweventhandler.h" |
37 #include "databuffertransactionelement.h" |
37 #include "databuffertransactionelement.h" |
38 #include "newstickercallbackhandler.h" |
|
39 #include "newstickertransactionelement.h" |
38 #include "newstickertransactionelement.h" |
40 #include "csspropertymap.h" |
39 #include "csspropertymap.h" |
41 #include "policyevaluator.h" |
40 #include "policyevaluator.h" |
42 #include "debug.h" |
41 #include "debug.h" |
43 #include "xnuiengineappif.h" |
42 #include "xnuiengineappif.h" |
44 #include "xnnodeappif.h" |
43 #include "xnnodeappif.h" |
45 #include "xncomponentnodeimpl.h" |
|
46 #include "xnproperty.h" |
44 #include "xnproperty.h" |
47 #include "mxncomponentinterface.h" |
45 #include "mxncomponentinterface.h" |
48 #include "xntext.h" |
46 #include "xntext.h" |
49 #include "xnbitmap.h" |
47 #include "xnbitmap.h" |
50 #include "xntype.h" |
48 #include "xntype.h" |
51 #include "xnmenuadapter.h" |
49 #include "xnmenuadapter.h" |
52 #include "xnlistquerydialogadapter.h" |
50 #include "xnlistquerydialogadapter.h" |
|
51 #include "xnnewsticker.h" |
53 #include "mxncomponentinterface.h" |
52 #include "mxncomponentinterface.h" |
54 #include "aistrcnv.h" |
53 #include "aistrcnv.h" |
55 #include "contentprioritymap.h" |
54 #include "contentprioritymap.h" |
56 #include "ainativeuiplugins.h" |
55 #include "ainativeuiplugins.h" |
57 |
56 |
985 { |
981 { |
986 // Check if target is newsticker |
982 // Check if target is newsticker |
987 MTransactionElement* element( NULL ); |
983 MTransactionElement* element( NULL ); |
988 |
984 |
989 if ( IsParentNewsticker( *target ) ) |
985 if ( IsParentNewsticker( *target ) ) |
990 { |
986 { |
991 // Register callback interface for newsticker |
|
992 CXnNodeAppIf *parent( target->ParentL() ); |
987 CXnNodeAppIf *parent( target->ParentL() ); |
993 |
988 |
994 if( !parent ) |
989 if( !parent ) |
995 { |
990 { |
996 return KErrNotFound; |
991 return KErrNotFound; |
997 } |
992 } |
998 |
993 |
999 RegisterNewstickerCallbackInterfaceL( *parent ); |
|
1000 |
|
1001 iNTPublisher.Set( info.Name() ); |
|
1002 iNTClass = AiUtility::CopyToBufferL( iNTClass, nodeId ); |
|
1003 |
|
1004 element = iFactory->CreateNewsTickerTransactionElementL( |
994 element = iFactory->CreateNewsTickerTransactionElementL( |
1005 *target, aText, priority, aIndex ); |
995 *target, aText, priority, aIndex ); |
1006 } |
996 } |
1007 else if( target->Type()->Type() == |
997 else if( target->Type()->Type() == |
1008 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
998 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
1075 CGulIcon* icon( LeaveIfNull( UnpackPtr<CGulIcon>( aBuf ), KErrArgument ) ); |
1065 CGulIcon* icon( LeaveIfNull( UnpackPtr<CGulIcon>( aBuf ), KErrArgument ) ); |
1076 |
1066 |
1077 // Publish icon |
1067 // Publish icon |
1078 retval = PublishIconL( aPlugin, nodeId, icon, aIndex ); |
1068 retval = PublishIconL( aPlugin, nodeId, icon, aIndex ); |
1079 } |
1069 } |
1080 else if ( type == KContentTypeImageSvg || |
1070 else if ( type == KContentTypeImageSvg || type == KContentTypeData ) |
1081 type == KContentTypeData ) |
|
1082 { |
1071 { |
1083 // Publish data |
1072 // Publish data |
1084 retval = PublishDataL( aPlugin, nodeId, aBuf, type, aIndex ); |
1073 retval = PublishDataL( aPlugin, nodeId, aBuf, type, aIndex ); |
1085 } |
1074 } |
1086 |
1075 |
1133 { |
1122 { |
1134 return KErrNotSupported; |
1123 return KErrNotSupported; |
1135 } |
1124 } |
1136 |
1125 |
1137 if ( AllowPublishByPriority( *target, priority ) ) |
1126 if ( AllowPublishByPriority( *target, priority ) ) |
1138 { |
1127 { |
1139 // Check if target is newsticker |
|
1140 if ( IsParentNewsticker( *target ) ) |
|
1141 { |
|
1142 // Register callback interface |
|
1143 CXnNodeAppIf *parent( target->ParentL() ); |
|
1144 |
|
1145 if( !parent ) |
|
1146 { |
|
1147 return KErrNotFound; |
|
1148 } |
|
1149 |
|
1150 RegisterNewstickerCallbackInterfaceL( *parent ); |
|
1151 |
|
1152 iNTPublisher.Set( info.Name() ); |
|
1153 iNTClass = AiUtility::CopyToBufferL( iNTClass, nodeId ); |
|
1154 } |
|
1155 |
|
1156 // Create transaction element for file |
1128 // Create transaction element for file |
1157 MTransactionElement* element = |
1129 MTransactionElement* element = |
1158 iFactory->CreateImageTransactionElementL( |
1130 iFactory->CreateImageTransactionElementL( |
1159 *target, aFile, priority ); |
1131 *target, aFile, priority ); |
1160 |
1132 |
1223 if ( !AllowPublishByPriority( *target, priority ) ) |
1195 if ( !AllowPublishByPriority( *target, priority ) ) |
1224 { |
1196 { |
1225 return KErrAccessDenied; |
1197 return KErrAccessDenied; |
1226 } |
1198 } |
1227 |
1199 |
1228 if ( IsParentNewsticker( *target ) ) |
|
1229 { |
|
1230 CXnNodeAppIf *parent( target->ParentL() ); |
|
1231 |
|
1232 if( !parent ) |
|
1233 { |
|
1234 return KErrNotFound; |
|
1235 } |
|
1236 |
|
1237 RegisterNewstickerCallbackInterfaceL( *parent ); |
|
1238 |
|
1239 iNTPublisher.Set( info.Name() ); |
|
1240 iNTClass = AiUtility::CopyToBufferL( iNTClass, nodeId ); |
|
1241 } |
|
1242 |
|
1243 if( target->Type()->Type() == |
1200 if( target->Type()->Type() == |
1244 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
1201 XnListQueryDialogInterface::MXnListQueryDialogInterface::Type()) |
1245 { |
1202 { |
1246 // Get the data interface for dialog and delete data |
1203 // Get the data interface for dialog and delete data |
1247 XnListQueryDialogInterface::MXnListQueryDialogInterface* listQuery( NULL ); |
1204 XnListQueryDialogInterface::MXnListQueryDialogInterface* listQuery( NULL ); |
1478 if ( !AllowPublishByPriority( *target, priority ) ) |
1435 if ( !AllowPublishByPriority( *target, priority ) ) |
1479 { |
1436 { |
1480 return KErrAccessDenied; |
1437 return KErrAccessDenied; |
1481 } |
1438 } |
1482 |
1439 |
1483 // Special handling of newsticker |
|
1484 if ( IsParentNewsticker( *target ) ) |
|
1485 { |
|
1486 // Register callback interface |
|
1487 CXnNodeAppIf *parent( target->ParentL() ); |
|
1488 |
|
1489 if( !parent ) |
|
1490 { |
|
1491 return KErrNotFound; |
|
1492 } |
|
1493 |
|
1494 RegisterNewstickerCallbackInterfaceL( *parent ); |
|
1495 |
|
1496 iNTPublisher.Set( info.Name() ); |
|
1497 iNTClass = AiUtility::CopyToBufferL( iNTClass, aCid ); |
|
1498 } |
|
1499 |
|
1500 MTransactionElement* element = |
1440 MTransactionElement* element = |
1501 iFactory->CreateImageTransactionElementL( |
1441 iFactory->CreateImageTransactionElementL( |
1502 *target, aIcon, priority ); |
1442 *target, aIcon, priority ); |
1503 |
1443 |
1504 if ( aResource ) |
1444 if ( aResource ) |
1559 if ( !AllowPublishByPriority( *target, priority ) ) |
1499 if ( !AllowPublishByPriority( *target, priority ) ) |
1560 { |
1500 { |
1561 return KErrAccessDenied; |
1501 return KErrAccessDenied; |
1562 } |
1502 } |
1563 |
1503 |
1564 if( aContentType == KContentTypeData ) |
|
1565 { |
|
1566 CXnComponent& component( target->ParentL()->Component() ); |
|
1567 component.SetDataL( aData, aCid, aIndex ); |
|
1568 return KErrNone; |
|
1569 } |
|
1570 |
|
1571 if ( !CDataBufferTransactionElement::IsSupported( *target, aContentType ) ) |
1504 if ( !CDataBufferTransactionElement::IsSupported( *target, aContentType ) ) |
1572 { |
1505 { |
1573 return KErrNotSupported; |
1506 return KErrNotSupported; |
1574 } |
1507 } |
1575 |
1508 |
1576 // Handle newsticker |
1509 MTransactionElement* element( NULL ); |
1577 if ( IsParentNewsticker( *target ) ) |
1510 |
1578 { |
1511 if ( aContentType == KContentTypeData ) |
1579 CXnNodeAppIf *parent( target->ParentL() ); |
1512 { |
1580 |
1513 element = iFactory->CreateDataBufferTransactionElementL( |
1581 if( !parent ) |
1514 *target, aData, priority, aCid, aIndex ); |
1582 { |
1515 } |
1583 return KErrNotFound; |
1516 else |
1584 } |
1517 { |
1585 |
1518 element = iFactory->CreateDataBufferTransactionElementL( |
1586 RegisterNewstickerCallbackInterfaceL( *parent ); |
1519 *target, aData, priority ); |
1587 |
1520 } |
1588 iNTPublisher.Set( info.Name() ); |
|
1589 iNTClass = AiUtility::CopyToBufferL( iNTClass, aCid ); |
|
1590 } |
|
1591 |
|
1592 MTransactionElement* element = |
|
1593 iFactory->CreateDataBufferTransactionElementL( |
|
1594 *target, aData, priority ); |
|
1595 |
1521 |
1596 if ( aResource ) |
1522 if ( aResource ) |
1597 { |
1523 { |
1598 iPolicyEvaluator->EvaluateResourcePolicyL( |
1524 iPolicyEvaluator->EvaluateResourcePolicyL( |
1599 *target, *aResource, element->PolicyArray() ); |
1525 *target, *aResource, element->PolicyArray() ); |
1917 children.Reset(); |
1843 children.Reset(); |
1918 |
1844 |
1919 // Continue content refresh for next ui element. |
1845 // Continue content refresh for next ui element. |
1920 StartContentRefresh(); |
1846 StartContentRefresh(); |
1921 } |
1847 } |
1922 |
1848 |
1923 // ---------------------------------------------------------------------------- |
|
1924 // CContentRenderer::TitleScrolled |
|
1925 // |
|
1926 // ---------------------------------------------------------------------------- |
|
1927 // |
|
1928 void CContentRenderer::TitleScrolled( TInt aTitleIndex ) |
|
1929 { |
|
1930 if ( iCallbackHandler ) |
|
1931 { |
|
1932 TRAP_IGNORE( iCallbackHandler->TitleScrolledL( |
|
1933 iNTPublisher, *iNTClass, aTitleIndex ) ); |
|
1934 } |
|
1935 } |
|
1936 |
|
1937 // ---------------------------------------------------------------------------- |
|
1938 // CContentRenderer::TitleToScroll |
|
1939 // |
|
1940 // ---------------------------------------------------------------------------- |
|
1941 // |
|
1942 void CContentRenderer::TitleToScroll( TInt aTitleIndex ) |
|
1943 { |
|
1944 if ( iCallbackHandler ) |
|
1945 { |
|
1946 TRAP_IGNORE( iCallbackHandler->TitleToScrollL( |
|
1947 iNTPublisher, *iNTClass, aTitleIndex ) ); |
|
1948 } |
|
1949 } |
|
1950 |
|
1951 // ---------------------------------------------------------------------------- |
1849 // ---------------------------------------------------------------------------- |
1952 // CContentRenderer::IsParentNewsticker |
1850 // CContentRenderer::IsParentNewsticker |
1953 // |
1851 // |
1954 // ---------------------------------------------------------------------------- |
1852 // ---------------------------------------------------------------------------- |
1955 // |
1853 // |
1966 |
1864 |
1967 const TDesC8& type( parent->Type()->Type() ) ; |
1865 const TDesC8& type( parent->Type()->Type() ) ; |
1968 |
1866 |
1969 return ( type == XnNewstickerInterface::MXnNewstickerInterface::Type() ); |
1867 return ( type == XnNewstickerInterface::MXnNewstickerInterface::Type() ); |
1970 } |
1868 } |
1971 |
1869 |
1972 // ---------------------------------------------------------------------------- |
|
1973 // CContentRenderer::RegisterNewstickerCallbackInterfaceL |
|
1974 // |
|
1975 // ---------------------------------------------------------------------------- |
|
1976 // |
|
1977 void CContentRenderer::RegisterNewstickerCallbackInterfaceL( |
|
1978 CXnNodeAppIf& aTarget ) |
|
1979 { |
|
1980 if ( !iCallbackHandler ) |
|
1981 { |
|
1982 // Instantiate callback handler |
|
1983 CNewstickerCallbackHandler* handler = |
|
1984 CNewstickerCallbackHandler::NewLC( *iFwEventHandler ); |
|
1985 |
|
1986 // Set callback handler |
|
1987 iCallbackHandler = handler; |
|
1988 CleanupStack::Pop( handler ); |
|
1989 } |
|
1990 |
|
1991 // Obtain newsticker component interface |
|
1992 XnNewstickerInterface::MXnNewstickerInterface* newsticker( NULL ); |
|
1993 XnComponentInterface::MakeInterfaceL( newsticker, aTarget ); |
|
1994 |
|
1995 LeaveIfNull( newsticker, KErrGeneral ); |
|
1996 |
|
1997 // Set callback interface |
|
1998 newsticker->SetCallbackInterfaceL( this ); |
|
1999 } |
|
2000 |
1870 |
2001 // End of File |
1871 // End of File |