aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-10-22 20:51:46 +0800
committerRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-10-22 20:51:46 +0800
commita406aeb3ea8e44f2f511a0755f10d4639f8bfca2 (patch)
tree47e12a908aedbc737be5b57b2804eb1dbb66ba46
parent7a8c9637225f457d4648a00ff7d8031acd403730 (diff)
downloadPrismLauncher-a406aeb3ea8e44f2f511a0755f10d4639f8bfca2.tar.gz
PrismLauncher-a406aeb3ea8e44f2f511a0755f10d4639f8bfca2.tar.bz2
PrismLauncher-a406aeb3ea8e44f2f511a0755f10d4639f8bfca2.zip
feat: register as zip/mrpack handler on macOS
Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
-rw-r--r--cmake/MacOSXBundleInfo.plist.in23
-rw-r--r--launcher/Application.cpp7
2 files changed, 30 insertions, 0 deletions
diff --git a/cmake/MacOSXBundleInfo.plist.in b/cmake/MacOSXBundleInfo.plist.in
index 1b22e21f..597beaa6 100644
--- a/cmake/MacOSXBundleInfo.plist.in
+++ b/cmake/MacOSXBundleInfo.plist.in
@@ -44,5 +44,28 @@
<string>${MACOSX_SPARKLE_UPDATE_PUBLIC_KEY}</string>
<key>SUFeedURL</key>
<string>${MACOSX_SPARKLE_UPDATE_FEED_URL}</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>zip</string>
+ <string>mrpack</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Prism Launcher instance</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>TEXT</string>
+ <string>utxt</string>
+ <string>TUTX</string>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSHandlerRank</key>
+ <string>Alternate</string>
+ </dict>
+ </array>
</dict>
</plist>
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 6ffec1ae..bcb3aa0d 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<QFileOpenEvent*>(event);
+ m_mainWindow->droppedURLs({ ev->url() });
+ return true;
}
#endif
return QApplication::event(event);