|
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 <hbaction.h> |
|
23 #include <hbdialog.h> |
|
24 #include <hbtextitem.h> |
|
25 |
|
26 #include "iaupdateresultsdialog.h" |
|
27 #include "iaupdateresultsinfo.h" |
|
28 #include "iaupdatedebug.h" |
|
29 |
|
30 |
|
31 IAUpdateResultsDialog::IAUpdateResultsDialog(QObject *parent) |
|
32 : QObject(parent) |
|
33 { |
|
34 |
|
35 } |
|
36 |
|
37 IAUpdateResultsDialog::~IAUpdateResultsDialog() |
|
38 { |
|
39 } |
|
40 |
|
41 void IAUpdateResultsDialog::showResults(const TIAUpdateResultsInfo ¶m) |
|
42 { |
|
43 QString buf; |
|
44 constructText(param,buf); |
|
45 HbDialog dialog; |
|
46 HbTextItem *text = new HbTextItem(&dialog); |
|
47 text->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
|
48 text->setText(buf); |
|
49 dialog.setContentWidget(text); |
|
50 HbAction *primaryAction = new HbAction("Ok"); |
|
51 dialog.setPrimaryAction(primaryAction); |
|
52 dialog.setTimeout(HbPopup::NoTimeout); |
|
53 dialog.show(); |
|
54 //dialog.exec(); |
|
55 return; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // IAUpdateResultsDialog::constructText |
|
60 // |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void IAUpdateResultsDialog::constructText(const TIAUpdateResultsInfo ¶m, QString &buf) |
|
64 { |
|
65 if (param.iCountSuccessfull == 0 && param.iCountCancelled == 0 && |
|
66 param.iCountFailed == 0) |
|
67 { |
|
68 QString stringCount; |
|
69 stringCount.setNum(param.iCountSuccessfull); |
|
70 buf.append(stringCount); |
|
71 buf.append(" updates successful"); |
|
72 buf.append("\n"); |
|
73 return; |
|
74 } |
|
75 |
|
76 if (param.iCountSuccessfull != 0) |
|
77 { |
|
78 QString stringCount; |
|
79 stringCount.setNum(param.iCountSuccessfull); |
|
80 buf.append(stringCount); |
|
81 if (param.iCountSuccessfull == 1) |
|
82 { |
|
83 buf.append(" application updated"); |
|
84 } |
|
85 else |
|
86 { |
|
87 buf.append(" applications updated"); |
|
88 } |
|
89 buf.append("\n"); |
|
90 } |
|
91 |
|
92 if (param.iCountCancelled != 0) |
|
93 { |
|
94 QString stringCount; |
|
95 stringCount.setNum(param.iCountCancelled); |
|
96 buf.append(stringCount); |
|
97 if (param.iCountCancelled == 1) |
|
98 { |
|
99 buf.append(" update cancelled"); |
|
100 } |
|
101 else |
|
102 { |
|
103 buf.append(" updates cancelled"); |
|
104 } |
|
105 buf.append("\n"); |
|
106 } |
|
107 |
|
108 if (param.iCountFailed != 0) |
|
109 { |
|
110 QString stringCount; |
|
111 stringCount.setNum(param.iCountFailed); |
|
112 buf.append(stringCount); |
|
113 if (param.iCountFailed == 1) |
|
114 { |
|
115 buf.append(" update failed"); |
|
116 } |
|
117 else |
|
118 { |
|
119 buf.append(" updates failed"); |
|
120 } |
|
121 buf.append("\n"); |
|
122 } |
|
123 |
|
124 if (param.iFileInUseError) |
|
125 { |
|
126 buf.append("Close all applications and try again."); |
|
127 buf.append("\n"); |
|
128 } |
|
129 } |
|
130 |
|
131 // End of File |