File indexing completed on 2024-07-14 03:54:25

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis@kde.org>
0004     SPDX-FileCopyrightText: 2000 Carsten Pfeiffer <pfeiffer@kde.org>
0005     SPDX-FileCopyrightText: 2003-2005 David Faure <faure@kde.org>
0006     SPDX-FileCopyrightText: 2001-2006 Michael Brade <brade@kde.org>
0007 
0008     SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #include "kdirlister.h"
0012 #include <KJobUiDelegate>
0013 #include <KJobWidgets>
0014 #include <kio/listjob.h>
0015 
0016 #include <QWidget>
0017 
0018 class KDirListerPrivate
0019 {
0020 public:
0021     KDirListerPrivate()
0022     {
0023     }
0024 
0025     QWidget *m_window = nullptr; // Main window this lister is associated with
0026 };
0027 
0028 KDirLister::KDirLister(QObject *parent)
0029     : KCoreDirLister(parent)
0030     , d(new KDirListerPrivate)
0031 {
0032 }
0033 
0034 KDirLister::~KDirLister()
0035 {
0036 }
0037 
0038 bool KDirLister::autoErrorHandlingEnabled() const
0039 {
0040     return KCoreDirLister::autoErrorHandlingEnabled();
0041 }
0042 
0043 void KDirLister::setMainWindow(QWidget *window)
0044 {
0045     d->m_window = window;
0046 }
0047 
0048 QWidget *KDirLister::mainWindow()
0049 {
0050     return d->m_window;
0051 }
0052 
0053 void KDirLister::jobStarted(KIO::ListJob *job)
0054 {
0055     if (d->m_window) {
0056         KJobWidgets::setWindow(job, d->m_window);
0057     }
0058 }
0059 
0060 #include "moc_kdirlister.cpp"