• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.12
  • kdelibs
  • kio
  • kfile
kdiskfreespace.cpp
Go to the documentation of this file.
1 /*
2  * kdiskfreespace.cpp
3  *
4  * Copyright 2007 David Faure <faure@kde.org>
5  * Copyright 2008 Dirk Mueller <mueller@kde.org>
6  * Copyright 2008 Sebastian Trug <trueg@kde.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License version 2 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include "kdiskfreespace.h"
24 #include "kdiskfreespaceinfo.h"
25 #include <QtCore/QTimer>
26 
27 #include <kdebug.h>
28 
29 
30 class KDiskFreeSpace::Private
31 {
32 public:
33  Private(KDiskFreeSpace *parent)
34  : m_parent(parent)
35  {}
36 
37  bool _k_calculateFreeSpace();
38 
39  KDiskFreeSpace *m_parent;
40  QString m_path;
41 };
42 
43 
44 KDiskFreeSpace::KDiskFreeSpace(QObject *parent)
45  : QObject(parent), d(new Private(this))
46 {
47 }
48 
49 
50 KDiskFreeSpace::~KDiskFreeSpace()
51 {
52  delete d;
53 }
54 
55 
56 bool KDiskFreeSpace::readDF( const QString & mountPoint )
57 {
58  d->m_path = mountPoint;
59  return d->_k_calculateFreeSpace();
60 }
61 
62 
63 bool KDiskFreeSpace::Private::_k_calculateFreeSpace()
64 {
65  KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo( m_path );
66  if ( info.isValid() ) {
67  quint64 sizeKiB = info.size() / 1024;
68  quint64 availKiB = info.available() / 1024;
69  emit m_parent->foundMountPoint( info.mountPoint(), sizeKiB, sizeKiB-availKiB, availKiB );
70  }
71 
72  emit m_parent->done();
73 
74  m_parent->deleteLater();
75 
76  return info.isValid();
77 }
78 
79 KDiskFreeSpace * KDiskFreeSpace::findUsageInfo( const QString & path )
80 {
81  KDiskFreeSpace * job = new KDiskFreeSpace;
82  job->d->m_path = path;
83  QTimer::singleShot(0, job, SLOT(_k_calculateFreeSpace()));
84  return job;
85 }
86 
87 #include "kdiskfreespace.moc"
88 
KDiskFreeSpace::readDF
bool readDF(const QString &mountPoint)
Call this to fire a search on the disk usage information for mountPoint.
Definition: kdiskfreespace.cpp:56
kdebug.h
KDiskFreeSpace
Definition: kdiskfreespace.h:34
QString
QObject
KDiskFreeSpace::~KDiskFreeSpace
~KDiskFreeSpace()
Destructor - this object autodeletes itself when it's done.
Definition: kdiskfreespace.cpp:50
kdiskfreespaceinfo.h
KDiskFreeSpace::KDiskFreeSpace
KDiskFreeSpace(QObject *parent=0)
Constructor.
Definition: kdiskfreespace.cpp:44
KDiskFreeSpace::findUsageInfo
static KDiskFreeSpace * findUsageInfo(const QString &path)
Call this to fire a search on the disk usage information for the mount point containing path...
Definition: kdiskfreespace.cpp:79
quint64
kdiskfreespace.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal