phonesettings/cpphonesettingsplugins/divertplugin/src/cpdivertselectioncustomitem.cpp
changeset 30 ebdbd102c78a
parent 22 6bb1b21d2484
equal deleted inserted replaced
27:2f8f8080a020 30:ebdbd102c78a
    20 #include <hbcheckbox.h>
    20 #include <hbcheckbox.h>
    21 #include <qgraphicsgridlayout.h>
    21 #include <qgraphicsgridlayout.h>
    22 #include <cppluginlogging.h>
    22 #include <cppluginlogging.h>
    23 
    23 
    24 
    24 
       
    25 /*!
       
    26   CpDivertSelectionCustomitem::CpDivertSelectionCustomitem.
       
    27  */
    25 CpDivertSelectionCustomitem::CpDivertSelectionCustomitem(
    28 CpDivertSelectionCustomitem::CpDivertSelectionCustomitem(
    26         QGraphicsItem *parent /**=0*/,
    29         QGraphicsItem *parent /**=0*/,
    27         Qt::WindowFlags wFlags /**=0*/):
    30         Qt::WindowFlags wFlags /**=0*/):
    28         HbWidget(parent, wFlags),
    31         HbWidget(parent, wFlags),
    29         layout(NULL),
    32         layout(NULL),
    30         checkbox(NULL),
    33         checkbox(NULL),
    31         //numberValueLabel(NULL),
       
    32         timeoutLabel(NULL),
    34         timeoutLabel(NULL),
    33         timeoutValueLabel(NULL),
    35         timeoutValueLabel(NULL),
    34         m_state(Disabled)
    36         m_state(Disabled)
    35 {
    37 {
    36     DPRINT;
    38     DPRINT;
    40     layout->setContentsMargins(0,0,0,0);
    42     layout->setContentsMargins(0,0,0,0);
    41     layout->setRowMaximumHeight(0,0);
    43     layout->setRowMaximumHeight(0,0);
    42     layout->setRowMaximumHeight(1,0);
    44     layout->setRowMaximumHeight(1,0);
    43 
    45 
    44     checkbox = new HbCheckBox(this);
    46     checkbox = new HbCheckBox(this);
    45     checkbox->setBackgroundItem(HbStyle::P_DataItem_background);
       
    46 
       
    47     HbStyle::setItemName(checkbox, "dataItem_ContentWidget");
    47     HbStyle::setItemName(checkbox, "dataItem_ContentWidget");
    48 
    48 
    49     layout->addItem(checkbox, 0, 0, 1, 2);
    49     layout->addItem(checkbox, 0, 0, 1, 2);
    50 
       
    51     connect(checkbox,SIGNAL(clicked()), this, SIGNAL(clicked()));
    50     connect(checkbox,SIGNAL(clicked()), this, SIGNAL(clicked()));
    52 
       
    53     //numberValueLabel = new HbLabel(this);
       
    54     //layout->addItem(numberValueLabel, 0, 1);
       
    55     //connect(numberValueLabel,SIGNAL(clicked()), this, SIGNAL(clicked()));
       
    56 
    51 
    57     timeoutLabel = new HbLabel(this);
    52     timeoutLabel = new HbLabel(this);
    58     HbStyle::setItemName(timeoutLabel, "dataItem_ContentWidget");
    53     HbStyle::setItemName(timeoutLabel, "dataItem_ContentWidget");
    59     timeoutLabel->setAlignment(Qt::AlignRight);
    54     timeoutLabel->setAlignment(Qt::AlignRight);
    60     layout->addItem(timeoutLabel, 1, 0);
    55     layout->addItem(timeoutLabel, 1, 0);
    61 
    56 
    62     timeoutLabel->hide();
    57     timeoutLabel->hide();
    63     timeoutValueLabel = new HbLabel(this);
    58     timeoutValueLabel = new HbLabel(this);
    64     timeoutValueLabel->setBackgroundItem(HbStyle::P_DataItem_background);
       
    65     HbStyle::setItemName(timeoutValueLabel, "dataItem_ContentWidget");
    59     HbStyle::setItemName(timeoutValueLabel, "dataItem_ContentWidget");
    66     timeoutValueLabel->hide();
    60     timeoutValueLabel->hide();
    67     layout->addItem(timeoutValueLabel, 1, 1);
    61     layout->addItem(timeoutValueLabel, 1, 1);
    68 
    62 
    69     setLayout(layout);
    63     setLayout(layout);
    70 }
    64 }
    71 
    65 
       
    66 
       
    67 /*!
       
    68   CpDivertSelectionCustomitem::~CpDivertSelectionCustomitem. 
       
    69  */
    72 CpDivertSelectionCustomitem::~CpDivertSelectionCustomitem()
    70 CpDivertSelectionCustomitem::~CpDivertSelectionCustomitem()
    73 {
    71 {
    74     DPRINT;
    72     DPRINT;
    75 }
    73 }
    76 
    74 
       
    75 
       
    76 /*!
       
    77   CpDivertSelectionCustomitem::number.
       
    78  */
    77 const QString CpDivertSelectionCustomitem::number() const
    79 const QString CpDivertSelectionCustomitem::number() const
    78 {
    80 {
    79     DPRINT;
    81     DPRINT;
    80     return checkbox->text();
    82     return checkbox->text();
    81 }
    83 }
    82 
    84 
    83 void CpDivertSelectionCustomitem::setNumber( const QString& number )
    85 
       
    86 /*!
       
    87   CpDivertSelectionCustomitem::setNumber.
       
    88  */
       
    89 void CpDivertSelectionCustomitem::setNumber(const QString& number)
    84 {
    90 {
    85     DPRINT << number;
    91     DPRINT << number;    
    86     
       
    87     checkbox->setText(number);
    92     checkbox->setText(number);
    88 }
    93 }
    89 
    94 
       
    95 
       
    96 /*!
       
    97   CpDivertSelectionCustomitem::timeout.
       
    98  */
    90 int CpDivertSelectionCustomitem::timeout() const
    99 int CpDivertSelectionCustomitem::timeout() const
    91 {
   100 {
    92     DPRINT;
   101     DPRINT;
    93     return timeoutValueLabel->plainText().toInt();
   102     return timeoutValueLabel->plainText().toInt();
    94 }
   103 }
    95 
   104 
    96 void CpDivertSelectionCustomitem::setTimeout( int timeout)
   105 
       
   106 /*!
       
   107   CpDivertSelectionCustomitem::setTimeout.
       
   108  */
       
   109 void CpDivertSelectionCustomitem::setTimeout(int timeout)
    97 {
   110 {
    98     DPRINT << timeout;
   111     DPRINT << timeout;
    99     timeoutValueLabel->setPlainText(QString::number(timeout));
   112     timeoutValueLabel->setPlainText(QString::number(timeout));
   100 }
   113 }
   101 
   114 
       
   115 
       
   116 /*!
       
   117   CpDivertSelectionCustomitem::timeoutText.
       
   118  */
   102 const QString CpDivertSelectionCustomitem::timeoutText() const
   119 const QString CpDivertSelectionCustomitem::timeoutText() const
   103 {
   120 {
   104     DPRINT;
   121     DPRINT;
   105     return timeoutLabel->plainText();
   122     return timeoutLabel->plainText();
   106 }
   123 }
   107 
   124 
       
   125 
       
   126 /*!
       
   127   CpDivertSelectionCustomitem::setTimeoutText.
       
   128  */
   108 void CpDivertSelectionCustomitem::setTimeoutText( const QString& text )
   129 void CpDivertSelectionCustomitem::setTimeoutText( const QString& text )
   109 {
   130 {
   110     DPRINT << text;
   131     DPRINT << text;
   111     timeoutLabel->setPlainText(text);
   132     timeoutLabel->setPlainText(text);
   112 
   133 
   118         timeoutLabel->hide();
   139         timeoutLabel->hide();
   119         timeoutValueLabel->hide();
   140         timeoutValueLabel->hide();
   120     }
   141     }
   121 }
   142 }
   122 
   143 
       
   144 
       
   145 /*!
       
   146   CpDivertSelectionCustomitem::state.
       
   147  */
   123 int CpDivertSelectionCustomitem::state() const
   148 int CpDivertSelectionCustomitem::state() const
   124 {
   149 {
   125     DPRINT << m_state;
   150     DPRINT << m_state;
   126     
       
   127     return m_state;
   151     return m_state;
   128 }
   152 }
   129 
   153 
       
   154 
       
   155 /*!
       
   156   CpDivertSelectionCustomitem::setState.
       
   157  */
   130 void CpDivertSelectionCustomitem::setState(int state)
   158 void CpDivertSelectionCustomitem::setState(int state)
   131 {
   159 {
   132     DPRINT << state;
   160     DPRINT << state;
   133     
       
   134     m_state = state;
   161     m_state = state;
   135     
       
   136     updateCheckState();
   162     updateCheckState();
   137 }
   163 }
   138 
   164 
       
   165 
       
   166 /*!
       
   167   CpDivertSelectionCustomitem::updateCheckState.
       
   168  */
   139 void CpDivertSelectionCustomitem::updateCheckState()
   169 void CpDivertSelectionCustomitem::updateCheckState()
   140 {
   170 {
   141     DPRINT << m_state;
   171     DPRINT << m_state;
   142     
   172     
   143     switch (m_state) {
   173     switch (m_state) {
   153             break;
   183             break;
   154         default:
   184         default:
   155             break;
   185             break;
   156     }
   186     }
   157 }
   187 }
       
   188 
       
   189 // End of File.