From 088d32e712a2c6e51a04f919c0ade96b643a49e3 Mon Sep 17 00:00:00 2001 From: xiphon Date: Thu, 12 Dec 2019 01:21:49 +0000 Subject: OSHelper: file preselection support (Windows and Mac) Co-authored-by: selsta --- src/qt/macoshelper.h | 1 + src/qt/macoshelper.mm | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'src/qt') diff --git a/src/qt/macoshelper.h b/src/qt/macoshelper.h index bddf70c6..a6caa79b 100644 --- a/src/qt/macoshelper.h +++ b/src/qt/macoshelper.h @@ -35,6 +35,7 @@ class MacOSHelper public: static bool isCapsLock(); + static bool openFolderAndSelectItem(const QUrl &path); }; #endif //MACOSHELPER_H diff --git a/src/qt/macoshelper.mm b/src/qt/macoshelper.mm index 0b29f25f..a7fb061d 100644 --- a/src/qt/macoshelper.mm +++ b/src/qt/macoshelper.mm @@ -47,3 +47,11 @@ bool MacOSHelper::isCapsLock() return (flags & NSAlphaShiftKeyMask); #endif } + +bool MacOSHelper::openFolderAndSelectItem(const QUrl &path) +{ + NSURL *nspath = path.toNSURL(); + NSArray *fileURLs = [NSArray arrayWithObjects:nspath, nil]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs]; + return true; +} -- cgit v1.2.3