Placeholders: Support for macOS #6290

This commit is contained in:
Markus Goetz 2018-04-19 13:34:02 +02:00 committed by Kevin Ottens
parent 600b1a72c1
commit 8dcfd50a7d
No known key found for this signature in database
GPG Key ID: 074BBBCB8DECC9E2
3 changed files with 52 additions and 0 deletions

View File

@ -36,5 +36,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>

View File

@ -706,4 +706,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

View File

@ -83,6 +83,7 @@ protected:
void parseOptions(const QStringList &);
void setupTranslations();
void setupLogging();
bool event(QEvent *event);
signals:
void folderRemoved();