diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2019-02-19 10:33:05 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2019-02-19 10:33:05 +0000 |
commit | b72f0e6d559845947d7810eb4800a851db8cb088 (patch) | |
tree | 817000e29accd560fc4593a861290202f3e1cd7a /src/VBox/Frontends | |
parent | 9712175bcc1d5e3094a18a6458d348ab823ce4aa (diff) | |
download | VirtualBox-svn-b72f0e6d559845947d7810eb4800a851db8cb088.tar.gz |
FE/Qt: bugref:9340. Updating recently used medium lists, and media folder lists.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@77356 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Frontends')
3 files changed, 18 insertions, 16 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp index 8b7c962c8f3..94567b48a14 100644 --- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp +++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp @@ -2548,8 +2548,6 @@ QUuid VBoxGlobal::openMedium(UIMediumDeviceType enmMediumType, QString strMedium /* Initialize variables: */ CVirtualBox comVBox = virtualBox(); - updateRecentlyUsedMediumListAndFolder(enmMediumType, strMediumLocation); - /* Open corresponding medium: */ CMedium comMedium = comVBox.OpenMedium(strMediumLocation, mediumTypeToGlobal(enmMediumType), KAccessMode_ReadWrite, false); @@ -2636,8 +2634,11 @@ QUuid VBoxGlobal::openMediumWithFileOpenDialog(UIMediumDeviceType enmMediumType, /* If dialog has some result: */ if (!files.empty() && !files[0].isEmpty()) - return openMedium(enmMediumType, files[0], pParent); - + { + QUuid uMediumId = openMedium(enmMediumType, files[0], pParent); + updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location()); + return uMediumId; + } return QUuid(); } @@ -2693,6 +2694,8 @@ QUuid VBoxGlobal::openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType default: break; } + if (!uMediumId.isNull()) + updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location()); return uMediumId; } @@ -2828,7 +2831,10 @@ int VBoxGlobal::openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType e if (selectedMediumIds.isEmpty()) returnCode = UIMediumSelector::ReturnCode_Rejected; else + { outUuid = selectedMediumIds[0]; + updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(outUuid).location()); + } } delete pSelector; return static_cast<int>(returnCode); diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp index eb11c580c8e..efef60a8987 100644 --- a/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp +++ b/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp @@ -216,8 +216,6 @@ void UIFDCreationDialog::accept() /* Notify VBoxGlobal about the new medium: */ vboxGlobal().createMedium(UIMedium(newMedium, UIMediumDeviceType_Floppy, KMediumState_Created)); - /* Update the recently used media list: */ - vboxGlobal().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_Floppy, strMediumLocation); /* After a successful creation and initilization of the floppy disk we call base class accept effectively closing this dialog: */ diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp index 6d2c2f7ad1b..2a287b71dd7 100644 --- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp +++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp @@ -442,22 +442,20 @@ void UIMediumSelector::sltAddMedium() return; repopulateTreeWidget(); selectMedium(uMediumID); - } void UIMediumSelector::sltCreateMedium() { QUuid uMediumId = vboxGlobal().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder, m_strMachineName, m_strMachineGuestOSTypeId); - if (!uMediumId.isNull()) - { - /* Update the tree widget making sure we show the new item: */ - repopulateTreeWidget(); - /* Select the new item: */ - selectMedium(uMediumId); - /* Update the search: */ - m_pSearchWidget->search(m_pTreeWidget); - } + if (uMediumId.isNull()) + return; + /* Update the tree widget making sure we show the new item: */ + repopulateTreeWidget(); + /* Select the new item: */ + selectMedium(uMediumId); + /* Update the search: */ + m_pSearchWidget->search(m_pTreeWidget); } void UIMediumSelector::sltHandleItemSelectionChanged() |