Changeset 86689 in vbox for trunk/src/VBox
- Timestamp:
- Oct 23, 2020 2:23:39 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.cpp
r86688 r86689 84 84 /** Returns item name. */ 85 85 QString name() const { return m_strName; } 86 87 /** Returns definition composed on the basis of @a strShortName. */ 88 static QString definition(const QString &strShortName); 86 89 }; 87 90 … … 101 104 /** Returns item name. */ 102 105 QString name() const { return m_strName; } 106 107 /** Returns definition composed on the basis of @a strProviderShortName and @a strName. */ 108 static QString definition(const QString &strProviderShortName, const QString &strName); 103 109 }; 104 110 … … 121 127 setText(Column_Name, m_strName); 122 128 setData(Column_Name, Data_ProviderID, m_uId); 123 setData(Column_Name, Data_Definition, QVariant::fromValue( QString("/%1").arg(m_strShortName)));129 setData(Column_Name, Data_Definition, QVariant::fromValue(definition(m_strShortName))); 124 130 setCheckState(Column_ListVMs, m_fRestricted ? Qt::Unchecked : Qt::Checked); 131 } 132 133 /* static */ 134 QString UIItemCloudProvider::definition(const QString &strShortName) 135 { 136 return QString("/%1").arg(strShortName); 125 137 } 126 138 … … 142 154 /* Update item fields: */ 143 155 setText(Column_Name, m_strName); 144 setData(Column_Name, Data_Definition, QVariant::fromValue( QString("/%1/%2").arg(m_strProviderShortName, m_strName)));156 setData(Column_Name, Data_Definition, QVariant::fromValue(definition(m_strProviderShortName, m_strName))); 145 157 setCheckState(Column_ListVMs, m_fRestricted ? Qt::Unchecked : Qt::Checked); 158 } 159 160 /* static */ 161 QString UIItemCloudProfile::definition(const QString &strProviderShortName, const QString &strName) 162 { 163 return QString("/%1/%2").arg(strProviderShortName, strName); 146 164 } 147 165 … … 801 819 802 820 /* Make sure provider item is properly inserted: */ 803 UIItemCloudProvider *pItem = searchItem(providerData.m_uId); 821 QTreeWidgetItem *pItem = searchItem(UIItemCloudProvider::definition(providerData.m_strShortName)); 822 AssertPtrReturnVoid(pItem); 804 823 805 824 /* Iterate through provider's profiles: */ … … 841 860 if (comProvider.isOk()) 842 861 providerData.m_strName = comProvider.GetName(); 843 const QString strProviderPath = QString("/%1").arg(providerData.m_strShortName);862 const QString strProviderPath = UIItemCloudProvider::definition(providerData.m_strShortName); 844 863 providerData.m_fRestricted = restrictions.contains(strProviderPath); 845 864 foreach (const QString &strSupportedPropertyName, comProvider.GetSupportedPropertyNames()) … … 862 881 if (comProfile.isOk()) 863 882 profileData.m_strName = comProfile.GetName(); 864 const QString strProfilePath = QString("/%1/%2").arg(providerData.m_strShortName).arg(profileData.m_strName);883 const QString strProfilePath = UIItemCloudProfile::definition(providerData.m_strShortName, profileData.m_strName); 865 884 profileData.m_fRestricted = restrictions.contains(strProfilePath); 866 885 … … 911 930 return pChildItem; 912 931 913 /* Null by default: */914 return 0;915 }916 917 UIItemCloudProvider *UICloudProfileManagerWidget::searchItem(const QUuid &uId) const918 {919 /* Iterate through tree-widget children: */920 for (int i = 0; i < m_pTreeWidget->childCount(); ++i)921 if (m_pTreeWidget->childItem(i)->data(Column_Name, Data_ProviderID).toUuid() == uId)922 return qobject_cast<UIItemCloudProvider*>(m_pTreeWidget->childItem(i));923 932 /* Null by default: */ 924 933 return 0; -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.h
r86688 r86689 169 169 QTreeWidgetItem *searchItem(const QString &strDefinition, 170 170 QTreeWidgetItem *pParentItem = 0) const; 171 /** Searches for a provider item with specified @a uId. */172 UIItemCloudProvider *searchItem(const QUuid &uId) const;173 171 174 172 /** Creates a new tree-widget item
Note:
See TracChangeset
for help on using the changeset viewer.