Changeset 108046 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 4, 2025 5:24:54 AM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167323
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r108003 r108046 2793 2793 RTPrintf("%-28s ", Info::tr("Shared folders:")); 2794 2794 uint32_t numSharedFolders = 0; 2795 #if 0 // not yet implemented2796 2795 /* globally shared folders first */ 2797 2796 { 2798 SafeIfaceArray <ISharedFolder> sfColl;2799 CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam( sfColl)),rc);2800 for (size_t i = 0; i < sfColl.size(); ++i)2801 { 2802 ComPtr<ISharedFolder> sf = sfColl[i];2797 com::SafeIfaceArray <ISharedFolder> folders; 2798 CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), hrc); 2799 for (size_t i = 0; i < folders.size(); ++i) 2800 { 2801 ComPtr<ISharedFolder> sf = folders[i]; 2803 2802 showSharedFolder(sf, details, Info::tr("global mapping"), "GlobalMapping", i + 1, numSharedFolders == 0); 2804 2803 ++numSharedFolders; 2805 2804 } 2806 2805 } 2807 #endif2808 2806 /* now VM mappings */ 2809 2807 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r108003 r108046 1687 1687 * Done parsing, do some work. 1688 1688 */ 1689 ComPtr<IMachine> ptrMachine;1690 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);1691 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE);1692 1693 1689 HRESULT hrc; 1694 if (fTransient) 1695 { 1696 /* open an existing session for the VM */ 1697 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1698 1699 /* get the session machine */ 1700 ComPtr<IMachine> ptrSessionMachine; 1701 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1702 1703 /* get the session console */ 1704 ComPtr<IConsole> ptrConsole; 1705 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1706 if (ptrConsole.isNull()) 1707 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running."), pszMachineName); 1708 1709 CHECK_ERROR2(hrc, ptrConsole, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1710 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1711 a->session->UnlockMachine(); 1690 if (!strcmp(pszMachineName, "global")) 1691 { 1692 if (fTransient) 1693 return errorSyntax(Misc::tr("Invalid option: global and transient both specified")); 1694 ComPtr<IVirtualBox> pVirtualBox = a->virtualBox; 1695 CHECK_ERROR2(hrc, pVirtualBox, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1696 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1712 1697 } 1713 1698 else 1714 1699 { 1715 /* open a session for the VM */ 1716 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1717 1718 /* get the mutable session machine */ 1719 ComPtr<IMachine> ptrSessionMachine; 1720 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1721 1722 CHECK_ERROR2(hrc, ptrSessionMachine, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1723 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1724 if (SUCCEEDED(hrc)) 1725 { 1726 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1727 } 1728 1729 a->session->UnlockMachine(); 1700 ComPtr<IMachine> ptrMachine; 1701 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 1702 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE); 1703 1704 if (fTransient) 1705 { 1706 /* open an existing session for the VM */ 1707 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1708 1709 /* get the session machine */ 1710 ComPtr<IMachine> ptrSessionMachine; 1711 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1712 1713 /* get the session console */ 1714 ComPtr<IConsole> ptrConsole; 1715 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1716 if (ptrConsole.isNull()) 1717 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running."), pszMachineName); 1718 1719 CHECK_ERROR2(hrc, ptrConsole, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1720 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1721 a->session->UnlockMachine(); 1722 } 1723 else 1724 { 1725 /* open a session for the VM */ 1726 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1727 1728 /* get the mutable session machine */ 1729 ComPtr<IMachine> ptrSessionMachine; 1730 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1731 1732 CHECK_ERROR2(hrc, ptrSessionMachine, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1733 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1734 if (SUCCEEDED(hrc)) 1735 { 1736 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1737 } 1738 1739 a->session->UnlockMachine(); 1740 } 1730 1741 } 1731 1742 … … 1785 1796 * Done parsing, do some real work. 1786 1797 */ 1787 ComPtr<IMachine> ptrMachine;1788 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);1789 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE);1790 1791 1798 HRESULT hrc; 1792 if (fTransient) 1793 { 1794 /* open an existing session for the VM */ 1795 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1796 /* get the session machine */ 1797 ComPtr<IMachine> ptrSessionMachine; 1798 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1799 /* get the session console */ 1800 ComPtr<IConsole> ptrConsole; 1801 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1802 if (ptrConsole.isNull()) 1803 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running.\n"), pszMachineName); 1804 1805 CHECK_ERROR2(hrc, ptrConsole, RemoveSharedFolder(Bstr(pszName).raw())); 1806 1807 a->session->UnlockMachine(); 1799 if (!strcmp(pszMachineName, "global")) 1800 { 1801 ComPtr<IVirtualBox> pVirtualBox = a->virtualBox; 1802 CHECK_ERROR2(hrc, pVirtualBox, RemoveSharedFolder(Bstr(pszName).raw())); 1808 1803 } 1809 1804 else 1810 1805 { 1811 /* open a session for the VM */ 1812 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1813 1814 /* get the mutable session machine */ 1815 ComPtr<IMachine> ptrSessionMachine; 1816 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1817 1818 CHECK_ERROR2(hrc, ptrSessionMachine, RemoveSharedFolder(Bstr(pszName).raw())); 1819 1820 /* commit and close the session */ 1821 if (SUCCEEDED(hrc)) 1822 { 1823 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1824 } 1825 a->session->UnlockMachine(); 1806 ComPtr<IMachine> ptrMachine; 1807 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 1808 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE); 1809 1810 if (fTransient) 1811 { 1812 /* open an existing session for the VM */ 1813 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1814 /* get the session machine */ 1815 ComPtr<IMachine> ptrSessionMachine; 1816 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1817 /* get the session console */ 1818 ComPtr<IConsole> ptrConsole; 1819 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1820 if (ptrConsole.isNull()) 1821 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running.\n"), pszMachineName); 1822 1823 CHECK_ERROR2(hrc, ptrConsole, RemoveSharedFolder(Bstr(pszName).raw())); 1824 1825 a->session->UnlockMachine(); 1826 } 1827 else 1828 { 1829 /* open a session for the VM */ 1830 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1831 1832 /* get the mutable session machine */ 1833 ComPtr<IMachine> ptrSessionMachine; 1834 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1835 1836 CHECK_ERROR2(hrc, ptrSessionMachine, RemoveSharedFolder(Bstr(pszName).raw())); 1837 1838 /* commit and close the session */ 1839 if (SUCCEEDED(hrc)) 1840 { 1841 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1842 } 1843 a->session->UnlockMachine(); 1844 } 1826 1845 } 1827 1846 -
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r106061 r108046 1619 1619 print("Machines: %s" % (colPath(ctx, props.defaultMachineFolder))) 1620 1620 1621 #print("Global shared folders:")1622 #for udin ctx['global'].getArray(vbox, 'sharedFolders'):1623 #printSf(ctx, sf)1621 print("Global shared folders:") 1622 for sf in ctx['global'].getArray(vbox, 'sharedFolders'): 1623 printSf(ctx, sf) 1624 1624 host = vbox.host 1625 1625 cnt = host.processorCount … … 2648 2648 return 0 2649 2649 2650 mach = argsToMach(ctx, args) 2651 if mach is None: 2652 return 0 2650 if args[1] != 'global': 2651 mach = argsToMach(ctx, args) 2652 if mach is None: 2653 return 0 2653 2654 path = args[2] 2654 2655 name = args[3] … … 2661 2662 if cur_arg == 'persistent': 2662 2663 persistent = True 2663 if persistent: 2664 if args[1] == 'global': 2665 ctx['vb'].createSharedFolder(name, path, writable) 2666 elif persistent: 2664 2667 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.createSharedFolder(name, path, writable), []) 2665 2668 else: … … 2672 2675 return 0 2673 2676 2674 mach = argsToMach(ctx, args) 2675 if mach is None: 2676 return 0 2677 if args[1] != 'global': 2678 mach = argsToMach(ctx, args) 2679 if mach is None: 2680 return 0 2677 2681 name = args[2] 2678 2682 found = False 2679 for sharedfolder in ctx['global'].getArray(mach, 'sharedFolders'): 2680 if sharedfolder.name == name: 2681 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.removeSharedFolder(name), []) 2682 found = True 2683 break 2684 if not found: 2685 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: console.removeSharedFolder(name)]) 2683 if args[1] == 'global': 2684 for sharedfolder in ctx['global'].getArray(ctx['vb'], 'sharedFolders'): 2685 if sharedfolder.name == name: 2686 ctx['vb'].removeSharedFolder(name) 2687 found = True 2688 break 2689 else: 2690 for sharedfolder in ctx['global'].getArray(mach, 'sharedFolders'): 2691 if sharedfolder.name == name: 2692 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.removeSharedFolder(name), []) 2693 found = True 2694 break 2695 if not found: 2696 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: console.removeSharedFolder(name)]) 2686 2697 return 0 2687 2698 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r107330 r108046 896 896 enum UISharedFolderType 897 897 { 898 UISharedFolderType_Global, 898 899 UISharedFolderType_Machine, 899 900 UISharedFolderType_Console -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r106061 r108046 1411 1411 /* Enumerate all the folders: */ 1412 1412 QMap<QString, QString> folders; 1413 foreach (const CSharedFolder &comGlobalFolder, gpGlobalSession->virtualBox().GetSharedFolders()) 1414 folders.insert(comGlobalFolder.GetName(), comGlobalFolder.GetHostPath()); 1413 1415 foreach (const CSharedFolder &comPermanentFolder, comMachine.GetSharedFolders()) 1414 1416 folders.insert(comPermanentFolder.GetName(), comPermanentFolder.GetHostPath()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UISharedFolderDetailsEditor.cpp
r106061 r108046 57 57 , m_pCheckBoxAutoMount(0) 58 58 , m_pCheckBoxPermanent(0) 59 , m_pCheckBoxGlobal(0) 59 60 , m_pButtonBox(0) 60 61 { … … 115 116 { 116 117 return m_pEditorAutoMountPoint ? m_pEditorAutoMountPoint->text() : QString(); 118 } 119 120 void UISharedFolderDetailsEditor::setGlobal(bool fGlobal) 121 { 122 if (m_pCheckBoxGlobal) 123 m_pCheckBoxGlobal->setChecked(fGlobal); 124 } 125 126 bool UISharedFolderDetailsEditor::isGlobal() const 127 { 128 return m_pCheckBoxGlobal ? m_pCheckBoxGlobal->isChecked() : false; 117 129 } 118 130 … … 171 183 if (m_pCheckBoxPermanent) 172 184 { 173 m_pCheckBoxPermanent->setText(tr("&Make Permanent")); 174 m_pCheckBoxPermanent->setToolTip(tr("When checked, this shared folder will be permanent.")); 175 } 185 m_pCheckBoxPermanent->setText(tr("&Make Machine-permanent")); 186 m_pCheckBoxPermanent->setToolTip(tr("When checked, this shared folder will be permanent " 187 "to this guest machine.")); 188 } 189 if (m_pCheckBoxGlobal) 190 { 191 m_pCheckBoxGlobal->setText(tr("&Make Global")); 192 m_pCheckBoxGlobal->setToolTip(tr("When checked, this shared folder will be available " 193 "to all VMs.")); 194 } 195 } 196 197 void UISharedFolderDetailsEditor::sltGlobalToggled() 198 { 199 m_pCheckBoxPermanent->setHidden(m_pCheckBoxGlobal->isChecked()); 176 200 } 177 201 … … 253 277 if (pLayout) 254 278 { 255 pLayout->setRowStretch( 6, 1);279 pLayout->setRowStretch(7, 1); 256 280 257 281 /* Prepare path label: */ … … 311 335 pLayout->addWidget(m_pCheckBoxPermanent, 5, 1); 312 336 } 337 /* Prepare global check-box: */ 338 m_pCheckBoxGlobal = new QCheckBox(this); 339 if (m_pCheckBoxGlobal) 340 { 341 pLayout->addWidget(m_pCheckBoxGlobal, 6, 1); 342 } 313 343 314 344 /* Prepare button-box: */ … … 317 347 { 318 348 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 319 pLayout->addWidget(m_pButtonBox, 7, 0, 1, 2);349 pLayout->addWidget(m_pButtonBox, 8, 0, 1, 2); 320 350 } 321 351 } … … 335 365 this, &UISharedFolderDetailsEditor::sltValidate); 336 366 if (m_fUsePermanent) 367 { 337 368 connect(m_pCheckBoxPermanent, &QCheckBox::toggled, 338 369 this, &UISharedFolderDetailsEditor::sltValidate); 370 connect(m_pCheckBoxGlobal, &QCheckBox::toggled, 371 this, &UISharedFolderDetailsEditor::sltGlobalToggled); 372 } 339 373 if (m_pButtonBox) 340 374 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UISharedFolderDetailsEditor.h
r106061 r108046 95 95 bool isPermanent() const; 96 96 97 /** Defines whether folder is @a fGlobal. */ 98 void setGlobal(bool fGlobal); 99 /** Returns whether folder is global. */ 100 bool isGlobal() const; 101 97 102 private slots: 98 103 99 104 /** Handles translation event. */ 100 105 void sltRetranslateUI(); 106 /** Handles global/machine folder button visibility. */ 107 void sltGlobalToggled(); 101 108 /** Holds signal about folder path selected. */ 102 109 void sltSelectPath(); … … 143 150 /** Holds the permanent check-box instance. */ 144 151 QCheckBox *m_pCheckBoxPermanent; 152 /** Holds the global check-box instance. */ 153 QCheckBox *m_pCheckBoxGlobal; 145 154 /** Holds the button-box instance. */ 146 155 QIDialogButtonBox *m_pButtonBox; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UISharedFoldersEditor.cpp
r106061 r108046 466 466 const bool fAddEnabled = pCurrentItem; 467 467 const bool fRemoveEnabled = fAddEnabled && pCurrentItem->parent(); 468 SFTreeViewItem *pItem = static_cast<SFTreeViewItem*>(pCurrentItem); 469 const bool fEditEnabled = fRemoveEnabled && pItem->m_enmType != UISharedFolderType_Global; 468 470 m_pActionAdd->setEnabled(fAddEnabled); 469 m_pActionEdit->setEnabled(f RemoveEnabled);471 m_pActionEdit->setEnabled(fEditEnabled); 470 472 m_pActionRemove->setEnabled(fRemoveEnabled); 471 473 } … … 473 475 void UISharedFoldersEditor::sltHandleDoubleClick(QTreeWidgetItem *pItem) 474 476 { 475 const bool fEditEnabled = pItem && pItem->parent(); 477 SFTreeViewItem *pSFItem = static_cast<SFTreeViewItem*>(pItem); 478 const bool fEditEnabled = pItem 479 && pItem->parent() 480 && pSFItem->m_enmType != UISharedFolderType_Global; 476 481 if (fEditEnabled) 477 482 sltEditFolder(); … … 484 489 if (m_pTreeWidget->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable) 485 490 { 486 menu.addAction(m_pActionEdit); 491 SFTreeViewItem *pSFItem = static_cast<SFTreeViewItem*>(pItem); 492 if (pSFItem->m_enmType != UISharedFolderType_Global) 493 menu.addAction(m_pActionEdit); 487 494 menu.addAction(m_pActionRemove); 488 495 } … … 508 515 const QString strName = dlgFolderDetails.name(); 509 516 const QString strPath = dlgFolderDetails.path(); 510 const UISharedFolderType enmType = dlgFolderDetails.isPermanent() ? UISharedFolderType_Machine : UISharedFolderType_Console; 517 const UISharedFolderType enmType = dlgFolderDetails.isGlobal() 518 ? UISharedFolderType_Global 519 : dlgFolderDetails.isPermanent() 520 ? UISharedFolderType_Machine 521 : UISharedFolderType_Console; 511 522 /* Shared folder's name & path could not be empty: */ 512 523 Assert(!strName.isEmpty() && !strPath.isEmpty()); … … 546 557 dlgFolderDetails.setName(pItem->m_strName); 547 558 dlgFolderDetails.setPermanent(pItem->m_enmType == UISharedFolderType_Machine); 559 dlgFolderDetails.setGlobal(pItem->m_enmType == UISharedFolderType_Global); 548 560 dlgFolderDetails.setWriteable(pItem->m_fWritable); 549 561 dlgFolderDetails.setAutoMount(pItem->m_fAutoMount); … … 555 567 const QString strName = dlgFolderDetails.name(); 556 568 const QString strPath = dlgFolderDetails.path(); 557 const UISharedFolderType enmType = dlgFolderDetails.isPermanent() ? UISharedFolderType_Machine : UISharedFolderType_Console; 569 const UISharedFolderType enmType = dlgFolderDetails.isGlobal() 570 ? UISharedFolderType_Global 571 : dlgFolderDetails.isPermanent() 572 ? UISharedFolderType_Machine 573 : UISharedFolderType_Console; 558 574 /* Shared folder's name & path could not be empty: */ 559 575 Assert(!strName.isEmpty() && !strPath.isEmpty()); … … 751 767 switch (enmSharedFolderType) 752 768 { 769 case UISharedFolderType_Global: pRootItem->m_strName = tr(" Global Folders"); break; 753 770 case UISharedFolderType_Machine: pRootItem->m_strName = tr(" Machine Folders"); break; 754 771 case UISharedFolderType_Console: pRootItem->m_strName = tr(" Transient Folders"); break; … … 766 783 void UISharedFoldersEditor::updateRootItemsVisibility() 767 784 { 785 /* Update (show/hide) global root item: */ 786 setRootItemVisible(UISharedFolderType_Global, m_foldersAvailable.value(UISharedFolderType_Global)); 768 787 /* Update (show/hide) machine (permanent) root item: */ 769 788 setRootItemVisible(UISharedFolderType_Machine, m_foldersAvailable.value(UISharedFolderType_Machine)); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r107478 r108046 31 31 /* GUI includes: */ 32 32 #include "UIErrorString.h" 33 #include "UIGlobalSession.h" 33 34 #include "UIMachineSettingsSF.h" 34 35 #include "UISharedFoldersEditor.h" … … 106 107 /* Get actual folders: */ 107 108 QMultiMap<UISharedFolderType, CSharedFolder> folders; 109 /* Load global folders: */ 110 if (isSharedFolderTypeSupported(UISharedFolderType_Global)) 111 { 112 foreach (const CSharedFolder &folder, getSharedFolders(UISharedFolderType_Global)) 113 folders.insert(UISharedFolderType_Global, folder); 114 } 108 115 /* Load machine (permanent) folders if allowed: */ 109 116 if (isSharedFolderTypeSupported(UISharedFolderType_Machine)) … … 215 222 /* Polish availability: */ 216 223 m_pEditorSharedFolders->setFeatureAvailable(isMachineInValidMode()); 224 m_pEditorSharedFolders->setFoldersAvailable(UISharedFolderType_Global, isSharedFolderTypeSupported(UISharedFolderType_Global)); 217 225 m_pEditorSharedFolders->setFoldersAvailable(UISharedFolderType_Machine, isSharedFolderTypeSupported(UISharedFolderType_Machine)); 218 226 m_pEditorSharedFolders->setFoldersAvailable(UISharedFolderType_Console, isSharedFolderTypeSupported(UISharedFolderType_Console)); … … 264 272 switch (enmSharedFolderType) 265 273 { 274 case UISharedFolderType_Global: return true; 266 275 case UISharedFolderType_Machine: return isMachineInValidMode(); 267 276 case UISharedFolderType_Console: return isMachineOnline(); … … 289 298 switch (enmFoldersType) 290 299 { 300 case UISharedFolderType_Global: 301 { 302 /* Load global folders: */ 303 CVirtualBox vbox = gpGlobalSession->virtualBox(); 304 folders = vbox.GetSharedFolders(); 305 fSuccess = vbox.isOk(); 306 307 /* Show error message if necessary: */ 308 if (!fSuccess) 309 notifyOperationProgressError(UIErrorString::formatErrorInfo(vbox)); 310 311 break; 312 } 291 313 case UISharedFolderType_Machine: 292 314 { … … 413 435 switch (enmFoldersType) 414 436 { 437 case UISharedFolderType_Global: 438 { 439 /* Remove existing folder: */ 440 CVirtualBox vbox = gpGlobalSession->virtualBox(); 441 vbox.RemoveSharedFolder(strFolderName); 442 fSuccess = vbox.isOk(); 443 if (!fSuccess) 444 { 445 /* Show error message: */ 446 notifyOperationProgressError(UIErrorString::formatErrorInfo(vbox)); 447 } 448 break; 449 } 415 450 case UISharedFolderType_Machine: 416 451 { … … 474 509 switch (enmFoldersType) 475 510 { 511 case UISharedFolderType_Global: 512 { 513 /* Create new folder: */ 514 CVirtualBox vbox = gpGlobalSession->virtualBox(); 515 vbox.CreateSharedFolder(strFolderName, strFolderPath, fIsWritable, fIsAutoMount, strAutoMountPoint); 516 /* Show error if the operation failed: */ 517 fSuccess = vbox.isOk(); 518 if (!fSuccess) 519 notifyOperationProgressError(UIErrorString::formatErrorInfo(vbox)); 520 break; 521 } 476 522 case UISharedFolderType_Machine: 477 523 {
Note:
See TracChangeset
for help on using the changeset viewer.