Index: sources/gui/GuiView.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r7d6fa45cd6ab5806153706ce7092872220678de3 --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 7d6fa45cd6ab5806153706ce7092872220678de3) @@ -17,6 +17,7 @@ #include "GuiView.h" #include "GuiController.h" #include "DeviceController.h" +#include "FileHandler.h" // namespace using namespace Gui; @@ -374,3 +375,16 @@ // TODO : the space check should also be done for the USB as destination but needs calculation and will be done later. // usbIsLow ( vPercent <= Storage::Available_Space_Percent ); } + + +/*! + * \brief GuiView::isPathSymLink + * \details Determines if the path passed is a symlink + * \param vFilePath - the targeted filepath to check + * \return true if path is a symbolic link, false otherwise + */ +bool GuiView::isPathSymLink(const QString vFilePath ) +{ + // TODO to be removed when model added for export log + return Storage::FileHandler::isPathSymLink(vFilePath); +} Index: sources/gui/GuiView.h =================================================================== diff -u -ra6586ea871f21a08e7d50552983360fb5e344b3a -r7d6fa45cd6ab5806153706ce7092872220678de3 --- sources/gui/GuiView.h (.../GuiView.h) (revision a6586ea871f21a08e7d50552983360fb5e344b3a) +++ sources/gui/GuiView.h (.../GuiView.h) (revision 7d6fa45cd6ab5806153706ce7092872220678de3) @@ -116,6 +116,8 @@ void doExportListRemove ( ); quint8 doExportListPercent(quint32 vIndex ); + bool isPathSymLink (const QString vFilePath ); + signals: void didActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG void didActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r265600079f9f3b741cd3e67c229f39ec66571419 -r7d6fa45cd6ab5806153706ce7092872220678de3 --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 265600079f9f3b741cd3e67c229f39ec66571419) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 7d6fa45cd6ab5806153706ce7092872220678de3) @@ -62,8 +62,9 @@ property bool isDevice : true //false // it has to be true to make it work on the devices. readonly property string typePathClr : "" - readonly property string typePathSrc : isDevice ? "file:///media/sd-card" : "file:///home/denali/Desktop/sd-card" - readonly property string typePathDst : isDevice ? "file:///media/usb" : "file:///home/denali/Desktop/usb-disk" + readonly property string typePathPrefix : "file://" + readonly property string typePathSrc : typePathPrefix + (isDevice ? "/media/sd-card" : "/home/denali/Desktop/sd-card" ) + readonly property string typePathDst : typePathPrefix + (isDevice ? "/media/usb" : "/home/denali/Desktop/usb-disk") readonly property string typeFolderApplication : "/log" readonly property string typeFolderService : "/service" readonly property string typeFolderTreatment : "/treatment" @@ -319,7 +320,7 @@ 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(_sdcFolderView.visibleFileCounter) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) width : parent.width height : _root.headetRowHight verticalAlignment : Text.AlignVCenter @@ -339,6 +340,7 @@ } ListView { id : _sdcFolderView + property int visibleFileCounter : 0 enabled : !_GuiView.exportRunning && ! isUpdatePanels clip : true anchors.fill : parent @@ -347,6 +349,14 @@ anchors.rightMargin : 5 spacing : 3 FolderListModel { id : _sdcFolderModel + onStatusChanged: { + // onFolderChanged does not get emitted when switching folders, but status change does. + // Reset the displayed file counter when the state of the model is null + if (_sdcFolderModel.status == FolderListModel.Null) + { + _sdcFolderView.visibleFileCounter = 0 + } + } showDirs : false sortField : FolderListModel.Time folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. @@ -363,7 +373,11 @@ property int exportPercent : _GuiView.exportIndex === index ? _GuiView.exportPercent : 0 + property bool isShownInList : !_GuiView.isPathSymLink(_sdcFolderColumn.currentTypeFolderApplication.replace(typePathPrefix, "") + "/" + fileName) + Component.onCompleted: if ( isShownInList ) _sdcFolderView.visibleFileCounter++ + onExportPercentChanged : console.log( "%", exportPercent) + //DEBUG: onInExportListChanged: console.debug(" * ", index, inExportList) function exportListUpdate() { if (_GuiView.doExportListSelect( index ) ) { @@ -384,19 +398,23 @@ marker.visible : false maximum : 100 // percent value : maximum - exportPercent - width : _sdcFolderView.width - height : 40 + + // Setting height and width to 0 when the file is not shown in the list because + // it is a symlink or other conditions + width : isShownInList ? _sdcFolderView.width : 0 + height : isShownInList ? 40 : 0 + bgColor : Colors.transparent color : inExportList ? Colors.borderButtonSelected : Colors.transparent radius : 5 Row { id : _sdcFileRow - width : parent.width - height : 40 + width : isShownInList ? parent.width : 0 + height : isShownInList ? 40 : 0 leftPadding : 5 Text { id : _sdcFileNameText x : 2 clip : true - width : _contentRect.columnWidthFileName - 2 + width : isShownInList ? (_contentRect.columnWidthFileName - 2) : 0 text : fileName color : Colors.textMain font.pixelSize : Fonts.fontPixelTextRectExtra @@ -405,12 +423,12 @@ } Rectangle { id : _sdcColumnVerticalLine color : Colors.borderButtonUnselected - width : 1 + width : isShownInList ? 1 : 0 height : parent.height + _usbFolderColumn.spacing } Text { id : _sdcFileSizeText clip : true - width : _contentRect.columnWidthFileSize + width : isShownInList ? (_contentRect.columnWidthFileSize) : 0 text : Variables.sizeConverted( fileSize, 1000, 3) color : Colors.textMain font.pixelSize : Fonts.fontPixelTextRectExtra Index: sources/storage/FileHandler.cpp =================================================================== diff -u -rb7649e74aeebe1545ba0db9aabe2b41f0a28baec -r7d6fa45cd6ab5806153706ce7092872220678de3 --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision b7649e74aeebe1545ba0db9aabe2b41f0a28baec) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 7d6fa45cd6ab5806153706ce7092872220678de3) @@ -425,3 +425,17 @@ dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden | QDir::Readable); return dir.entryList(); } + + +/*! + * \brief FileHandler::isPathSymLink + * \details Determines if the path passed is a symbolic link + * \param vFilePath - the targeted filepath to check + * \return true if path is a symbolic link, false otherwise + */ +bool FileHandler::isPathSymLink(const QString &vFilePath) +{ + QFileInfo fileInfo(vFilePath); + //DEBUG: qDebug() << vFilePath << fileInfo.isSymbolicLink() << fileInfo.isSymLink(); + return fileInfo.isSymbolicLink(); +} Index: sources/storage/FileHandler.h =================================================================== diff -u -rb7649e74aeebe1545ba0db9aabe2b41f0a28baec -r7d6fa45cd6ab5806153706ce7092872220678de3 --- sources/storage/FileHandler.h (.../FileHandler.h) (revision b7649e74aeebe1545ba0db9aabe2b41f0a28baec) +++ sources/storage/FileHandler.h (.../FileHandler.h) (revision 7d6fa45cd6ab5806153706ce7092872220678de3) @@ -76,6 +76,8 @@ static QStringList subFolders(const QString &vFolder); + static bool isPathSymLink(const QString &vFilePath); + /*! * \brief FileHandler::copyFile * \details Copies a file chunk by chunk @@ -96,10 +98,7 @@ static quint8 mO_CopyPercent = 0; quint8 mC_CopyPercent = 0; - // determine if the file is a symlink by checking for the absolute path of the QFile object - // if it is empty, this indicates that it is not a symlink, otherwise skip the file - QString symLinkAbsolutePath = srcFile.symLinkTarget(); - if(!symLinkAbsolutePath.isEmpty()) { return eOK ; } // skipping the file + if ( isPathSymLink(vSource + vFileName) ) { return eOK ; } // skipping the file if ( ! srcDir .exists() ) { err = eSrcFolderNotExist ; goto lErr; } if ( ! srcFile.exists() ) { err = eSrcFileNotExist ; goto lErr; }