166 if (index >= 0 && checkAccess(index, indicatorType, securityCredentials)) { |
166 if (index >= 0 && checkAccess(index, indicatorType, securityCredentials)) { |
167 HbIndicatorInterface *indicator = indicatorInfo->indicator; |
167 HbIndicatorInterface *indicator = indicatorInfo->indicator; |
168 |
168 |
169 indicator->disconnect(this, SLOT(deactivateIndicator())); |
169 indicator->disconnect(this, SLOT(deactivateIndicator())); |
170 connect(indicator, SIGNAL(deactivate()), SLOT(deactivateIndicator()), Qt::QueuedConnection); |
170 connect(indicator, SIGNAL(deactivate()), SLOT(deactivateIndicator()), Qt::QueuedConnection); |
171 |
171 success = true; |
172 indicator->processClientRequest( |
172 try { |
|
173 indicator->processClientRequest( |
173 HbIndicatorInterface::RequestActivate, parameter); |
174 HbIndicatorInterface::RequestActivate, parameter); |
174 //in case indicator deactivated itself, find the indicator again. |
175 } catch (const std::bad_alloc &) { |
175 index = findPlugin(indicatorType, &indicatorInfo); |
176 success = false; |
176 |
177 } |
177 if (index >= 0 && !indicatorInfo->activated) { |
178 if (success) { |
178 indicatorInfo->activated = true; |
179 //in case indicator deactivated itself, find the indicator again. |
179 emit indicatorActivated(indicator); |
180 index = findPlugin(indicatorType, &indicatorInfo); |
180 indicatorInfo->statusAreaIconPath = statusAreaIconPath(indicator); |
181 |
181 emit indicatorActivated(IndicatorClientInfo( |
182 if (index >= 0 && !indicatorInfo->activated) { |
182 indicator->indicatorType(), indicatorInfo->statusAreaIconPath, |
183 indicatorInfo->activated = true; |
183 indicator->category(), hasMenuData(*indicator))); |
184 emit indicatorActivated(indicator); |
184 |
185 indicatorInfo->statusAreaIconPath = statusAreaIconPath(indicator); |
185 connect(indicator, SIGNAL(dataChanged()), SLOT(indicatorDataChanged())); |
186 emit indicatorActivated(IndicatorClientInfo( |
186 connect(indicator, SIGNAL(userActivated(QVariantMap)), SLOT(userActivateIndicator(QVariantMap))); |
187 indicator->indicatorType(), indicatorInfo->statusAreaIconPath, |
187 } |
188 indicator->category(), hasMenuData(*indicator))); |
188 success = true; |
189 |
|
190 connect(indicator, SIGNAL(dataChanged()), SLOT(indicatorDataChanged())); |
|
191 connect(indicator, SIGNAL(userActivated(QVariantMap)), SLOT(userActivateIndicator(QVariantMap))); |
|
192 } |
|
193 } |
189 } |
194 } |
190 return success; |
195 return success; |
191 } |
196 } |
192 |
197 |
193 /* |
198 /* |
296 bool success = false; |
301 bool success = false; |
297 IndicatorInfo *info = 0; |
302 IndicatorInfo *info = 0; |
298 int index = findPlugin(indicatorType, &info); |
303 int index = findPlugin(indicatorType, &info); |
299 if (index >= 0 && checkAccess(index, indicatorType, securityCredentials)) { |
304 if (index >= 0 && checkAccess(index, indicatorType, securityCredentials)) { |
300 HbIndicatorInterface *indicator = info->indicator; |
305 HbIndicatorInterface *indicator = info->indicator; |
|
306 success = true; |
301 if (indicator->indicatorType() == indicatorType && info->activated) { |
307 if (indicator->indicatorType() == indicatorType && info->activated) { |
302 indicator->processClientRequest( |
308 try { |
|
309 indicator->processClientRequest( |
303 HbIndicatorInterface::RequestDeactivate, parameter); |
310 HbIndicatorInterface::RequestDeactivate, parameter); |
304 } |
311 } catch (const std::bad_alloc &) { |
305 success = true; |
312 success = false; |
|
313 } |
|
314 } |
306 } |
315 } |
307 TRACE_EXIT |
316 TRACE_EXIT |
308 return success; |
317 return success; |
309 } |
318 } |
310 |
319 |