50 { |
50 { |
51 mLabel1 = style()->createPrimitive(HbStyle::P_InputDialog_text,this); |
51 mLabel1 = style()->createPrimitive(HbStyle::P_InputDialog_text,this); |
52 mEdit1 = new HbLineEdit(this); |
52 mEdit1 = new HbLineEdit(this); |
53 HbStyle::setItemName(mEdit1, "text-1"); |
53 HbStyle::setItemName(mEdit1, "text-1"); |
54 |
54 |
|
55 connect(mEdit1,SIGNAL(textChanged(const QString)),this,SLOT(emitTextChange(const QString))); |
55 this->setProperty("additionalRowVisible",QVariant(false)); |
56 this->setProperty("additionalRowVisible",QVariant(false)); |
56 } |
57 } |
57 |
58 |
58 |
59 void HbInputDialogContentWidget::emitTextChange(const QString & data) |
|
60 { |
|
61 emit textChanged(data); |
|
62 } |
59 void HbInputDialogContentWidget::setAdditionalRowVisible(bool visible) |
63 void HbInputDialogContentWidget::setAdditionalRowVisible(bool visible) |
60 { |
64 { |
61 mAdditionalRowVisible = visible; |
65 mAdditionalRowVisible = visible; |
62 |
66 |
63 if(!mLabel2 && visible) { |
67 if(!mLabel2 && visible) { |
114 mPrimaryMode = HbInputDialog::TextInput; //Default input mode is text input |
118 mPrimaryMode = HbInputDialog::TextInput; //Default input mode is text input |
115 |
119 |
116 //Populate the widget |
120 //Populate the widget |
117 mContentWidget = new HbInputDialogContentWidget(this); |
121 mContentWidget = new HbInputDialogContentWidget(this); |
118 |
122 |
|
123 q->connect(mContentWidget,SIGNAL(textChanged(const QString)),q,SLOT(textChange(const QString))); |
119 q->setContentWidget(mContentWidget); |
124 q->setContentWidget(mContentWidget); |
120 q->addAction(new HbAction(q->tr("Ok"), q)); |
125 |
121 |
126 action1=new HbAction(hbTrId("txt_common_button_ok"),q); |
122 q->addAction(new HbAction(q->tr("Cancel"), q)); |
127 action1->setEnabled(false); |
|
128 q->addAction(action1); |
|
129 q->connect(action1,SIGNAL(triggered()),q,SLOT(accept())); |
|
130 |
|
131 HbAction *action2=new HbAction(hbTrId("txt_common_button_cancel"),q); |
|
132 q->addAction(action2); |
|
133 q->connect(action2,SIGNAL(triggered()),q,SLOT(reject())); |
123 |
134 |
124 q->setTimeout(HbPopup::NoTimeout); |
135 q->setTimeout(HbPopup::NoTimeout); |
125 q->setModal(true); // Dialog is modal |
136 q->setModal(true); // Dialog is modal |
126 q->setDismissPolicy(HbPopup::NoDismiss); |
137 q->setDismissPolicy(HbPopup::NoDismiss); |
127 |
138 |
129 SIGNAL( orientationChanged(Qt::Orientation )), |
140 SIGNAL( orientationChanged(Qt::Orientation )), |
130 q, |
141 q, |
131 SLOT( _q_notesOrientationChanged(Qt::Orientation) ) ); |
142 SLOT( _q_notesOrientationChanged(Qt::Orientation) ) ); |
132 } |
143 } |
133 |
144 |
|
145 void HbInputDialogPrivate::textChange(const QString data) |
|
146 { |
|
147 Q_UNUSED(data); |
|
148 Q_Q(HbInputDialog); |
|
149 |
|
150 if(q->actions().count() == 0) { |
|
151 return; |
|
152 } |
|
153 |
|
154 if(mContentWidget->mEdit1->hasAcceptableInput()) { |
|
155 q->actions().at(0)->setEnabled(true); |
|
156 } else { |
|
157 q->actions().at(0)->setEnabled(false); |
|
158 } |
|
159 |
|
160 } |
134 |
161 |
135 void HbInputDialogPrivate::setInputMode(HbLineEdit *pEdit, HbInputDialog::InputMode mode) |
162 void HbInputDialogPrivate::setInputMode(HbLineEdit *pEdit, HbInputDialog::InputMode mode) |
136 { |
163 { |
137 Q_Q(HbInputDialog); |
164 Q_Q(HbInputDialog); |
138 |
165 |