diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index d3a8a8d623..c0a40b32e4 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -714,3 +714,20 @@ void FontEditorWidget::update_preview() if (m_font_preview_window) m_font_preview_window->update(); } + +void FontEditorWidget::drop_event(GUI::DropEvent& event) +{ + event.accept(); + + if (event.mime_data().has_urls()) { + auto urls = event.mime_data().urls(); + if (urls.is_empty()) + return; + + window()->move_to_front(); + if (!request_close()) + return; + + open_file(urls.first().path()); + } +} diff --git a/Userland/Applications/FontEditor/FontEditor.h b/Userland/Applications/FontEditor/FontEditor.h index 2a5dc1ae2f..9a38b2154e 100644 --- a/Userland/Applications/FontEditor/FontEditor.h +++ b/Userland/Applications/FontEditor/FontEditor.h @@ -37,6 +37,8 @@ public: private: FontEditorWidget(const String& path, RefPtr&&); + virtual void drop_event(GUI::DropEvent&) override; + void open_file(String const&); void undo(); void redo();