+ 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 <QDataStream>
|
||||||
# include <QDebug>
|
# include <QDebug>
|
||||||
# include <QFileInfo>
|
# include <QFileInfo>
|
||||||
|
# include <QFileOpenEvent>
|
||||||
# include <QSessionManager>
|
# include <QSessionManager>
|
||||||
# include <QTimer>
|
# include <QTimer>
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "GuiApplication.h"
|
#include "GuiApplication.h"
|
||||||
|
#include "Application.h"
|
||||||
#include "SpaceballEvent.h"
|
#include "SpaceballEvent.h"
|
||||||
#include "MainWindow.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 {
|
class GUISingleApplication::Private {
|
||||||
|
|
|
@ -49,6 +49,9 @@ public:
|
||||||
bool notify (QObject * receiver, QEvent * event);
|
bool notify (QObject * receiver, QEvent * event);
|
||||||
void commitData(QSessionManager &manager);
|
void commitData(QSessionManager &manager);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent * event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int systemExit;
|
int systemExit;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,5 +34,18 @@
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
<string>True</string>
|
<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>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user