From 35657e60057c7a0337b55a62e414db9d801a2c30 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 4 Sep 2016 15:42:51 +0200 Subject: [PATCH] Mac: Fix opening urls from FileOpen event --- src/lib/app/mainapplication.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index cdec4bc89..c9060c6d4 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -1124,9 +1124,17 @@ RegisterQAppAssociation* MainApplication::associationManager() bool MainApplication::event(QEvent* e) { switch (e->type()) { - case QEvent::FileOpen: - addNewTab(QUrl::fromLocalFile(static_cast(e)->file())); + case QEvent::FileOpen: { + QFileOpenEvent *ev = static_cast(e); + if (!ev->url().isEmpty()) { + addNewTab(ev->url()); + } else if (!ev->file().isEmpty()) { + addNewTab(QUrl::fromLocalFile(ev->file())); + } else { + return false; + } return true; + } case QEvent::ApplicationActivate: if (!activeWindow() && m_windows.isEmpty())