27 // ---------------------------------------------------------------------------- |
27 // ---------------------------------------------------------------------------- |
28 // omacppinquerydialog ::omacppinquerydialog |
28 // omacppinquerydialog ::omacppinquerydialog |
29 // Initialization of member variables; Create Pin query |
29 // Initialization of member variables; Create Pin query |
30 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
31 // |
31 // |
32 omacppinquerydialog::omacppinquerydialog(const QVariantMap ¶meters) : |
32 omacppinquerydialog::omacppinquerydialog(const QVariantMap ¶meters) |
33 devicemanagementnotifierwidget(parameters) |
|
34 { |
33 { |
35 qDebug("omacppinquerydialog omacppinquerydialog() start"); |
34 qDebug("omacppinquerydialog omacppinquerydialog() start"); |
|
35 |
|
36 // Do translation |
|
37 QTranslator *translator = new QTranslator(); |
|
38 QString lang = QLocale::system().name(); |
|
39 QString path = "Z:/resource/qt/translations/"; |
|
40 bool fine = translator->load("deviceupdates_en.qm", path); |
|
41 if (fine) |
|
42 qApp->installTranslator(translator); |
|
43 |
|
44 QTranslator *commontranslator = new QTranslator(); |
|
45 |
|
46 fine = commontranslator->load("common_" + lang, path); |
|
47 if (fine) |
|
48 qApp->installTranslator(commontranslator); |
|
49 |
36 mlineedit = 0; |
50 mlineedit = 0; |
37 mactionok = 0; |
51 mactionok = 0; |
|
52 mDialog = 0; |
38 createcppinquery(parameters); |
53 createcppinquery(parameters); |
39 qDebug("omacppinquerydialog omacppinquerydialog() end"); |
54 qDebug("omacppinquerydialog omacppinquerydialog() end"); |
40 } |
55 } |
41 |
56 |
|
57 |
|
58 // Set parameters |
|
59 bool omacppinquerydialog::setDeviceDialogParameters( |
|
60 const QVariantMap ¶meters) |
|
61 { |
|
62 |
|
63 return true; |
|
64 } |
|
65 |
|
66 // Get error |
|
67 int omacppinquerydialog::deviceDialogError() const |
|
68 { |
|
69 |
|
70 return 0; |
|
71 } |
|
72 |
42 HbDialog *omacppinquerydialog::deviceDialogWidget() const |
73 HbDialog *omacppinquerydialog::deviceDialogWidget() const |
43 { |
74 { |
44 return const_cast<omacppinquerydialog*> (this); |
75 return mDialog; |
45 } |
76 } |
46 |
77 |
47 // ---------------------------------------------------------------------------- |
78 // ---------------------------------------------------------------------------- |
48 // omacppinquerydialog ::createcppinquery |
79 // omacppinquerydialog ::createcppinquery |
49 // Create Pin query dialog from docml; Connect the signals to slots |
80 // Create Pin query dialog from docml; Connect the signals to slots |
59 { |
90 { |
60 qFatal("omacppinquerydialog createcppinquery() Unable to read pin.docml"); |
91 qFatal("omacppinquerydialog createcppinquery() Unable to read pin.docml"); |
61 |
92 |
62 } |
93 } |
63 |
94 |
64 HbDialog *dialog = qobject_cast<HbDialog *> (loader.findWidget("dialog")); |
95 |
65 dialog->setDismissPolicy(HbPopup::NoDismiss); |
96 mDialog = qobject_cast<HbDialog *> (loader.findWidget("dialog")); |
66 dialog->setTimeout(HbPopup::NoTimeout); |
97 mDialog->setDismissPolicy(HbPopup::NoDismiss); |
|
98 mDialog->setTimeout(HbPopup::NoTimeout); |
67 |
99 |
68 int tries = -1; |
100 int tries = -1; |
69 |
101 |
70 //Get the reties left |
102 //Get the reties left |
71 QVariantMap::const_iterator i = parameters.find(keyparam1); |
103 QVariantMap::const_iterator i = parameters.find(keyparam1); |
86 label->setNumber(tries); |
118 label->setNumber(tries); |
87 } |
119 } |
88 |
120 |
89 label->setPlainText(labelstring); |
121 label->setPlainText(labelstring); |
90 |
122 |
91 mactionok = (HbAction *) dialog->actions().first(); |
123 mactionok = (HbAction *) mDialog->actions().first(); |
92 QString softkeyok = hbTrId("txt_common_button_ok"); |
124 QString softkeyok = hbTrId("txt_common_button_ok"); |
93 mactionok->setText(softkeyok); |
125 mactionok->setText(softkeyok); |
94 mactionok->setEnabled(false); |
126 mactionok->setEnabled(false); |
95 |
127 |
96 HbAction *actioncancel = (HbAction *) dialog->actions().at(1); |
128 HbAction *actioncancel = (HbAction *) mDialog->actions().at(1); |
97 QString softkeyCancel = hbTrId("txt_common_button_cancel"); |
129 QString softkeyCancel = hbTrId("txt_common_button_cancel"); |
98 actioncancel->setText(softkeyCancel); |
130 actioncancel->setText(softkeyCancel); |
99 |
131 |
100 mlineedit = qobject_cast<HbLineEdit *> (loader.findObject("lineEdit")); |
132 mlineedit = qobject_cast<HbLineEdit *> (loader.findObject("lineEdit")); |
101 mlineedit->setEchoMode(HbLineEdit::Password); |
133 mlineedit->setEchoMode(HbLineEdit::Password); |
103 |
135 |
104 mlineedit->setInputMethodHints(Qt::ImhDigitsOnly); |
136 mlineedit->setInputMethodHints(Qt::ImhDigitsOnly); |
105 HbEditorInterface editorInterface(mlineedit); |
137 HbEditorInterface editorInterface(mlineedit); |
106 editorInterface.setMode(HbInputModeNumeric); |
138 editorInterface.setMode(HbInputModeNumeric); |
107 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
139 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
108 dialog->setTimeout(HbPopup::NoTimeout); |
140 mDialog->setTimeout(HbPopup::NoTimeout); |
109 |
141 |
110 bool bconnect = false; |
142 bool bconnect = false; |
111 // Connection to the slot when PIN text is changed |
143 // Connection to the slot when PIN text is changed |
112 bconnect = QObject::connect(mlineedit, SIGNAL(contentsChanged()), this, |
144 bconnect = QObject::connect(mlineedit, SIGNAL(contentsChanged()), this, |
113 SLOT( pintextChanged())); |
145 SLOT( pintextChanged())); |
118 // Connections to the slot when Ok and Cancel buttons are clicked |
150 // Connections to the slot when Ok and Cancel buttons are clicked |
119 QObject::connect(mactionok, SIGNAL(triggered()), this, SLOT(okSelected())); |
151 QObject::connect(mactionok, SIGNAL(triggered()), this, SLOT(okSelected())); |
120 QObject::connect(actioncancel, SIGNAL(triggered()), this, |
152 QObject::connect(actioncancel, SIGNAL(triggered()), this, |
121 SLOT(cancelSelected())); |
153 SLOT(cancelSelected())); |
122 |
154 |
123 if (dialog) |
155 |
124 dialog->show(); |
|
125 |
|
126 |
156 |
127 |
157 |
128 qDebug("omacppinquerydialog createcppinquery() end"); |
158 qDebug("omacppinquerydialog createcppinquery() end"); |
129 } |
159 } |
130 |
160 |
200 |
230 |
201 LOGSTRING("omacppinquerydialog::cancelSelected() end"); |
231 LOGSTRING("omacppinquerydialog::cancelSelected() end"); |
202 qDebug("omacppinquerydialog::cancelSelected() end"); |
232 qDebug("omacppinquerydialog::cancelSelected() end"); |
203 } |
233 } |
204 |
234 |
|
235 // Close device dialog |
|
236 void omacppinquerydialog::closeDeviceDialog(bool byClient) |
|
237 { |
|
238 Q_UNUSED(byClient); |
|
239 mDialog->close(); |
|
240 emit deviceDialogClosed(); |
|
241 } |
|
242 |
|
243 // Return signal source (container) for the dialog |
|
244 QObject *omacppinquerydialog::signalSender() const |
|
245 { |
|
246 return const_cast<omacppinquerydialog*>(this); |
|
247 } |
|
248 |
205 // End of File |
249 // End of File |
206 |
250 |