File indexing completed on 2025-01-19 12:45:16
0001 /* 0002 * kdiskfreespace.h 0003 * 0004 * Copyright 2007 David Faure <faure@kde.org> 0005 * Copyright 2008 Dirk Mueller <mueller@kde.org> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License version 2 as published by the Free Software Foundation. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KDISKFREESP_H 0023 #define KDISKFREESP_H 0024 0025 #include <QObject> 0026 #include <QString> 0027 0028 #include <kdelibs4support_export.h> 0029 0030 /** 0031 * \deprecated Use KDiskFreeSpaceInfo 0032 */ 0033 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDiskFreeSpace : public QObject 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 0039 /** 0040 * Constructor 0041 */ 0042 KDELIBS4SUPPORT_DEPRECATED explicit KDiskFreeSpace(QObject *parent = nullptr); 0043 0044 /** 0045 * Destructor - this object autodeletes itself when it's done 0046 */ 0047 ~KDiskFreeSpace() override; 0048 0049 /** 0050 * Call this to fire a search on the disk usage information 0051 * for @p mountPoint. 0052 * The foundMountPoint() signal will be emitted 0053 * if this mount point is found, with the info requested. 0054 * The done() signal is emitted in any case. 0055 * 0056 * @return true if the request could be handled, false if another 0057 * request is happening already. readDF() can only be called once 0058 * on a given instance of KDiskFreeSpace, given that it handles only 0059 * the request for one mount point and then auto-deletes itself. 0060 * Suicidal objects are not reusable... 0061 */ 0062 bool readDF(const QString &mountPoint); 0063 0064 /** 0065 * Call this to fire a search on the disk usage information 0066 * for the mount point containing @p path. 0067 * The foundMountPoint() signal will be emitted 0068 * if this mount point is found, with the info requested. 0069 * The done() signal is emitted in any case. 0070 */ 0071 static KDiskFreeSpace *findUsageInfo(const QString &path); 0072 0073 Q_SIGNALS: 0074 /** 0075 * Emitted when the information about the requested mount point was found. 0076 * @param mountPoint the requested mount point 0077 * @param kibSize the total size of the partition in KiB 0078 * @param kibUsed the amount of KiB being used on the partition 0079 * @param kibAvail the available space on the partition in KiB 0080 */ 0081 void foundMountPoint(const QString &mountPoint, quint64 kibSize, quint64 kibUsed, quint64 kibAvail); 0082 0083 /** 0084 * Emitted when the request made via readDF is over, whether foundMountPoint was emitted or not. 0085 */ 0086 void done(); 0087 0088 private: 0089 class Private; 0090 Private *const d; 0091 0092 Q_PRIVATE_SLOT(d, bool _k_calculateFreeSpace()) 0093 }; 0094 0095 #endif