ipsservices/nmipssettings/src/nmipssettingstimeeditor.cpp
changeset 40 2c62ef3caffd
parent 23 2dc6caa42ec3
child 68 83cc6bae1de8
equal deleted inserted replaced
39:b0b89ca206b5 40:2c62ef3caffd
    37     Constructor of NmIpsSettingsTimeEditor.
    37     Constructor of NmIpsSettingsTimeEditor.
    38 */
    38 */
    39 NmIpsSettingsTimeEditor::NmIpsSettingsTimeEditor(QGraphicsItem *parent, Qt::WindowFlags wFlags)
    39 NmIpsSettingsTimeEditor::NmIpsSettingsTimeEditor(QGraphicsItem *parent, Qt::WindowFlags wFlags)
    40     : HbWidget(parent, wFlags),
    40     : HbWidget(parent, wFlags),
    41       mButton(0),
    41       mButton(0),
    42       mTimePickerDialog(0)
    42       mTimePickerDialog(0),
       
    43       mPrimaryAction(0)
    43 {
    44 {
    44     // Create widget layout.
    45     // Create widget layout.
    45     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
    46     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
    46     this->setLayout(layout); // Takes ownership
    47     this->setLayout(layout); // Takes ownership
    47 
    48 
   128     timePicker->setDisplayFormat(timeFormat());
   129     timePicker->setDisplayFormat(timeFormat());
   129     timePicker->setTime(mTime);
   130     timePicker->setTime(mTime);
   130 
   131 
   131     // Set dialog actions.
   132     // Set dialog actions.
   132     HbAction *okAction = new HbAction(QString(hbTrId("txt_common_button_ok")), mTimePickerDialog);
   133     HbAction *okAction = new HbAction(QString(hbTrId("txt_common_button_ok")), mTimePickerDialog);
   133     mTimePickerDialog->setPrimaryAction(okAction);
   134     mTimePickerDialog->addAction(okAction);
   134 
   135     mPrimaryAction = okAction;
   135     HbAction *cancelAction = new HbAction(QString(hbTrId("txt_common_button_cancel")),
   136     
   136         mTimePickerDialog);
   137     HbAction *cancelAction = new HbAction(QString(hbTrId("txt_common_button_cancel")), 
   137     mTimePickerDialog->setSecondaryAction( cancelAction );
   138                                           mTimePickerDialog);
       
   139     mTimePickerDialog->addAction(cancelAction);
   138 
   140 
   139     // Show the dialog.
   141     // Show the dialog.
   140     mTimePickerDialog->open(this, SLOT(handleTimeAction(HbAction *)));
   142     mTimePickerDialog->open(this, SLOT(handleTimeAction(HbAction *)));
   141 }
   143 }
   142 
   144 
   143 /*!
   145 /*!
   144     Handles the action from the time picker dialog.
   146     Handles the action from the time picker dialog.
   145  */
   147  */
   146 void NmIpsSettingsTimeEditor::handleTimeAction(HbAction *action)
   148 void NmIpsSettingsTimeEditor::handleTimeAction(HbAction *action)
   147 {
   149 {
   148     if (action == mTimePickerDialog->primaryAction()) {
   150     if (action==mPrimaryAction) {
   149         // Get the time from the picker.
   151         // Get the time from the picker.
   150         QTime newTime = static_cast<HbDateTimePicker *> (mTimePickerDialog->contentWidget())->time();
   152         QTime newTime = static_cast<HbDateTimePicker *> (mTimePickerDialog->contentWidget())->time();
   151 
   153 
   152         // Store the new time.
   154         // Store the new time.
   153         setTime(newTime);
   155         setTime(newTime);