summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VirtualBox
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-02-19 11:16:35 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-02-19 11:16:35 +0000
commitb635d534ae17740f3906bce7b3bb1892c1b12731 (patch)
tree697cfd70defe001e85cece75368b2305de720f68 /src/VBox/Frontends/VirtualBox
parent2d785336988bc82fa49b69c67c78fdb16231e23e (diff)
downloadVirtualBox-svn-b635d534ae17740f3906bce7b3bb1892c1b12731.tar.gz
FE/Qt: bugref:9340. Dont use/update recent medium list for hard disk when there is a vm content.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@77359 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Frontends/VirtualBox')
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp18
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp3
2 files changed, 17 insertions, 4 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
index 94567b48a14..c67c1fbdff5 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
@@ -2585,6 +2585,11 @@ QUuid VBoxGlobal::openMediumWithFileOpenDialog(UIMediumDeviceType enmMediumType,
QString strTitle;
QString allType;
QString strLastFolder = defaultFolderPathForType(enmMediumType);
+
+ /* For DVDs and Floppies always check first the last recently used medium folder. For hard disk use
+ the caller's setting: */
+ fUseLastFolder = (enmMediumType == UIMediumDeviceType_DVD) || (enmMediumType == UIMediumDeviceType_Floppy);
+
switch (enmMediumType)
{
case UIMediumDeviceType_HardDisk:
@@ -2636,7 +2641,9 @@ QUuid VBoxGlobal::openMediumWithFileOpenDialog(UIMediumDeviceType enmMediumType,
if (!files.empty() && !files[0].isEmpty())
{
QUuid uMediumId = openMedium(enmMediumType, files[0], pParent);
- updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location());
+ if (enmMediumType == UIMediumDeviceType_DVD || enmMediumType == UIMediumDeviceType_Floppy ||
+ (enmMediumType == UIMediumDeviceType_HardDisk && fUseLastFolder))
+ updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location());
return uMediumId;
}
return QUuid();
@@ -2695,8 +2702,13 @@ QUuid VBoxGlobal::openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType
break;
}
if (!uMediumId.isNull())
- updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location());
-
+ {
+ /* Update the recent medium list only if the mdium type is DVD or floppy. In case of hard disk
+ update those only if there is no vm context: */
+ if (enmMediumType == UIMediumDeviceType_DVD || enmMediumType == UIMediumDeviceType_Floppy ||
+ (enmMediumType == UIMediumDeviceType_HardDisk && strMachineName.isEmpty()))
+ updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location());
+ }
return uMediumId;
}
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
index 5497ba9a96a..b467365b93e 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
@@ -488,7 +488,8 @@ void UIMediumManagerWidget::sltHandleMediumEnumerationFinish()
void UIMediumManagerWidget::sltAddMedium()
{
QString strDefaultMachineFolder = vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder();
- vboxGlobal().openMediumWithFileOpenDialog(currentMediumType(), this, strDefaultMachineFolder);
+ vboxGlobal().openMediumWithFileOpenDialog(currentMediumType(), this,
+ strDefaultMachineFolder, true /* use most recent medium folder */);
}
void UIMediumManagerWidget::sltCreateMedium()