src/hbcore/style/hbstyle.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include "hbstyleoptionslider.h"
    26 #include "hbstyleoptionslider_p.h"
    27 #include "hbstyleoptionsliderelement_p.h"
    27 #include "hbstyleoptionsliderelement_p.h"
    28 #include "hbstyleoptionpushbutton.h"
    28 #include "hbstyleoptionpushbutton_p.h"
    29 #include "hbstyleoptiontoolbutton.h"
    29 #include "hbstyleoptiontoolbutton_p.h"
    30 #include "hbstyleoptiontooltip.h"
    30 #include "hbstyleoptiontooltip_p.h"
    31 #include "hbstyleoptionprogressbar.h"
    31 #include "hbstyleoptionprogressbar_p.h"
    32 #include "hbstyleoptionabstractviewitem.h"
    32 #include "hbstyleoptionabstractviewitem_p.h"
    33 #include "hbstyleoptionlistviewitem.h"
    33 #include "hbstyleoptionlistviewitem_p.h"
    34 #include "hbstyleoptionmenuitem.h"
    34 #include "hbstyleoptionmenuitem_p.h"
    35 #include "hbstyleoptionlabel.h"
    35 #include "hbstyleoptionlabel_p.h"
    36 #include "hbstyleoptionscrollbar.h"
    36 #include "hbstyleoptionscrollbar_p.h"
    37 #include "hbstyleoptiontoolbarextension.h"
    37 #include "hbstyleoptiongridviewitem_p.h"
    38 #include "hbstyleoptiongridviewitem.h"
    38 #include "hbstyleoptioncheckbox_p.h"
    39 #include "hbstyleoptioncheckbox.h"
       
    40 #include "hbiconloader_p.h"
    39 #include "hbiconloader_p.h"
    41 #include "hbstyleoptiontitlepane.h"
    40 #include "hbstyleoptiontitlepane_p.h"
    42 #include "hbstyleoptionstatusbar_p.h"
    41 #include "hbstyleoptionstatusbar_p.h"
    43 #include "hbstyleoptionindicatorgroup.h"
    42 #include "hbstyleoptionindicatorgroup_p.h"
    44 #include "hbstyleoptionprogressdialog.h"
    43 #include "hbstyleoptionprogressdialog_p.h"
    45 #include "hbstyleoptionnotificationdialog.h"
    44 #include "hbstyleoptionnotificationdialog_p.h"
    46 #include "hbstyleoptiontreeviewitem.h"
    45 #include "hbstyleoptiontreeviewitem_p.h"
    47 #include "hbstyleoptioncolorgridviewitem.h"
    46 #include "hbstyleoptioncolorgridviewitem_p.h"
    48 #include "hbstyleoptionmessagebox.h"
    47 #include "hbstyleoptionmessagebox_p.h"
    49 #include "hbstyleoptionsoftkey.h"   // deprecated
    48 #include "hbstyleoptionnavigationbutton_p.h"
    50 #include "hbstyleoptionnavigationbutton.h"
    49 #include "hbstyleoptionindicatorbutton_p.h"
    51 #include "hbstyleoptionindicatorbutton.h"
       
    52 #include "hbstyleoptionsignalindicator_p.h"
    50 #include "hbstyleoptionsignalindicator_p.h"
    53 #include "hbstyleoptionbatteryindicator_p.h"
    51 #include "hbstyleoptionbatteryindicator_p.h"
    54 #include "hbstyle_p.h"
    52 #include "hbstyle_p.h"
    55 #include "hbstyleloader.h"
    53 #include "hbstyleloader.h"
    56 #include "hbwidgetloader_p.h"
    54 #include "hbwidgetloader_p.h"
    57 #include "hbstyleoptionratingslider.h"
    55 #include "hbwidget_p.h"
    58 #include "hbstyleoptiondataformviewitem.h"
    56 #include "hbstyleoptionratingslider_p.h"
       
    57 #include "hbstyleoptiondataformviewitem_p.h"
    59 #include "hbstyleoptiondatagroup_p.h"
    58 #include "hbstyleoptiondatagroup_p.h"
    60 #include "hbstyleoptiondatagroupheadingwidget_p.h"
    59 #include "hbstyleoptiondatagroupheadingwidget_p.h"
    61 #include "hbstyleoptiondataform.h"
    60 #include "hbstyleoptiondataform_p.h"
    62 #include "hbstyleoptiongroupbox.h"
    61 #include "hbstyleoptiongroupbox_p.h"
    63 #include "hbstyleoptionindexfeedback.h"
    62 #include "hbstyleoptionindexfeedback_p.h"
    64 #include "hbstyleoptioncombobox.h"
    63 #include "hbstyleoptioncombobox_p.h"
    65 #include "hbstyleoptioninputdialog.h"
    64 #include "hbstyleoptioninputdialog_p.h"
    66 #include "hbstyleoptionprogresssliderhandle_p.h"
    65 #include "hbstyleoptionprogresssliderhandle_p.h"
    67 #include "hbstyleoptionprogressslider.h"
    66 #include "hbstyleoptionprogressslider_p.h"
    68 
    67 
    69 #include <hbicon.h>
    68 #include <hbicon.h>
    70 #include <hbstyle.h>
    69 #include <hbstyle.h>
    71 #include <hbframedrawer.h>
    70 #include <hbframedrawer.h>
    72 #include <hbiconitem.h>
    71 #include <hbiconitem.h>
    86 #include <hbrichtextitem_p.h>
    85 #include <hbrichtextitem_p.h>
    87 #include <hbtoucharea.h>
    86 #include <hbtoucharea.h>
    88 #include <hbindicatorleveliconitem_p.h>
    87 #include <hbindicatorleveliconitem_p.h>
    89 
    88 
    90 #include <hbglobal.h>
    89 #include <hbglobal.h>
    91 #include <QPluginLoader>
    90 #include <hbpluginloader_p.h>
    92 #include <hbstyleinterface.h>
    91 #include "hbstyleinterface_p.h"
    93 #include <hbstyleparameters.h>
    92 #include <hbstyleparameters.h>
    94 
    93 
    95 #include "hbstyleselector_p.h"
    94 #include "hbstyleselector_p.h"
    96 #include "hblayeredstyleloader_p.h"
    95 #include "hblayeredstyleloader_p.h"
    97 #include "hbwidgetstyleloader_p.h"
    96 #include "hbwidgetstyleloader_p.h"
   111 #include <QDebug>
   110 #include <QDebug>
   112 
   111 
   113 //Uncomment next define(s) in order to get more debug prints.
   112 //Uncomment next define(s) in order to get more debug prints.
   114 //Similar define exists also in the engine side.
   113 //Similar define exists also in the engine side.
   115 //#define HBSTYLE_DEBUG
   114 //#define HBSTYLE_DEBUG
   116 #define HBSTYLE_DEBUG_FONT
       
   117 
   115 
   118 /*!
   116 /*!
   119     @beta
   117     @beta
   120     @hbcore
   118     @hbcore
   121     \class HbStyle
   119     \class HbStyle
   812 {
   810 {
   813     delete d_ptr;
   811     delete d_ptr;
   814 }
   812 }
   815 
   813 
   816 /*!
   814 /*!
       
   815 
   817     \deprecated HbStyle::registerPlugin(const QString&)
   816     \deprecated HbStyle::registerPlugin(const QString&)
   818     is deprecated. Style plugins are not supported anymore.
   817     is deprecated. Style plugins are not supported anymore.
   819 
   818 
   820     Registers the style plugin with the Style system. This method can be called by a custom widget
   819     Registers the style plugin with the Style system. This method can be called by a custom widget
   821     or application in order to register the style plugin that implements the custom graphics primitives.
   820     or application in order to register the style plugin that implements the custom graphics primitives.
   845         // return the base ID of the primitives enumeration
   844         // return the base ID of the primitives enumeration
   846         return d->registeredPlugins.value(pluginName)->primitiveBaseId;
   845         return d->registeredPlugins.value(pluginName)->primitiveBaseId;
   847     }
   846     }
   848 
   847 
   849     // load the plugin
   848     // load the plugin
   850     QPluginLoader* loader = new QPluginLoader(pluginName);
   849     HbPluginLoader* loader = new HbPluginLoader(pluginName);
   851     if (loader == 0)
   850     if (!loader)
   852         return -1;
   851         return -1;
   853 
   852 
   854     // get the instance pointer
   853     // get the instance pointer
   855     QObject* pluginInstance = loader->instance();
   854     QObject* pluginInstance = loader->instance();
   856     if (pluginInstance == 0) {
   855     if (!pluginInstance) {
   857         delete loader;
       
   858 
   856 
   859         // try the additional paths
   857         // try the additional paths
   860         QFileInfo fileInfo( pluginName );
   858         QFileInfo fileInfo(pluginName);
   861         foreach( QString additionalPath, hbInstance->libraryPaths() ) {
   859         foreach (QString additionalPath, hbInstance->libraryPaths()) {
   862             const QDir pluginDir(additionalPath);
   860             const QDir pluginDir(additionalPath);
   863             loader = new QPluginLoader(pluginDir.absoluteFilePath(fileInfo.fileName()));
   861             loader->setPluginName(pluginDir.absoluteFilePath(fileInfo.fileName()));
   864             if ( loader ) {
   862             pluginInstance = loader->instance();
   865                 pluginInstance = loader->instance();
   863             if (pluginInstance) {
   866                 if ( !pluginInstance ) {
   864                 break;
   867                     delete loader;
       
   868                 } else {
       
   869                     break;
       
   870                 }
       
   871             }
   865             }
   872         }
   866         }
   873 
   867 
   874         if ( !pluginInstance ) {
   868         if (!pluginInstance) {
       
   869             delete loader;
   875             return -1;
   870             return -1;
   876         }
   871         }
   877     }
   872     }
   878 
   873 
   879     HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance);
   874     HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance);
   914     return pluginInfo->primitiveBaseId;
   909     return pluginInfo->primitiveBaseId;
   915 }
   910 }
   916 
   911 
   917 
   912 
   918 /*!
   913 /*!
       
   914 
   919     \deprecated HbStyle::unregisterPlugin(const QString&)
   915     \deprecated HbStyle::unregisterPlugin(const QString&)
   920     is deprecated. Style plugins are not supported anymore.
   916     is deprecated. Style plugins are not supported anymore.
   921 
   917 
   922     Un-registers the style plugin.
   918     Un-registers the style plugin.
   923     If the reference count becomes zero, the plugin is unloaded and the primitive IDs are de-registered
   919     If the reference count becomes zero, the plugin is unloaded and the primitive IDs are de-registered
  1023 
  1019 
  1024             case P_CheckBox_icon:
  1020             case P_CheckBox_icon:
  1025             case P_GroupBoxHeading_icon:
  1021             case P_GroupBoxHeading_icon:
  1026             case P_Label_icon:
  1022             case P_Label_icon:
  1027             case P_GridViewItem_icon: {
  1023             case P_GridViewItem_icon: {
  1028                 HbIconItem *item = new HbIconItem(HbIcon(),parent);
  1024                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
  1029                 setItemName(item, QLatin1String("icon"));
  1025                 setItemName(item, QLatin1String("icon"));
  1030                 return item; 
  1026                 return item; 
  1031                 }
  1027                 }
  1032             case P_DataGroup_icon:
  1028             case P_DataGroup_icon:
  1033                 {
  1029                 {
  1338                 HbFrameItem *n = new HbFrameItem(parent);
  1334                 HbFrameItem *n = new HbFrameItem(parent);
  1339                 n->setZValue(-1);
  1335                 n->setZValue(-1);
  1340                 setItemName(n, QLatin1String("background"));
  1336                 setItemName(n, QLatin1String("background"));
  1341                 return n;
  1337                 return n;
  1342             }
  1338             }
  1343             case P_Softkey_background:  // deprecated
       
  1344             case P_NavigationButton_background:
  1339             case P_NavigationButton_background:
  1345             case P_IndicatorButton_background:
  1340             case P_IndicatorButton_background:
  1346             case P_IndicatorGroup_background:   // deprecated
       
  1347             {
  1341             {
  1348                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
  1342                 HbIconItem *n = new HbIconItem(HbIcon(), parent);
  1349                 n->setZValue(-1);
  1343                 n->setZValue(-1);
  1350                 setItemName(n, QLatin1String("background"));
  1344                 setItemName(n, QLatin1String("background"));
  1351                 return n;
  1345                 return n;
  1382                 HbIconItem *n = new HbIconItem(parent);
  1376                 HbIconItem *n = new HbIconItem(parent);
  1383                 n->setFlags(HbIcon::Colorized);
  1377                 n->setFlags(HbIcon::Colorized);
  1384                 setItemName(n, QLatin1String("icon4"));
  1378                 setItemName(n, QLatin1String("icon4"));
  1385                 return n;
  1379                 return n;
  1386             }
  1380             }
  1387             case P_IndicatorGroup_signalicon: // deprecated
       
  1388             case P_SignalIndicator_icon:
  1381             case P_SignalIndicator_icon:
  1389             {
  1382             {
  1390                 HbIconItem *n = new HbIconItem(parent);
  1383                 HbIconItem *n = new HbIconItem(parent);
  1391                 n->setFlags(HbIcon::Colorized);
  1384                 n->setFlags(HbIcon::Colorized);
  1392                 setItemName(n, QLatin1String("icon"));
  1385                 setItemName(n, QLatin1String("icon"));
  1393                 return n;
  1386                 return n;
  1394             }
  1387             }
  1395             case P_SignalLevel_background:
  1388             case P_SignalLevel_background:
  1396             {
  1389             {
  1397                 HbIconItem *n = new HbIconItem(parent);
  1390                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1398                 n->setZValue(-1);
  1391                 n->setZValue(-1);
  1399                 setItemName(n, QLatin1String("background"));
  1392                 setItemName(n, QLatin1String("background"));
  1400                 return n;
  1393                 return n;
  1401             }
  1394             }
  1402             case P_SignalLevel_icon:
  1395             case P_SignalLevel_icon:
  1403             {
  1396             {
  1404                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1397                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1405                 setItemName(n, QLatin1String("levelicon"));
  1398                 setItemName(n, QLatin1String("levelicon"));
  1406                 return n;
  1399                 return n;
  1407             }
  1400             }
  1408             case P_IndicatorGroup_batteryicon: // deprecated
       
  1409             case P_BatteryIndicator_icon:
  1401             case P_BatteryIndicator_icon:
  1410             {
  1402             {
  1411                 HbIconItem *n = new HbIconItem(parent);
  1403                 HbIconItem *n = new HbIconItem(parent);
  1412                 n->setFlags(HbIcon::Colorized);
  1404                 n->setFlags(HbIcon::Colorized);
  1413                 setItemName(n, QLatin1String("icon"));
  1405                 setItemName(n, QLatin1String("icon"));
  1414                 return n;
  1406                 return n;
  1415             }
  1407             }
  1416             case P_BatteryLevel_background:
  1408             case P_BatteryLevel_background:
  1417             {
  1409             {
  1418                 HbIconItem *n = new HbIconItem(parent);
  1410                 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent);
  1419                 n->setZValue(-1);
  1411                 n->setZValue(-1);
  1420                 setItemName(n, QLatin1String("background"));
  1412                 setItemName(n, QLatin1String("background"));
  1421                 return n;
  1413                 return n;
  1422             }
  1414             }
  1423             case P_BatteryLevel_icon:
  1415             case P_BatteryLevel_icon:
  1428             }
  1420             }
  1429             case P_TitlePane_background:
  1421             case P_TitlePane_background:
  1430                 {
  1422                 {
  1431                     HbFrameItem *n = new HbFrameItem(parent);
  1423                     HbFrameItem *n = new HbFrameItem(parent);
  1432                     n->setZValue(-1);
  1424                     n->setZValue(-1);
  1433                     setItemName(n, QLatin1String("frame"));
  1425                     setItemName(n, QLatin1String("background"));
  1434                     return n;
  1426                     return n;
  1435                 }
  1427                 }
  1436             case P_LineEdit_frame_normal:
  1428             case P_LineEdit_frame_normal:
  1437             case P_LineEdit_frame_highlight:
  1429             case P_LineEdit_frame_highlight:
  1438             case P_TextEdit_frame_normal:
  1430             case P_TextEdit_frame_normal:
  1458             }
  1450             }
  1459             case P_StatusBar_background:
  1451             case P_StatusBar_background:
  1460             {
  1452             {
  1461                 HbFrameItem *n = new HbFrameItem(parent);
  1453                 HbFrameItem *n = new HbFrameItem(parent);
  1462                 n->setZValue(-1);
  1454                 n->setZValue(-1);
  1463                 setItemName(n, QLatin1String("statusbar"));
  1455                 setItemName(n, QLatin1String("background"));
  1464                 return n;
  1456                 return n;
  1465             }
  1457             }
  1466             case P_StatusBar_timetext:
  1458             case P_StatusBar_timetext:
  1467             {
  1459             {
  1468                 HbTextItem *textItem = new HbTextItem(parent);
  1460                 HbTextItem *textItem = new HbTextItem(parent);
  1520                 return iconItem;
  1512                 return iconItem;
  1521             }
  1513             }
  1522 
  1514 
  1523             case P_ItemViewItem_radiobutton:
  1515             case P_ItemViewItem_radiobutton:
  1524             case P_ItemViewItem_selection: {
  1516             case P_ItemViewItem_selection: {
  1525                 HbIconItem *iconItem = new HbIconItem(parent);
  1517                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1526                 setItemName(iconItem, QLatin1String("selection-icon"));
  1518                 setItemName(iconItem, QLatin1String("selection-icon"));
  1527                 return iconItem;
  1519                 return iconItem;
  1528             }
  1520             }
  1529 
  1521 
  1530             case P_Edit_text:{
  1522             case P_Edit_text:{
  1532             }
  1524             }
  1533             case P_GroupBoxHeading_text:
  1525             case P_GroupBoxHeading_text:
  1534             case P_NotificationDialog_text:{
  1526             case P_NotificationDialog_text:{
  1535                 HbTextItem *n = new HbTextItem(parent);
  1527                 HbTextItem *n = new HbTextItem(parent);
  1536                 setItemName(n, QLatin1String("text"));
  1528                 setItemName(n, QLatin1String("text"));
       
  1529                 n->setMinimumLines(1);
       
  1530                 n->setMaximumLines(1);
       
  1531                 n->setTextWrapping(Hb::TextNoWrap);
  1537                 return n;
  1532                 return n;
  1538             }
  1533             }
  1539             case P_NotificationDialog_title:{
  1534             case P_NotificationDialog_title:{
  1540                 HbTextItem *n = new HbTextItem(parent);
  1535                 HbTextItem *n = new HbTextItem(parent);
  1541                 setItemName(n, QLatin1String("title"));
  1536                 setItemName(n, QLatin1String("title"));
  1554                 HbIconItem *n = new HbIconItem(QString(), parent);
  1549                 HbIconItem *n = new HbIconItem(QString(), parent);
  1555                 return n;
  1550                 return n;
  1556             }
  1551             }
  1557 
  1552 
  1558             case P_ItemViewItem_background: {
  1553             case P_ItemViewItem_background: {
  1559                 HbIconItem *iconItem = new HbIconItem(parent);
  1554                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1560                 setItemName(iconItem, QLatin1String("background"));
  1555                 setItemName(iconItem, QLatin1String("background"));
  1561                 return iconItem;
  1556                 return iconItem;
  1562             }
  1557             }
  1563 
  1558 
  1564             case P_ListViewItem_text: {
  1559             case P_ListViewItem_text: {
  1565                 HbTextItem *textItem = new HbTextItem(parent);
  1560                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
  1566                 textItem->setMinimumLines(1);
  1561 
  1567                 textItem->setMaximumLines(1);
       
  1568                 textItem->setTextWrapping(Hb::TextNoWrap);
       
  1569                 return textItem;
  1562                 return textItem;
  1570             }
  1563             }
  1571 
  1564 
  1572             case P_ListViewItem_richtext: {
  1565             case P_ListViewItem_richtext: {
  1573                 HbRichTextItem *textItem = new HbRichTextItem(parent);
  1566                 HbRichTextItem *textItem = q_check_ptr(new HbRichTextItem(parent));
  1574                 return textItem;
  1567                 return textItem;
  1575             }
  1568             }
  1576 
  1569 
  1577             case P_GridViewItem_text: {
  1570             case P_GridViewItem_text: {
  1578                 HbTextItem *textItem = new HbTextItem(parent);
  1571                 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
  1579                 // caching do not work properly - text is not refreshed immediatelly
  1572                 // caching do not work properly - text is not refreshed immediatelly
  1580                 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
  1573                 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
  1581                 setItemName(textItem, QLatin1String("text"));
  1574                 setItemName(textItem, QLatin1String("text"));
  1582                 textItem->setMinimumLines(1);
       
  1583                 textItem->setMaximumLines(1);
       
  1584                 textItem->setTextWrapping(Hb::TextNoWrap);
       
  1585                 textItem->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
       
  1586                 return textItem;
  1575                 return textItem;
  1587             }
  1576             }
  1588 
  1577 
  1589             case P_ListViewItem_icon:
  1578             case P_ListViewItem_icon:
  1590                 return new HbIconItem(parent);
  1579                 return q_check_ptr(new HbIconItem(parent));
  1591 
  1580 
  1592             case P_ColorGridViewItem_colorIcon:
  1581             case P_ColorGridViewItem_colorIcon:
  1593                 return new HbIconItem("qtg_graf_colorpicker_mask", parent);
  1582                 return new HbIconItem("qtg_graf_colorpicker_mask", parent);
  1594             case P_ColorGridViewItem_borderIcon:
  1583             case P_ColorGridViewItem_borderIcon:
  1595                 return new HbIconItem("qtg_graf_colorpicker_filled", parent);
  1584                 return new HbIconItem("qtg_graf_colorpicker_filled", parent);
  1596             case P_ColorGridViewItem_checkIcon:
  1585             case P_ColorGridViewItem_checkIcon:
  1597                 return new HbIconItem("qtg_small_tick", parent);
  1586                 return new HbIconItem("qtg_small_tick", parent);
  1598 
  1587 
  1599             case P_TreeViewItem_expandicon: {
  1588             case P_TreeViewItem_expandicon: {
  1600                 HbIconItem *iconItem = new HbIconItem(parent);
  1589                 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
  1601                 setItemName(iconItem, QLatin1String("subitem-indicator"));
  1590                 setItemName(iconItem, QLatin1String("subitem-indicator"));
  1602                 return iconItem;
  1591                 return iconItem;
  1603             }
  1592             }
  1604 
  1593 
  1605             case P_SelectionControl_selectionstart://fallthrough
  1594             case P_SelectionControl_selectionstart://fallthrough
  1623             case P_ComboBox_button: {
  1612             case P_ComboBox_button: {
  1624                 HbIconItem *n = new HbIconItem(QString(), parent);
  1613                 HbIconItem *n = new HbIconItem(QString(), parent);
  1625                 return n;
  1614                 return n;
  1626             }
  1615             }
  1627             case P_ItemViewItem_focus: {
  1616             case P_ItemViewItem_focus: {
  1628                 HbFrameItem *item = new HbFrameItem(parent);
  1617                 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
  1629                 setItemName(item, QLatin1String("focus-indicator"));
  1618                 //setItemName(item, QLatin1String("focus-indicator"));
  1630                 return item;
  1619                 return item;
  1631             }
  1620             }
  1632             case P_ItemHighlight_background: 
  1621             case P_ItemHighlight_background: 
  1633                 return new HbFrameItem(parent);
  1622                 return new HbFrameItem(parent);
  1634 
  1623 
  1635             case P_ItemViewItem_frame: {
  1624             case P_ItemViewItem_frame: {
  1636                 HbFrameItem *item = new HbFrameItem(parent);
  1625                 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
  1637                 setItemName(item,"frame");
  1626                 setItemName(item,"frame");
  1638                 return item;
  1627                 return item;
  1639             }
  1628             }
  1640             case P_ScrollArea_continuationbottom:
  1629             case P_ScrollArea_continuationbottom:
  1641             {
  1630             {
  1665                 n->setZValue(-1);
  1654                 n->setZValue(-1);
  1666                 return n;
  1655                 return n;
  1667             }
  1656             }
  1668             case P_ItemViewItem_touchmultiselection:
  1657             case P_ItemViewItem_touchmultiselection:
  1669             {
  1658             {
  1670                 HbTouchArea *area = new HbTouchArea(parent);
  1659                 HbTouchArea *area = q_check_ptr(new HbTouchArea(parent));
  1671                 setItemName(area, "multiselection-toucharea");
  1660                 setItemName(area, "multiselection-toucharea");
  1672                 return area;
  1661                 return area;
  1673             }
  1662             }
  1674             case P_IndexFeedback_popup_text:
  1663             case P_IndexFeedback_popup_text:
  1675             {
  1664             {
  1757                 {
  1746                 {
  1758                     if (const HbStyleOptionGroupBox *opt = 
  1747                     if (const HbStyleOptionGroupBox *opt = 
  1759                         qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) {
  1748                         qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) {
  1760                             HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1749                             HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1761                             if (opt->collapsed) {
  1750                             if (opt->collapsed) {
       
  1751                                 iconItem->setIconName(QLatin1String("qtg_small_expand"));
       
  1752                             } else {
  1762                                 iconItem->setIconName(QLatin1String("qtg_small_collapse"));
  1753                                 iconItem->setIconName(QLatin1String("qtg_small_collapse"));
  1763                             } else {
       
  1764                                 iconItem->setIconName(QLatin1String("qtg_small_expand"));
       
  1765                             }
  1754                             }
  1766                     }
  1755                     }
  1767                     break;
  1756                     break;
  1768                 }
  1757                 }
  1769             case P_DataGroup_icon:
  1758             case P_DataGroup_icon:
  1770                 {
  1759                 {
  1771                     if (const HbStyleOptionDataGroupHeadingWidget *opt = 
  1760                     if (const HbStyleOptionDataGroupHeadingWidget *opt = 
  1772                             qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) {
  1761                             qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) {
  1773                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1762                         HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  1774                         if (opt->expanded) {
  1763                         if (opt->expanded) {
       
  1764                             iconItem->setIconName(QLatin1String("qtg_small_collapse"));
       
  1765                         } else {
  1775                             iconItem->setIconName(QLatin1String("qtg_small_expand"));
  1766                             iconItem->setIconName(QLatin1String("qtg_small_expand"));
  1776                         } else {
       
  1777                             iconItem->setIconName(QLatin1String("qtg_small_collapse"));
       
  1778                         }
  1767                         }
  1779                     }
  1768                     }
  1780                 break;
  1769                 break;
  1781                 }
  1770                 }
  1782             case P_DataItem_icon:
  1771             case P_DataItem_icon:
  2127                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2116                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  2128                     textItem->setText(opt->timeText);
  2117                     textItem->setText(opt->timeText);
  2129                     }
  2118                     }
  2130                 break;
  2119                 break;
  2131             }
  2120             }
  2132             case P_IndicatorGroup_background: { // deprecated
  2121             
  2133                 const HbStyleOptionIndicatorGroup *opt = qstyleoption_cast<const HbStyleOptionIndicatorGroup *>(option);
       
  2134 
       
  2135                 if (opt) {
       
  2136                     HbIconItem *iconItem = static_cast<HbIconItem*>( item );
       
  2137                     iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
       
  2138                     if (opt->direction == Qt::LeftToRight) {
       
  2139                         if (opt->mode == QIcon::Active) {
       
  2140                             if (opt->transparent) {
       
  2141                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l"));
       
  2142                             } else {
       
  2143                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l"));
       
  2144                             }
       
  2145                         } else if (opt->mode == QIcon::Selected) {
       
  2146                             if (opt->transparent) {
       
  2147                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l"));
       
  2148                             } else {
       
  2149                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l"));
       
  2150                             }
       
  2151                         } else {
       
  2152                             if (opt->transparent) {
       
  2153                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
       
  2154                             } else {
       
  2155                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
       
  2156                             }
       
  2157                         }
       
  2158                     } else {
       
  2159                         if (opt->mode == QIcon::Active) {
       
  2160                             if (opt->transparent) {
       
  2161                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r"));
       
  2162                             } else {
       
  2163                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r"));
       
  2164                             }
       
  2165                         } else if (opt->mode == QIcon::Selected) {
       
  2166                             if (opt->transparent) {
       
  2167                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_r"));
       
  2168                             } else {
       
  2169                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_r"));
       
  2170                             }
       
  2171                         } else {
       
  2172                             if (opt->transparent) {
       
  2173                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r"));
       
  2174                             } else {
       
  2175                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r"));
       
  2176                             }
       
  2177                         }
       
  2178                     }
       
  2179                 }
       
  2180                 break;
       
  2181             }
       
  2182 
       
  2183             case P_IndicatorGroup_icon1: 
  2122             case P_IndicatorGroup_icon1: 
  2184             case P_IndicatorGroup_icon2: 
  2123             case P_IndicatorGroup_icon2: 
  2185             case P_IndicatorGroup_icon3: 
  2124             case P_IndicatorGroup_icon3: 
  2186             case P_IndicatorGroup_icon4: 
  2125             case P_IndicatorGroup_icon4: 
  2187                 {  
  2126                 {  
  2200                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  2139                     iconItem->setIconName("qtg_graf_titlebar_minimize");
  2201                 }
  2140                 }
  2202                 break;
  2141                 break;
  2203             }
  2142             }
  2204 
  2143 
  2205             case P_SignalIndicator_icon:
  2144             case P_SignalIndicator_icon: {
  2206             case P_IndicatorGroup_signalicon: { // deprecated
       
  2207                 const HbStyleOptionSignalIndicator *opt = qstyleoption_cast<const HbStyleOptionSignalIndicator *>(option);
  2145                 const HbStyleOptionSignalIndicator *opt = qstyleoption_cast<const HbStyleOptionSignalIndicator *>(option);
  2208                 if (opt) {
  2146                 if (opt) {
  2209                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2147                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2210                     switch (opt->networkMode) {
  2148                     switch (opt->networkMode) {
  2211                         case 0:
  2149                         case 0:
  2229                     }
  2167                     }
  2230                 }
  2168                 }
  2231                 break;
  2169                 break;
  2232             }
  2170             }
  2233             case P_SignalLevel_background: {
  2171             case P_SignalLevel_background: {
  2234                 if (option) {
  2172                 const HbStyleOptionSignalIndicator *opt = qstyleoption_cast<const HbStyleOptionSignalIndicator *>(option);
  2235                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2173                 if (opt) {
       
  2174                     HbIndicatorLevelIconItem *iconItem = static_cast<HbIndicatorLevelIconItem*>(item);
  2236                     iconItem->setIconName("qtg_graf_signal_bg");
  2175                     iconItem->setIconName("qtg_graf_signal_bg");
       
  2176                     iconItem->setValue(100 - opt->signalValue);
       
  2177                     iconItem->setDirection(HbIndicatorLevelIconItem::RightToLeft);
       
  2178                     iconItem->update();
  2237                 }
  2179                 }
  2238                 break;
  2180                 break;
  2239             }
  2181             }
  2240             case P_SignalLevel_icon: {
  2182             case P_SignalLevel_icon: {
  2241                 const HbStyleOptionSignalIndicator *opt = qstyleoption_cast<const HbStyleOptionSignalIndicator *>(option);
  2183                 const HbStyleOptionSignalIndicator *opt = qstyleoption_cast<const HbStyleOptionSignalIndicator *>(option);
  2258                             iconItem->setIconName("qtg_graf_signal_bg");
  2200                             iconItem->setIconName("qtg_graf_signal_bg");
  2259                             break;
  2201                             break;
  2260                     }
  2202                     }
  2261                     iconItem->setValue(opt->signalValue);
  2203                     iconItem->setValue(opt->signalValue);
  2262                     iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight);
  2204                     iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight);
  2263                 }
  2205                     iconItem->update();
  2264                 break;
  2206                 }
  2265             }
  2207                 break;
  2266             case P_BatteryIndicator_icon:
  2208             }
  2267             case P_IndicatorGroup_batteryicon: { // deprecated
  2209             case P_BatteryIndicator_icon: {
  2268                 if (option) {
  2210                 if (option) {
  2269                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2211                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2270                     iconItem->setIconName("qtg_status_battery");
  2212                     iconItem->setIconName("qtg_status_battery");
  2271                 }
  2213                 }
  2272                 break;
  2214                 break;
  2273             }
  2215             }
  2274             case P_BatteryLevel_background: {
  2216             case P_BatteryLevel_background: {
  2275                 if (option) {
  2217                 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option);
  2276                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  2218                 if (opt) {
       
  2219                     HbIndicatorLevelIconItem *iconItem = static_cast<HbIndicatorLevelIconItem*>(item);
  2277                     iconItem->setIconName("qtg_graf_battery_bg");
  2220                     iconItem->setIconName("qtg_graf_battery_bg");
       
  2221                     iconItem->setValue(100 - opt->batteryValue);
       
  2222                     iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight);
       
  2223                     iconItem->update();
  2278                 }
  2224                 }
  2279                 break;
  2225                 break;
  2280             }
  2226             }
  2281             case P_BatteryLevel_icon: {
  2227             case P_BatteryLevel_icon: {
  2282                 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option);
  2228                 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option);
  2299                             iconItem->setIconName("qtg_graf_battery_bg");
  2245                             iconItem->setIconName("qtg_graf_battery_bg");
  2300                             break;
  2246                             break;
  2301                     }
  2247                     }
  2302                     iconItem->setValue(opt->batteryValue);
  2248                     iconItem->setValue(opt->batteryValue);
  2303                     iconItem->setDirection(HbIndicatorLevelIconItem::RightToLeft);
  2249                     iconItem->setDirection(HbIndicatorLevelIconItem::RightToLeft);
  2304                 }
  2250                     iconItem->update();
  2305                 break;
       
  2306             }
       
  2307             case P_Softkey_background:{ // deprecated
       
  2308                 const HbStyleOptionSoftKey *opt = qstyleoption_cast<const HbStyleOptionSoftKey *>(option);
       
  2309 
       
  2310                 if (opt) {
       
  2311 
       
  2312                     switch (opt->mKey)
       
  2313                         {
       
  2314                         case Hb::PrimarySoftKey:
       
  2315                             // does not exist...
       
  2316                             break;
       
  2317                         case Hb::SecondarySoftKey:
       
  2318                             {
       
  2319                                 if (opt) {
       
  2320                                     HbIconItem *iconItem = static_cast<HbIconItem*>( item );
       
  2321                                     if (opt->direction == Qt::LeftToRight) {
       
  2322                                         if (opt->transparent) {
       
  2323                                             if (opt->mode == QIcon::Active) {
       
  2324                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r"));
       
  2325                                             } else {
       
  2326                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r"));
       
  2327                                             }
       
  2328                                         } else {
       
  2329                                             if (opt->mode == QIcon::Active) {
       
  2330                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r"));
       
  2331                                             } else {
       
  2332                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r"));
       
  2333                                             }
       
  2334                                          }
       
  2335                                     } else {
       
  2336                                         if (opt->transparent) {
       
  2337                                             if (opt->mode == QIcon::Active) {
       
  2338                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l"));
       
  2339                                             } else {
       
  2340                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
       
  2341                                             }
       
  2342                                         } else {
       
  2343                                             if (opt->mode == QIcon::Active) {
       
  2344                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l"));
       
  2345                                             } else {
       
  2346                                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
       
  2347                                             }
       
  2348                                          }
       
  2349                                     }
       
  2350                                 }
       
  2351                             }
       
  2352                             break;
       
  2353                         case Hb::MiddleSoftKey:
       
  2354                             // does not exist...
       
  2355                             break;
       
  2356                         default:
       
  2357                             break;
       
  2358                         }
       
  2359                 }
  2251                 }
  2360                 break;
  2252                 break;
  2361             }
  2253             }
  2362 
  2254 
  2363             case P_NavigationButton_background: {
  2255             case P_NavigationButton_background: {
  2364                 const HbStyleOptionNavigationButton *opt = qstyleoption_cast<const HbStyleOptionNavigationButton *>(option);
  2256                 const HbStyleOptionNavigationButton *opt = qstyleoption_cast<const HbStyleOptionNavigationButton *>(option);
  2365                     if (opt) {
  2257                     if (opt) {
  2366                         HbIconItem *iconItem = static_cast<HbIconItem*>( item );
  2258                         HbIconItem *iconItem = static_cast<HbIconItem*>( item );
  2367                         iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
  2259                         iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
  2368                         if (opt->direction == Qt::LeftToRight) {
  2260                         if (opt->transparent) {
  2369                             if (opt->transparent) {
  2261                             if (opt->mode == QIcon::Active) {
  2370                                 if (opt->mode == QIcon::Active) {
  2262                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r"));
  2371                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r"));
       
  2372                                 } else {
       
  2373                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r"));
       
  2374                                 }
       
  2375                             } else {
  2263                             } else {
  2376                                 if (opt->mode == QIcon::Active) {
  2264                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r"));
  2377                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r"));
  2265                             }
  2378                                 } else {
       
  2379                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r"));
       
  2380                                 }
       
  2381                              }
       
  2382                         } else {
  2266                         } else {
  2383                             if (opt->transparent) {
  2267                             if (opt->mode == QIcon::Active) {
  2384                                 if (opt->mode == QIcon::Active) {
  2268                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r"));
  2385                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l"));
       
  2386                                 } else {
       
  2387                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
       
  2388                                 }
       
  2389                             } else {
  2269                             } else {
  2390                                 if (opt->mode == QIcon::Active) {
  2270                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r"));
  2391                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l"));
  2271                             }
  2392                                 } else {
       
  2393                                     iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
       
  2394                                 }
       
  2395                              }
       
  2396                         }
  2272                         }
  2397                     }
  2273                     }
  2398                 break;
  2274                 break;
  2399             }
  2275             }
  2400 
  2276 
  2401             case P_IndicatorButton_background: {
  2277             case P_IndicatorButton_background: {
  2402                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  2278                 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option);
  2403                 if (opt) {
  2279                 if (opt) {
  2404                     HbIconItem *iconItem = static_cast<HbIconItem*>( item );
  2280                     HbIconItem *iconItem = static_cast<HbIconItem*>( item );
  2405                     iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
  2281                     iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
  2406                     if (opt->direction == Qt::LeftToRight) {
  2282                     if (opt->mode == QIcon::Active) {
  2407                         if (opt->mode == QIcon::Active) {
  2283                         if (opt->transparent) {
  2408                             if (opt->transparent) {
  2284                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l"));
  2409                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l"));
       
  2410                             } else {
       
  2411                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l"));
       
  2412                             }
       
  2413                         } else if (opt->mode == QIcon::Selected) {
       
  2414                             if (opt->transparent) {
       
  2415                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l"));
       
  2416                             } else {
       
  2417                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l"));
       
  2418                             }
       
  2419                         } else {
  2285                         } else {
  2420                             if (opt->transparent) {
  2286                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l"));
  2421                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  2287                         }
  2422                             } else {
  2288                     } else if (opt->mode == QIcon::Selected) {
  2423                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  2289                         if (opt->transparent) {
  2424                             }
  2290                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l"));
       
  2291                         } else {
       
  2292                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l"));
  2425                         }
  2293                         }
  2426                     } else {
  2294                     } else {
  2427                         if (opt->mode == QIcon::Active) {
  2295                         if (opt->transparent) {
  2428                             if (opt->transparent) {
  2296                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l"));
  2429                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r"));
       
  2430                             } else {
       
  2431                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r"));
       
  2432                             }
       
  2433                         } else if (opt->mode == QIcon::Selected) {
       
  2434                             if (opt->transparent) {
       
  2435                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_r"));
       
  2436                             } else {
       
  2437                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_r"));
       
  2438                             }
       
  2439                         } else {
  2297                         } else {
  2440                             if (opt->transparent) {
  2298                             iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l"));
  2441                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r"));
       
  2442                             } else {
       
  2443                                 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r"));
       
  2444                             }
       
  2445                         }
  2299                         }
  2446                     }
  2300                     }
  2447                 }
  2301                 }
  2448                 break;
  2302                 break;
  2449             }
  2303             }
  3264                 break;
  3118                 break;
  3265             case P_ListViewItem_text:
  3119             case P_ListViewItem_text:
  3266                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  3120                 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
  3267                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3121                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3268                     
  3122                     
  3269                     // needs set word wrapping explicitly, if multiple lines supported
       
  3270                     if (opt->index == 1) {
  3123                     if (opt->index == 1) {
  3271                         Hb::TextWrapping wrapping = Hb::TextNoWrap;
  3124                         if (opt->multilineSecondaryTextSupported) {
  3272                         if (    opt->minimumLines != 1
  3125                             if (opt->minimumLines != -1) {
  3273                             ||  opt->maximumLines != 1) {
  3126                                 // min & max secondary text row counts set by app
  3274                             wrapping = Hb::TextWordWrap;
  3127                                 Hb::TextWrapping wrapping = Hb::TextNoWrap;
       
  3128                                 if (    opt->minimumLines != 1
       
  3129                                     ||  opt->maximumLines != 1) {
       
  3130                                     wrapping = Hb::TextWordWrap;
       
  3131                                 }
       
  3132                                 textItem->setTextWrapping(wrapping);
       
  3133                                 textItem->setMinimumLines(opt->minimumLines);
       
  3134                                 textItem->setMaximumLines(opt->maximumLines);
       
  3135                             } else {
       
  3136                                 // min & max secondary text row counts not set by app. Allow setting those from .css
       
  3137                                 // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and
       
  3138                                 // min & max secondary text row counts has not bee set by app
       
  3139                                 HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem);
       
  3140                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
       
  3141                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false);
       
  3142                                 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false);
       
  3143                             }
       
  3144                         } else {
       
  3145                             // min & max secondary text row counts must always be 1. They cannot be overridden by .css
       
  3146                             textItem->setTextWrapping(Hb::TextNoWrap);
       
  3147                             textItem->setMinimumLines(1);
       
  3148                             textItem->setMaximumLines(1);
  3275                         }
  3149                         }
  3276                         textItem->setTextWrapping(wrapping);
  3150                     } // else - default values from .css still in use
  3277                         textItem->setMinimumLines(opt->minimumLines);
       
  3278                         textItem->setMaximumLines(opt->maximumLines);
       
  3279                     }
       
  3280                     setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
  3151                     setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
  3281                     textItem->setText(opt->content.value<QString>());
  3152                     textItem->setText(opt->content.value<QString>());
  3282                 }
  3153                 }
  3283                 break;
  3154                 break;
  3284             case P_ListViewItem_richtext:
  3155             case P_ListViewItem_richtext:
  3344 
  3215 
  3345             case P_GridViewItem_text:
  3216             case P_GridViewItem_text:
  3346                 if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
  3217                 if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
  3347                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3218                     HbTextItem *textItem = static_cast<HbTextItem*>(item);
  3348                     textItem->setAlignment(Qt::AlignCenter);
  3219                     textItem->setAlignment(Qt::AlignCenter);
  3349                     textItem->setTextWrapping(Hb::TextWrapAnywhere);
       
  3350                     textItem->setText(opt->text);
  3220                     textItem->setText(opt->text);
  3351                 }
  3221                 }
  3352                 break;
  3222                 break;
  3353 
  3223 
  3354             case P_ItemHighlight_background:
  3224             case P_ItemHighlight_background:
  3438               
  3308               
  3439             case P_ProgressSlider_frame:
  3309             case P_ProgressSlider_frame:
  3440                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  3310                 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) {
  3441                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3311                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
  3442                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3312                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
  3443                     if(opt->pressedState) {
  3313                    	if (opt->disableState ) { 
  3444                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed"));
  3314                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled"));
  3445                     }
  3315 					}
  3446                     else {
  3316 					else {
  3447                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal"));
  3317 					     if(opt->pressedState) {
  3448                     }
  3318                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed"));
       
  3319                          }
       
  3320                          else {
       
  3321                                frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal"));
       
  3322                          }
       
  3323 					}
  3449                     frameItem->frameDrawer().setFillWholeRect(true);       
  3324                     frameItem->frameDrawer().setFillWholeRect(true);       
  3450                     frameItem->update();
  3325                     frameItem->update();
  3451                     }
  3326                     }
  3452                     break;
  3327                     break;
  3453             case P_ProgressSlider_track: // The ProgressValue Mask
  3328             case P_ProgressSlider_track: // The ProgressValue Mask
  3655             }
  3530             }
  3656             case P_TreeViewItem_expandicon:
  3531             case P_TreeViewItem_expandicon:
  3657                 if (const HbStyleOptionTreeViewItem *opt = qstyleoption_cast<const HbStyleOptionTreeViewItem *>(option)) {
  3532                 if (const HbStyleOptionTreeViewItem *opt = qstyleoption_cast<const HbStyleOptionTreeViewItem *>(option)) {
  3658                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  3533                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
  3659                     if (opt->expanded) {
  3534                     if (opt->expanded) {
       
  3535                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_collapse") : QLatin1String("qtg_small_collapse"));
       
  3536                     } else {
  3660                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_expand") : QLatin1String("qtg_small_expand"));
  3537                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_expand") : QLatin1String("qtg_small_expand"));
  3661                     } else {
       
  3662                         iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_collapse") : QLatin1String("qtg_small_collapse"));
       
  3663                     }
  3538                     }
  3664                 }
  3539                 }
  3665                 break;
  3540                 break;
  3666             case P_ScrollArea_continuationbottom:
  3541             case P_ScrollArea_continuationbottom:
  3667                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  3542                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
  3940         }
  3815         }
  3941     }
  3816     }
  3942 
  3817 
  3943     HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget);
  3818     HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget);
  3944     if ( hbWidget ) {
  3819     if ( hbWidget ) {
  3945 #ifdef HBSTYLE_DEBUG_FONT
       
  3946         QString debugName;
       
  3947         bool isHbGroupBoxHeadingWidget(false);
       
  3948         if (!name.isEmpty()) {
       
  3949             QGraphicsItem* debugParent = hbWidget->parentItem();
       
  3950             if (debugParent->isWidget()) {
       
  3951                 debugName = static_cast<QGraphicsWidget*>(debugParent)->metaObject()->className();
       
  3952                 if (debugName == "HbGroupBoxHeadingWidget") {
       
  3953                     isHbGroupBoxHeadingWidget = true;
       
  3954                 }
       
  3955             }
       
  3956             debugName.append("::");
       
  3957             debugName.append(name);
       
  3958         } else {
       
  3959             debugName = widget->metaObject()->className();
       
  3960         }
       
  3961         if ( isHbGroupBoxHeadingWidget ) {
       
  3962             qDebug() << "HbStyle::polishItem :" << debugName;
       
  3963             qDebug() << "HbStyle::polishItem : -- Number of maching CSS declarations: " << decl.count();
       
  3964         }
       
  3965 
       
  3966 #endif
       
  3967         HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget);
  3820         HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget);
  3968         QFont font;
  3821         QFont font;
  3969         HbFontSpec fontSpec;
  3822         HbFontSpec fontSpec;
  3970         int dummy;
  3823         int dummy;
  3971         if (extractor.extractFont(&font, &fontSpec, &dummy)) {
  3824         if (extractor.extractFont(&font, &fontSpec, &dummy)) {
  3972             if ( !fontSpec.isNull() ) {
  3825             if ( !fontSpec.isNull() ) {
  3973                 if ( font == QFont() ) {
  3826                 if ( font == QFont() ) {
  3974 #ifdef HBSTYLE_DEBUG_FONT
  3827 #ifdef HBSTYLE_DEBUG
  3975                     if ( isHbGroupBoxHeadingWidget )
       
  3976                     qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << fontSpec.role();
  3828                     qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << fontSpec.role();
  3977 #endif
  3829 #endif
  3978                     hbWidget->setFontSpec(fontSpec);
  3830                     hbWidget->setFontSpec(fontSpec);
  3979                 } else {
  3831                 } else {
  3980 #ifdef HBSTYLE_DEBUG_FONT
  3832 #ifdef HBSTYLE_DEBUG
  3981                     if ( isHbGroupBoxHeadingWidget )
       
  3982                     qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: "
  3833                     qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: "
  3983                              << fontSpec.role() << font;
  3834                              << fontSpec.role() << font;
  3984 #endif
  3835 #endif
  3985                     hbWidget->setFont(fontSpec.font().resolve(font));
  3836                     hbWidget->setFont(fontSpec.font().resolve(font));
  3986                 }
  3837                 }
  3987             } else {
  3838             } else {
  3988 #ifdef HBSTYLE_DEBUG_FONT
  3839 #ifdef HBSTYLE_DEBUG
  3989                 if ( isHbGroupBoxHeadingWidget )
       
  3990                 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << font;
  3840                 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << font;
  3991 #endif
  3841 #endif
  3992                 hbWidget->setFont(font);
  3842                 hbWidget->setFont(font);
  3993             }
  3843             }
  3994         }
  3844         }
  4265         return;
  4115         return;
  4266     }
  4116     }
  4267 #ifdef HBSTYLE_DEBUG
  4117 #ifdef HBSTYLE_DEBUG
  4268     qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className();
  4118     qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className();
  4269 #endif
  4119 #endif
  4270 #ifdef HBSTYLE_DEBUG_FONT
       
  4271     bool isHbGroupBoxHeadingWidget(false);
       
  4272     if (QString(widget->metaObject()->className()) == "HbGroupBoxHeadingWidget") {
       
  4273         isHbGroupBoxHeadingWidget = true;
       
  4274         QVariant gbtype = widget->property( "groupBoxType" );
       
  4275         qDebug() << "HbStyle::polish : Polishing HbGroupBoxHeadingWidget, type" << gbtype.toInt();
       
  4276     }
       
  4277 #endif
       
  4278 
  4120 
  4279     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  4121     HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts);
  4280     if(!styleLoader){
  4122     if(!styleLoader){
  4281 #ifdef HBSTYLE_DEBUG_FONT
       
  4282     if (isHbGroupBoxHeadingWidget) {
       
  4283         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
       
  4284     }
       
  4285 #endif
       
  4286 #ifdef HBSTYLE_DEBUG
  4123 #ifdef HBSTYLE_DEBUG
  4287         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
  4124         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
  4288 #endif
  4125 #endif
  4289         return;
  4126         return;
  4290     }
  4127     }
  4304         }
  4141         }
  4305     } else {
  4142     } else {
  4306         styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  4143         styleRules = styleLoader->styleRulesForNode(n, profile.orientation());
  4307     }
  4144     }
  4308 
  4145 
  4309 #ifdef HBSTYLE_DEBUG_FONT
  4146 #ifdef HBSTYLE_DEBUG
  4310     if (isHbGroupBoxHeadingWidget) {
  4147     qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count();
  4311         qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count();
       
  4312     }
       
  4313 #endif
  4148 #endif
  4314     if (!styleRules.count()) {
  4149     if (!styleRules.count()) {
  4315 #ifdef HBSTYLE_DEBUG
       
  4316         qDebug() << "HbStyle::polish : No style rules found.";
       
  4317 #endif
       
  4318         return;
  4150         return;
  4319     }
  4151     }
  4320     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4152     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
  4321 #ifdef HBSTYLE_DEBUG_FONT
       
  4322     if (isHbGroupBoxHeadingWidget) {
       
  4323         qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count();
       
  4324     }
       
  4325 #endif
       
  4326 #ifdef HBSTYLE_DEBUG
  4153 #ifdef HBSTYLE_DEBUG
  4327     qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count();
  4154     qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count();
  4328 #endif
  4155 #endif
  4329     d->ensureLayoutParameters(profile);
  4156     d->ensureLayoutParameters(profile);
  4330 
  4157 
  4338 #endif
  4165 #endif
  4339         extractor.extractParameters( params.params(), params.values() );
  4166         extractor.extractParameters( params.params(), params.values() );
  4340     }
  4167     }
  4341 
  4168 
  4342     bool layoutDefined = extractor.extractLayout(&layoutName, &sectionName);
  4169     bool layoutDefined = extractor.extractLayout(&layoutName, &sectionName);
  4343 #ifdef HBSTYLE_DEBUG_FONT
       
  4344     if (isHbGroupBoxHeadingWidget) {
       
  4345         if (!layoutDefined) {
       
  4346             qDebug() << "HbStyle::polish : Couldn't find layout name for the widget.";
       
  4347         } else {
       
  4348             qDebug() << "HbStyle::polish : Layout name: " << layoutName;
       
  4349         }
       
  4350     }
       
  4351 #endif
       
  4352 #ifdef HBSTYLE_DEBUG
  4170 #ifdef HBSTYLE_DEBUG
  4353     if (!layoutDefined) {
  4171     if (!layoutDefined) {
  4354         qDebug() << "HbStyle::polish : Couldn't find layout name for the widget.";
  4172         qDebug() << "HbStyle::polish : Couldn't find layout name for the widget.";
  4355     } else {
  4173     } else {
  4356         qDebug() << "HbStyle::polish : Layout name: " << layoutName;
  4174         qDebug() << "HbStyle::polish : Layout name: " << layoutName;
  4367 #ifdef HBSTYLE_DEBUG
  4185 #ifdef HBSTYLE_DEBUG
  4368             qDebug() << "LayoutName cache miss.";
  4186             qDebug() << "LayoutName cache miss.";
  4369 #endif
  4187 #endif
  4370             HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4188             HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance();
  4371             if ( !loader->loadWidgetML(widget, layoutName, sectionName)) {
  4189             if ( !loader->loadWidgetML(widget, layoutName, sectionName)) {
  4372 #ifdef HBSTYLE_DEBUG_FONT
       
  4373                 if (isHbGroupBoxHeadingWidget) {
       
  4374                     qDebug() << "HbStyle::polish : Failed to load WidgetML";
       
  4375                 }
       
  4376 #endif
       
  4377 #ifdef HBSTYLE_DEBUG
  4190 #ifdef HBSTYLE_DEBUG
  4378                 qDebug() << "HbStyle::polish : Failed to load WidgetML";
  4191                 qDebug() << "HbStyle::polish : Failed to load WidgetML";
  4379 #endif
  4192 #endif
  4380                 return;       
  4193                 return;       
  4381             }
  4194             }
  4877     widgetLayoutNames.clear();
  4690     widgetLayoutNames.clear();
  4878     styleRulesCache.clear();
  4691     styleRulesCache.clear();
  4879     colorParameters.clear();
  4692     colorParameters.clear();
  4880 }
  4693 }
  4881 
  4694 
       
  4695 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const
       
  4696 {
       
  4697     return HbWidgetBasePrivate::d_ptr(widgetBase);
       
  4698 }
       
  4699 
       
  4700 
  4882 #include "moc_hbstyle.cpp"
  4701 #include "moc_hbstyle.cpp"