Changeset 86671 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 22, 2020 2:55:41 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
r86669 r86671 25 25 #include "QIInputDialog.h" 26 26 #include "QIMessageBox.h" 27 #include "QIToolBar.h" 27 28 #include "QITreeWidget.h" 28 #include "UICommon.h"29 29 #include "UIActionPoolManager.h" 30 30 #include "UICloudNetworkingStuff.h" 31 #include "UICloudProfileDetailsWidget.h" 32 #include "UICloudProfileManager.h" 33 #include "UICommon.h" 31 34 #include "UIExtraDataManager.h" 32 35 #include "UIIconPool.h" 33 #include "UICloudProfileDetailsWidget.h"34 #include "UICloudProfileManager.h"35 36 #include "UIMessageCenter.h" 36 #include " QIToolBar.h"37 #include "UIVirtualBoxEventHandler.h" 37 38 38 39 /* COM includes: */ … … 814 815 void UICloudProfileManagerWidget::loadCloudStuff() 815 816 { 817 /* Save current item definition: */ 818 QITreeWidgetItem *pCurrentItem = QITreeWidgetItem::toItem(m_pTreeWidget->currentItem()); 819 const QString strDefinition = pCurrentItem ? pCurrentItem->data(Column_Name, Data_Definition).toString() : QString(); 820 816 821 /* Clear tree first of all: */ 817 822 m_pTreeWidget->clear(); … … 852 857 } 853 858 854 /* Choose the 1st item as current initially: */ 855 m_pTreeWidget->setCurrentItem(m_pTreeWidget->topLevelItem(0)); 859 /* Try to restore current item by definition: */ 860 if (!strDefinition.isEmpty()) 861 m_pTreeWidget->setCurrentItem(searchItem(strDefinition)); 862 /* Choose the 1st item as current if nothing chosen: */ 863 if (!m_pTreeWidget->currentItem()) 864 m_pTreeWidget->setCurrentItem(m_pTreeWidget->topLevelItem(0)); 865 /* Handle current item change in any case: */ 856 866 sltHandleCurrentItemChange(); 857 867 } … … 915 925 if (!comProfile.isOk()) 916 926 msgCenter().cannotAcquireCloudProfileParameter(comProfile, this); 927 } 928 929 QTreeWidgetItem *UICloudProfileManagerWidget::searchItem(const QString &strDefinition, 930 QTreeWidgetItem *pParentItem /* = 0 */) const 931 { 932 /* If no parent-item passed => we will start from the invisible-root-item: */ 933 if (!pParentItem) 934 pParentItem = m_pTreeWidget->invisibleRootItem(); 935 936 /* Check whether parent-item is of required type: */ 937 QITreeWidgetItem *pParentItemOfType = QITreeWidgetItem::toItem(pParentItem); 938 if (pParentItemOfType) 939 { 940 /* Check if parent-item has required definition: */ 941 if (pParentItemOfType->data(Column_Name, Data_Definition).toString() == strDefinition) 942 return pParentItem; 943 } 944 945 /* Iterate through parent-item children: */ 946 for (int i = 0; i < pParentItem->childCount(); ++i) 947 if (QTreeWidgetItem *pChildItem = searchItem(strDefinition, pParentItem->child(i))) 948 return pChildItem; 949 950 /* Null by default: */ 951 return 0; 917 952 } 918 953 -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.h
r86250 r86671 168 168 /** @name Tree-widget stuff. 169 169 * @{ */ 170 /** Seearches a provider item with specified @a uId. */ 170 /** Recursively searches for an item with specified @a strDefinition, 171 * using @a pParentItem as an item to start search from. */ 172 QTreeWidgetItem *searchItem(const QString &strDefinition, 173 QTreeWidgetItem *pParentItem = 0) const; 174 /** Searches for a provider item with specified @a uId. */ 171 175 UIItemCloudProvider *searchItem(const QUuid &uId) const; 172 176
Note:
See TracChangeset
for help on using the changeset viewer.