| 1 | /* |
| 2 | This file is part of the KDE project |
| 3 | SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org> |
| 4 | SPDX-FileCopyrightText: 2001, 2002, 2004-2006 Michael Brade <brade@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef kdirlister_h |
| 10 | #define kdirlister_h |
| 11 | |
| 12 | #include "kiowidgets_export.h" |
| 13 | #include <kcoredirlister.h> |
| 14 | |
| 15 | class QWidget; |
| 16 | class KDirListerPrivate; |
| 17 | |
| 18 | /*! |
| 19 | * \class KDirLister |
| 20 | * \inmodule KIOWidgets |
| 21 | * |
| 22 | * \brief Subclass of KCoreDirLister which uses QWidgets to show error messages |
| 23 | * and to associate jobs with windows. |
| 24 | */ |
| 25 | class KIOWIDGETS_EXPORT KDirLister : public KCoreDirLister |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | |
| 29 | public: |
| 30 | /*! |
| 31 | * Create a directory lister. |
| 32 | */ |
| 33 | explicit KDirLister(QObject *parent = nullptr); |
| 34 | |
| 35 | /*! |
| 36 | * Destroy the directory lister. |
| 37 | */ |
| 38 | ~KDirLister() override; |
| 39 | |
| 40 | /*! |
| 41 | * Check whether auto error handling is enabled. |
| 42 | * If enabled, it will show an error dialog to the user when an |
| 43 | * error occurs. It is turned on by default. |
| 44 | * |
| 45 | * Returns \c true if auto error handling is enabled, \c false otherwise |
| 46 | * \sa setAutoErrorHandlingEnabled() |
| 47 | */ |
| 48 | bool autoErrorHandlingEnabled() const; // KF6 remove, already provided by KCoreDirLister |
| 49 | |
| 50 | /*! |
| 51 | * Pass the main window this object is associated with |
| 52 | * this is used for caching authentication data |
| 53 | * |
| 54 | * \a window the window to associate with, \c nullptr to disassociate |
| 55 | */ |
| 56 | void setMainWindow(QWidget *window); |
| 57 | |
| 58 | /*! |
| 59 | * Returns the main window associated with this object, or \c nullptr if there is none |
| 60 | */ |
| 61 | QWidget *mainWindow(); |
| 62 | |
| 63 | protected: |
| 64 | void jobStarted(KIO::ListJob *) override; |
| 65 | |
| 66 | private: |
| 67 | friend class KDirListerPrivate; |
| 68 | std::unique_ptr<KDirListerPrivate> d; |
| 69 | }; |
| 70 | |
| 71 | #endif |
| 72 | |