Index: sources/gui/GuiView.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -246,10 +246,14 @@ * \details invocable slot from UI to insert an item in the selection list. * \param vIndex - selected item index * \param vFileName - selected item file name + * \param isPendingFolder - indicate that this file is in the pending subfolder */ -void GuiView::doExportListInsert(quint32 vIndex, const QString &vFilename) +void GuiView::doExportListInsert(quint32 vIndex, const QString &vFilename, bool isPendingFolder) { - _exportList [vIndex] = vFilename ; + // File indicated in the pending folder, append "pending" to filename + QString filename = isPendingFolder ? QString("%1%2").arg(Storage::Log_Folder_Pending).arg(vFilename) : vFilename; + + _exportList [vIndex] = filename ; _exportListPercent [vIndex] = 100 ; exportIndex ( vIndex ); exportFile ( vFilename ); Index: sources/gui/GuiView.h =================================================================== diff -u -ra6586ea871f21a08e7d50552983360fb5e344b3a -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/gui/GuiView.h (.../GuiView.h) (revision a6586ea871f21a08e7d50552983360fb5e344b3a) +++ sources/gui/GuiView.h (.../GuiView.h) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -110,7 +110,7 @@ void doExportService (); void doExportTreatment (); - void doExportListInsert (quint32 vIndex, const QString &vFilename ); + void doExportListInsert (quint32 vIndex, const QString &vFilename , bool isPendingFolder); void doExportListDelete (quint32 vIndex ); bool doExportListSelect (quint32 vIndex ); void doExportListRemove ( ); Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r80476e323935705a3b8b547dd8536d3a90a49e3e -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 80476e323935705a3b8b547dd8536d3a90a49e3e) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -134,6 +134,39 @@ isUpdatePanels = false } + // updateDisplayedList() is added to manually combine the contents of the FileListModel + // for the log folder and the sub-folder, pending, to a third ListModel that is used as + // the model of the ListView. + // NOTE: this function will no longer be needed if a CPP model is added to replace the three + // list models providing for the ListView of SD-Card files. + function updateDisplayedList(){ + let mainFolderReady = _sdcFolderModel.status == FolderListModel.Ready + let pendingFolderReady = _sdcFolderModelPending.status == FolderListModel.Ready + let isPendingFolderEmpty = _sdcFolderModelPending.count == 0 + + _displayedFolderList.clear(); // clear list of the last set of files + + if(!mainFolderReady) return; // if list is not ready, skip handling + + var index = 0; + // append the non-pending subfolder log files + for (index = 0; _sdcFolderModel.count > index; index++) { + _displayedFolderList.append({"fileName" : _sdcFolderModel.get(index, "fileName"), + "fileSize" : _sdcFolderModel.get(index, "fileSize"), + "isFromPendingFolder" :false + }) + + } + + // append the pending subfolder log files + for (index = 0; _sdcFolderModelPending.count > index; index++) { + _displayedFolderList.append({"fileName" : _sdcFolderModelPending.get(index, "fileName"), + "fileSize" : _sdcFolderModelPending.get(index, "fileSize"), + "isFromPendingFolder" : true + }) + } + } + Connections { target: _GuiView function onSdIsReadyChanged ( vValue ) { _root.updatePanels() } function onDidExportStat ( vIndex, vFileName, vPercent ) { _sdcFolderView.positionViewAtIndex(vIndex, ListView.Center) } @@ -308,18 +341,24 @@ function updateModel() { _sdcFolderModel.folder = currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. _sdcFolderModel.nameFilters = _root.typeFilterAll + + _sdcFolderModelPending.folder = currentTypeFolderApplication + "/pending/" // FIXME: This needs to be handled as part of a single model (_sdcFolderModel) + _sdcFolderModelPending.nameFilters = _root.typeFilterAll } function clearModel() { _sdcFolderModel.folder = _root.typePathClr _sdcFolderModel.nameFilters = _root.typeFilterClr + + _sdcFolderModelPending.folder = _root.typePathClr + _sdcFolderModelPending.nameFilters = _root.typeFilterClr } spacing : 5 width : _contentRect.columnWidthFolder height : parent.height anchors.verticalCenter : parent.verticalCenter Label { id : _sdcLabel - text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderModel.count) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) + text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderModel.count + _sdcFolderModelPending.count) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) width : parent.width height : _root.headetRowHight verticalAlignment : Text.AlignVCenter @@ -346,11 +385,24 @@ anchors.leftMargin : 5 anchors.rightMargin : 5 spacing : 3 + + ListModel { id: _displayedFolderList + // TODO / FIXME : Ideally, the following : _displayed, _sdcFolderModel, and _sdcFolderModelPending is + // provided by a single CPP model that will navigate and provide the files from both root and subdirectories + } + FolderListModel { id : _sdcFolderModel + // FIXME: there has to be a View for this which also get changed by log type. showDirs : false sortField : FolderListModel.Time - rootFolder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. + onStatusChanged: updateDisplayedList() } + FolderListModel { id : _sdcFolderModelPending + // FIXME: This needs to be handled as part of a single model (_sdcFolderModel) + showDirs : false + sortField : FolderListModel.Time + onStatusChanged: updateDisplayedList() + } Component { id : _sdcFileDelegate ProgressBar { id : _sdcItemBackground @@ -370,7 +422,7 @@ _GuiView.doExportListDelete( index ) } else { - _GuiView.doExportListInsert( index , fileName ) + _GuiView.doExportListInsert( index , fileName, isFromPendingFolder) } } @@ -420,7 +472,7 @@ } } } - model : _sdcFolderModel + model : _displayedFolderList delegate : _sdcFileDelegate } } Index: sources/storage/Logger.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/storage/Logger.cpp (.../Logger.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -615,6 +615,14 @@ // qDebug() << it.key() << it.value() << mSource << mDestination; auto index = it.key (); auto filename = it.value(); + + // TODO : When a logging-file model is added, the following condition might not be needed + bool isPendingFolder = filename.contains(Storage::Log_Folder_Pending); + if(isPendingFolder) { + mSource = mSource .append ( Storage::Log_Folder_Pending ); + filename = filename.replace( Storage::Log_Folder_Pending, ""); + } + result = FileHandler::copyFile(mSource, mDestination + _logBasePathNames[vLogType], filename, ¬ifier, index); } } Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -112,7 +112,7 @@ const char *Log_Folder_Application = "log/" ; // Event/Data Log const char *Log_Folder_Service = "service/" ; // Service Log const char *Log_Folder_Treatment = "treatment/" ; // Treatment Log - const char *Log_Folder_Pending = "treatment/pending/" ; // Treatment Log Pending, have not been saved on cloud yet. + const char *Log_Folder_Pending = "/pending/" ; // * Log Pending, have not been saved on cloud yet. // FIXME : Not sure having global settings object is a good idea. Index: sources/storage/StorageGlobals.h =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -r32dc194cb261763cd4e9d5409921d4c8523fc84d --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 32dc194cb261763cd4e9d5409921d4c8523fc84d) @@ -71,7 +71,7 @@ extern const char *Log_Folder_Application; // Event/Data Log extern const char *Log_Folder_Service; // Service Log extern const char *Log_Folder_Treatment; // Treatment Log - extern const char *Log_Folder_Pending; // Treatment Log Pending, have not been saved on cloud yet. + extern const char *Log_Folder_Pending; // * Log Pending, have not been saved on cloud yet. // Date and Time extern const char *Date_Time_Set_Sh;