Skip to content
Permalink
Browse files

translate all ziputils error messages and remove log tags

  • Loading branch information
jef-n committed Feb 18, 2019
1 parent 9efe4c5 commit f8e76db19ab9cec4bc55ac984350b7fe48688baf
Showing with 15 additions and 28 deletions.
  1. +15 −28 src/core/qgsziputils.cpp
@@ -37,32 +37,27 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString

if ( !QFileInfo::exists( zipFilename ) )
{
QString err = QObject::tr( "Error zip file does not exist: '%1'" ).arg( zipFilename );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error zip file does not exist: '%1'" ).arg( zipFilename ) );
return false;
}
else if ( zipFilename.isEmpty() )
{
QString err = QObject::tr( "Error zip filename is empty" );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error zip filename is empty" ) );
return false;
}
else if ( !QDir( dir ).exists( dir ) )
{
QString err = QObject::tr( "Error output dir does not exist: '%1'" ).arg( dir );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error output dir does not exist: '%1'" ).arg( dir ) );
return false;
}
else if ( !QFileInfo( dir ).isDir() )
{
QString err = QObject::tr( "Error output dir is not a directory: '%1'" ).arg( dir );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error output dir is not a directory: '%1'" ).arg( dir ) );
return false;
}
else if ( !QFileInfo( dir ).isWritable() )
{
QString err = QObject::tr( "Error output dir is not writable: '%1'" ).arg( dir );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error output dir is not writable: '%1'" ).arg( dir ) );
return false;
}

@@ -93,13 +88,13 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
if ( !newFile.absoluteDir().exists() )
{
if ( !QDir( dir ).mkpath( newFile.absolutePath() ) )
QgsMessageLog::logMessage( QStringLiteral( "Failed to create a subdirectory %1/%2" ).arg( dir ).arg( fileName ) );
QgsMessageLog::logMessage( QObject::tr( "Failed to create a subdirectory %1/%2" ).arg( dir ).arg( fileName ) );
}

QFile outFile( newFile.absoluteFilePath() );
if ( !outFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
{
QgsMessageLog::logMessage( QStringLiteral( "Could not write to %1" ).arg( newFile.absoluteFilePath() ) );
QgsMessageLog::logMessage( QObject::tr( "Could not write to %1" ).arg( newFile.absoluteFilePath() ) );
}
else
{
@@ -111,26 +106,23 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
else
{
zip_fclose( file );
QString err = QObject::tr( "Error reading file: '%1'" ).arg( zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error reading file: '%1'" ).arg( zip_strerror( z ) ) );
return false;
}
}
}
else
{
zip_close( z );
QString err = QObject::tr( "Error getting files: '%1'" ).arg( zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error getting files: '%1'" ).arg( zip_strerror( z ) ) );
return false;
}

zip_close( z );
}
else
{
QString err = QObject::tr( "Error opening zip archive: '%1' (Error code: %2)" ).arg( z ? zip_strerror( z ) : zipFilename, rc );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error opening zip archive: '%1' (Error code: %2)" ).arg( z ? zip_strerror( z ) : zipFilename, rc ) );
return false;
}

@@ -141,8 +133,7 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
{
if ( zipFilename.isEmpty() )
{
QString err = QObject::tr( "Error zip filename is empty" );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error zip filename is empty" ) );
return false;
}

@@ -157,8 +148,7 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
QFileInfo fileInfo( file );
if ( !fileInfo.exists() )
{
QString err = QObject::tr( "Error input file does not exist: '%1'" ).arg( file );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error input file does not exist: '%1'" ).arg( file ) );
zip_close( z );
return false;
}
@@ -175,16 +165,14 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
#endif
if ( rc == -1 )
{
QString err = QObject::tr( "Error adding file '%1': %2" ).arg( file, zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error adding file '%1': %2" ).arg( file, zip_strerror( z ) ) );
zip_close( z );
return false;
}
}
else
{
QString err = QObject::tr( "Error creating data source '%1': %2" ).arg( file, zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error creating data source '%1': %2" ).arg( file, zip_strerror( z ) ) );
zip_close( z );
return false;
}
@@ -194,8 +182,7 @@ bool QgsZipUtils::zip( const QString &zipFilename, const QStringList &files )
}
else
{
QString err = QObject::tr( "Error creating zip archive '%1': %2" ).arg( zipFilename, zip_strerror( z ) );
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
QgsMessageLog::logMessage( QObject::tr( "Error creating zip archive '%1': %2" ).arg( zipFilename, zip_strerror( z ) ) );
return false;
}

0 comments on commit f8e76db

Please sign in to comment.
You can’t perform that action at this time.