Changeset 73734 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 17, 2018 12:43:50 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp
r73718 r73734 1835 1835 { 1836 1836 setName(QApplication::translate("UIActionPool", "&Add...")); 1837 setStatusTip(QApplication::translate("UIActionPool", "Add a Disk Image File"));1837 setStatusTip(QApplication::translate("UIActionPool", "Add a disk image file")); 1838 1838 setToolTip(tr("Add a Disk Image File (%1)").arg(shortcut().toString())); 1839 1839 } … … 2239 2239 /* 'Remove' action: */ 2240 2240 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Remove)) || fSeparator; 2241 /* 'Release' action: */ 2242 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Release)) || fSeparator; 2241 2243 2242 2244 /* Separator? */ … … 2247 2249 } 2248 2250 2249 /* 'Release' action: */2250 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Release)) || fSeparator;2251 2251 /* 'Properties' action: */ 2252 2252 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_T_Details)) || fSeparator; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r73723 r73734 166 166 , m_pDetailsWidget(0) 167 167 , m_pToolBar(0) 168 , m_pContextMenu(0)169 168 , m_pProgressBar(0) 170 169 { … … 189 188 void UIMediumManagerWidget::retranslateUi() 190 189 { 191 /* Translatetoolbar: */190 /* Adjust toolbar: */ 192 191 #ifdef VBOX_WS_MAC 193 192 // WORKAROUND: … … 617 616 } 618 617 619 void UIMediumManagerWidget::sltHandleContextMenu Call(const QPoint &position)618 void UIMediumManagerWidget::sltHandleContextMenuRequest(const QPoint &position) 620 619 { 621 620 /* Get current tree-widget: */ … … 623 622 AssertPtrReturnVoid(pTreeWidget); 624 623 625 /* Make sure underlaying item was found: */624 /* If underlaying item was found => make sure that item is current one: */ 626 625 QTreeWidgetItem *pItem = pTreeWidget->itemAt(position); 627 if (!pItem) 628 return; 629 630 /* Make sure that item is current one: */ 631 setCurrentItem(pTreeWidget, pItem); 632 633 /* Show item context menu: */ 634 if (m_pContextMenu) 635 m_pContextMenu->exec(pTreeWidget->viewport()->mapToGlobal(position)); 626 if (pItem) 627 setCurrentItem(pTreeWidget, pItem); 628 629 /* Compose temporary context-menu: */ 630 QMenu menu; 631 if (pTreeWidget->itemAt(position)) 632 { 633 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy)); 634 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Move)); 635 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove)); 636 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release)); 637 menu.addSeparator(); 638 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details)); 639 } 640 else 641 { 642 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add)); 643 menu.addSeparator(); 644 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh)); 645 } 646 /* And show it: */ 647 menu.exec(pTreeWidget->viewport()->mapToGlobal(position)); 636 648 } 637 649 … … 734 746 /* Update action icons: */ 735 747 updateActionIcons(); 736 737 /* Prepare context-menu: */738 prepareContextMenu();739 }740 741 void UIMediumManagerWidget::prepareContextMenu()742 {743 /* Create context-menu: */744 m_pContextMenu = new QMenu(this);745 AssertPtrReturnVoid(m_pContextMenu);746 {747 /* Configure contex-menu: */748 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add));749 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy));750 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Move));751 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove));752 m_pContextMenu->addSeparator();753 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release));754 m_pContextMenu->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details));755 }756 748 } 757 749 … … 795 787 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Move)); 796 788 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove)); 789 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release)); 797 790 m_pToolBar->addSeparator(); 798 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release));799 791 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details)); 800 792 m_pToolBar->addSeparator(); … … 890 882 m_pActionPool->action(UIActionIndexST_M_Medium_T_Details), &QAction::setChecked); 891 883 connect(pTreeWidget, &QITreeWidget::customContextMenuRequested, 892 this, &UIMediumManagerWidget::sltHandleContextMenu Call);884 this, &UIMediumManagerWidget::sltHandleContextMenuRequest); 893 885 connect(pTreeWidget, &QITreeWidget::resized, 894 886 this, &UIMediumManagerWidget::sltPerformTablesAdjustment, Qt::QueuedConnection); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r73721 r73734 188 188 void sltHandleCurrentItemChanged(); 189 189 /** Handles item context-menu-call case. */ 190 void sltHandleContextMenu Call(const QPoint &position);190 void sltHandleContextMenuRequest(const QPoint &position); 191 191 /** @} */ 192 192 … … 209 209 /** Prepares actions. */ 210 210 void prepareActions(); 211 /** Prepares context-menu. */212 void prepareContextMenu();213 211 /** Prepares widgets. */ 214 212 void prepareWidgets(); … … 348 346 /** Holds the toolbar widget instance. */ 349 347 UIToolBar *m_pToolBar; 350 /** Holds the context-menu object instance. */351 QMenu *m_pContextMenu;352 348 /** @} */ 353 349
Note:
See TracChangeset
for help on using the changeset viewer.