From 7c6ee7f1a24faeafc793414e877bf014743d9cfe Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Thu, 12 Mar 2015 04:01:41 +1100 Subject: Added QML bindings for packages --- heimdall-frontend/source/qml/DropFiles.qml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'heimdall-frontend/source/qml/DropFiles.qml') diff --git a/heimdall-frontend/source/qml/DropFiles.qml b/heimdall-frontend/source/qml/DropFiles.qml index 9187b4f..2745b4e 100644 --- a/heimdall-frontend/source/qml/DropFiles.qml +++ b/heimdall-frontend/source/qml/DropFiles.qml @@ -2,7 +2,9 @@ import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.2 +import "ArrayExtensions.js" as ArrayExtensions import "FileUtils.js" as FileUtils +import HeimdallFrontend 1.0 as Native DropFilesForm { id: background @@ -30,13 +32,16 @@ DropFilesForm { if (count > 0) { for (var i = 0; i < count; i++) { if (FileUtils.isFile(urls[i])) { - var filename = FileUtils.filenameFromUrl(urls[i]); - - fileModel.append({ icon: "drop_zone.svg", text: filename }); - - if (FileUtils.isArchive(filename)) { - fileUrls.push(FileUtils.extractArchive(urls[i])); + if (FileUtils.isArchive(urls[i])) { + var packageData = Native.Firmware.extractArchive(urls[i]); + packageData.filePaths.forEach(function(path) { + var filename = FileUtils.filenameFromPath(path); + fileModel.append({ icon: "drop_zone.svg", text: filename }); + }); + fileUrls.extend(packageData.filePaths); } else { + var filename = FileUtils.filenameFromUrl(urls[i]); + fileModel.append({ icon: "drop_zone.svg", text: filename }); fileUrls.push(urls[i]); } } -- cgit v1.2.3