+ fixes #0001860: Can not open a FreeCAD project in FreeCAD by double-clicking the project file on Macintosh
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user