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