Improve .torrent associate handling

* Use correct pointer type in NSIS scripts
* Only remove qbt specific registry keys when uninstalling or disassociating
* Set .torrent Content Type when associating .torrent format
* Move ".torrent association" functions to Utils::OS class

PR #19709.
This commit is contained in:
Chocobo1 2023-10-16 14:51:17 +08:00 committed by GitHub
parent 90e023f138
commit cba433823f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 276 additions and 185 deletions

View file

@ -99,6 +99,10 @@
#include "gui/uithememanager.h"
#include "gui/utils.h"
#include "gui/windowstate.h"
#ifdef Q_OS_WIN
#include "base/utils/os.h"
#endif // Q_OS_WIN
#endif // DISABLE_GUI
#ifndef DISABLE_WEBUI
@ -883,14 +887,14 @@ int Application::exec()
delete m_startupProgressDialog;
#ifdef Q_OS_WIN
auto *pref = Preferences::instance();
if (!pref->neverCheckFileAssoc() && (!Preferences::isTorrentFileAssocSet() || !Preferences::isMagnetLinkAssocSet()))
if (!pref->neverCheckFileAssoc() && (!Utils::OS::isTorrentFileAssocSet() || !Utils::OS::isMagnetLinkAssocSet()))
{
if (QMessageBox::question(m_window, tr("Torrent file association")
, tr("qBittorrent is not the default application for opening torrent files or Magnet links.\nDo you want to make qBittorrent the default application for these?")
, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
{
pref->setTorrentFileAssoc(true);
pref->setMagnetLinkAssoc(true);
Utils::OS::setTorrentFileAssoc(true);
Utils::OS::setMagnetLinkAssoc(true);
}
else
{