diff options
-rw-r--r-- | cmake/modules/MacOSXBundleInfo.plist.in | 37 | ||||
-rw-r--r-- | src/gui/application.cpp | 14 | ||||
-rw-r--r-- | src/gui/application.h | 1 |
3 files changed, 52 insertions, 0 deletions
diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index fc2be53f7..3a402f1e8 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -32,5 +32,42 @@ <false/> <key>SUPublicDSAKeyFile</key> <string>dsa_pub.pem</string> + +<key>UTExportedTypeDeclarations</key> +<array> + <dict> + <key>UTTypeIdentifier</key> + <string>@APPLICATION_REV_DOMAIN@.placeholder</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <string>@APPLICATION_PLACEHOLDER_SUFFIX@</string> + <key>public.mime-type</key> + <string>application/octet-stream</string> + </dict> + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + </array> + </dict> +</array> + +<key>CFBundleDocumentTypes</key> +<array> + <dict> + <key>CFBundleTypeName</key> + <string>@APPLICATION_EXECUTABLE@ Download Placeholder</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>LSHandlerRank</key> + <string>Owner</string> + <key>LSItemContentTypes</key> + <array> + <string>@APPLICATION_REV_DOMAIN@.placeholder</string> + </array> + </dict> +</array> + + </dict> </plist> diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 703f1f843..3386cb970 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -659,4 +659,18 @@ void Application::openPlaceholder(const QString &filename) }); } +bool Application::event(QEvent *event) +{ +#ifdef Q_OS_MAC + if (event->type() == QEvent::FileOpen) { + QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event); + qCDebug(lcApplication) << "QFileOpenEvent" << openEvent->file(); + // placeholder file, open it after the Folder were created (if the app is not terminated) + QString fn = openEvent->file(); + QTimer::singleShot(0, this, [this, fn] { openPlaceholder(fn); }); + } +#endif + return SharedTools::QtSingleApplication::event(event); +} + } // namespace OCC diff --git a/src/gui/application.h b/src/gui/application.h index 744bc1819..3857cc3e7 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -82,6 +82,7 @@ protected: void parseOptions(const QStringList &); void setupTranslations(); void setupLogging(); + bool event(QEvent *event); signals: void folderRemoved(); |