telutils/dialpad/src/dialpadkeypad.cpp
changeset 19 e44a8c097b15
parent 15 d7fc66ccd6fb
child 27 7eb70891911c
equal deleted inserted replaced
15:d7fc66ccd6fb 19:e44a8c097b15
    24 #include <hbinputlanguage.h>
    24 #include <hbinputlanguage.h>
    25 #include <hbapplication.h>
    25 #include <hbapplication.h>
    26 #include <hblineedit.h>
    26 #include <hblineedit.h>
    27 
    27 
    28 #include "dialpadkeypad.h"
    28 #include "dialpadkeypad.h"
    29 #include "dialpadbuttonstyle.h"
       
    30 #include "dialpadbutton.h"
    29 #include "dialpadbutton.h"
    31 #include "dialpadinputfield.h"
    30 #include "dialpadinputfield.h"
    32 
    31 
    33 static const int DialpadRowCount = 5;
    32 static const int DialpadRowCount = 5;
    34 static const int DialpadColumnCount = 3;
    33 static const int DialpadColumnCount = 3;
    69             mKeyClickedSignalMapper,SLOT(map()));
    68             mKeyClickedSignalMapper,SLOT(map()));
    70     mKeyClickedSignalMapper->setMapping(&mInputField.backspaceButton(),
    69     mKeyClickedSignalMapper->setMapping(&mInputField.backspaceButton(),
    71                                         Qt::Key_Backspace);
    70                                         Qt::Key_Backspace);
    72 
    71 
    73     // create keypad
    72     // create keypad
    74     mNormalButtonStyle = new DialpadButtonStyle();
       
    75     mCallButtonStyle = new DialpadButtonStyle();
       
    76     mCallButtonStyle->setButtonStyle(DialpadButtonStyle::CallButtonStyle);
       
    77 
       
    78     for (int i = 0; i < DialpadButtonCount; i++) {
    73     for (int i = 0; i < DialpadButtonCount; i++) {
    79         int keyCode = DialpadButtonToKeyCodeTable[i];
    74         int keyCode = DialpadButtonToKeyCodeTable[i];
    80 
    75 
    81         DialpadButton* button = new DialpadButton(this);
    76         DialpadButton* button = new DialpadButton(this);
    82         mButtons[i] = button;
    77         mButtons[i] = button;
    88         QString buttonName;
    83         QString buttonName;
    89         buttonName.setNum(keyCode);
    84         buttonName.setNum(keyCode);
    90         button->setObjectName(buttonName);
    85         button->setObjectName(buttonName);
    91 
    86 
    92         if (keyCode==Qt::Key_Yes) {
    87         if (keyCode==Qt::Key_Yes) {
    93             button->setStyle(mCallButtonStyle);
       
    94             HbIcon callIcon(handsetIcon); // todo correct icon
    88             HbIcon callIcon(handsetIcon); // todo correct icon
    95             button->setIcon(callIcon);
    89             button->setIcon(callIcon);
    96             button->setButtonType(DialpadButton::CallButton); // for css
    90             button->setButtonType(DialpadButton::CallButton); // for css
    97         } else {
    91         } else {
    98             button->setStyle(mNormalButtonStyle);
       
    99             button->setButtonType(DialpadButton::NumericButton); // for css
    92             button->setButtonType(DialpadButton::NumericButton); // for css
   100         }
    93         }
   101 
    94 
   102         if (keyCode==Qt::Key_1) {
    95         if (keyCode==Qt::Key_1) {
   103             HbIcon mboxIcon(vmbxIcon);
    96             HbIcon mboxIcon(vmbxIcon);
   134     connect(mLongPressTimer,SIGNAL(timeout()),SLOT(handleLongPress()));
   127     connect(mLongPressTimer,SIGNAL(timeout()),SLOT(handleLongPress()));
   135 }
   128 }
   136 
   129 
   137 DialpadKeypad::~DialpadKeypad()
   130 DialpadKeypad::~DialpadKeypad()
   138 {
   131 {
   139     delete mCallButtonStyle;
       
   140     delete mNormalButtonStyle;
       
   141 }
   132 }
   142 
   133 
   143 void DialpadKeypad::createButtonGrid()
   134 void DialpadKeypad::createButtonGrid()
   144 {
   135 {
   145     // button grid
   136     // button grid
   320         for (int i=0; i < DialpadRowCount ;i++) {
   311         for (int i=0; i < DialpadRowCount ;i++) {
   321             mGridLayout->setRowFixedHeight(i, height);
   312             mGridLayout->setRowFixedHeight(i, height);
   322         }
   313         }
   323     }
   314     }
   324 }
   315 }
       
   316 
       
   317 void DialpadKeypad::resetButtons()
       
   318 {
       
   319     for(int i = 0; i < DialpadButtonCount; i++) {
       
   320         mButtons[i]->setDown(false);
       
   321     }
       
   322 }