1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include "seccodeuiutility.h" |
|
18 #include <QString> |
|
19 #include <hbinputdialog.h> |
|
20 #include <hbmessagebox.h> |
|
21 |
|
22 QString SecCodeUiUtility::getPassword(const QString &label,bool *ok /*= 0*/,QGraphicsItem *parent /*= 0*/) |
|
23 { |
|
24 HbInputDialog *dlg = new HbInputDialog(parent); |
|
25 dlg->setEchoMode(HbLineEdit::Password); |
|
26 QString result; |
|
27 dlg->setPromptText(label); |
|
28 dlg->setInputMode(HbInputDialog::TextInput); |
|
29 HbAction* action = dlg->exec(); |
|
30 if(action == dlg->secondaryAction()) { //Cancel was pressed |
|
31 if(ok) { |
|
32 *ok = false; |
|
33 } |
|
34 } else { //OK was pressed |
|
35 if(ok) { |
|
36 *ok = true; |
|
37 } |
|
38 result = dlg->value().toString(); |
|
39 } |
|
40 delete dlg; |
|
41 return result; |
|
42 } |
|
43 |
|
44 void SecCodeUiUtility::showInformationMessage(const QString &message,QGraphicsItem *parent /*= 0*/ ) |
|
45 { |
|
46 HbMessageBox::information(message,0,0,parent); |
|
47 } |
|
48 |
|
49 void SecCodeUiUtility::showWarningMessage(const QString &message,QGraphicsItem *parent /*= 0*/) |
|
50 { |
|
51 HbMessageBox::warning(message,0,0,parent); |
|
52 } |
|
53 |
|
54 void SecCodeUiUtility::showErrorMessage(const QString &message,QGraphicsItem *parent /*= 0*/) |
|
55 { |
|
56 HbMessageBox::information(message,0,0,parent); |
|
57 } |
|
58 |
|
59 QString SecCodeUiUtility::getPinRemainingAttemptsMessage(int remainingAttempts) |
|
60 { |
|
61 Q_UNUSED(remainingAttempts); |
|
62 |
|
63 return QString("PIN code:"); |
|
64 } |
|
65 |
|
66 QString SecCodeUiUtility::getPin2RemainingAttemptsMessage(int remainingAttempts) |
|
67 { |
|
68 Q_UNUSED(remainingAttempts); |
|
69 |
|
70 return QString("PIN2 code:"); |
|
71 } |
|