File indexing completed on 2024-12-01 03:41:13
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org> 0004 SPDX-FileCopyrightText: 2001, 2002, 2004-2006 Michael Brade <brade@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef kdirlister_h 0010 #define kdirlister_h 0011 0012 #include "kiowidgets_export.h" 0013 #include <kcoredirlister.h> 0014 0015 class QWidget; 0016 class KDirListerPrivate; 0017 0018 /** 0019 * @class KDirLister kdirlister.h <KDirLister> 0020 * 0021 * Subclass of KCoreDirLister which uses QWidgets to show error messages 0022 * and to associate jobs with windows. 0023 */ 0024 class KIOWIDGETS_EXPORT KDirLister : public KCoreDirLister 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 /** 0030 * Create a directory lister. 0031 */ 0032 explicit KDirLister(QObject *parent = nullptr); 0033 0034 /** 0035 * Destroy the directory lister. 0036 */ 0037 ~KDirLister() override; 0038 0039 /** 0040 * Check whether auto error handling is enabled. 0041 * If enabled, it will show an error dialog to the user when an 0042 * error occurs. It is turned on by default. 0043 * @return true if auto error handling is enabled, false otherwise 0044 * @see setAutoErrorHandlingEnabled() 0045 */ 0046 bool autoErrorHandlingEnabled() const; // KF6 remove, already provided by KCoreDirLister 0047 0048 /** 0049 * Pass the main window this object is associated with 0050 * this is used for caching authentication data 0051 * @param window the window to associate with, @c nullptr to disassociate 0052 */ 0053 void setMainWindow(QWidget *window); 0054 0055 /** 0056 * Returns the main window associated with this object. 0057 * @return the associated main window, or @c nullptr if there is none 0058 */ 0059 QWidget *mainWindow(); 0060 0061 protected: 0062 /** 0063 * Reimplemented to associate a window with new jobs 0064 * @reimp 0065 */ 0066 void jobStarted(KIO::ListJob *) override; 0067 0068 private: 0069 friend class KDirListerPrivate; 0070 std::unique_ptr<KDirListerPrivate> d; 0071 }; 0072 0073 #endif