From 361741d677f5646fe339e5ba11ce9e99d9d2266b Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 26 Feb 2024 15:44:44 +0300 Subject: [PATCH] Correctly adjust "Add New torrent" dialog position in all the cases PR #20457. Closes #20449. --- src/gui/addnewtorrentdialog.cpp | 8 +++----- src/gui/search/searchjobwidget.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index e9331a654..b901538f1 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -551,7 +551,10 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre // Qt::Window is required to avoid showing only two dialog on top (see #12852). // Also improves the general convenience of adding multiple torrents. if (!attached) + { dlg->setWindowFlags(Qt::Window); + adjustDialogGeometry(dlg, parent); + } dlg->setAttribute(Qt::WA_DeleteOnClose); if (Net::DownloadManager::hasSupportedScheme(source)) @@ -570,14 +573,9 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre : dlg->loadTorrentFile(source); if (isLoaded) - { - adjustDialogGeometry(dlg, parent); dlg->QDialog::show(); - } else - { delete dlg; - } } void AddNewTorrentDialog::show(const QString &source, QWidget *parent) diff --git a/src/gui/search/searchjobwidget.cpp b/src/gui/search/searchjobwidget.cpp index c3a8c1815..e40863526 100644 --- a/src/gui/search/searchjobwidget.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -292,7 +292,7 @@ void SearchJobWidget::addTorrentToSession(const QString &source, const AddTorren if (source.isEmpty()) return; if ((option == AddTorrentOption::ShowDialog) || ((option == AddTorrentOption::Default) && AddNewTorrentDialog::isEnabled())) - AddNewTorrentDialog::show(source, this); + AddNewTorrentDialog::show(source, window()); else BitTorrent::Session::instance()->addTorrent(source); }