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

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • runner
  • kml
KmlDocument.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2013 Dennis Nienhüser <earthwings@gentoo.org>
9 
10 #include "KmlDocument.h"
11 
12 #include "MarbleDebug.h"
13 
14 #include <QFile>
15 #include <QDir>
16 
17 namespace Marble
18 {
19 
20 KmlDocument::~KmlDocument()
21 {
22  foreach( const QString &file, m_files ) {
23  if ( !QFile::remove( file ) ) {
24  mDebug() << "Failed to remove temporary file" << file;
25  }
26  }
27  if ( !m_path.isEmpty() ) {
28  removeDirectoryRecursively( m_path );
29  }
30 }
31 
32 void KmlDocument::setFiles( const QString &path, const QStringList &files )
33 {
34  m_path = path;
35  m_files = files;
36 }
37 
38 void KmlDocument::removeDirectoryRecursively( const QString &path )
39 {
40  QStringList const subdirs = QDir( path ).entryList( QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot );
41  foreach( const QString &subdir, subdirs ) {
42  removeDirectoryRecursively( path + '/' + subdir );
43  }
44  QDir::root().rmdir( path );
45 }
46 
47 }
Marble::KmlDocument::setFiles
void setFiles(const QString &path, const QStringList &files)
Temporary files to delete at destruction.
Definition: KmlDocument.cpp:32
QFile::remove
bool remove()
QDir::root
QDir root()
MarbleDebug.h
KmlDocument.h
QDir::rmdir
bool rmdir(const QString &dirName) const
QString::isEmpty
bool isEmpty() const
QString
QStringList
QDir
Marble::KmlDocument::~KmlDocument
~KmlDocument()
Definition: KmlDocument.cpp:20
QDir::entryList
QStringList entryList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

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

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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