mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Temporary .qgs files are deleted
This commit is contained in:
parent
a0a2f0c539
commit
1d8574e436
@ -136,6 +136,13 @@ class QgsProjectArchive : QgsArchive
|
|||||||
Returns the current .qgs project file or an empty string if there's none
|
Returns the current .qgs project file or an empty string if there's none
|
||||||
:rtype: str
|
:rtype: str
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
bool clearProjectFile();
|
||||||
|
%Docstring
|
||||||
|
Remove the current .qgs project file from the temporary directory.
|
||||||
|
:return: true if the file is well removed, false otherwise
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -152,3 +152,17 @@ bool QgsProjectArchive::unzip( const QString &filename )
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QgsProjectArchive::clearProjectFile()
|
||||||
|
{
|
||||||
|
bool rc = false;
|
||||||
|
QString file = projectFile();
|
||||||
|
|
||||||
|
if ( !file.isEmpty() && QFile::exists( file ) )
|
||||||
|
rc = QFile::remove( file );
|
||||||
|
|
||||||
|
if ( rc )
|
||||||
|
mFiles.removeOne( file );
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
@ -147,6 +147,12 @@ class CORE_EXPORT QgsProjectArchive : public QgsArchive
|
|||||||
* Returns the current .qgs project file or an empty string if there's none
|
* Returns the current .qgs project file or an empty string if there's none
|
||||||
*/
|
*/
|
||||||
QString projectFile() const;
|
QString projectFile() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the current .qgs project file from the temporary directory.
|
||||||
|
* \returns true if the file is well removed, false otherwise
|
||||||
|
*/
|
||||||
|
bool clearProjectFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2110,17 +2110,18 @@ bool QgsProject::unzip( const QString &filename )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the archive
|
// keep the archive and remove the temporary .qgs file
|
||||||
mUnzipping = false;
|
mUnzipping = false;
|
||||||
mPathResolverBaseName = QString();
|
mPathResolverBaseName = QString();
|
||||||
mArchive.reset( archive.release() );
|
mArchive.reset( archive.release() );
|
||||||
|
mArchive->clearProjectFile();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsProject::zip()
|
bool QgsProject::zip()
|
||||||
{
|
{
|
||||||
if ( unzipped() )
|
if ( !mArchive->filename().isEmpty() )
|
||||||
return zip( mArchive->filename() );
|
return zip( mArchive->filename() );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -2168,9 +2169,6 @@ bool QgsProject::zip( const QString &filename )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the archive
|
|
||||||
mArchive.reset( archive.release() );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user