Changeset 75226 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 2, 2018 2:35:10 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
r75219 r75226 156 156 /* Clear combo initially: */ 157 157 m_pAccountComboBox->clear(); 158 159 /* Return if no provider chosen: */ 160 if (providerId().isNull()) 161 return; 162 163 /* (Re)initialize Cloud Provider: */ 164 m_comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId()); 165 /* Show error message if necessary: */ 166 if (!m_comCloudProviderManager.isOk()) 167 msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, providerId()); 168 else 169 { 170 /* Acquire existing profile names: */ 171 const QVector<QString> profileNames = m_comCloudProvider.GetProfileNames(); 158 /* Clear Cloud Provider: */ 159 m_comCloudProvider = CCloudProvider(); 160 161 /* If provider chosen: */ 162 if (!providerId().isNull()) 163 { 164 /* (Re)initialize Cloud Provider: */ 165 m_comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId()); 172 166 /* Show error message if necessary: */ 173 if (!m_comCloudProvider .isOk())174 msgCenter().cannot AcquireCloudProviderParameter(m_comCloudProvider);167 if (!m_comCloudProviderManager.isOk()) 168 msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, providerId()); 175 169 else 176 170 { 177 /* Iterate through existing profile names: */ 178 foreach (const QString &strProfileName, profileNames) 171 /* Acquire existing profile names: */ 172 const QVector<QString> profileNames = m_comCloudProvider.GetProfileNames(); 173 /* Show error message if necessary: */ 174 if (!m_comCloudProvider.isOk()) 175 msgCenter().cannotAcquireCloudProviderParameter(m_comCloudProvider); 176 else 179 177 { 180 /* Skip if we have nothing to show (wtf happened?): */ 181 if (strProfileName.isEmpty()) 182 continue; 183 184 /* Compose item, fill it's data: */ 185 m_pAccountComboBox->addItem(strProfileName); 186 m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, AccountData_ProfileName); 178 /* Iterate through existing profile names: */ 179 foreach (const QString &strProfileName, profileNames) 180 { 181 /* Skip if we have nothing to show (wtf happened?): */ 182 if (strProfileName.isEmpty()) 183 continue; 184 185 /* Compose item, fill it's data: */ 186 m_pAccountComboBox->addItem(strProfileName); 187 m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, AccountData_ProfileName); 188 } 187 189 } 188 190 } 189 } 190 191 /* Set previous/default item if possible: */192 int iNewIndex = -1;193 if ( iNewIndex == -1194 && !strOldData.isNull())195 i NewIndex = m_pAccountComboBox->findData(strOldData, AccountData_ProfileName);196 if ( iNewIndex == -1197 && m_pAccountComboBox->count() > 0)198 i NewIndex = 0;199 if (iNewIndex != -1)200 m_pAccountComboBox->setCurrentIndex(iNewIndex);191 192 /* Set previous/default item if possible: */ 193 int iNewIndex = -1; 194 if ( iNewIndex == -1 195 && !strOldData.isNull()) 196 iNewIndex = m_pAccountComboBox->findData(strOldData, AccountData_ProfileName); 197 if ( iNewIndex == -1 198 && m_pAccountComboBox->count() > 0) 199 iNewIndex = 0; 200 if (iNewIndex != -1) 201 m_pAccountComboBox->setCurrentIndex(iNewIndex); 202 } 201 203 202 204 /* Unblock signals after update: */ … … 210 212 m_pAccountPropertyTable->setRowCount(0); 211 213 m_pAccountPropertyTable->setColumnCount(0); 212 213 /* Return if no provider initialized: */ 214 if (m_comCloudProvider.isNull()) 215 return; 216 /* Return if no profile chosen: */ 217 if (profileName().isNull()) 218 return; 219 220 /* Acquire Cloud Profile: */ 221 m_comCloudProfile = m_comCloudProvider.GetProfileByName(profileName()); 222 /* Show error message if necessary: */ 223 if (!m_comCloudProvider.isOk()) 224 msgCenter().cannotFindCloudProfile(m_comCloudProvider, profileName()); 225 else 226 { 227 /* Acquire properties: */ 228 QVector<QString> keys; 229 QVector<QString> values; 230 values = m_comCloudProfile.GetProperties(QString(), keys); 214 /* Clear Cloud Profile: */ 215 m_comCloudProfile = CCloudProfile(); 216 217 /* If both provider and profile chosen: */ 218 if (!m_comCloudProvider.isNull() && !profileName().isNull()) 219 { 220 /* Acquire Cloud Profile: */ 221 m_comCloudProfile = m_comCloudProvider.GetProfileByName(profileName()); 231 222 /* Show error message if necessary: */ 232 if (!m_comCloudPro file.isOk())233 msgCenter().cannot AcquireCloudProfileParameter(m_comCloudProfile);223 if (!m_comCloudProvider.isOk()) 224 msgCenter().cannotFindCloudProfile(m_comCloudProvider, profileName()); 234 225 else 235 226 { 236 /* Configure table: */ 237 m_pAccountPropertyTable->setRowCount(keys.size()); 238 m_pAccountPropertyTable->setColumnCount(2); 239 240 /* Push acquired keys/values to data fields: */ 241 for (int i = 0; i < m_pAccountPropertyTable->rowCount(); ++i) 227 /* Acquire properties: */ 228 QVector<QString> keys; 229 QVector<QString> values; 230 values = m_comCloudProfile.GetProperties(QString(), keys); 231 /* Show error message if necessary: */ 232 if (!m_comCloudProfile.isOk()) 233 msgCenter().cannotAcquireCloudProfileParameter(m_comCloudProfile); 234 else 242 235 { 243 /* Create key item: */ 244 QTableWidgetItem *pItemK = new QTableWidgetItem(keys.at(i)); 245 if (pItemK) 236 /* Configure table: */ 237 m_pAccountPropertyTable->setRowCount(keys.size()); 238 m_pAccountPropertyTable->setColumnCount(2); 239 240 /* Push acquired keys/values to data fields: */ 241 for (int i = 0; i < m_pAccountPropertyTable->rowCount(); ++i) 246 242 { 247 /* Non-editable for sure, but non-selectable? */ 248 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsEditable); 249 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsSelectable); 250 251 /* Use non-translated description as tool-tip: */ 252 const QString strToolTip = m_comCloudProfile.GetPropertyDescription(keys.at(i)); 253 /* Show error message if necessary: */ 254 if (!m_comCloudProfile.isOk()) 255 msgCenter().cannotAcquireCloudProfileParameter(m_comCloudProfile); 256 else 257 pItemK->setData(Qt::UserRole, strToolTip); 258 259 /* Insert into table: */ 260 m_pAccountPropertyTable->setItem(i, 0, pItemK); 243 /* Create key item: */ 244 QTableWidgetItem *pItemK = new QTableWidgetItem(keys.at(i)); 245 if (pItemK) 246 { 247 /* Non-editable for sure, but non-selectable? */ 248 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsEditable); 249 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsSelectable); 250 251 /* Use non-translated description as tool-tip: */ 252 const QString strToolTip = m_comCloudProfile.GetPropertyDescription(keys.at(i)); 253 /* Show error message if necessary: */ 254 if (!m_comCloudProfile.isOk()) 255 msgCenter().cannotAcquireCloudProfileParameter(m_comCloudProfile); 256 else 257 pItemK->setData(Qt::UserRole, strToolTip); 258 259 /* Insert into table: */ 260 m_pAccountPropertyTable->setItem(i, 0, pItemK); 261 } 262 263 /* Create value item: */ 264 QTableWidgetItem *pItemV = new QTableWidgetItem(values.at(i)); 265 if (pItemV) 266 { 267 /* Non-editable for sure, but non-selectable? */ 268 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsEditable); 269 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsSelectable); 270 271 /* Use the value as tool-tip, there can be quite long values: */ 272 const QString strToolTip = values.at(i); 273 pItemV->setToolTip(strToolTip); 274 275 /* Insert into table: */ 276 m_pAccountPropertyTable->setItem(i, 1, pItemV); 277 } 261 278 } 262 279 263 /* Create value item: */ 264 QTableWidgetItem *pItemV = new QTableWidgetItem(values.at(i)); 265 if (pItemV) 266 { 267 /* Non-editable for sure, but non-selectable? */ 268 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsEditable); 269 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsSelectable); 270 271 /* Use the value as tool-tip, there can be quite long values: */ 272 const QString strToolTip = values.at(i); 273 pItemV->setToolTip(strToolTip); 274 275 /* Insert into table: */ 276 m_pAccountPropertyTable->setItem(i, 1, pItemV); 277 } 280 /* Update table tool-tips: */ 281 updateAccountPropertyTableToolTips(); 282 283 /* Adjust the table: */ 284 adjustAccountPropertyTable(); 278 285 } 279 280 /* Update table tool-tips: */281 updateAccountPropertyTableToolTips();282 283 /* Adjust the table: */284 adjustAccountPropertyTable();285 286 } 286 287 }
Note:
See TracChangeset
for help on using the changeset viewer.