From a406aeb3ea8e44f2f511a0755f10d4639f8bfca2 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Sat, 22 Oct 2022 20:51:46 +0800 Subject: [PATCH] feat: register as zip/mrpack handler on macOS Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com> --- cmake/MacOSXBundleInfo.plist.in | 23 +++++++++++++++++++++++ launcher/Application.cpp | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/cmake/MacOSXBundleInfo.plist.in b/cmake/MacOSXBundleInfo.plist.in index 1b22e21fd..597beaa61 100644 --- a/cmake/MacOSXBundleInfo.plist.in +++ b/cmake/MacOSXBundleInfo.plist.in @@ -44,5 +44,28 @@ ${MACOSX_SPARKLE_UPDATE_PUBLIC_KEY} SUFeedURL ${MACOSX_SPARKLE_UPDATE_FEED_URL} + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + zip + mrpack + + CFBundleTypeName + Prism Launcher instance + CFBundleTypeOSTypes + + TEXT + utxt + TUTX + **** + + CFBundleTypeRole + Viewer + LSHandlerRank + Alternate + + diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 6ffec1ae4..bcb3aa0d3 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -943,6 +943,13 @@ bool Application::event(QEvent* event) { emit clickedOnDock(); } m_prevAppState = ev->applicationState(); + return true; + } + + if (event->type() == QEvent::FileOpen) { + auto ev = static_cast(event); + m_mainWindow->droppedURLs({ ev->url() }); + return true; } #endif return QApplication::event(event);