src/hbcore/style/hbstyle.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/style/hbstyle.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/style/hbstyle.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -30,12 +30,9 @@
 #include "hbstyleoptiontoolbutton_p.h"
 #include "hbstyleoptiontooltip_p.h"
 #include "hbstyleoptionprogressbar_p.h"
-#include "hbstyleoptionabstractviewitem_p.h"
-#include "hbstyleoptionlistviewitem_p.h"
 #include "hbstyleoptionmenuitem_p.h"
 #include "hbstyleoptionlabel_p.h"
 #include "hbstyleoptionscrollbar_p.h"
-#include "hbstyleoptiongridviewitem_p.h"
 #include "hbstyleoptioncheckbox_p.h"
 #include "hbiconloader_p.h"
 #include "hbstyleoptiontitlepane_p.h"
@@ -43,7 +40,6 @@
 #include "hbstyleoptionindicatorgroup_p.h"
 #include "hbstyleoptionprogressdialog_p.h"
 #include "hbstyleoptionnotificationdialog_p.h"
-#include "hbstyleoptiontreeviewitem_p.h"
 #include "hbstyleoptioncolorgridviewitem_p.h"
 #include "hbstyleoptionmessagebox_p.h"
 #include "hbstyleoptionnavigationbutton_p.h"
@@ -59,7 +55,6 @@
 #include "hbstyleoptiondatagroupheadingwidget_p.h"
 #include "hbstyleoptiondataform_p.h"
 #include "hbstyleoptiongroupbox_p.h"
-#include "hbstyleoptionindexfeedback_p.h"
 #include "hbstyleoptioncombobox_p.h"
 #include "hbstyleoptioninputdialog_p.h"
 #include "hbstyleoptionprogresssliderhandle_p.h"
@@ -219,9 +214,9 @@
    Updating of a primitive's state is done by using HbStyle::updatePrimitive() method which uses the style primitive data classes (comparable to
    Qt styleoptions) to get the state information needed for the primitive updating.
 
-    \param primitiveType, enumeration of the base primitive
-    \param itemName, string which identifies a primitive in the widget (e.g. "background", or "text"). The item name matches with primitive names in widget's CSS file.
-    \param parent, parent for the primitive, although the default is 0 usually the widget is given as a parent for the primitive
+    \param primitiveType enumeration of the base primitive
+    \param itemName string which identifies a primitive in the widget (e.g. "background", or "text"). The item name matches with primitive names in widget's CSS file.
+    \param parent parent for the primitive, although the default is 0 usually the widget is given as a parent for the primitive
     \return QGraphicsObject, the returned primitive should be stored as a QGraphicsObject on the widget side
     \sa HbStyle::updatePrimitive()
     \sa HbStylePrimitiveData
@@ -280,9 +275,9 @@
     isSet()-method is called first to check if the widget did assign the primitive data value.
 
 
-    \param primitive, the primitive to be updated
-    \param data, primitive data needed for updating the primitive
-    \param parent, optionally the parent can be given
+    \param primitive the primitive to be updated
+    \param data primitive data needed for updating the primitive
+    \param parent optionally the parent can be given
     \return bool, true if correct primitive type was found from the style, false if not.
     \sa HbStyle::createPrimitive()
     \sa HbStylePrimitiveData
