VirtualBox

Changeset 74956 in vbox for trunk


Ignore:
Timestamp:
Oct 19, 2018 7:52:44 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125974
Message:

FE/Qt: bugref:9230: Cloud Profile Manager: Update newly created profile with DEFAULT properties/values (if present) and SUPPORTED properties finally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.cpp

    r74945 r74956  
    349349                    createItemForCloudProfile(pProviderItem, data, true);
    350350
     351                    /* If profile still Ok: */
     352                    if (comCloudProfile.isOk())
     353                    {
     354                        /* Acquire supported property names: */
     355                        const QVector<QString> supportedNames = comCloudProfile.GetSupportedPropertyNames();
     356                        /* Show error message if necessary: */
     357                        if (!comCloudProfile.isOk())
     358                            msgCenter().cannotAcquireCloudProfileParameter(comCloudProfile, this);
     359                        else
     360                        {
     361                            /* Add unknown supported properties to known properties list.
     362                             * That allows to have at least something if we have nothing. */
     363                            foreach (const QString &strSupportedName, supportedNames)
     364                                if (!data.m_data.contains(strSupportedName))
     365                                    data.m_data[strSupportedName] = qMakePair(QString(), QString());
     366                        }
     367                    }
     368
     369                    /* If profile still Ok: */
     370                    if (comCloudProfile.isOk())
     371                    {
     372                        /* Now push known properties back to profile all together.
     373                         * That will rewrite empty profile with values gathered above. */
     374                        const QVector<QString> updatedKeys = data.m_data.keys().toVector();
     375                        QVector<QString> updatedValues;
     376                        typedef QPair<QString, QString> QStringPair;
     377                        foreach (const QStringPair &valuePair, data.m_data.values())
     378                            updatedValues += valuePair.first;
     379                        comCloudProfile.SetProperties(updatedKeys, updatedValues);
     380                        /* Show error message if necessary: */
     381                        if (!comCloudProfile.isOk())
     382                            msgCenter().cannotAssignCloudProfileParameter(comCloudProfile, this);
     383                        else
     384                        {
     385                            /* Update profile in the tree: */
     386                            UIDataCloudProfile updatedData;
     387                            loadCloudProfile(comCloudProfile, updatedData);
     388                            updateItemForCloudProfile(updatedData, true, static_cast<UIItemCloudProfile*>(m_pTreeWidget->currentItem()));
     389                        }
     390                    }
     391
    351392                    /* Save profile changes: */
    352393                    comCloudProvider.SaveProfiles();
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette