From c68498fcfe89aababc31f897623a42b342a4316c Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 19 Oct 2020 16:16:02 -0400 Subject: [PATCH] fix: support downloads in browser --- src/status/permissions.nim | 2 +- ui/app/AppLayouts/Browser/BrowserLayout.qml | 18 ++++++++++-------- ui/app/AppLayouts/Browser/DownloadView.qml | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/status/permissions.nim b/src/status/permissions.nim index bccc24ac94..6b22693776 100644 --- a/src/status/permissions.nim +++ b/src/status/permissions.nim @@ -4,7 +4,7 @@ import sets import libstatus/core import libstatus/types import chronicles -import eventemitter +import ../eventemitter import sequtils type diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 4ec5cc93ad..afa9cbe010 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -378,11 +378,12 @@ Rectangle { anchors.top: parent.top anchors.topMargin: tabs.tabHeight + tabs.anchors.topMargin z: 52 + visible: !downloadView.visible } QQC1.TabView { property int tabHeight: 40 - + visible: !downloadView.visible id: tabs function createEmptyTab(profile) { var tab = addTab("", tabComponent); @@ -413,6 +414,8 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right Component.onCompleted: { + defaultProfile.downloadRequested.connect(onDownloadRequested); + otrProfile.downloadRequested.connect(onDownloadRequested); var tab = createEmptyTab(defaultProfile); tab.item.url = determineRealURL("https://simpledapp.eth"); } @@ -721,6 +724,12 @@ Rectangle { } } + function onDownloadRequested(download) { + downloadView.visible = true; + downloadView.append(download); + download.accept(); + } + MessageDialog { id: sslDialog @@ -756,13 +765,6 @@ Rectangle { anchors.fill: parent } - function onDownloadRequested(download) { - console.log("DOWNLOAD REQUESTED") - downloadView.visible = true; - downloadView.append(download); - download.accept(); - } - FindBar { id: findBar visible: false diff --git a/ui/app/AppLayouts/Browser/DownloadView.qml b/ui/app/AppLayouts/Browser/DownloadView.qml index 35b5c9c31b..74a00f8bfb 100644 --- a/ui/app/AppLayouts/Browser/DownloadView.qml +++ b/ui/app/AppLayouts/Browser/DownloadView.qml @@ -111,7 +111,7 @@ Rectangle { Button { id: cancelButton anchors.right: parent.right - iconSource: "icons/process-stop.png" + text: "X" onClicked: { var download = downloadModel.downloads[index];