@@ -296,6 +291,7 @@
 bool HbStyle::updatePrimitive(QGraphicsObject *primitive, const HbStylePrimitiveData *data, QGraphicsObject *parent) const
 {
     Q_UNUSED(parent);
+    bool ret = false;
 
     if (HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(primitive)) {
         const HbStyleTextPrimitiveData *td = hbstyleprimitivedata_cast<const HbStyleTextPrimitiveData*>(data);
@@ -321,7 +317,9 @@
             textItem->setMinimumLines(td->minimumLines);
         if (td->maximumLines.isSet())
             textItem->setMaximumLines(td->maximumLines);
-        return true;
+        if (td->fontSpec.isSet())
+            textItem->setFontSpec(td->fontSpec);
+        ret = true;
 
     } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) {
         const HbStyleIconPrimitiveData *id = hbstyleprimitivedata_cast<const HbStyleIconPrimitiveData*>(data);
@@ -347,7 +345,7 @@
             iconItem->setBrush(id->brush);
         if (id->color.isSet())
             iconItem->setColor(id->color);
-        return true;
+        ret = true;
 
     } else if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(primitive)) {
         const HbStyleFramePrimitiveData *fd =  hbstyleprimitivedata_cast<const HbStyleFramePrimitiveData*>(data);
@@ -369,7 +367,7 @@
         if (fd->bitmapMask.isSet())
             drawer->setMask(fd->bitmapMask); 
         frameItem->setFrameDrawer(drawer);
-        return true;
+        ret = true;
 
     } else if (HbMarqueeItem *marqueeItem = qgraphicsitem_cast<HbMarqueeItem*>(primitive)) {
          const HbStyleMarqueePrimitiveData *md =  hbstyleprimitivedata_cast<const HbStyleMarqueePrimitiveData*>(data);
@@ -385,7 +383,7 @@
          }
          if (md->loopCount.isSet())
              marqueeItem->setLoopCount(md->loopCount);
-        return true;
+        ret = true;
 
     } else if (HbTouchArea *touchArea = qgraphicsitem_cast<HbTouchArea*>(primitive)) {
         const HbStyleTouchAreaPrimitiveData *td =  hbstyleprimitivedata_cast<const HbStyleTouchAreaPrimitiveData*>(data);
@@ -393,7 +391,7 @@
             touchArea->setSize(td->size);
         if (td->geometry.isSet())
             touchArea->setGeometry(td->geometry);
-        return true;
+        ret = true;
 
     } else if (HbRichTextItem *richTextItem = qgraphicsitem_cast<HbRichTextItem*>(primitive)) {
         const HbStyleRichTextPrimitiveData *rd =  hbstyleprimitivedata_cast<const HbStyleRichTextPrimitiveData*>(data);
@@ -411,10 +409,17 @@
             richTextItem->setTextClip(rd->clipping);
         if (rd->geometry.isSet())
             richTextItem->setGeometry(rd->geometry);
-        return true;
+        ret = true;
     }
 
-return false;
+    if (ret) {
+        if (data->geometry.isSet() 
+            && primitive->isWidget()) {
+            static_cast<QGraphicsWidget*>(primitive)->setGeometry(data->geometry);
+        }
+    }
+
+    return ret;
 }
 
 
@@ -452,12 +457,15 @@
 
             case P_CheckBox_icon:
             case P_GroupBoxHeading_icon:
-            case P_Label_icon:
-            case P_GridViewItem_icon: {
+            case P_Label_icon: {
                 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent));
                 HbStyle::setItemName(item, QLatin1String("icon"));
                 return item;
                 }
