mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
Move Utils::Misc::isUrl() function
All usage of this function gets to call Net::DownloadManager eventually.
This commit is contained in:
@@ -231,7 +231,7 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
|
||||
{
|
||||
AddNewTorrentDialog *dlg = new AddNewTorrentDialog(inParams, parent);
|
||||
|
||||
if (Utils::Misc::isUrl(source)) {
|
||||
if (Net::DownloadManager::hasSupportedScheme(source)) {
|
||||
// Launch downloader
|
||||
// TODO: Don't save loaded torrent to file, just use downloaded data!
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/rss/rss_folder.h"
|
||||
#include "base/rss/rss_session.h"
|
||||
@@ -1295,7 +1296,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
for (const QString &file : asConst(files)) {
|
||||
const bool isTorrentLink = (file.startsWith("magnet:", Qt::CaseInsensitive)
|
||||
|| file.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive)
|
||||
|| Utils::Misc::isUrl(file));
|
||||
|| Net::DownloadManager::hasSupportedScheme(file));
|
||||
if (isTorrentLink)
|
||||
torrentFiles << file;
|
||||
else
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include "base/rss/rss_feed.h"
|
||||
#include "base/rss/rss_folder.h"
|
||||
#include "base/rss/rss_session.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "articlelistwidget.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
@@ -249,7 +248,7 @@ void RSSWidget::on_newFeedButton_clicked()
|
||||
{
|
||||
// Ask for feed URL
|
||||
const QString clipText = qApp->clipboard()->text();
|
||||
const QString defaultURL = (Utils::Misc::isUrl(clipText) ? clipText : "http://");
|
||||
const QString defaultURL = Net::DownloadManager::hasSupportedScheme(clipText) ? clipText : "http://";
|
||||
|
||||
bool ok;
|
||||
QString newURL = AutoExpandableDialog::getText(
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "pluginsourcedialog.h"
|
||||
@@ -337,7 +336,7 @@ void PluginSelectDialog::askForPluginUrl()
|
||||
bool ok = false;
|
||||
QString clipTxt = qApp->clipboard()->text();
|
||||
QString defaultUrl = "http://";
|
||||
if (Utils::Misc::isUrl(clipTxt) && clipTxt.endsWith(".py"))
|
||||
if (Net::DownloadManager::hasSupportedScheme(clipTxt) && clipTxt.endsWith(".py"))
|
||||
defaultUrl = clipTxt;
|
||||
QString url = AutoExpandableDialog::getText(
|
||||
this, tr("New search engine plugin URL"),
|
||||
|
||||
Reference in New Issue
Block a user