1 /* |
|
2 * Copyright (c) 2009 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 // CLASS HEADER |
|
19 #include "customdatasynchconfigvalidator.h" |
|
20 |
|
21 // INTERNAL INCLUDES |
|
22 #include "customdatasynchconfigvalidatorenginewrapper.h" |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <qmessagebox.h> |
|
26 #include <qgraphicseffect.h> |
|
27 #include <qlabel.h> |
|
28 |
|
29 const int TESTNAMECOLUMN = 0; |
|
30 const int RESULTCOLUMN = 1; |
|
31 const int MOREINFOCOLUMN = 2; |
|
32 const QString MOREINFO_SYMBOL = "!"; |
|
33 const QString MOREINFO_VERIFY_BY_USER_SYMBOL = "?"; |
|
34 const QString NOK_SYMBOL = "NOK"; |
|
35 const QString OK_SYMBOL = "OK"; |
|
36 |
|
37 // ---------------------------------------------------------------------------- |
|
38 void CustomDataSynchConfigValidator::Initialize() |
|
39 { |
|
40 //TODO: cleanup QTableWidgetItem settings and harmonize layout for columns |
|
41 QFont font; |
|
42 font.setPointSize(4); |
|
43 ui.buttonTestActivator->setFont(font); |
|
44 for (int r = 0; r < ui.tableWidget->rowCount(); r++) { |
|
45 for (int c = 0; c < ui.tableWidget->columnCount(); c++) { |
|
46 ui.tableWidget->item(r, c)->setFlags(ui.tableWidget->item(r, c)->flags() |
|
47 & ~Qt::ItemIsEditable); |
|
48 ui.tableWidget->item(r, c)->setFont(font); |
|
49 } |
|
50 } |
|
51 //Split columns widths for first time |
|
52 const int descriptionColumnInitialWidth = 260; |
|
53 ui.tableWidget->setColumnWidth(TESTNAMECOLUMN, descriptionColumnInitialWidth); |
|
54 ui.tableWidget->resizeColumnToContents(RESULTCOLUMN); |
|
55 ui.tableWidget->resizeColumnToContents(MOREINFOCOLUMN); |
|
56 } |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 CustomDataSynchConfigValidator::CustomDataSynchConfigValidator(QWidget *parent) : |
|
60 QMainWindow(parent) |
|
61 { |
|
62 ui.setupUi(this); |
|
63 Initialize(); |
|
64 |
|
65 mEngineWrapper = new CustomDataSynchConfigValidatorEngineWrapper(this); |
|
66 |
|
67 bool connectSucceeded; |
|
68 connectSucceeded = QObject::connect(ui.buttonTestActivator, SIGNAL(clicked()), this, |
|
69 SLOT(activateValidation())); |
|
70 connectSucceeded = QObject::connect(ui.tableWidget, SIGNAL(itemClicked(QTableWidgetItem *)), |
|
71 this, SLOT(handleMoreInfoItemsClicks(QTableWidgetItem *))); |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 void CustomDataSynchConfigValidator::resizeEvent(QResizeEvent* event) |
|
76 { |
|
77 //TODO: in basic QT how to detect landscape vs portrait |
|
78 if (ui.tableWidget && ui.tableWidget->isVisible()) { |
|
79 ui.tableWidget->resizeColumnToContents(RESULTCOLUMN);//result column |
|
80 ui.tableWidget->resizeColumnToContents(MOREINFOCOLUMN);//info column |
|
81 } |
|
82 QMainWindow::resizeEvent(event); |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 CustomDataSynchConfigValidator::~CustomDataSynchConfigValidator() |
|
87 { |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------------------------------- |
|
91 void CustomDataSynchConfigValidator::activateValidation() |
|
92 { |
|
93 bool cenrepCheck; |
|
94 for (int r = 0; r < ui.tableWidget->rowCount(); r++) { |
|
95 if (matchCheckNameWithTableRowIdAndString(r, "OperatorDataSynchErrorCenrepExistsTest")) { |
|
96 cenrepCheck = mEngineWrapper->operatordataSynchErrorCenrepExists(); |
|
97 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
98 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
99 } |
|
100 else if (matchCheckNameWithTableRowIdAndString(r, "OperatorDataSynchCenrepExistsTest")) { |
|
101 cenrepCheck = mEngineWrapper->operatordataSynchCenrepExists(); |
|
102 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
103 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
104 } |
|
105 else if (matchCheckNameWithTableRowIdAndString(r, "DataSynchCenrepExistsTest")) { |
|
106 cenrepCheck = mEngineWrapper->dataSynchCenrepExists(); |
|
107 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
108 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
109 } |
|
110 else if (matchCheckNameWithTableRowIdAndString(r, "CustomProfilesTest")) { |
|
111 cenrepCheck = mEngineWrapper->customSynchProfilesAllowed(); |
|
112 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
113 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
114 } |
|
115 else if (matchCheckNameWithTableRowIdAndString(r, "ContactsAdapterAvailabilityTest")) { |
|
116 bool adapterCheck = mEngineWrapper->configuredContactsAdapterExists( |
|
117 mContactsAdapterAvailabilityTestErrorNote); |
|
118 ui.tableWidget->item(r, RESULTCOLUMN)->setText(adapterCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
119 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(adapterCheck ? "" : MOREINFO_SYMBOL); |
|
120 } |
|
121 else if (matchCheckNameWithTableRowIdAndString(r, "CustomSynchProfileServerIdTest")) { |
|
122 cenrepCheck = mEngineWrapper->configuredCustomSynchProfileExists(mCustomSynchProfileServerIdTestErrorNote); |
|
123 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
124 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
125 } |
|
126 else if (matchCheckNameWithTableRowIdAndString(r, "ContactsAdapterSynchProfileTest")) { |
|
127 cenrepCheck = mEngineWrapper->contactAdapterCenrepValueToProfileMatches(mContactsAdapterSynchProfileTestErrorNote); |
|
128 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : NOK_SYMBOL); |
|
129 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_SYMBOL); |
|
130 } |
|
131 else if (matchCheckNameWithTableRowIdAndString(r, "MyprofileAdapterSynchProfileTest")) { |
|
132 cenrepCheck = mEngineWrapper->myprofileAdapterCenrepValueToProfileMatches(mMyprofileAdapterSynchProfileTestErrorNote); |
|
133 ui.tableWidget->item(r, RESULTCOLUMN)->setText(cenrepCheck ? OK_SYMBOL : "VERIFY"); |
|
134 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText(cenrepCheck ? "" : MOREINFO_VERIFY_BY_USER_SYMBOL); |
|
135 } |
|
136 // Check if Device info extension plugin exists |
|
137 else if (matchCheckNameWithTableRowIdAndString(r, "DeviceInfoExtensionPluginTest")) |
|
138 { |
|
139 bool devInfoExtCheck = mEngineWrapper->devInfoExtensionPluginAvailable(); |
|
140 ui.tableWidget->item(r, RESULTCOLUMN)->setText( |
|
141 devInfoExtCheck ? OK_SYMBOL : "VERIFY"); |
|
142 ui.tableWidget->item(r, MOREINFOCOLUMN)->setText( |
|
143 devInfoExtCheck ? "" : MOREINFO_VERIFY_BY_USER_SYMBOL); |
|
144 } |
|
145 else { |
|
146 continue; |
|
147 } |
|
148 } |
|
149 } |
|
150 |
|
151 // ---------------------------------------------------------------------------- |
|
152 void CustomDataSynchConfigValidator::handleMoreInfoItemsClicks( |
|
153 QTableWidgetItem *itemClicked) |
|
154 { |
|
155 if ((0 == itemClicked->text().compare(MOREINFO_SYMBOL))||(0 == itemClicked->text().compare(MOREINFO_VERIFY_BY_USER_SYMBOL))) { |
|
156 //user wants to have some info, |
|
157 //and possible hint regarding how to solve NOK case |
|
158 int r = itemClicked->row(); |
|
159 |
|
160 QScopedPointer<QMessageBox> msgBox(new QMessageBox()); |
|
161 msgBox->setWindowTitle(ui.tableWidget->verticalHeaderItem(r)->text()); |
|
162 |
|
163 if (matchCheckNameWithTableRowIdAndString(r, "OperatorDataSynchErrorCenrepExistsTest")) { |
|
164 QString |
|
165 line1 = |
|
166 "OperatorDataSynchErrorCenrep ini file z:\\private\\10202be9\\2001FDF1.txt was not found from image"; |
|
167 QString line2 = "\n\nCheck image creation \\output subfolder for the cenrep ini file."; |
|
168 QString line3 = |
|
169 "\n\nCheck also that .\\s60\\root.confml that operatordatasyncerror.confml is included."; |
|
170 msgBox->setText(line1 + line2 + line3); |
|
171 } |
|
172 else if (matchCheckNameWithTableRowIdAndString(r, "OperatorDataSynchCenrepExistsTest")) { |
|
173 QString line1 = |
|
174 "OperatorDataSynchCenrep ini file z:\\private\\10202be9\\2001E2E1.txt was not found from image"; |
|
175 QString line2 = "\n\nCheck image creation \\output subfolder for the cenrep ini file."; |
|
176 QString line3 = |
|
177 "\n\nCheck also that .\\s60\\root.confml that operatordatasyncerror.confml is included."; |
|
178 msgBox->setText(line1 + line2 + line3); |
|
179 } |
|
180 else if (matchCheckNameWithTableRowIdAndString(r, "DataSynchCenrepExistsTest")) { |
|
181 QString line1 = |
|
182 "DataSynchCenrep ini file z:\\private\\10202be9\\2000CF7E.txt was not found from image"; |
|
183 QString line2 = "\n\nCheck image creation \\output subfolder for the cenrep ini file."; |
|
184 QString line3 = |
|
185 "\n\nCheck also that .\\s60\\root.confml that operatordatasyncerror.confml is included."; |
|
186 msgBox->setText(line1 + line2 + line3); |
|
187 } |
|
188 else if (matchCheckNameWithTableRowIdAndString(r, "CustomProfilesTest")) { |
|
189 QString line1 = |
|
190 "Support for custom synch profiles defined using z:\\private\\101F99FB\\variantdata.xml is (0) now disabled in cenrep."; |
|
191 QString |
|
192 line2 = |
|
193 "\n\nCheck that variant.confml has KCRUidDataSyncInternalKeys cenrep key KNsmlDsCustomProfiles set to 1."; |
|
194 QString |
|
195 line3 = |
|
196 "\n\nCheck also that DataSynchCenrep ini file z:\\private\\10202be9\\2000CF7E.txt exists in image, see check above."; |
|
197 msgBox->setText(line1 + line2 + line3); |
|
198 } |
|
199 else if (matchCheckNameWithTableRowIdAndString(r, "ContactsAdapterAvailabilityTest")) { |
|
200 QString line1 = "Configured contact adapter does not exist."; |
|
201 QString line2 = "\n\n" + mContactsAdapterAvailabilityTestErrorNote; |
|
202 QString line3 = "\n\n"; |
|
203 msgBox->setText(line1 + line2 + line3); |
|
204 } |
|
205 else if (matchCheckNameWithTableRowIdAndString(r, "CustomSynchProfileServerIdTest")) { |
|
206 QString line1 = "ServerId match failed."+mCustomSynchProfileServerIdTestErrorNote; |
|
207 QString line2 = |
|
208 "\n\noperator datasync cenrep z:\\private\\10202be9\\2001E2E1.txt and synch profile was not found."; |
|
209 QString line3 = "\n\nCheck variantdata.xml also."; |
|
210 msgBox->setText(line1 + line2 + line3); |
|
211 } |
|
212 else if (matchCheckNameWithTableRowIdAndString(r, "ContactsAdapterSynchProfileTest")) { |
|
213 QString errorMsg = mContactsAdapterSynchProfileTestErrorNote; |
|
214 msgBox->setText(errorMsg); |
|
215 } |
|
216 else if (matchCheckNameWithTableRowIdAndString(r, "MyprofileAdapterSynchProfileTest")) { |
|
217 QString errorMsg = mMyprofileAdapterSynchProfileTestErrorNote; |
|
218 msgBox->setText(errorMsg); |
|
219 } |
|
220 // DevInfo extension error note |
|
221 else if (matchCheckNameWithTableRowIdAndString(r, "DeviceInfoExtensionPluginTest")) { |
|
222 msgBox->setText("DevInfo extension plugin not found."); |
|
223 } |
|
224 QGraphicsOpacityEffect* effect = new QGraphicsOpacityEffect(); |
|
225 effect->setOpacity(0.85); |
|
226 msgBox->setGraphicsEffect(effect); |
|
227 msgBox->exec(); |
|
228 } |
|
229 } |
|
230 |
|
231 // ---------------------------------------------------------------------------- |
|
232 bool CustomDataSynchConfigValidator::matchCheckNameWithTableRowIdAndString( |
|
233 int row, QString matchString) |
|
234 { |
|
235 bool match = ui.tableWidget->verticalHeaderItem(row)->text().compare(matchString) == 0 ? true |
|
236 : false; |
|
237 return match; |
|
238 } |
|
239 |
|
240 // End of file |
|