+            case P_GridViewItem_icon: {
+                Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling");
+                return 0;
+            }
             case P_DataGroup_icon:
                 {
                 HbIconItem *item = new HbIconItem(HbIcon(), parent);
@@ -984,9 +992,8 @@
 
             case P_ItemViewItem_radiobutton:
             case P_ItemViewItem_selection: {
-                HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
-                HbStyle::setItemName(iconItem, QLatin1String("selection-icon"));
-                return iconItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_selection no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_Edit_text:{
@@ -1021,34 +1028,28 @@
             }
 
             case P_ItemViewItem_background: {
-                HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
-                iconItem->setZValue(-3.0);
-                HbStyle::setItemName(iconItem, QLatin1String("background"));
-                iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
-                return iconItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_ListViewItem_text: {
-                HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
-
-                return textItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_ListViewItem_richtext: {
-                HbRichTextItem *textItem = q_check_ptr(new HbRichTextItem(parent));
-                return textItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_GridViewItem_text: {
-                HbTextItem *textItem = q_check_ptr(new HbTextItem(parent));
-                // caching do not work properly - text is not refreshed immediatelly
-                //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
-                HbStyle::setItemName(textItem, QLatin1String("text"));
-                return textItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_ListViewItem_icon:
-                return q_check_ptr(new HbIconItem(parent));
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling");
+                return 0;
 
             case P_ColorGridViewItem_colorIcon:
                 return new HbIconItem("qtg_graf_colorpicker_mask", parent);
@@ -1058,9 +1059,8 @@
                 return new HbIconItem("qtg_small_tick", parent);
 
             case P_TreeViewItem_expandicon: {
-                HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent));
-                HbStyle::setItemName(iconItem, QLatin1String("subitem-indicator"));
-                return iconItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling");
+                return 0;
             }
 
             case P_SelectionControl_selectionstart://fallthrough
@@ -1086,18 +1086,15 @@
                 return n;
             }
             case P_ItemViewItem_focus: {
-                HbFrameItem *frameItem = q_check_ptr(new HbFrameItem(parent));
-                frameItem->setZValue(-1.0);
-                return frameItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling");
+                return 0;
             }
             case P_ItemHighlight_background:
                 return new HbFrameItem(parent);
 
             case P_ItemViewItem_frame: {
-                HbFrameItem *item = q_check_ptr(new HbFrameItem(parent));
-                item->setZValue(-4.0);
-                HbStyle::setItemName(item,"frame");
-                return item;
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling");
+                return 0;
             }
             case P_ScrollArea_continuationbottom:
             {
@@ -1129,33 +1126,18 @@
             }
             case P_ItemViewItem_touchmultiselection:
             {
-                HbTouchArea *area = q_check_ptr(new HbTouchArea(parent));
-                HbStyle::setItemName(area, "multiselection-toucharea");
-                return area;
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_touchmultiselection no more supported. Use refactored styling");
+                return 0;
             }
             case P_IndexFeedback_popup_text:
             {
-                HbTextItem *textItem = new HbTextItem(parent);
-                textItem->setAlignment(Qt::AlignCenter);
-                textItem->setTextWrapping(Hb::TextNoWrap);
-                HbStyle::setItemName(textItem, QLatin1String("index-text"));
-
-                //TODO:: make this a sane value
-                textItem->setZValue(4);
-                return textItem;
+                Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling");
+                return 0;
             }
             case P_IndexFeedback_popup_background:
             {
-               
-                HbFrameItem *n = new HbFrameItem(parent);
-                n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview");
-                n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                qreal cornerPieceSize = 0;
-                hbInstance->style()->parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize);
-                n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize);
-                HbStyle::setItemName(n, QLatin1String("index-background"));
-                n->setZValue(3);
-                return n;
+                Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling");
+                return 0;
             }
             case P_InputDialog_text:
             {
@@ -2257,48 +2239,13 @@
             case P_ItemViewItem_radiobutton:
             case P_ItemViewItem_checkbox:
             case P_ItemViewItem_selection:{
-                if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)){
-                    HbIconItem *iconItem = static_cast<HbIconItem *>(item);
-                    iconItem->setAlignment(Qt::AlignCenter);
-
-                    if (opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
-                        if (opt->checkState == Qt::Checked) {
-                            iconItem->setState(QIcon::On);
-                            iconItem->setIconName(QLatin1String("qtg_small_radio_selected"));
-                        } else {
-                            iconItem->setState(QIcon::Off);
-                            iconItem->setIconName(QLatin1String("qtg_small_radio_unselected"));
-                        }
-                    } else {
-                        if (opt->checkState == Qt::Checked) {
-                            iconItem->setState(QIcon::On);
-                            if (opt->singleSelectionMode) {
-                                iconItem->setIconName(QLatin1String("qtg_small_tick"));
-                            }
-                            else {
-                                iconItem->setIconName(QLatin1String("qtg_small_selected"));
-                            }
-                        } else if (opt->checkState == Qt::PartiallyChecked) {
-                            iconItem->setState(QIcon::On);
-                            iconItem->setIconName(QLatin1String("qtg_small_selected_partial"));
-                        } else {
-                            iconItem->setState(QIcon::Off);
-                            if (opt->singleSelectionMode) {
-                                iconItem->setIconName(QLatin1String(""));
-                            }
-                            else {
-                                iconItem->setIconName(QLatin1String("qtg_small_unselected"));
-                            }
-                        }
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_selection no more supported. Use refactored styling");
                 break;
             }
 
             case P_LineEdit_frame_normal:{
                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
                     if(frameItem->isEnabled()) {
-                        qDebug() << "Update primitive bagckground enabled";
                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal"));
                     } else {
                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_disabled"));
@@ -2671,100 +2618,16 @@
                 }
                 break;
             case P_ListViewItem_text:
-                if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
-                    HbTextItem *textItem = static_cast<HbTextItem*>(item);
-
-                    if (opt->index == 1) {
-                        if (opt->multilineSecondaryTextSupported) {
-                            if (opt->minimumLines != -1) {
-                                // min & max secondary text row counts set by app
-                                Hb::TextWrapping wrapping = Hb::TextNoWrap;
-                                if (    opt->minimumLines != 1
-                                    ||  opt->maximumLines != 1) {
-                                    wrapping = Hb::TextWordWrap;
-                                }
-                                textItem->setTextWrapping(wrapping);
-                                textItem->setMinimumLines(opt->minimumLines);
-                                textItem->setMaximumLines(opt->maximumLines);
-                            } else {
-                                // min & max secondary text row counts not set by app. Allow setting those from .css
-                                // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and
-                                // min & max secondary text row counts has not bee set by app
-                                HbWidgetBasePrivate *widgetBaseP = widgetBasePrivate(textItem);
-                                widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false);
-                                widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false);
-                                widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false);
-                            }
-                        } else {
-                            // min & max secondary text row counts must always be 1. They cannot be overridden by .css
-                            textItem->setTextWrapping(Hb::TextNoWrap);
-                            textItem->setMinimumLines(1);
-                            textItem->setMaximumLines(1);
-                        }
-                    } // else - default values from .css still in use
-
-                    // Below optimizes the most common cases.
-                    if (opt->index == 0) {
-                        HbStyle::setItemName(textItem, QLatin1String("text-1"));
-                    } else if (opt->index == 1) {
-                        HbStyle::setItemName(textItem, QLatin1String("text-2"));
-                    } else if (opt->index == 2) {
-                        HbStyle::setItemName(textItem, QLatin1String("text-3"));
-                    } else {
-                        HbStyle::setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1));
-                    }
-
-                    textItem->setText(opt->content.value<QString>());
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling");
                 break;
             case P_ListViewItem_richtext:
