File indexing completed on 2024-05-12 05:00:04
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2023 Stefano Crocco <stefano.crocco@alice.it> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "downloaderextension.h" 0008 #include "common.h" 0009 0010 #include <KIO/JobUiDelegateFactory> 0011 #include <KJobTrackerInterface> 0012 #include <KIO/JobTracker> 0013 #include <KJobWidgets> 0014 0015 using namespace KonqInterfaces; 0016 0017 DownloaderExtension::DownloaderExtension(QObject* parent) : QObject(parent) 0018 { 0019 } 0020 0021 DownloaderExtension::~DownloaderExtension() 0022 { 0023 } 0024 0025 DownloaderExtension * DownloaderExtension::downloader(QObject* obj) 0026 { 0027 return as<DownloaderExtension>(obj); 0028 } 0029 0030 DownloaderJob::DownloaderJob(QObject* parent) : KJob(parent) 0031 { 0032 } 0033 0034 void KonqInterfaces::DownloaderJob::prepareDownloadJob(QWidget* widget, const QString& destPath) 0035 { 0036 if (!destPath.isEmpty()) { 0037 setDownloadPath(destPath); 0038 } 0039 setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget)); 0040 KJobWidgets::setWindow(this, widget); 0041 KJobTrackerInterface *t = KIO::getJobTracker(); 0042 if (t) { 0043 t->registerJob(this); 0044 } 0045 }