diff --git a/logformat/LogFormat.cpp b/logformat/LogFormat.cpp index 7db32eff..7c110874 100644 --- a/logformat/LogFormat.cpp +++ b/logformat/LogFormat.cpp @@ -401,37 +401,42 @@ unsigned long LogFormat::runImport(QTextStream& importLogStream, int recordDXCCId = record.value(RECORDIDX(LogbookModel::COLUMN_DXCC)).toInt(); // 0 = NAN or not present // otherwise = DXCC ID - const DxccEntity &entity = ( recordDXCCId != 0 ) ? Data::instance()->lookupDxccID(recordDXCCId) - : Data::instance()->lookupDxcc(call.toString()); - - if ( entity.dxcc == 0 ) // DXCC not found + if ( recordDXCCId != 0 || updateDxcc ) { - writeImportLog(importLogStream, - (updateDxcc) ? ERROR_SEVERITY : WARNING_SEVERITY, - processedRec, - record, - tr("Cannot find DXCC Entity Info")); - ( updateDxcc ) ? (*errors)++ - : (*warnings)++; - if ( updateDxcc ) - continue; - } - else - { - record.setValue(RECORDIDX(LogbookModel::COLUMN_DXCC), entity.dxcc); - record.setValue(RECORDIDX(LogbookModel::COLUMN_COUNTRY), Data::removeAccents(entity.country)); - record.setValue(RECORDIDX(LogbookModel::COLUMN_COUNTRY_INTL), entity.country); + const DxccEntity &entity = ( updateDxcc ) ? Data::instance()->lookupDxcc(call.toString()) + : Data::instance()->lookupDxccID(recordDXCCId); - // other DXCC related values ​​are not closely related to DXCC value and could have been filled - // therefore check if it is present or not. - if ( record.value(RECORDIDX(LogbookModel::COLUMN_CONTINENT)).toString().isEmpty() ) - record.setValue(RECORDIDX(LogbookModel::COLUMN_CONTINENT), entity.cont); + if ( entity.dxcc == 0 ) // DXCC not found + { + writeImportLog(importLogStream, + (updateDxcc) ? ERROR_SEVERITY : WARNING_SEVERITY, + processedRec, + record, + tr("Cannot find DXCC Entity Info")); + if ( updateDxcc ) + { + (*errors)++; + continue; + } + (*warnings)++; + } + else + { + record.setValue(RECORDIDX(LogbookModel::COLUMN_DXCC), entity.dxcc); + record.setValue(RECORDIDX(LogbookModel::COLUMN_COUNTRY), Data::removeAccents(entity.country)); + record.setValue(RECORDIDX(LogbookModel::COLUMN_COUNTRY_INTL), entity.country); - if ( record.value(RECORDIDX(LogbookModel::COLUMN_ITUZ)).toString().isEmpty() ) - record.setValue(RECORDIDX(LogbookModel::COLUMN_ITUZ), QString::number(entity.ituz)); + // other DXCC related values ​​are not closely related to DXCC value and could have been filled + // therefore check if it is present or not. + if ( record.value(RECORDIDX(LogbookModel::COLUMN_CONTINENT)).toString().isEmpty() ) + record.setValue(RECORDIDX(LogbookModel::COLUMN_CONTINENT), entity.cont); - if ( record.value(RECORDIDX(LogbookModel::COLUMN_CQZ)).toString().isEmpty() ) - record.setValue(RECORDIDX(LogbookModel::COLUMN_CQZ), QString::number(entity.cqz)); + if ( record.value(RECORDIDX(LogbookModel::COLUMN_ITUZ)).toString().isEmpty() ) + record.setValue(RECORDIDX(LogbookModel::COLUMN_ITUZ), QString::number(entity.ituz)); + + if ( record.value(RECORDIDX(LogbookModel::COLUMN_CQZ)).toString().isEmpty() ) + record.setValue(RECORDIDX(LogbookModel::COLUMN_CQZ), QString::number(entity.cqz)); + } } if ( record.value(RECORDIDX(LogbookModel::COLUMN_PREFIX)).toString().isEmpty() )