81 HbAction *action_2 = qobject_cast<HbAction*>(loader.findObject("action_2")); |
93 HbAction *action_2 = qobject_cast<HbAction*>(loader.findObject("action_2")); |
82 |
94 |
83 connect(action, SIGNAL(triggered()), this, SLOT(handleStartUpdate())); |
95 connect(action, SIGNAL(triggered()), this, SLOT(handleStartUpdate())); |
84 connect(action_1, SIGNAL(triggered()), this, SLOT(handleSettings())); |
96 connect(action_1, SIGNAL(triggered()), this, SLOT(handleSettings())); |
85 connect(action_2, SIGNAL(triggered()), this, SLOT(handleDisclaimer())); |
97 connect(action_2, SIGNAL(triggered()), this, SLOT(handleDisclaimer())); |
86 |
98 |
|
99 mContent = qobject_cast< HbWidget*>( loader.findWidget("content") ); |
|
100 |
87 mListView = qobject_cast<HbListWidget*>( loader.findWidget("listWidget") ); |
101 mListView = qobject_cast<HbListWidget*>( loader.findWidget("listWidget") ); |
88 mListView->setSelectionMode( HbAbstractItemView::MultiSelection ); |
102 mListView->setSelectionMode( HbAbstractItemView::MultiSelection ); |
89 |
103 |
90 connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), |
104 connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), |
91 this, SLOT( handleDetails( HbAbstractViewItem *, const QPointF & ) ) ); |
105 this, SLOT( handleDetails( HbAbstractViewItem *, const QPointF & ) ) ); |
92 |
106 |
93 HbListViewItem *prototype = mListView->listItemPrototype(); |
107 HbListViewItem *prototype = mListView->listItemPrototype(); |
94 |
108 |
95 prototype->setGraphicsSize(HbListViewItem::LargeIcon); |
109 prototype->setGraphicsSize(HbListViewItem::LargeIcon); |
96 |
110 |
|
111 HbDockWidget *dock = new HbDockWidget(this); |
|
112 HbWidget *dockContainer = new HbWidget(dock); |
|
113 QGraphicsLinearLayout *dockLayout = new QGraphicsLinearLayout(dockContainer); |
|
114 dockLayout->setOrientation(Qt::Vertical); |
|
115 dockContainer->setLayout(dockLayout); |
|
116 |
|
117 mSelections = new HbGroupBox(dockContainer); |
|
118 mSelections->setHeading("Selected 0/0 (0 kB)"); |
|
119 |
|
120 dockLayout->addItem( mSelections); |
|
121 |
|
122 dockLayout->addItem(toolBar); |
|
123 |
|
124 dock->setWidget(dockContainer); |
|
125 |
|
126 setDockWidget(dock); |
|
127 |
|
128 |
|
129 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::IAUpdateMainView() end"); |
97 } |
130 } |
98 |
131 |
99 IAUpdateMainView::~IAUpdateMainView() |
132 IAUpdateMainView::~IAUpdateMainView() |
100 { |
133 { |
|
134 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::~IAUpdateMainView() begin"); |
|
135 |
|
136 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::~IAUpdateMainView() end"); |
101 } |
137 } |
102 |
138 |
103 // ----------------------------------------------------------------------------- |
139 // ----------------------------------------------------------------------------- |
104 // IAUpdateMainView::refresh |
140 // IAUpdateMainView::refresh |
105 // Refreshes update list |
141 // Refreshes update list |
106 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
107 // |
143 // |
108 void IAUpdateMainView::refresh( const RPointerArray<MIAUpdateNode> &nodes, |
144 void IAUpdateMainView::refresh(const RPointerArray<MIAUpdateNode> &nodes, |
109 const RPointerArray<MIAUpdateFwNode> &fwNodes, |
145 const RPointerArray<MIAUpdateFwNode> &fwNodes, |
110 int /*error*/ ) |
146 int error) |
111 { |
147 { |
112 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh begin"); |
148 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh() begin"); |
113 |
149 removeCurrentContentLayout(); |
114 mAllNodes.Reset(); |
|
115 |
150 |
116 if (fwNodes.Count() > 0) |
151 refreshFirmwareUpdates(fwNodes); |
117 { |
152 |
118 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh hard code importance"); |
153 refreshApplicationUpdates(nodes); |
119 //hardcode the importance of firmware as Critical |
154 |
120 for (int i = 0; i < fwNodes.Count(); i++) |
155 if (nodes.Count() == 0 && fwNodes.Count() == 0 && |
121 { |
156 error != KErrCancel && error != KErrAbort) |
122 fwNodes[i]->Base().SetImportance(MIAUpdateBaseNode::ECritical); |
157 { |
123 } |
158 if (!mContentDataForm) |
124 |
159 { |
125 //either NSU or FOTA available |
160 mContentDataForm = new HbDataForm(mContent); |
126 if (fwNodes.Count() == 1) |
161 } |
127 { |
162 QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout(); |
128 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh either NSU or FOTA available"); |
163 linearLayout->addItem(mContentDataForm); |
129 MIAUpdateAnyNode *node = fwNodes[0]; |
164 QString formText; |
130 mAllNodes.Append(node); |
|
131 } |
|
132 |
165 |
133 //both NSU and FOTA available, show only FOTA node |
166 if (error == KErrNone) |
134 if (fwNodes.Count() == 2) |
167 { |
135 { |
168 formText = QString("Applications are up to date"); |
136 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh both NSU and FOTA available"); |
|
137 MIAUpdateAnyNode *node1 = fwNodes[0]; |
|
138 MIAUpdateFwNode *fwnode = static_cast<MIAUpdateFwNode*>(node1); |
|
139 if (fwnode->FwType() == MIAUpdateFwNode::EFotaDp2) |
|
140 { |
|
141 mAllNodes.Append(node1); |
|
142 } |
|
143 else |
|
144 { |
|
145 MIAUpdateAnyNode* node2 = fwNodes[1]; |
|
146 mAllNodes.Append(node2); |
|
147 } |
|
148 } |
|
149 } |
|
150 |
|
151 |
|
152 for(int i = 0; i < nodes.Count(); ++i) |
|
153 { |
|
154 MIAUpdateAnyNode *node = nodes[i]; |
|
155 mAllNodes.Append(node); |
|
156 } |
|
157 |
|
158 mListView->clear(); |
|
159 QItemSelectionModel *selectionModel = mListView->selectionModel(); |
|
160 selectionModel->clear(); |
|
161 HbIcon icon(QString(":/icons/qgn_menu_swupdate")); |
|
162 |
|
163 for(int j = 0; j < mAllNodes.Count(); ++j) |
|
164 { |
|
165 MIAUpdateAnyNode *node = mAllNodes[j]; |
|
166 |
|
167 QString importanceDescription; |
|
168 MIAUpdateNode::TUIUpdateState uiState = MIAUpdateNode::ENormal; |
|
169 if (node->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal) |
|
170 { |
|
171 MIAUpdateNode *updateNode = static_cast<MIAUpdateNode*>(node); |
|
172 uiState = updateNode->UiState(); |
|
173 } |
|
174 if (uiState == MIAUpdateNode::ENormal) |
|
175 { |
|
176 setImportance(node, importanceDescription); |
|
177 } |
169 } |
178 else |
170 else |
179 { |
171 { |
180 if(uiState == MIAUpdateNode::EUpdated) |
172 formText = QString("Refreshing failed. Try again later."); |
181 { |
173 } |
182 importanceDescription = "Updated"; |
174 mContentDataForm->setDescription(formText); |
183 } |
175 } |
184 else if(uiState == MIAUpdateNode::EFailed) |
176 updateSelectionInfoInDock(); |
185 { |
177 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh() end"); |
186 importanceDescription = "Failed"; |
|
187 } |
|
188 else if(uiState == MIAUpdateNode::EDownloaded) |
|
189 { |
|
190 importanceDescription = "Downloaded"; |
|
191 } |
|
192 } |
|
193 |
|
194 |
|
195 |
|
196 HbListWidgetItem *item = new HbListWidgetItem(); |
|
197 QString name; |
|
198 if (node->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal) |
|
199 { |
|
200 MIAUpdateNode *updateNode = static_cast<MIAUpdateNode*>(node); |
|
201 if (updateNode->UiState() == MIAUpdateNode::EDownloading) |
|
202 { |
|
203 name = QString("Downloading "); |
|
204 } |
|
205 else if (updateNode->UiState() == MIAUpdateNode::EInstalling) |
|
206 { |
|
207 name = QString("Installing "); |
|
208 } |
|
209 } |
|
210 name.append(XQConversions::s60DescToQString(node->Base().Name())); |
|
211 if (node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw) |
|
212 { |
|
213 name.append(" DEVICE SOFTWARE"); |
|
214 } |
|
215 item->setText(name); |
|
216 item->setSecondaryText(importanceDescription); |
|
217 item->setIcon(icon); |
|
218 mListView->addItem(item); |
|
219 |
|
220 if (node->Base().IsSelected()) |
|
221 { |
|
222 int count = mListView->count(); |
|
223 QModelIndex modelIndex = mListView->model()->index(count-1,0); |
|
224 selectionModel->select(modelIndex, QItemSelectionModel::Select); |
|
225 } |
|
226 |
|
227 } |
|
228 connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), |
|
229 this, SLOT(handleSelectionChanged(QItemSelection,QItemSelection))); |
|
230 |
|
231 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh end"); |
|
232 } |
178 } |
233 |
179 |
234 |
180 |
235 |
181 |
236 |
182 |
237 void IAUpdateMainView::handleStartUpdate() |
183 void IAUpdateMainView::handleStartUpdate() |
238 { |
184 { |
239 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() begin"); |
185 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() begin"); |
240 bool firmwareUpdate = false; |
186 mEngine->StartUpdate(fotaSelected()); |
241 RPointerArray<MIAUpdateAnyNode> selectedNodes; |
|
242 getSelectedNodes(selectedNodes); |
|
243 if (selectedNodes.Count() > 0) |
|
244 { |
|
245 if ( selectedNodes[0]->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) |
|
246 { |
|
247 //the marking logic will make sure firmware won't be marked with normal sis updates |
|
248 //at the same time. |
|
249 firmwareUpdate = true; |
|
250 } |
|
251 } |
|
252 selectedNodes.Close(); |
|
253 mEngine->StartUpdate(firmwareUpdate); |
|
254 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() end"); |
187 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() end"); |
255 } |
188 } |
256 |
189 |
257 |
190 |
258 void IAUpdateMainView::handleSettings() |
191 void IAUpdateMainView::handleSettings() |
259 { |
192 { |
|
193 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSettings() begin"); |
260 emit toSettingView(); |
194 emit toSettingView(); |
|
195 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSettings() end"); |
261 } |
196 } |
262 |
197 |
263 void IAUpdateMainView::handleDisclaimer() |
198 void IAUpdateMainView::handleDisclaimer() |
264 { |
199 { |
|
200 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDisclaimer() begin"); |
265 if (!mDialogUtil) |
201 if (!mDialogUtil) |
266 { |
202 { |
267 mDialogUtil = new IAUpdateDialogUtil(this); |
203 mDialogUtil = new IAUpdateDialogUtil(this); |
268 } |
204 } |
269 if (mDialogUtil) |
205 if (mDialogUtil) |
270 { |
206 { |
271 HbAction *primaryAction = new HbAction("OK"); |
207 HbAction *primaryAction = new HbAction("OK"); |
272 mDialogUtil->showAgreement(primaryAction); |
208 mDialogUtil->showAgreement(primaryAction); |
273 } |
209 } |
274 } |
210 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDisclaimer() end"); |
275 |
211 } |
276 void IAUpdateMainView::handleDetails( HbAbstractViewItem * item, const QPointF & ) |
212 |
277 { |
213 void IAUpdateMainView::handleDetails(HbAbstractViewItem * item, const QPointF &) |
278 |
214 { |
279 |
215 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDetails() begin"); |
280 int ind = item->modelIndex().row(); |
216 int ind = item->modelIndex().row(); |
281 if (getNode(ind) != NULL) |
217 if (getApplicationNode(ind) != NULL) |
282 { |
218 { |
283 showDetails(*getNode(ind)); |
219 showDetails(*getApplicationNode(ind)); |
284 } |
220 } |
|
221 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDetails() end"); |
|
222 } |
|
223 |
|
224 void IAUpdateMainView::handleFotaDetails(HbAbstractViewItem *, const QPointF &) |
|
225 { |
|
226 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFotaDetails begin"); |
|
227 //only one FOTA item in a list, just use it |
|
228 for (int i = 0; i < mFwNodes.Count(); i++) |
|
229 { |
|
230 if (mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2) |
|
231 { |
|
232 showDetails(*mFwNodes[i]); |
|
233 } |
|
234 } |
|
235 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFotaDetails end"); |
285 } |
236 } |
286 |
237 |
287 |
238 |
288 void IAUpdateMainView::handleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) |
239 void IAUpdateMainView::handleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) |
289 { |
240 { |
|
241 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSelectionChanged begin"); |
290 if (!mSelectionUpdate) |
242 if (!mSelectionUpdate) |
291 { |
243 { |
292 bool changedItemFound = false; |
244 bool changedItemFound = false; |
293 QModelIndexList indexList = selected.indexes(); |
245 QModelIndexList indexList = selected.indexes(); |
294 for (int i = 0; !changedItemFound && i < indexList.count(); ++i) |
246 for (int i = 0; !changedItemFound && i < indexList.count(); ++i) |
320 if (action == mPrimaryAction) |
299 if (action == mPrimaryAction) |
321 { |
300 { |
322 updateSelectionsToNodeArray(*mNode,mMark); |
301 updateSelectionsToNodeArray(*mNode,mMark); |
323 } |
302 } |
324 updateSelectionsToList(); |
303 updateSelectionsToList(); |
|
304 updateSelectionInfoInDock(); |
325 break; |
305 break; |
326 case CannotOmit: |
306 case CannotOmit: |
327 break; |
307 break; |
328 case Details: |
308 case Details: |
329 break; |
309 break; |
330 default: |
310 default: |
331 break; |
311 break; |
332 } |
312 } |
333 } |
313 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::dialogFinished end"); |
334 |
314 } |
335 |
315 |
336 void IAUpdateMainView::getSelectedNodes(RPointerArray<MIAUpdateAnyNode> &selectedNodes) const |
316 bool IAUpdateMainView::fotaSelected() const |
337 { |
317 { |
338 for (int i = 0; i < mAllNodes.Count(); ++i) |
318 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() begin"); |
339 { |
319 bool selected = false; |
340 if (mAllNodes[i]->Base().IsSelected()) |
320 for (int i = 0; i < mFwNodes.Count() && !selected; ++i) |
341 { |
321 { |
342 selectedNodes.Append(mAllNodes[i]); |
322 if ( mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2 && mFwNodes[i]->Base().IsSelected() ) |
343 } |
323 { |
344 } |
324 selected = true; |
345 } |
325 } |
|
326 } |
|
327 if (selected) |
|
328 { |
|
329 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() Fota item is selected"); |
|
330 } |
|
331 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() end"); |
|
332 return selected; |
|
333 } |
|
334 |
|
335 |
346 |
336 |
347 void IAUpdateMainView::markListItem(bool mark, int index) |
337 void IAUpdateMainView::markListItem(bool mark, int index) |
348 { |
338 { |
|
339 IAUPDATE_TRACE_2("[IAUPDATE] IAUpdateMainView::markListItem() begin mark: %d index %d", mark, index); |
349 if (mark) |
340 if (mark) |
350 { |
341 { |
351 //It's Mark Command |
342 //It's Mark Command |
352 RPointerArray<MIAUpdateAnyNode> selectedNodes; |
343 if (fotaSelected()) |
353 getSelectedNodes(selectedNodes); |
344 { |
|
345 //FOTA item is selected, unmark FOTA item |
|
346 //FOTA item and application update items can't be selected at the same time |
|
347 markFotaItem(false); |
|
348 } |
|
349 } |
|
350 |
|
351 bool accepted = false; |
354 |
352 |
355 //There are selected items already and type are different with the current one |
353 if(index > -1) |
356 if (selectedNodes.Count() > 0 && (mAllNodes[index]->NodeType() != selectedNodes[0]->NodeType())) |
354 { |
357 { |
355 accepted = true; |
358 // firmware item and normal sis items can't be selected at the same time |
356 MIAUpdateNode* node = mNodes[index]; |
359 // unmark the selected nodes. |
357 RPointerArray<MIAUpdateNode> mands; |
360 for (int i = 0; i < selectedNodes.Count(); i++) |
358 RPointerArray<MIAUpdateNode> deps; |
361 { |
|
362 int index = mAllNodes.Find(selectedNodes[i]); |
|
363 mAllNodes[index]->Base().SetSelected(false); |
|
364 } |
|
365 } |
|
366 selectedNodes.Close(); |
|
367 } |
|
368 |
|
369 //there is no selected items or the type is the same with the current one |
|
370 |
|
371 if (mAllNodes[index]->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) |
|
372 { |
|
373 mAllNodes[index]->Base().SetSelected(mark); |
|
374 updateSelectionsToList(); |
|
375 return; |
|
376 } |
|
377 |
|
378 if (mAllNodes[index]->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal ) |
|
379 { |
|
380 bool accepted = false; |
|
381 |
|
382 if(index > -1) |
|
383 { |
|
384 accepted = true; |
|
385 |
|
386 MIAUpdateNode* node = static_cast<MIAUpdateNode*>(mAllNodes[index]); |
|
387 RPointerArray<MIAUpdateAnyNode> mands; |
|
388 RPointerArray<MIAUpdateNode> deps; |
|
389 |
359 |
|
360 if (mark) |
|
361 { |
|
362 TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*node, mNodes, deps)); |
|
363 if (err != KErrNone) |
|
364 { |
|
365 deps.Close(); |
|
366 updateSelectionsToList(); |
|
367 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end"); |
|
368 return; |
|
369 } |
|
370 if (!getMandatoryNodes(mands)) |
|
371 { |
|
372 // error when creating mandatory node list |
|
373 mands.Close(); |
|
374 updateSelectionsToList(); |
|
375 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end"); |
|
376 return; |
|
377 } |
|
378 } |
|
379 else |
|
380 { |
|
381 //mandatory item is not allowed to be unmarked |
|
382 if (mNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
|
383 { |
|
384 //show dialog |
|
385 showUpdateCannotOmitDialog(); |
|
386 updateSelectionsToList(); |
|
387 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end"); |
|
388 return; |
|
389 } |
|
390 TRAPD(err,IAUpdateDepUtils::GetDependantsL(*node, mNodes, deps)); |
|
391 if (err != KErrNone) |
|
392 { |
|
393 deps.Close(); |
|
394 updateSelectionsToList(); |
|
395 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end"); |
|
396 return; |
|
397 } |
|
398 // item is not allowed to be unmarked if its dependant is mandatory |
|
399 bool mandatoryDependantFound = false; |
|
400 for(int i = 0; i < deps.Count() && !mandatoryDependantFound; i++) |
|
401 { |
|
402 if (deps[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
|
403 { |
|
404 mandatoryDependantFound = true; |
|
405 } |
|
406 } |
|
407 if (mandatoryDependantFound) |
|
408 { |
|
409 showUpdateCannotOmitDialog(); |
|
410 deps.Close(); |
|
411 updateSelectionsToList(); |
|
412 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end"); |
|
413 return; |
|
414 } |
|
415 } |
|
416 |
|
417 int depCount = deps.Count(); |
|
418 |
|
419 if (depCount > 0) |
|
420 { |
|
421 QString text; |
|
422 QString names; |
|
423 MIAUpdateNode* depNode = NULL; |
|
424 QString separator(","); |
|
425 |
|
426 for(int i = 0; i < depCount; i++) |
|
427 { |
|
428 depNode = deps[i]; |
|
429 if (i > 0) |
|
430 { |
|
431 names.append(separator); |
|
432 names.append(QString(" ")); |
|
433 } |
|
434 names.append(XQConversions::s60DescToQString(depNode->Base().Name())); |
|
435 } |
|
436 |
390 if (mark) |
437 if (mark) |
391 { |
438 { |
392 TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*node, mAllNodes, deps)); |
439 if (depCount > 1) |
393 if (err != KErrNone) |
|
394 { |
440 { |
395 deps.Close(); |
441 text.append("This update needs also updates "); |
396 updateSelectionsToList(); |
442 text.append(names); |
397 return; |
443 text.append(" for working"); |
398 } |
444 } |
399 if (!getMandatoryNodes(mands)) |
445 else |
400 { |
446 { |
401 // error when creating mandatory node list |
447 text.append("This update needs also \""); |
402 mands.Close(); |
448 text.append(names); |
403 updateSelectionsToList(); |
449 text.append("\" for working"); |
404 return; |
|
405 } |
|
406 } |
|
407 else |
|
408 { |
|
409 //mandatory item is not allowed to be unmarked |
|
410 if (mAllNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
|
411 { |
|
412 //show dialog |
|
413 showUpdateCannotOmitDialog(); |
|
414 updateSelectionsToList(); |
|
415 return; |
|
416 } |
|
417 |
|
418 //CleanupClosePushL( deps ); |
|
419 TRAPD(err,IAUpdateDepUtils::GetDependantsL(*node, mAllNodes, deps)); |
|
420 if (err != KErrNone) |
|
421 { |
|
422 deps.Close(); |
|
423 updateSelectionsToList(); |
|
424 return; |
|
425 } |
|
426 // item is not allowed to be unmarked if its dependant is mandatory |
|
427 bool mandatoryDependantFound = false; |
|
428 for(int i = 0; i < deps.Count() && !mandatoryDependantFound; i++) |
|
429 { |
|
430 if (deps[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
|
431 { |
|
432 mandatoryDependantFound = true; |
|
433 } |
450 } |
434 } |
451 } |
435 if (mandatoryDependantFound) |
452 else |
|
453 { |
|
454 if (depCount > 1) |
436 { |
455 { |
437 showUpdateCannotOmitDialog(); |
456 text.append("Updates "); |
438 deps.Close(); |
457 text.append(names); |
439 updateSelectionsToList(); |
458 text.append(" need this update for working"); |
440 return; |
459 } |
441 } |
|
442 } |
|
443 |
|
444 int depCount = deps.Count(); |
|
445 |
|
446 if (depCount > 0) |
|
447 { |
|
448 QString text; |
|
449 QString names; |
|
450 MIAUpdateNode* depNode = NULL; |
|
451 QString separator(","); |
|
452 |
|
453 for(int i = 0; i < depCount; i++) |
|
454 { |
|
455 depNode = deps[i]; |
|
456 if (i > 0) |
|
457 { |
|
458 names.append(separator); |
|
459 names.append(QString(" ")); |
|
460 } |
|
461 names.append(XQConversions::s60DescToQString(depNode->Base().Name())); |
|
462 } |
|
463 |
|
464 |
|
465 if (mark) |
|
466 { |
|
467 if (depCount > 1) |
|
468 { |
|
469 text.append("This update needs also updates "); |
|
470 text.append(names); |
|
471 text.append(" for working"); |
|
472 //resourceId = R_IAUPDATE_DEPENDENCY_MARK_MANY; |
|
473 } |
|
474 else |
|
475 { |
|
476 text.append("This update needs also \""); |
|
477 text.append(names); |
|
478 text.append("\" for working"); |
|
479 //resourceId = R_IAUPDATE_DEPENDENCY_MARK_ONE; |
|
480 } |
|
481 } |
|
482 else |
460 else |
483 { |
461 { |
484 if (depCount > 1) |
462 text.append("Update \""); |
485 { |
463 text.append(names); |
486 text.append("Updates "); |
464 text.append("\" needs this update for working"); |
487 text.append(names); |
465 } |
488 text.append(" need this update for working"); |
466 } |
489 //resourceId = R_IAUPDATE_DEPENDENCY_UNMARK_MANY; |
|
490 } |
|
491 else |
|
492 { |
|
493 text.append("Update \""); |
|
494 text.append(names); |
|
495 text.append("\" needs this update for working"); |
|
496 //resourceId = R_IAUPDATE_DEPENDENCY_UNMARK_ONE; |
|
497 } |
|
498 } |
|
499 |
467 |
500 if (mark && mAllNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
468 if (mark && mNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
501 { |
469 { |
502 // depencencies of mandatory update are also selected without showing dialog |
470 // depencencies of mandatory update are also selected without showing dialog |
503 accepted = true; |
471 accepted = true; |
504 } |
472 } |
505 else |
473 else |
506 { |
474 { |
507 mNode = node; |
475 mNode = node; |
508 mMark = mark; |
476 mMark = mark; |
509 showDependenciesFoundDialog(text); |
477 accepted = false; |
510 return; |
478 showDependenciesFoundDialog(text); |
511 } |
479 } |
512 } |
480 } |
513 if (accepted) |
481 if (accepted) |
514 { |
482 { |
515 updateSelectionsToNodeArray(*node, mark); |
483 updateSelectionsToNodeArray(*node, mark); |
516 } |
484 } |
517 } |
485 } |
518 |
486 if (accepted) |
519 } |
487 { |
520 updateSelectionsToList(); |
488 updateSelectionsToList(); |
|
489 updateSelectionInfoInDock(); |
|
490 } |
|
491 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() end"); |
521 } |
492 } |
522 |
493 |
|
494 |
|
495 void IAUpdateMainView::markFotaItem(bool mark) |
|
496 { |
|
497 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateMainView::markFotaItem() begin mark: %d", mark); |
|
498 if (mark) |
|
499 { |
|
500 //It's Mark Command |
|
501 |
|
502 //if some of application update item(s) are selected, unmark them |
|
503 //FOTA item and application update items can't be selected at the same time |
|
504 bool deselected = false; |
|
505 for (int i = 0; i < mNodes.Count(); ++i) |
|
506 { |
|
507 if (mNodes[i]->Base().IsSelected()) |
|
508 { |
|
509 mNodes[i]->Base().SetSelected(false); |
|
510 } |
|
511 } |
|
512 if (deselected) |
|
513 { |
|
514 // umnmarked items to be updated also to UI |
|
515 updateSelectionsToList(); |
|
516 } |
|
517 } |
|
518 for (int j = 0; j < mFwNodes.Count(); ++j) |
|
519 { |
|
520 if (mFwNodes[j]->FwType() == MIAUpdateFwNode::EFotaDp2) |
|
521 { |
|
522 mFwNodes[j]->Base().SetSelected(mark); |
|
523 if (mark) |
|
524 { |
|
525 mFwListView->selectionModel()->select(mFwListView->model()->index(0,0),QItemSelectionModel::Select); |
|
526 } |
|
527 else |
|
528 { |
|
529 mFwListView->selectionModel()->select(mFwListView->model()->index(0,0),QItemSelectionModel::Deselect); |
|
530 } |
|
531 } |
|
532 } |
|
533 updateSelectionInfoInDock(); |
|
534 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markFotaItem() end"); |
|
535 } |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
523 void IAUpdateMainView::updateSelectionsToNodeArray(MIAUpdateNode &node, bool mark) |
541 void IAUpdateMainView::updateSelectionsToNodeArray(MIAUpdateNode &node, bool mark) |
524 { |
542 { |
|
543 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToNodeArray() begin"); |
525 RPointerArray<MIAUpdateNode> deps; |
544 RPointerArray<MIAUpdateNode> deps; |
526 TInt err = KErrNone; |
545 TInt err = KErrNone; |
527 if (mark) |
546 if (mark) |
528 { |
547 { |
529 TRAP(err,IAUpdateDepUtils::GetDependenciesL(node, mAllNodes, deps)); |
548 TRAP(err,IAUpdateDepUtils::GetDependenciesL(node, mNodes, deps)); |
530 } |
549 } |
531 else |
550 else |
532 { |
551 { |
533 TRAP(err,IAUpdateDepUtils::GetDependantsL(node, mAllNodes, deps)); |
552 TRAP(err,IAUpdateDepUtils::GetDependantsL(node, mNodes, deps)); |
534 } |
553 } |
535 if (err == KErrNone ) |
554 if (err == KErrNone ) |
536 { |
555 { |
537 int depCount = deps.Count(); |
556 int depCount = deps.Count(); |
538 for(int i = 0; i < depCount; i++) |
557 for(int i = 0; i < depCount; i++) |
539 { |
558 { |
540 int depNodeInd = mAllNodes.Find(deps[i]); |
559 int depNodeInd = mNodes.Find(deps[i]); |
541 mAllNodes[depNodeInd]->Base().SetSelected(mark); |
560 mNodes[depNodeInd]->Base().SetSelected(mark); |
542 } |
561 } |
543 deps.Close(); |
562 deps.Close(); |
544 int nodeInd = mAllNodes.Find(&node); |
563 int nodeInd = mNodes.Find(&node); |
545 mAllNodes[nodeInd]->Base().SetSelected(mark); |
564 mNodes[nodeInd]->Base().SetSelected(mark); |
546 } |
565 } |
547 |
566 |
548 //mark all of the mandatory items |
567 //mark all of the mandatory items |
549 if ( mark ) |
568 if ( mark ) |
550 { |
569 { |
551 RPointerArray<MIAUpdateAnyNode> mands; |
570 RPointerArray<MIAUpdateNode> mands; |
552 if (getMandatoryNodes(mands)) |
571 if (getMandatoryNodes(mands)) |
553 { |
572 { |
554 int mandCount = mands.Count(); |
573 int mandCount = mands.Count(); |
555 if (mandCount > 0) |
574 if (mandCount > 0) |
556 { |
575 { |
557 for(int i = 0; i < mandCount; i++) |
576 for(int i = 0; i < mandCount; i++) |
558 { |
577 { |
559 int mandNodeInd = mAllNodes.Find(mands[i]); |
578 int mandNodeInd = mNodes.Find(mands[i]); |
560 mAllNodes[mandNodeInd]->Base().SetSelected(mark); |
579 mNodes[mandNodeInd]->Base().SetSelected(mark); |
561 if (mAllNodes[mandNodeInd]->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal) |
580 if (mNodes[mandNodeInd]->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal) |
562 { |
581 { |
563 // mark also all dependencies of a mandatory item |
582 // mark also all dependencies of a mandatory item |
564 MIAUpdateNode* dependencyNode = static_cast<MIAUpdateNode*>(mAllNodes[mandNodeInd]); |
583 MIAUpdateNode* dependencyNode = mNodes[mandNodeInd]; |
565 RPointerArray<MIAUpdateNode> dependencies; |
584 RPointerArray<MIAUpdateNode> dependencies; |
566 TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*dependencyNode, mAllNodes, dependencies)); |
585 TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*dependencyNode, mNodes, dependencies)); |
567 if (err) |
586 if (err) |
568 { |
587 { |
569 dependencies.Close(); |
588 dependencies.Close(); |
570 mands.Close(); |
589 mands.Close(); |
571 return; |
590 return; |
572 } |
591 } |
573 for(int j = 0; j < dependencies.Count(); j++) |
592 for(int j = 0; j < dependencies.Count(); j++) |
574 { |
593 { |
575 int depNodeInd = mAllNodes.Find(dependencies[j]); |
594 int depNodeInd = mNodes.Find(dependencies[j]); |
576 mAllNodes[depNodeInd]->Base().SetSelected(true); |
595 mNodes[depNodeInd]->Base().SetSelected(true); |
577 } |
596 } |
578 dependencies.Close(); |
597 dependencies.Close(); |
579 } |
598 } |
580 } |
599 } |
581 } |
600 } |
582 } |
601 } |
583 mands.Close(); |
602 mands.Close(); |
584 } |
603 } |
585 } |
604 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToNodeArray() end"); |
586 |
605 } |
587 |
606 |
588 bool IAUpdateMainView::getMandatoryNodes(RPointerArray<MIAUpdateAnyNode> &mandNodes) const |
607 |
589 { |
608 bool IAUpdateMainView::getMandatoryNodes(RPointerArray<MIAUpdateNode> &mandNodes) const |
|
609 { |
|
610 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::getMandatoryNodes() begin"); |
590 bool ret = true; |
611 bool ret = true; |
591 for(int i = 0; i < mAllNodes.Count(); ++i) |
612 for(int i = 0; i < mNodes.Count(); ++i) |
592 { |
613 { |
593 if (mAllNodes[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
614 if (mNodes[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory) |
594 { |
615 { |
595 if (mandNodes.Append(mAllNodes[i]) != KErrNone) |
616 if (mandNodes.Append(mNodes[i]) != KErrNone) |
596 { |
617 { |
597 ret = false; |
618 ret = false; |
598 } |
619 } |
599 } |
620 } |
600 } |
621 } |
|
622 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::getMandatoryNodes() end"); |
601 return ret; |
623 return ret; |
602 } |
624 } |
603 |
625 |
604 void IAUpdateMainView::showUpdateCannotOmitDialog() |
626 void IAUpdateMainView::showUpdateCannotOmitDialog() |
605 { |
627 { |
|
628 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showUpdateCannotOmitDialog() begin"); |
606 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
629 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
607 messageBox->setText(QString("This required update cannot be omitted")); |
630 messageBox->setText(QString("This required update cannot be omitted")); |
608 int actionCount = messageBox->actions().count(); |
631 int actionCount = messageBox->actions().count(); |
609 for (int i=actionCount-1; i >= 0; i--) |
632 for (int i=actionCount-1; i >= 0; i--) |
610 { |
633 { |
913 default: |
951 default: |
914 { |
952 { |
915 break; |
953 break; |
916 } |
954 } |
917 } |
955 } |
|
956 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::setImportance() end"); |
918 } |
957 } |
919 |
958 |
|
959 void IAUpdateMainView::removeCurrentContentLayout() |
|
960 { |
|
961 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::removeCurrentContentLayout() begin"); |
|
962 int itemCount = mContent->layout()->count(); |
|
963 for (int i = 0; i < itemCount; i++) |
|
964 { |
|
965 mContent->layout()->removeAt(i); |
|
966 } |
|
967 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::removeCurrentContentLayout() end"); |
|
968 } |
|
969 |
|
970 void IAUpdateMainView::refreshFirmwareUpdates(const RPointerArray<MIAUpdateFwNode> &fwNodes) |
|
971 { |
|
972 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFirmwareUpdates() begin"); |
|
973 mFwNodes.Reset(); |
|
974 |
|
975 for (int i = 0; i < fwNodes.Count(); i++) |
|
976 { |
|
977 MIAUpdateFwNode *fwnode = (fwNodes[i]); |
|
978 mFwNodes.Append(fwnode); |
|
979 fwnode->Base().SetImportance(MIAUpdateBaseNode::ECritical); |
|
980 if (fwnode->FwType() == MIAUpdateFwNode::EFotaDp2) |
|
981 { |
|
982 refreshFotaUpdate(*fwnode ); |
|
983 } |
|
984 else if (fwNodes.Count() == 1 && fwnode->FwType() == MIAUpdateFwNode::EFotiNsu) |
|
985 { |
|
986 refreshNsuUpdate(); |
|
987 } |
|
988 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFirmwareUpdates() end"); |
|
989 } |
|
990 } |
|
991 |
|
992 void IAUpdateMainView::refreshFotaUpdate(MIAUpdateFwNode& fwNode) |
|
993 { |
|
994 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFotaUpdate() begin"); |
|
995 if (!mFwListView) |
|
996 { |
|
997 mFwListView = new HbListWidget(mContent); |
|
998 mFwListView->setSelectionMode( HbAbstractItemView::MultiSelection ); |
|
999 connect( mFwListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), |
|
1000 this, SLOT( handleFotaDetails( HbAbstractViewItem *, const QPointF & ) ) ); |
|
1001 mFwListView->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon); |
|
1002 mFwListView->listItemPrototype()->setStretchingStyle(HbListViewItem::NoStretching); |
|
1003 connect(mFwListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), |
|
1004 this, SLOT(handleFwSelectionChanged(QItemSelection,QItemSelection))); |
|
1005 } |
|
1006 QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout(); |
|
1007 linearLayout->addItem(mFwListView); |
|
1008 mFwListView->clear(); |
|
1009 QItemSelectionModel *selectionModel = mFwListView->selectionModel(); |
|
1010 selectionModel->clear(); |
|
1011 HbListWidgetItem *fwItem = new HbListWidgetItem(); |
|
1012 QString name(XQConversions::s60DescToQString(fwNode.Base().Name())); |
|
1013 name.append(" DEVICE SOFTWARE"); |
|
1014 fwItem->setText(name); |
|
1015 QString importanceDescription; |
|
1016 setImportance(&fwNode, importanceDescription); |
|
1017 fwItem->setSecondaryText(importanceDescription); |
|
1018 HbIcon icon(QString(":/icons/qgn_menu_swupdate")); |
|
1019 fwItem->setIcon(icon); |
|
1020 if (fwNode.Base().IsSelected()) |
|
1021 { |
|
1022 QModelIndex modelIndex = mFwListView->model()->index(0,0); |
|
1023 selectionModel->select(modelIndex, QItemSelectionModel::Select); |
|
1024 } |
|
1025 mFwListView->addItem(fwItem); |
|
1026 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFotaUpdate() end"); |
|
1027 } |
|
1028 |
|
1029 void IAUpdateMainView::refreshNsuUpdate() |
|
1030 { |
|
1031 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshNsuUpdate() begin"); |
|
1032 if (!mFwNSUGroupBox) |
|
1033 { |
|
1034 mFwNSUGroupBox = new HbGroupBox(mContent); |
|
1035 mFwNSUGroupBox->setHeading("Device software available"); |
|
1036 HbDataForm *dataForm = new HbDataForm(mFwNSUGroupBox); |
|
1037 mFwNSUGroupBox->setContentWidget(dataForm); |
|
1038 dataForm->setDescription("Use your PC to update the device software ([version %L]) from address www.nokia.com/softwareupdate"); |
|
1039 } |
|
1040 QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout(); |
|
1041 linearLayout->addItem(mFwNSUGroupBox); |
|
1042 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshNsuUpdate() end"); |
|
1043 } |
|
1044 |
|
1045 void IAUpdateMainView::refreshApplicationUpdates(const RPointerArray<MIAUpdateNode> &nodes) |
|
1046 { |
|
1047 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshApplicationUpdates() begin"); |
|
1048 if (nodes.Count() > 0) |
|
1049 { |
|
1050 if (!mApplicationUpdatesGroupBox) |
|
1051 { |
|
1052 mApplicationUpdatesGroupBox = new HbGroupBox(mContent); |
|
1053 mApplicationUpdatesGroupBox->setHeading("Application updates"); |
|
1054 } |
|
1055 QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout(); |
|
1056 linearLayout->addItem(mApplicationUpdatesGroupBox); |
|
1057 linearLayout->addItem(mListView); |
|
1058 } |
|
1059 mListView->clear(); |
|
1060 QItemSelectionModel *selectionModel = mListView->selectionModel(); |
|
1061 selectionModel->clear(); |
|
1062 HbIcon icon(QString(":/icons/qgn_menu_swupdate")); |
|
1063 mNodes.Reset(); |
|
1064 for(int i = 0; i < nodes.Count(); ++i) |
|
1065 { |
|
1066 MIAUpdateNode *node = nodes[i]; |
|
1067 mNodes.Append(node); |
|
1068 QString importanceDescription; |
|
1069 MIAUpdateNode::TUIUpdateState uiState = node->UiState(); |
|
1070 if (uiState == MIAUpdateNode::ENormal) |
|
1071 { |
|
1072 setImportance(node, importanceDescription); |
|
1073 } |
|
1074 else if (uiState == MIAUpdateNode::EUpdated) |
|
1075 { |
|
1076 importanceDescription = "Updated"; |
|
1077 } |
|
1078 else if (uiState == MIAUpdateNode::EFailed) |
|
1079 { |
|
1080 importanceDescription = "Failed"; |
|
1081 } |
|
1082 else if (uiState == MIAUpdateNode::EDownloaded) |
|
1083 { |
|
1084 importanceDescription = "Downloaded"; |
|
1085 } |
|
1086 HbListWidgetItem *item = new HbListWidgetItem(); |
|
1087 QString name; |
|
1088 if (uiState == MIAUpdateNode::EDownloading) |
|
1089 { |
|
1090 name = QString("Downloading "); |
|
1091 } |
|
1092 else if (uiState == MIAUpdateNode::EInstalling) |
|
1093 { |
|
1094 name = QString("Installing "); |
|
1095 } |
|
1096 name.append(XQConversions::s60DescToQString(node->Base().Name())); |
|
1097 item->setText(name); |
|
1098 item->setSecondaryText(importanceDescription); |
|
1099 item->setIcon(icon); |
|
1100 mListView->addItem(item); |
|
1101 |
|
1102 if (node->Base().IsSelected()) |
|
1103 { |
|
1104 int count = mListView->count(); |
|
1105 QModelIndex modelIndex = mListView->model()->index(count-1,0); |
|
1106 selectionModel->select(modelIndex, QItemSelectionModel::Select); |
|
1107 } |
|
1108 } |
|
1109 if (!mSelectionConnect) |
|
1110 { |
|
1111 mSelectionConnect = connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), |
|
1112 this, SLOT(handleSelectionChanged(QItemSelection,QItemSelection))); |
|
1113 } |
|
1114 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshApplicationUpdates() end"); |
|
1115 } |
|
1116 |
|
1117 void IAUpdateMainView::updateSelectionInfoInDock() |
|
1118 { |
|
1119 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionInfoInDock() begin"); |
|
1120 int countOfSelectedItems = 0; |
|
1121 int countOfAllItems = 0; |
|
1122 int selectedSizeInBytes = 0; |
|
1123 for (int i = 0; i < mFwNodes.Count(); ++i) |
|
1124 { |
|
1125 if (mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2) |
|
1126 { |
|
1127 countOfAllItems++; |
|
1128 if (mFwNodes[i]->Base().IsSelected()) |
|
1129 { |
|
1130 countOfSelectedItems++; |
|
1131 selectedSizeInBytes += mFwNodes[i]->Base().ContentSizeL(); |
|
1132 } |
|
1133 } |
|
1134 } |
|
1135 countOfAllItems += mNodes.Count(); |
|
1136 for (int j = 0; j < mNodes.Count(); ++j) |
|
1137 { |
|
1138 if (mNodes[j]->Base().IsSelected()) |
|
1139 { |
|
1140 countOfSelectedItems++; |
|
1141 selectedSizeInBytes += mNodes[j]->Base().ContentSizeL(); |
|
1142 } |
|
1143 } |
|
1144 |
|
1145 int selectedSize = 0; |
|
1146 QString unit; |
|
1147 if (selectedSizeInBytes >= KMaxShownInKiloBytes) |
|
1148 { |
|
1149 unit = "MB"; |
|
1150 selectedSize = selectedSizeInBytes / KMegaByte; |
|
1151 if (selectedSizeInBytes % KMegaByte != 0) |
|
1152 { |
|
1153 selectedSize++; |
|
1154 } |
|
1155 } |
|
1156 else |
|
1157 { |
|
1158 unit = "kB"; |
|
1159 selectedSize = selectedSizeInBytes / KKiloByte; |
|
1160 if (selectedSizeInBytes % KKiloByte != 0) |
|
1161 { |
|
1162 selectedSize++; |
|
1163 } |
|
1164 } |
|
1165 QString selectionString; |
|
1166 selectionString.append("Selected "); |
|
1167 QString numText; |
|
1168 numText.setNum(countOfSelectedItems); |
|
1169 selectionString.append(numText); |
|
1170 selectionString.append("/"); |
|
1171 numText.setNum(countOfAllItems); |
|
1172 selectionString.append(numText); |
|
1173 if (selectedSize > 0) |
|
1174 { |
|
1175 selectionString.append(" ("); |
|
1176 numText.setNum(selectedSize); |
|
1177 selectionString.append(numText); |
|
1178 selectionString.append(" "); |
|
1179 selectionString.append(unit); |
|
1180 selectionString.append(")"); |
|
1181 } |
|
1182 mSelections->setHeading(selectionString); |
|
1183 IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionInfoInDock() end"); |
|
1184 } |