Skip to content

Commit

Permalink
Fixing issue with unicode chars in XDG_PICTURE location (#2222)
Browse files Browse the repository at this point in the history
* Fixing issue with unicode chars in XDG_PICTURE location

* cleaned up
  • Loading branch information
borgmanJeremy authored Jan 3, 2022
1 parent f9745bb commit 179f658
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/screengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QDBusInterface>
#include <QDBusReply>
#include <QDir>
#include <QUrl>
#include <QUuid>
#endif

Expand Down Expand Up @@ -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);
// Parse this as URI to handle unicode properly
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();
Expand Down

0 comments on commit 179f658

Please sign in to comment.