equal
deleted
inserted
replaced
156 { |
156 { |
157 for (int i = 0; i < mIndicatorList->model()->rowCount(); ++i) { |
157 for (int i = 0; i < mIndicatorList->model()->rowCount(); ++i) { |
158 HbIndicatorInterface *indicator = |
158 HbIndicatorInterface *indicator = |
159 indicatorFromIndex(indicatorModel.item(i)->index()); |
159 indicatorFromIndex(indicatorModel.item(i)->index()); |
160 if (indicator) { |
160 if (indicator) { |
161 if (indicator->refreshData()) { |
161 bool refreshed = true; |
|
162 try { |
|
163 refreshed = indicator->refreshData(); |
|
164 } catch (const std::bad_alloc &) { |
|
165 refreshed = false; |
|
166 } |
|
167 if (refreshed) { |
162 setData(indicator, indicatorModel.item(i)->index()); |
168 setData(indicator, indicatorModel.item(i)->index()); |
163 } |
169 } |
164 } |
170 } |
165 } |
171 } |
166 } |
172 } |
173 void HbIndicatorMenuContent::itemActivated(const QModelIndex &modelIndex) |
179 void HbIndicatorMenuContent::itemActivated(const QModelIndex &modelIndex) |
174 { |
180 { |
175 HbIndicatorInterface *indicator = indicatorFromIndex(modelIndex); |
181 HbIndicatorInterface *indicator = indicatorFromIndex(modelIndex); |
176 if (indicator && indicator->interactionTypes().testFlag( |
182 if (indicator && indicator->interactionTypes().testFlag( |
177 HbIndicatorInterface::InteractionActivated)) { |
183 HbIndicatorInterface::InteractionActivated)) { |
178 indicator->handleInteraction(HbIndicatorInterface::InteractionActivated); |
184 try { |
|
185 indicator->handleInteraction(HbIndicatorInterface::InteractionActivated); |
|
186 } catch (const std::bad_alloc &) { |
|
187 } |
179 emit aboutToClose(); |
188 emit aboutToClose(); |
180 } |
189 } |
181 } |
190 } |
182 |
191 |
183 void HbIndicatorMenuContent::indicatorsActivated( |
192 void HbIndicatorMenuContent::indicatorsActivated( |
227 HbIndicatorInterface::SecondaryTextRole).toString(); |
236 HbIndicatorInterface::SecondaryTextRole).toString(); |
228 QString iconPath = source->indicatorData( |
237 QString iconPath = source->indicatorData( |
229 HbIndicatorInterface::DecorationNameRole).toString(); |
238 HbIndicatorInterface::DecorationNameRole).toString(); |
230 |
239 |
231 QStringList texts; |
240 QStringList texts; |
|
241 |
|
242 // List doesn't allow empty text |
|
243 static const char empty[] = " "; |
|
244 if (primaryText.isEmpty()) { |
|
245 primaryText.append(empty); |
|
246 } |
|
247 // Always reserve space for secondary text. Item size should be uniform. |
232 if (secondaryText.isEmpty()) { |
248 if (secondaryText.isEmpty()) { |
233 secondaryText = ' '; //always reserve space for secondary text. Item size should be uniform. |
249 secondaryText.append(empty); |
234 } |
250 } |
235 texts << primaryText << secondaryText; |
251 texts << primaryText << secondaryText; |
236 |
252 |
237 indicatorModel.setData(modelIndex, texts, Qt::DisplayRole); |
253 indicatorModel.setData(modelIndex, texts, Qt::DisplayRole); |
238 if (!iconPath.isEmpty()) { |
254 if (!iconPath.isEmpty()) { |