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 kdirlister.h <KDirLister> |
20 | * |
21 | * Subclass of KCoreDirLister which uses QWidgets to show error messages |
22 | * and to associate jobs with windows. |
23 | */ |
24 | class KIOWIDGETS_EXPORT KDirLister : public KCoreDirLister |
25 | { |
26 | Q_OBJECT |
27 | |
28 | public: |
29 | /** |
30 | * Create a directory lister. |
31 | */ |
32 | explicit KDirLister(QObject *parent = nullptr); |
33 | |
34 | /** |
35 | * Destroy the directory lister. |
36 | */ |
37 | ~KDirLister() override; |
38 | |
39 | /** |
40 | * Check whether auto error handling is enabled. |
41 | * If enabled, it will show an error dialog to the user when an |
42 | * error occurs. It is turned on by default. |
43 | * @return true if auto error handling is enabled, false otherwise |
44 | * @see setAutoErrorHandlingEnabled() |
45 | */ |
46 | bool autoErrorHandlingEnabled() const; // KF6 remove, already provided by KCoreDirLister |
47 | |
48 | /** |
49 | * Pass the main window this object is associated with |
50 | * this is used for caching authentication data |
51 | * @param window the window to associate with, @c nullptr to disassociate |
52 | */ |
53 | void setMainWindow(QWidget *window); |
54 | |
55 | /** |
56 | * Returns the main window associated with this object. |
57 | * @return the associated main window, or @c nullptr if there is none |
58 | */ |
59 | QWidget *mainWindow(); |
60 | |
61 | protected: |
62 | /** |
63 | * Reimplemented to associate a window with new jobs |
64 | * @reimp |
65 | */ |
66 | void jobStarted(KIO::ListJob *) override; |
67 | |
68 | private: |
69 | friend class KDirListerPrivate; |
70 | std::unique_ptr<KDirListerPrivate> d; |
71 | }; |
72 | |
73 | #endif |
74 | |