From 9c5e25971bc6bb9e2abe418166ddd0b79745a050 Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:44:17 +0800 Subject: [PATCH] opt: support to open image in system viewer (#1309) * opt: open image in external fix have to wait the resource downloaded * [autofix.ci] apply automated fixes --------- Co-authored-by: YiFang Xiao Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/ui/articleview.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index a62fce52..b160610d 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -1772,8 +1772,16 @@ void ArticleView::contextMenuRequested( QPoint const & pos ) if ( !fileName.isEmpty() ) { QFileInfo fileInfo( fileName ); - saveResource( url, webview->url(), fileName ); - QDesktopServices::openUrl( fileName ); + auto handler = saveResource( url, webview->url(), fileName ); + + if ( !handler->isEmpty() ) { + connect( handler, &ResourceToSaveHandler::done, this, [ fileName ]() { + QDesktopServices::openUrl( fileName ); + } ); + } + else { + QDesktopServices::openUrl( fileName ); + } } } else {