add more spacing
[personal-kdebase.git] / runtime / kioslave / trash / discspaceutil.h
blob1a76464d1a5077c0698967eb5b1f0449068fa237
1 /*
2 This file is part of the KDE project
4 Copyright (C) 2008 Tobias Koenig <tokoe@kde.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
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.
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.
22 #ifndef DISCSPACEUTIL_H
23 #define DISCSPACEUTIL_H
25 #include <QtCore/QString>
27 /**
28 * A small utility class to access and calculate
29 * size and usage of mount points.
31 class DiscSpaceUtil
33 public:
34 /**
35 * Creates a new disc space util.
37 * @param directory A directory the util shall work on.
38 * @param parent The parent object.
40 explicit DiscSpaceUtil( const QString &directory );
42 /**
43 * Returns the usage of the directory pass in the constructor on this
44 * mount point in percent.
46 * @param additional An additional amount of bytes that is added to the
47 * directory size before the usage is calculated.
49 double usage( qulonglong additional = 0 ) const;
51 /**
52 * Returns the size of the partition in bytes.
54 qulonglong size() const;
56 /**
57 * Returns the mount point of the directory.
59 QString mountPoint() const;
61 /**
62 * Returns the size of the given path in bytes.
64 static qulonglong sizeOfPath( const QString &path );
66 private:
67 void calculateFullSize();
69 QString mDirectory;
70 qulonglong mFullSize;
71 QString mMountPoint;
74 #endif