marble
Go to the documentation of this file.
13 #include <QTemporaryFile>
16 #include <quazip/quazip.h>
17 #include <quazip/quazipfile.h>
24 if ( !zip.open( QuaZip::mdUnzip ) ) {
25 mDebug() <<
"Failed to extract " << kmz;
29 QTemporaryFile outputDir ( QDir::tempPath() +
"/marble-kmz-XXXXXX" );
30 outputDir.setAutoRemove(
false );
32 if ( !QFile::remove( outputDir.fileName() ) || !QDir(
"/").mkdir( outputDir.fileName() ) ) {
33 mDebug() <<
"Failed to create temporary storage for extracting " << kmz;
37 m_kmzPath = outputDir.fileName();
38 QuaZipFile zipFile( &zip );
39 for (
bool moreFiles=zip.goToFirstFile(); moreFiles; moreFiles=zip.goToNextFile() ) {
40 QFileInfo output = QFileInfo( outputDir.fileName() +
"/" + zip.getCurrentFileName() );
41 if ( !output.dir().exists() ) {
42 QDir::root().mkpath( output.dir().absolutePath() );
45 QFile outputFile( output.absoluteFilePath() );
46 outputFile.open( QIODevice::WriteOnly );
47 zipFile.open( QIODevice::ReadOnly );
48 outputFile.write( zipFile.readAll() );
51 m_kmzFiles << output.absoluteFilePath();
53 if ( output.suffix().toLower() ==
"kml" ) {
54 if ( !m_kmlFile.isEmpty() ) {
55 mDebug() <<
"File" << kmz <<
"contains more than one .kml files";
57 m_kmlFile = output.absoluteFilePath();
bool open(const QString &file)
QStringList kmzFiles() const
QDebug mDebug()
a function to replace qDebug() in Marble library code
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.