|
1 /* |
|
2 * Copyright (c) 2010 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 |
|
18 // qt |
|
19 #include <QAction> |
|
20 // hb |
|
21 #include <hbmessagebox.h> |
|
22 #include <hbaction.h> |
|
23 // satapp |
|
24 #include "satappconfirmprovider.h" |
|
25 #include "satappconstant.h" |
|
26 #include "satappaction.h" |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // SatAppConfirmProvider::SatAppConfirmProvider |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 SatAppConfirmProvider::SatAppConfirmProvider(QObject *parent) |
|
33 : QObject(parent), mConfirmQuery(0), mAction(0) |
|
34 { |
|
35 qDebug("SATAPP: SatAppConfirmProvider::SatAppConfirmProvider"); |
|
36 } |
|
37 |
|
38 // ---------------------------------------------------------------------------- |
|
39 // SatAppConfirmProvider::~SatAppConfirmProvider |
|
40 // ---------------------------------------------------------------------------- |
|
41 // |
|
42 SatAppConfirmProvider::~SatAppConfirmProvider() |
|
43 { |
|
44 qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider >"); |
|
45 clearScreen(); |
|
46 qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider <"); |
|
47 } |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // SatAppConfirmProvider::showOpenChannelConfirm |
|
51 // ---------------------------------------------------------------------------- |
|
52 // |
|
53 void SatAppConfirmProvider::confirmCommand(SatAppAction &action) |
|
54 { |
|
55 qDebug("SATAPP: SatAppConfirmProvider::confirmCommand >"); |
|
56 mAction = &action; |
|
57 delete mConfirmQuery; |
|
58 mConfirmQuery = 0; |
|
59 TSatSQueryCommand aCommandId = |
|
60 static_cast<TSatSQueryCommand>(action.value(KeyQueryCommandId).toInt()); |
|
61 |
|
62 qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand aCommandId: %d", |
|
63 aCommandId); |
|
64 // Check quering command |
|
65 switch (aCommandId) |
|
66 { |
|
67 case ESatOpenChannelQuery: |
|
68 { |
|
69 qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ |
|
70 Quering OpenChannel"); |
|
71 showOpenChannelConfirm(action); |
|
72 break; |
|
73 } |
|
74 case ESatSSetUpCallQuery: |
|
75 { |
|
76 qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ |
|
77 Quering SetUpCall"); |
|
78 showSetUpCallConfirm(action); |
|
79 break; |
|
80 } |
|
81 // TODO: implemente later |
|
82 case ESatSRefreshQuery: |
|
83 // TODO: implemente later |
|
84 case ESatSLaunchBrowserQuery: |
|
85 { |
|
86 action.completeWithNoResponse(); |
|
87 break; |
|
88 } |
|
89 default: |
|
90 { |
|
91 qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\ |
|
92 Unknown quering command"); |
|
93 action.completeWithNoResponse(); |
|
94 } |
|
95 break; |
|
96 } |
|
97 qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand <"); |
|
98 } |
|
99 |
|
100 // ---------------------------------------------------------------------------- |
|
101 // SatAppConfirmProvider::showOpenChannelConfirm |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 void SatAppConfirmProvider::showOpenChannelConfirm(SatAppAction &action) |
|
105 { |
|
106 qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm >"); |
|
107 QString content = action.value(KeyText).toString(); |
|
108 if (!content.length()){ |
|
109 content = hbTrId("txt_simatk_info_open_connection"); |
|
110 } |
|
111 mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
112 // Sets the "Yes"-action/button |
|
113 mConfirmQuery->setText(content); |
|
114 mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel); |
|
115 SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()), |
|
116 &action, SLOT(completeWithSuccess()))); |
|
117 SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()), |
|
118 &action, SLOT(completeWithBackRequested()))); |
|
119 SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)), |
|
120 this, SLOT(resetState()))); |
|
121 qDebug("SATAPP: SatAppUiProvider::showOpenChannelConfirm before open"); |
|
122 mConfirmQuery->open(); |
|
123 qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm <"); |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------------------------------- |
|
127 // SatAppConfirmProvider::showSetUpCallConfirm |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 void SatAppConfirmProvider::showSetUpCallConfirm(SatAppAction &action) |
|
131 { |
|
132 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm >"); |
|
133 QString text = action.value(KeyText).toString(); |
|
134 QString additionText = action.value(KeyAdditionalText).toString(); |
|
135 QString alphaId; |
|
136 if (text.length() == 0) { |
|
137 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm length 0"); |
|
138 if (additionText.length() > 0) { |
|
139 alphaId.append(additionText); |
|
140 } else { |
|
141 alphaId.append(hbTrId("txt_simatk_title_sim_services")); |
|
142 } |
|
143 alphaId.append(hbTrId("txt_simatk_info_1_about_to_call")); |
|
144 } else { |
|
145 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm text"); |
|
146 alphaId.append(text); |
|
147 } |
|
148 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm new"); |
|
149 mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
150 mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel); |
|
151 mConfirmQuery->setText(alphaId); |
|
152 SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()), |
|
153 &action, SLOT(completeWithSuccess()))); |
|
154 SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()), |
|
155 &action, SLOT(completeWithBackRequested()))); |
|
156 SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)), |
|
157 this, SLOT(resetState()))); |
|
158 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm before open"); |
|
159 mConfirmQuery->open(); |
|
160 qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm <"); |
|
161 } |
|
162 |
|
163 // ---------------------------------------------------------------------------- |
|
164 // SatAppConfirmProvider::clearScreen |
|
165 // ---------------------------------------------------------------------------- |
|
166 // |
|
167 void SatAppConfirmProvider::clearScreen() |
|
168 { |
|
169 qDebug("SATAPP: SatAppConfirmProvider::clearScreen >"); |
|
170 if (mAction) { |
|
171 SAT_ASSERT(disconnect(mAction, SIGNAL(actionCompleted(SatAppAction *)), |
|
172 this, SLOT(resetState()))); |
|
173 qDebug("SATAPP: SatAppConfirmProvider::clearScreen quit event loop"); |
|
174 mAction->completeWithNoResponse(); |
|
175 mAction = 0; |
|
176 } |
|
177 delete mConfirmQuery; |
|
178 mConfirmQuery = 0; |
|
179 qDebug("SATAPP: SatAppConfirmProvider::clearScreen <"); |
|
180 } |
|
181 |
|
182 // ---------------------------------------------------------------------------- |
|
183 // SatAppConfirmProvider::resetState |
|
184 // reset |
|
185 // ---------------------------------------------------------------------------- |
|
186 // |
|
187 void SatAppConfirmProvider::resetState() |
|
188 { |
|
189 qDebug( "SATAPP: SatAppConfirmProvider::resetState >" ); |
|
190 mAction = 0; |
|
191 qDebug( "SATAPP: SatAppConfirmProvider::resetState <" ); |
|
192 } |
|
193 |
|
194 //End of file |