|
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 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include <hbmessagebox.h> |
|
23 #include <hblabel.h> |
|
24 |
|
25 #include "iaupdateresultsdialog.h" |
|
26 #include "iaupdateresultsinfo.h" |
|
27 #include "iaupdatedebug.h" |
|
28 |
|
29 |
|
30 IAUpdateResultsDialog::IAUpdateResultsDialog(QObject *parent) |
|
31 : QObject(parent) |
|
32 { |
|
33 |
|
34 } |
|
35 |
|
36 IAUpdateResultsDialog::~IAUpdateResultsDialog() |
|
37 { |
|
38 } |
|
39 |
|
40 void IAUpdateResultsDialog::showResults(const TIAUpdateResultsInfo ¶m, QObject *receiver, const char *member) |
|
41 { |
|
42 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
|
43 |
|
44 HbLabel *label = new HbLabel(messageBox); |
|
45 label->setHtml(QString("Update results")); |
|
46 messageBox->setHeadingWidget(label); |
|
47 |
|
48 messageBox->setIconVisible(false); |
|
49 |
|
50 QString buf; |
|
51 constructText(param,buf); |
|
52 messageBox->setText(buf); |
|
53 messageBox->setTimeout(HbPopup::NoTimeout); |
|
54 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
55 messageBox->open(receiver, member); |
|
56 return; |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // IAUpdateResultsDialog::constructText |
|
61 // |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void IAUpdateResultsDialog::constructText(const TIAUpdateResultsInfo ¶m, QString &buf) |
|
65 { |
|
66 if (param.iCountSuccessfull == 0 && param.iCountCancelled == 0 && |
|
67 param.iCountFailed == 0) |
|
68 { |
|
69 QString stringCount; |
|
70 stringCount.setNum(param.iCountSuccessfull); |
|
71 buf.append(stringCount); |
|
72 buf.append(" updates successful"); |
|
73 buf.append("<br />"); |
|
74 return; |
|
75 } |
|
76 |
|
77 if (param.iCountSuccessfull != 0) |
|
78 { |
|
79 QString stringCount; |
|
80 stringCount.setNum(param.iCountSuccessfull); |
|
81 buf.append(stringCount); |
|
82 if (param.iCountSuccessfull == 1) |
|
83 { |
|
84 buf.append(" application updated"); |
|
85 } |
|
86 else |
|
87 { |
|
88 buf.append(" applications updated"); |
|
89 } |
|
90 buf.append("<br />"); |
|
91 } |
|
92 |
|
93 if (param.iCountCancelled != 0) |
|
94 { |
|
95 QString stringCount; |
|
96 stringCount.setNum(param.iCountCancelled); |
|
97 buf.append(stringCount); |
|
98 if (param.iCountCancelled == 1) |
|
99 { |
|
100 buf.append(" update cancelled"); |
|
101 } |
|
102 else |
|
103 { |
|
104 buf.append(" updates cancelled"); |
|
105 } |
|
106 buf.append("<br />"); |
|
107 } |
|
108 |
|
109 if (param.iCountFailed != 0) |
|
110 { |
|
111 QString stringCount; |
|
112 stringCount.setNum(param.iCountFailed); |
|
113 buf.append(stringCount); |
|
114 if (param.iCountFailed == 1) |
|
115 { |
|
116 buf.append(" update failed"); |
|
117 } |
|
118 else |
|
119 { |
|
120 buf.append(" updates failed"); |
|
121 } |
|
122 buf.append("<br />"); |
|
123 } |
|
124 |
|
125 if (param.iFileInUseError) |
|
126 { |
|
127 buf.append("Close all applications and try again."); |
|
128 buf.append("<br />"); |
|
129 } |
|
130 } |
|
131 |
|
132 // End of File |