-                if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
-                    HbRichTextItem *label = static_cast<HbRichTextItem*>(item);
-                    label->setText(opt->content.value<QString>());
-
-                    // Below optimizes the most common cases.
-                    if (opt->index == 0) {
-                        HbStyle::setItemName(label, QLatin1String("text-1"));
-                    } else if (opt->index == 1) {
-                        HbStyle::setItemName(label, QLatin1String("text-2"));
-                    } else if (opt->index == 2) {
-                        HbStyle::setItemName(label, QLatin1String("text-3"));
-                    } else {
-                        HbStyle::setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1));
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling");
                 break;
             case P_ListViewItem_icon:
-                if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) {
-                    HbIconItem *iconItem = static_cast<HbIconItem*>(item);
-
-                    // Below optimizes the most common cases.
-                    if (opt->index == 0) {
-                        HbStyle::setItemName(iconItem, QLatin1String("icon-1"));
-                    } else if (opt->index == 1) {
-                        HbStyle::setItemName(iconItem, QLatin1String("icon-2"));
-                    } else {
-                        HbStyle::setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1));
-                    }
-
-                    if (iconItem->zValue() != opt->index + 1) {
-                        iconItem->setZValue(opt->index + 1);
-                    }
-
-                    if (opt->content.canConvert<HbIcon>()){
-                        iconItem->setIcon(opt->content.value<HbIcon>());
-                    } if (opt->content.canConvert<QIcon>()){
-                        iconItem->setIcon(opt->content.value<QIcon>());
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling");
                 break;
             case P_GridViewItem_icon:
-                if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
-                    HbIconItem *iconItem = static_cast<HbIconItem*>(item);
-                    iconItem->setIcon(opt->icon);
-                    iconItem->setAlignment(Qt::AlignCenter);
-                    iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling");
                 break;
 
             case P_ColorGridViewItem_colorIcon:
@@ -2798,11 +2661,7 @@
 
 
             case P_GridViewItem_text:
-                if (const  HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) {
-                    HbTextItem *textItem = static_cast<HbTextItem*>(item);
-                    textItem->setAlignment(Qt::AlignCenter);
-                    textItem->setText(opt->text);
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling");
                 break;
 
             case P_ItemHighlight_background:
@@ -3058,81 +2917,13 @@
                 }*/
                 break;
             case P_ItemViewItem_background:
-                if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
-                    HbIconItem *iconItem = static_cast<HbIconItem*>(item);
-                    iconItem->setGeometry(opt->boundingRect);
-                    if (opt->background.canConvert<HbIcon>()){
-                        iconItem->setIcon(opt->background.value<HbIcon>());
-                    } else if (opt->background.canConvert<QBrush>()){
-                        iconItem->setBrush(opt->background.value<QBrush>());
-                    }
-                }
-
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling");
                 break;
             case P_ItemViewItem_frame:
-                if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
-                    HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
-                    frameItem->setGeometry(opt->boundingRect);
-
-                    if (opt->background.canConvert<HbFrameBackground>()) {
-                        HbFrameBackground frame = opt->background.value<HbFrameBackground>();
-                        frameItem->frameDrawer().setFrameType(frame.frameType());
-                        frameItem->frameDrawer().setFrameGraphicsName(frame.frameGraphicsName());
-                    } else if (opt->viewItemType == Hb::ItemType_TreeViewItem) {
-                        if (opt->modelItemType == Hb::ParentItem) {
-                            frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                            frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
-                                QLatin1String("qtg_fr_popup_list_parent_normal") : QLatin1String("qtg_fr_list_parent_normal"));
-                        } else if (opt->modelItemType == Hb::SeparatorItem) {
-                            frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                            frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator"));
-                        } else {
-                            frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                            frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
-                                QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal"));
-                        }
-                    } else if ( opt->viewItemType == Hb::ItemType_ListViewItem
-                                || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
-                        if (opt->modelItemType == Hb::SeparatorItem) {
-                            frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                            frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator"));
-                        } else {
-                            frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                            frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
-                                QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal"));
-                        }
-                    } else if (opt->viewItemType == Hb::ItemType_GridViewItem
-                                || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
-                        frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                        frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
-                            QLatin1String("qtg_fr_popup_grid_normal") : QLatin1String("qtg_fr_grid_normal"));
-                    }
-                    else{
-                        frameItem->frameDrawer().setFrameGraphicsName(QString());
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling");
                 break;
             case P_ItemViewItem_focus:
-                if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) {
-                    HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
-                    frameItem->setGeometry(opt->boundingRect);
-
-                    if (opt->viewItemType == Hb::ItemType_TreeViewItem
-                        || opt->viewItemType == Hb::ItemType_ListViewItem
-                        || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) {
-                        frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                        frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ?
-                            QLatin1String("qtg_fr_popup_list_pressed") : QLatin1String("qtg_fr_list_pressed"));
-                    } else if (     opt->viewItemType == Hb::ItemType_GridViewItem
-                                ||  opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) {
-                        frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-                        frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ?
-                            QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed"));
-                    } else {
-                        HbStyle::setItemName(frameItem,QString());
-                        frameItem->frameDrawer().setFrameGraphicsName(QString());
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling");
                 break;
             case P_SelectionControl_selectionstart://fallthrough
             case P_SelectionControl_selectionend://fallthrough
@@ -3143,14 +2934,7 @@
                 break;
             }
             case P_TreeViewItem_expandicon:
