File vb-6.1.16-modal-dialog-parent.patch of Package virtualbox

Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
@@ -16,6 +16,7 @@
  */
 
 /* Qt includes: */
+#include <QApplication>
 #include <QHeaderView>
 #include <QMenu>
 #ifdef VBOX_WS_WIN
@@ -295,7 +296,7 @@ void UIGlobalSettingsExtension::sltAddPa
         extensions << QString("*.%1").arg(VBoxExtPackFileExts[i]);
     const QString strFilter = tr("Extension package files (%1)").arg(extensions.join(" "));
 
-    const QStringList fileNames = QIFileDialog::getOpenFileNames(strBaseFolder, strFilter, this, strTitle, 0, true, true);
+    const QStringList fileNames = QIFileDialog::getOpenFileNames(strBaseFolder, strFilter, QApplication::activeWindow(), strTitle, 0, true, true);
 
     QString strFilePath;
     if (!fileNames.isEmpty())
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
@@ -397,10 +397,10 @@ void UIFilePathSelector::selectPath()
     switch (m_enmMode)
     {
         case Mode_File_Open:
-            strSelPath = QIFileDialog::getOpenFileName(strInitDir, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle); break;
+            strSelPath = QIFileDialog::getOpenFileName(strInitDir, m_strFileDialogFilters, QApplication::activeWindow(), m_strFileDialogTitle); break;
         case Mode_File_Save:
         {
-            strSelPath = QIFileDialog::getSaveFileName(strInitDir, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle);
+            strSelPath = QIFileDialog::getSaveFileName(strInitDir, m_strFileDialogFilters, QApplication::activeWindow(), m_strFileDialogTitle);
             if (!strSelPath.isEmpty() && QFileInfo(strSelPath).suffix().isEmpty())
             {
                 if (m_strFileDialogDefaultSaveExtension.isEmpty())
@@ -411,7 +411,7 @@ void UIFilePathSelector::selectPath()
             break;
         }
         case Mode_Folder:
-            strSelPath = QIFileDialog::getExistingDirectory(strInitDir, parentWidget(), m_strFileDialogTitle); break;
+            strSelPath = QIFileDialog::getExistingDirectory(strInitDir, QApplication::activeWindow(), m_strFileDialogTitle); break;
     }
 
     /* Do nothing if nothing chosen: */
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UIEmptyFilePathSelector.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/widgets/UIEmptyFilePathSelector.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UIEmptyFilePathSelector.cpp
@@ -232,16 +232,16 @@ void UIEmptyFilePathSelector::choose()
     switch (mMode)
     {
         case UIEmptyFilePathSelector::Mode_File_Open:
-            path = QIFileDialog::getOpenFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); break;
+            path = QIFileDialog::getOpenFileName (initDir, mFileFilters, QApplication::activeWindow(), mFileDialogTitle); break;
         case UIEmptyFilePathSelector::Mode_File_Save:
         {
-            path = QIFileDialog::getSaveFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle);
+            path = QIFileDialog::getSaveFileName (initDir, mFileFilters, QApplication::activeWindow(), mFileDialogTitle);
             if (!path.isEmpty() && QFileInfo (path).suffix().isEmpty())
                 path = QString ("%1.%2").arg (path).arg (mDefaultSaveExt);
             break;
         }
         case UIEmptyFilePathSelector::Mode_Folder:
