+ fixes #0001860: Can not open a FreeCAD project in FreeCAD by double-clicking the project file on Macintosh
This commit is contained in:
parent
b2080f945a
commit
76c238fc98
|
@ -30,6 +30,7 @@
|
|||
# include <QDataStream>
|
||||
# include <QDebug>
|
||||
# include <QFileInfo>
|
||||
# include <QFileOpenEvent>
|
||||
# include <QSessionManager>
|
||||
# include <QTimer>
|
||||
#endif
|
||||
|
@ -47,6 +48,7 @@
|
|||
#endif
|
||||
|
||||
#include "GuiApplication.h"
|
||||
#include "Application.h"
|
||||
#include "SpaceballEvent.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
|
@ -144,6 +146,21 @@ void GUIApplication::commitData(QSessionManager &manager)
|
|||
}
|
||||
}
|
||||
|
||||
bool GUIApplication::event(QEvent * ev)
|
||||
{
|
||||
if (ev->type() == QEvent::FileOpen) {
|
||||
QString file = static_cast<QFileOpenEvent*>(ev)->file();
|
||||
QFileInfo fi(file);
|
||||
if (fi.suffix().toLower() == QLatin1String("fcstd")) {
|
||||
QByteArray fn = file.toUtf8();
|
||||
Application::Instance->open(fn, "FreeCAD");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return GUIApplicationNativeEventAware::event(ev);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class GUISingleApplication::Private {
|
||||
|
|
|
@ -49,6 +49,9 @@ public:
|
|||
bool notify (QObject * receiver, QEvent * event);
|
||||
void commitData(QSessionManager &manager);
|
||||
|
||||
protected:
|
||||
bool event(QEvent * event);
|
||||
|
||||
private:
|
||||
int systemExit;
|
||||
};
|
||||
|
|
|
@ -34,5 +34,18 @@
|
|||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>fcstd</string>
|
||||
</array>
|
||||
<key>LSIsAppleDefaultForType</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Loading…
Reference in New Issue
Block a user