Correctly adjust "Add New torrent" dialog position in all the cases

PR #20457.
Closes #20449.
This commit is contained in:
Vladimir Golovnev 2024-02-26 15:44:44 +03:00 committed by GitHub
parent cfa7a6db46
commit 361741d677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View file

@ -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)

View file

@ -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);
}