Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -r7e503c5459ec77a2816d6c7789da9b206cedbe8a -rec7f919fdb70ff29a8de627937e4ad7008e59c1c --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 7e503c5459ec77a2816d6c7789da9b206cedbe8a) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision ec7f919fdb70ff29a8de627937e4ad7008e59c1c) @@ -157,7 +157,7 @@ * \details sets the treatment log path if the given type is treatment log, with the path, vLogPath. * If the given vLogPath is empty, the defaults in Storage will be used. * \sa Storage::SDCard_Base_Path_Name - * \sa Storage::Treatment_Log_Folder + * \sa Storage::Log_Folder_Treatment * \param vLogType - The Log type of type Logger::LogType * \param vLogPath - the path to be set and used. */ @@ -167,7 +167,7 @@ if ( vLogPath.trimmed().isEmpty() ) { _treatmentLogPath = QString("%1%2") .arg(Storage::SDCard_Base_Path_Name) - .arg(Storage::Treatment_Log_Folder ); + .arg(Storage::Log_Folder_Treatment ); } else { _treatmentLogPath = vLogPath; @@ -362,10 +362,19 @@ */ bool TreatmentLog::exportLog() { - bool ok; - QString exportPath = Storage::USB_Mount_Point; - Storage::FileHandler::makeFolder(exportPath); - ok = FileHandler::copyFolder(_treatmentLogPath , exportPath); + bool ok = true; + QString dstPath = Storage::USB_Mount_Point ; + dstPath += Storage::Log_Folder_Treatment ; + QString srcFile = _lastTxInfo.mFileName ; + QString dstFile = dstPath + QFileInfo(srcFile).fileName(); + // HERE: expose to the UI dialog as the rejection/notification result + if ( ! Storage::FileHandler::makeFolder ( dstPath ) ) { LOG_DEBUG ( QString( "Couldn't create folder on USB drive to export TxLog" ) ); ok = false; goto lOut; } + if ( ! QFileInfo::exists ( srcFile ) ) { LOG_DEBUG ( QString( "TxLog '%1' doesn't exist" ).arg( srcFile ) ); ok = false; goto lOut; } + if ( QFileInfo::exists ( dstFile ) ) { LOG_DEBUG ( QString( "TxLog '%1' already exists" ).arg( dstFile ) ); ok = false; goto lOut; } + if ( ! QFile::copy (srcFile, dstFile ) ) { LOG_DEBUG ( QString( "Unable to Export TxLog '%1' to '%2'" ).arg( srcFile ).arg( dstFile ) ); ok = false; goto lOut; } + +lOut: + if ( ! ok ) LOG_EVENT_UI ( QString( "Unable to Export TxLog" )); return ok; }