-                if (const HbStyleOptionTreeViewItem *opt = qstyleoption_cast<const HbStyleOptionTreeViewItem *>(option)) {
-                    HbIconItem *iconItem = static_cast<HbIconItem*>(item);
-                    if (opt->expanded) {
-                        iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_collapse") : QLatin1String("qtg_small_collapse"));
-                    } else {
-                        iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_expand") : QLatin1String("qtg_small_expand"));
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling");
                 break;
             case P_ScrollArea_continuationbottom:
                 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) {
@@ -3239,19 +3023,10 @@
                 break;
 
             case P_IndexFeedback_popup_text:
-                if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) {
-                    HbTextItem *textItem = static_cast<HbTextItem*>(item);
-                    textItem->setFontSpec(opt->fontSpec);
-                    textItem->setGeometry(opt->textRect);
-                    textItem->setText(opt->text);
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling");
                 break;
             case P_IndexFeedback_popup_background:
-                if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) {
-                    if (HbFrameItem* frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
-                        frameItem->setGeometry(opt->popupRect);
-                    }
-                }
+                Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling");
                 break;
             case P_DateTimePicker_background:
                /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
@@ -3752,16 +3527,19 @@
     Note that this method is heavy on the system resources and should be called
     absolutely when necessary by the widget.
 
-    \param widget, HbWidget to be polished
-    \param params, style parameters to be returned to the caller
+    \param widget HbWidget to be polished
+    \param params style parameters to be returned to the caller
 */
 void HbStyle::polish(HbWidget *widget, HbStyleParameters &params)
 {
     Q_D( HbStyle );
 #ifdef HBSTYLE_DEBUG
-    qDebug() << "HbStyle::polish : -- -- -- --";
+    qDebug() << "HbStyle::polish : -- -- -- -- ENTER";
 #endif
     if( !widget ) {
+#ifdef HBSTYLE_DEBUG
+        qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
+#endif
         return;
     }
 #ifdef HBSTYLE_DEBUG
@@ -3772,6 +3550,7 @@
     if(!styleLoader){
 #ifdef HBSTYLE_DEBUG
         qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer.";
+        qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
 #endif
         return;
     }
@@ -3797,6 +3576,9 @@
     qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count();
 #endif
     if (!styleRules.count()) {
+#ifdef HBSTYLE_DEBUG
+        qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
+#endif
         return;
     }
     const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile);
@@ -3852,6 +3634,7 @@
                 if ( !loader->loadWidgetML(widget, layoutName, sectionName)) {
 #ifdef HBSTYLE_DEBUG
                     qDebug() << "HbStyle::polish : Failed to load WidgetML";
+                    qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
 #endif
                     return;
                 }
@@ -3887,7 +3670,7 @@
         }
         d->polishItem(styleRules, widget, item, name, profile, layoutDefined);
     }
