From eb978e7bbf4622f6d92d096222a77b5754f78e7c Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Mon, 3 Jan 2022 12:53:38 -0600 Subject: [PATCH 1/2] Fixing issue with unicode chars in XDG_PICTURE location --- src/utils/screengrabber.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index 92b666fa00..0c3873bf8f 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #endif ScreenGrabber::ScreenGrabber(QObject* parent) @@ -50,10 +51,12 @@ void ScreenGrabber::freeDesktopPortal(bool& ok, QPixmap& res) QEventLoop loop; const auto gotSignal = [&res, &loop](uint status, const QVariantMap& map) { if (status == 0) { - QString uri = map.value("uri").toString().remove(0, 7); - res = QPixmap(uri); + //QString uri = map.value("uri").toString().remove(0, 7); + QUrl uri = map.value("uri").toString(); + QString uriString = uri.toLocalFile(); + res = QPixmap(uriString); res.setDevicePixelRatio(qApp->devicePixelRatio()); - QFile imgFile(uri); + QFile imgFile(uriString); imgFile.remove(); } loop.quit(); From 8da01f18995a35639c53cec8b6b5d47fc032a1eb Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Mon, 3 Jan 2022 12:55:26 -0600 Subject: [PATCH 2/2] cleaned up --- src/utils/screengrabber.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index 0c3873bf8f..9989ead28f 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -17,8 +17,8 @@ #include #include #include -#include #include +#include #endif ScreenGrabber::ScreenGrabber(QObject* parent) @@ -51,7 +51,7 @@ void ScreenGrabber::freeDesktopPortal(bool& ok, QPixmap& res) QEventLoop loop; const auto gotSignal = [&res, &loop](uint status, const QVariantMap& map) { if (status == 0) { - //QString uri = map.value("uri").toString().remove(0, 7); + // Parse this as URI to handle unicode properly QUrl uri = map.value("uri").toString(); QString uriString = uri.toLocalFile(); res = QPixmap(uriString);