|
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: stub hbinputdialog |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "hbinputdialog.h" |
|
19 #include "testobjectstore.h" |
|
20 |
|
21 int HbInputDialog::mGetTextCallCount = 0; |
|
22 int HbInputDialog::mAttribute = -1; |
|
23 QString HbInputDialog::mLastHeading = ""; |
|
24 QString HbInputDialog::mLastText = ""; |
|
25 QVariant HbInputDialog::mValueReturnValue = QVariant(); |
|
26 int HbInputDialog::mValueCallCount = 0; |
|
27 int HbInputDialog::mOpenCallCount = 0; |
|
28 |
|
29 HbInputDialog::HbInputDialog(QGraphicsItem *parent) : HbWidget(parent) |
|
30 { |
|
31 HbAction *action = new HbAction(); |
|
32 mActions.append(action); |
|
33 action = new HbAction(); |
|
34 mActions.append(action); |
|
35 |
|
36 TestObjectStore::instance().addObject(this); |
|
37 } |
|
38 |
|
39 HbInputDialog::~HbInputDialog() |
|
40 { |
|
41 while(!mActions.isEmpty()) |
|
42 { |
|
43 delete mActions.takeFirst(); |
|
44 } |
|
45 } |
|
46 |
|
47 void HbInputDialog::open( QObject* receiver, const char* member ) |
|
48 { |
|
49 Q_UNUSED(receiver); |
|
50 Q_UNUSED(member); |
|
51 |
|
52 mOpenCallCount++; |
|
53 } |
|
54 |
|
55 void HbInputDialog::getText(const QString &heading |
|
56 ,QObject *receiver |
|
57 ,const char *member |
|
58 ,const QString &text |
|
59 ,QGraphicsScene *scene |
|
60 ,QGraphicsItem *parent) |
|
61 { |
|
62 Q_UNUSED(receiver); |
|
63 Q_UNUSED(member); |
|
64 Q_UNUSED(scene); |
|
65 Q_UNUSED(parent); |
|
66 |
|
67 mLastHeading = heading; |
|
68 mLastText = text; |
|
69 mGetTextCallCount++; |
|
70 } |
|
71 |
|
72 void HbInputDialog::emitDialogFinished( QObject* receiver, const char* member, int actionNum ) |
|
73 { |
|
74 if(connect(this, SIGNAL(finished(HbAction *)), receiver, member)) |
|
75 { |
|
76 emit finished(mActions.value(actionNum)); |
|
77 disconnect(this, SIGNAL(finished(HbAction *)), receiver, member); |
|
78 } |
|
79 } |
|
80 |
|
81 void HbInputDialog::setAttribute(int attribute) |
|
82 { |
|
83 HbInputDialog::mAttribute = attribute; |
|
84 } |
|
85 |
|
86 void HbInputDialog::setPromptText(const QString &text, int row) |
|
87 { |
|
88 while(mSetPromptTexts.count() < row+1) |
|
89 { |
|
90 mSetPromptTexts.append(""); |
|
91 } |
|
92 mSetPromptTexts[row] = text; |
|
93 } |
|
94 |
|
95 void HbInputDialog::setValue(const QVariant &value, int row) |
|
96 { |
|
97 while(mSetValues.count() < row+1) |
|
98 { |
|
99 mSetValues.append(""); |
|
100 } |
|
101 mSetValues[row] = value; |
|
102 } |
|
103 |