-            path = QIFileDialog::getExistingDirectory (initDir, parentWidget(), mFileDialogTitle); break;
+            path = QIFileDialog::getExistingDirectory (initDir, QApplication::activeWindow(), mFileDialogTitle); break;
     }
     if (path.isEmpty())
         return;
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
@@ -438,7 +438,7 @@ void UIMediumSelector::sltButtonLeaveEmp
 
 void UIMediumSelector::sltAddMedium()
 {
-    QUuid uMediumID = uiCommon().openMediumWithFileOpenDialog(m_enmMediumType, this, m_strMachineFolder);
+    QUuid uMediumID = uiCommon().openMediumWithFileOpenDialog(m_enmMediumType, QApplication::activeWindow(), m_strMachineFolder);
     if (uMediumID.isNull())
         return;
     repopulateTreeWidget();
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
@@ -3197,7 +3197,7 @@ void UICommon::updateMachineStorage(cons
                 }
                 else if (target.type == UIMediumTarget::UIMediumTargetType_WithFileDialog)
                 {
-                    uMediumID = openMediumWithFileOpenDialog(target.mediumType, windowManager().mainWindowShown(),
+                    uMediumID = openMediumWithFileOpenDialog(target.mediumType, QApplication::activeWindow(),
                                                              strMachineFolder, false /* fUseLastFolder */);
                 }
                 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO)
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
@@ -486,7 +486,7 @@ void UIMediumManagerWidget::sltHandleMac
 void UIMediumManagerWidget::sltAddMedium()
 {
     QString strDefaultMachineFolder = uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder();
-    uiCommon().openMediumWithFileOpenDialog(currentMediumType(), this,
+    uiCommon().openMediumWithFileOpenDialog(currentMediumType(), QApplication::activeWindow(),
                                               strDefaultMachineFolder, true /* use most recent medium folder */);
 }
 
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
@@ -3958,7 +3958,7 @@ void UIMachineSettingsStorage::sltChoose
 {
     const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
 
-    QUuid uMediumId = uiCommon().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder);
+    QUuid uMediumId = uiCommon().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), QApplication::activeWindow(), strMachineFolder);
     if (uMediumId.isNull())
         return;
     m_pMediumIdHolder->setId(uMediumId);
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
@@ -1176,7 +1176,7 @@ void UIExtraDataManagerWindow::sltSave()
     /* Compose initial file-name: */
     const QString strInitialFileName = QDir(uiCommon().homeFolder()).absoluteFilePath(QString("%1_ExtraData.xml").arg(currentChooserName()));
     /* Open file-save dialog to choose file to save extra-data into: */
-    const QString strFileName = QIFileDialog::getSaveFileName(strInitialFileName, "XML files (*.xml)", this,
+    const QString strFileName = QIFileDialog::getSaveFileName(strInitialFileName, "XML files (*.xml)", QApplication::activeWindow(),
                                                               "Choose file to save extra-data into..", 0, true, true);
     /* Make sure file-name was chosen: */
     if (strFileName.isEmpty())
@@ -1263,7 +1263,7 @@ void UIExtraDataManagerWindow::sltLoad()
     /* Compose initial file-name: */
     const QString strInitialFileName = QDir(uiCommon().homeFolder()).absoluteFilePath(QString("%1_ExtraData.xml").arg(currentChooserName()));
     /* Open file-open dialog to choose file to open extra-data into: */
-    const QString strFileName = QIFileDialog::getOpenFileName(strInitialFileName, "XML files (*.xml)", this,
+    const QString strFileName = QIFileDialog::getOpenFileName(strInitialFileName, "XML files (*.xml)", QApplication::activeWindow(),
                                                               "Choose file to load extra-data from..");
     /* Make sure file-name was chosen: */
     if (strFileName.isEmpty())
Index: VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
===================================================================
--- VirtualBox-6.1.18.orig/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
+++ VirtualBox-6.1.18/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
@@ -78,7 +78,7 @@ void UITextEditor::retranslateUi()
 
 void UITextEditor::open()
 {
-    QString fileName = QIFileDialog::getOpenFileName(uiCommon().documentsPath(), tr("Text (*.txt);;All (*.*)"), this, tr("Select a file to open..."));
+    QString fileName = QIFileDialog::getOpenFileName(uiCommon().documentsPath(), tr("Text (*.txt);;All (*.*)"), QApplication::activeWindow(), tr("Select a file to open..."));
     if (!fileName.isEmpty())
     {
         QFile file(fileName);
openSUSE Build Service is sponsored by