phoneuis/bubblemanager2/bubblecore/src/bubblebutton.cpp
changeset 45 6b911d05207e
parent 30 ebdbd102c78a
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <hbevent.h>
    18 #include <hbevent.h>
    19 #include <hbframeitem.h>
    19 #include <hbframeitem.h>
       
    20 #include <hbiconitem.h>
       
    21 #include <hbcolorscheme.h>
    20 
    22 
    21 #include "bubblebutton.h"
    23 #include "bubblebutton.h"
    22 
    24 
    23 BubbleButton::BubbleButton(QGraphicsItem *parent)
    25 BubbleButton::BubbleButton(QGraphicsItem *parent)
    24     : HbPushButton(parent), mButtonType(DefaultButton)
    26     : HbPushButton(parent), mButtonType(DefaultButton)
    42 bool BubbleButton::sceneEvent(QEvent *event)
    44 bool BubbleButton::sceneEvent(QEvent *event)
    43 {
    45 {
    44     bool result = HbPushButton::sceneEvent(event);
    46     bool result = HbPushButton::sceneEvent(event);
    45 
    47 
    46     if (event->type() == QEvent::UngrabMouse) {
    48     if (event->type() == QEvent::UngrabMouse) {
    47         if (isDown()) {
    49         if (isVisible() && isDown()) {
    48             // this is needed in situation, where
    50             // this is needed in situation, where
    49             // longpress launches a dialog (vmbx)
    51             // longpress launches a dialog (vmbx)
    50             // and button release event goes to
    52             // and button release event goes to
    51             // dialog (HbPopup grabs mouse).
    53             // dialog (HbPopup grabs mouse).
    52             setDown(false);
    54             setDown(false);
    68     if (!frame) {
    70     if (!frame) {
    69         return;
    71         return;
    70     }
    72     }
    71 
    73 
    72     QString graphicsName;
    74     QString graphicsName;
       
    75     QColor iconColor; // CSS doesn't work with changing icon color
    73 
    76 
    74     if (isDown()) {
    77     if (isDown()) {
    75         if (buttonType()==GreenButton) {
    78         if (buttonType()==GreenButton) {
    76             graphicsName = "qtg_fr_btn_green_pressed";
    79             graphicsName = "qtg_fr_btn_green_pressed";
       
    80             iconColor = HbColorScheme::color("qtc_callhandling_answer_pressed");
    77         } else if (buttonType()==RedButton) {
    81         } else if (buttonType()==RedButton) {
    78             graphicsName = "qtg_fr_btn_red_pressed";
    82             graphicsName = "qtg_fr_btn_red_pressed";
       
    83             iconColor = HbColorScheme::color("qtc_callhandling_reject_pressed");
       
    84         } else {
       
    85             iconColor = HbColorScheme::color("qtc_button_pressed");
    79         }
    86         }
    80     } else {
    87     } else {
    81         if (buttonType()==GreenButton) {
    88         if (buttonType()==GreenButton) {
    82             graphicsName = "qtg_fr_btn_green_normal";
    89             graphicsName = "qtg_fr_btn_green_normal";
       
    90             iconColor = HbColorScheme::color("qtc_callhandling_answer_normal");
    83         } else if (buttonType()==RedButton) {
    91         } else if (buttonType()==RedButton) {
    84             graphicsName = "qtg_fr_btn_red_normal";
    92             graphicsName = "qtg_fr_btn_red_normal";
       
    93             iconColor = HbColorScheme::color("qtc_callhandling_reject_normal");
       
    94         } else {
       
    95             iconColor = HbColorScheme::color("qtc_button_normal");
    85         }
    96         }
    86     }
    97     }
    87 
    98 
    88     if (graphicsName.length()) {
    99     if (graphicsName.length()) {
    89         frame->frameDrawer().setFrameGraphicsName(graphicsName);
   100         frame->frameDrawer().setFrameGraphicsName(graphicsName);
    90     }
   101     }
       
   102 
       
   103     // set icon color
       
   104     HbIconItem* iconItem =
       
   105         qgraphicsitem_cast<HbIconItem*>(HbWidget::primitive("icon"));
       
   106 
       
   107     if (iconItem && iconColor.isValid()) {
       
   108         iconItem->setColor(iconColor);
       
   109     }
    91 }
   110 }