-    foreach (QString nodeId, nodeIds) {
+    foreach (const QString &nodeId, nodeIds) {
         // These are the "missing" anchor items. Need to call polishItem
         // for them, too, for getting the anchor spacings right.
         // if there are anchor node ids, layoutDefined is always true.
@@ -3910,15 +3693,18 @@
     }
 #endif // HB_TEXT_MEASUREMENT_UTILITY
 
+#ifdef HBSTYLE_DEBUG
+    qDebug() << "HbStyle::polish : -- -- -- -- EXIT";
+#endif
 }
 
 /*!
     updateThemedItems updates themable children items of widget
 
-    \param styleRules, style-rules of the widget
-    \param variableRules, variable-rules of the widget
-    \param widget, widget whose themed parameters are supposed to be updated
-    \param item, graphics item whose themed parameters are supposed to be updated
+    \param styleRules style-rules of the widget
+    \param variableRules variable-rules of the widget
+    \param widget widget whose themed parameters are supposed to be updated
+    \param item graphics item whose themed parameters are supposed to be updated
 */
 void HbStylePrivate::updateThemedItems(
     const HbVector<HbCss::StyleRule> &styleRules,
@@ -3998,13 +3784,13 @@
 
     Updates the themable parameters of widget (specially those which are specified in css files)
 
-    \param widget, widget whose themed parameters are supposed to be updated
+    \param widget widget whose themed parameters are supposed to be updated
 */
 void HbStyle::updateThemedParams(HbWidget *widget)
 {
     Q_D( HbStyle );
 #ifdef HBSTYLE_DEBUG
-    qDebug() << "HbStyle::updateThemedParams : -- -- -- --";
+    qDebug() << "HbStyle::updateThemedParams : -- -- -- -- ENTER";
 #endif
     if( !widget ) {
         return;
@@ -4020,6 +3806,7 @@
     if(!styleLoader){
 #ifdef HBSTYLE_DEBUG
         qDebug() << "HbStyle::updateThemedParams : HbLayeredStyleLoader returned a null pointer.";
+        qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
 #endif
         return;
     }
@@ -4029,6 +3816,7 @@
     if (!styleRules.count()) {
 #ifdef HBSTYLE_DEBUG
         qDebug() << "HbStyle::updateThemedParams : No style rules found.";
+        qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
 #endif
         return;
     }
@@ -4038,6 +3826,10 @@
     foreach (QGraphicsItem* item, list) {
         d->updateThemedItems(styleRules, item, profile);
     }
+
+#ifdef HBSTYLE_DEBUG
+    qDebug() << "HbStyle::updateThemedParams : -- -- -- -- EXIT";
+#endif
 }
 
 /*!
@@ -4072,8 +3864,8 @@
 
     This method uses QGraphicsItem::setData() with id 0xfffe.
 
-    \param item, graphics item
-    \param name, name to be set
+    \param item graphics item
+    \param name name to be set
 */
 void HbStyle::setItemName( QGraphicsItem *item, const QString &name )
 {
@@ -4105,7 +3897,7 @@
     Returns the item name of a graphics item. Item name is not the same as object name.
     It's a textual identifier that uniquely identifies QGraphicsItem's child items.
 
-    \param item, graphics item
+    \param item graphics item
     \return item name or an empty string if name's not set
 */
 QString HbStyle::itemName( const QGraphicsItem *item )
@@ -4137,28 +3929,19 @@
     d->layoutParameters.init(effectiveProfile);
     HbCss::ValueExtractor valueExtractor(effectiveProfile);
     valueExtractor.setLayoutParameters(d->layoutParameters);
-    // todo: parsing variable/expression is done here so that there is no need to change API
-    // also parameters method not changed (this change is done for docml/widgetml parsing)
-    if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) {
-        return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value);
-    } else if (param.startsWith(QLatin1String("-var(")) && param.endsWith(QLatin1String(")"))) {
-        bool retVal = valueExtractor.extractVariableValue(param.mid(5,param.length()-6), value);
-        value = -value;
-        return retVal;
-    } else if (param.startsWith(QLatin1String("expr(")) && param.endsWith(QLatin1String(")"))) {
-        QString expressionString = param.mid(5,param.length()-6);
-        return valueExtractor.extractExpressionValue(expressionString, value);
-    } else if (param.startsWith(QLatin1String("-expr(")) && param.endsWith(QLatin1String(")"))) {
-        QString expressionString = param.mid(6,param.length()-7);
-        bool retVal = valueExtractor.extractExpressionValue(expressionString, value);
-        value = -value;
-        return retVal;
+
+    if ( param.endsWith(QLatin1String(")")) &&
+        ( param.startsWith(QLatin1String("var(")) ||
+          param.startsWith(QLatin1String("-var(")) ||
+          param.startsWith(QLatin1String("expr(")) ||
+          param.startsWith(QLatin1String("-expr(")) ) ) {
+        // Expression parser can deal with "functions"
+        return valueExtractor.extractExpressionValue(param, value);
     }
-
     return valueExtractor.extractVariableValue(param, value);
 }
 
-bool HbStylePrivate::parameterFromHashValue(quint32 hashValue, qreal &value, const HbDeviceProfile &profile) const
+bool HbStylePrivate::valueFromTokens(const QList<int> &tokens, qreal &value, const HbDeviceProfile &profile) const
 {
     HbDeviceProfile effectiveProfile = profile;
     if ( effectiveProfile.isNull() ) {
@@ -4167,7 +3950,7 @@
     layoutParameters.init(effectiveProfile);
     HbCss::ValueExtractor valueExtractor(effectiveProfile);
     valueExtractor.setLayoutParameters(layoutParameters);
-    return valueExtractor.extractVariableValue(hashValue, value);
+    return valueExtractor.extractExpressionValue(tokens, value);
 }
 
 
@@ -4214,8 +3997,8 @@
     of the polish loop. It is more efficient to use HbWidget::polish(HbStyleParameters &params)
     if you don't need to access the parameters before the (first) polish event.
 
-    \param parameters, style parameters to be returned to the caller
-    \param widget, HbWidget to be polished
+    \param parameters style parameters to be returned to the caller
+    \param widget HbWidget to be polished
     \sa HbStyle::polish, HbStyle::parameters and HbWidget::polish
 */
 void HbStyle::widgetParameters(HbStyleParameters &params, HbWidget* widget) const