1/*
2 * kdiskfreespace.h
3 *
4 * Copyright 2007 David Faure <faure@kde.org>
5 * Copyright 2008 Dirk Mueller <mueller@kde.org>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License version 2 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22
23#ifndef KDISKFREESP_H
24#define KDISKFREESP_H
25
26#include <QtCore/QObject>
27#include <QtCore/QString>
28
29#include <kio/kio_export.h>
30
31/**
32 * \deprecated Use KDiskFreeSpaceInfo
33 */
34class KIO_EXPORT_DEPRECATED KDiskFreeSpace : public QObject
35{
36 Q_OBJECT
37
38public:
39
40 /**
41 * Constructor
42 */
43 explicit KDiskFreeSpace( QObject *parent = 0 );
44
45 /**
46 * Destructor - this object autodeletes itself when it's done
47 */
48 ~KDiskFreeSpace();
49
50 /**
51 * Call this to fire a search on the disk usage information
52 * for @p mountPoint.
53 * The foundMountPoint() signal will be emitted
54 * if this mount point is found, with the info requested.
55 * The done() signal is emitted in any case.
56 *
57 * @return true if the request could be handled, false if another
58 * request is happening already. readDF() can only be called once
59 * on a given instance of KDiskFreeSpace, given that it handles only
60 * the request for one mount point and then auto-deletes itself.
61 * Suicidal objects are not reusable...
62 */
63 bool readDF( const QString & mountPoint );
64
65 /**
66 * Call this to fire a search on the disk usage information
67 * for the mount point containing @p path.
68 * The foundMountPoint() signal will be emitted
69 * if this mount point is found, with the info requested.
70 * The done() signal is emitted in any case.
71 */
72 static KDiskFreeSpace * findUsageInfo( const QString & path );
73
74Q_SIGNALS:
75 /**
76 * Emitted when the information about the requested mount point was found.
77 * @param mountPoint the requested mount point
78 * @param kibSize the total size of the partition in KiB
79 * @param kibUsed the amount of KiB being used on the partition
80 * @param kibAvail the available space on the partition in KiB
81 */
82 void foundMountPoint( const QString & mountPoint, quint64 kibSize, quint64 kibUsed, quint64 kibAvail );
83
84 /**
85 * Emitted when the request made via readDF is over, whether foundMountPoint was emitted or not.
86 */
87 void done();
88
89private:
90 class Private;
91 Private * const d;
92
93 Q_PRIVATE_SLOT( d, bool _k_calculateFreeSpace() )
94};
95
96#endif
97