OSHelper: file preselection support (Windows and Mac)

Co-authored-by: selsta <selsta@sent.at>
This commit is contained in:
xiphon
2019-12-12 01:21:49 +00:00
parent ba24fd79bb
commit 088d32e712
3 changed files with 55 additions and 8 deletions

View File

@@ -35,6 +35,7 @@ class MacOSHelper
public:
static bool isCapsLock();
static bool openFolderAndSelectItem(const QUrl &path);
};
#endif //MACOSHELPER_H

View File

@@ -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;
}