diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp index cc4f2696fc..bc6bca6434 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp +++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp @@ -105,6 +105,8 @@ void PreviewWidget::set_theme_from_file(String const& path, int fd) m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme)); set_preview_palette(m_preview_palette); + if (on_theme_load_from_file) + on_theme_load_from_file(path); } void PreviewWidget::paint_event(GUI::PaintEvent& event) diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.h b/Userland/Applications/ThemeEditor/PreviewWidget.h index 10be2f0339..c3000e83a3 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.h +++ b/Userland/Applications/ThemeEditor/PreviewWidget.h @@ -23,6 +23,8 @@ public: void set_preview_palette(const Gfx::Palette&); void set_theme_from_file(String const& path, int fd); + Function on_theme_load_from_file; + private: explicit PreviewWidget(const Gfx::Palette&); diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index b2270fcca1..5ea4e39a0b 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -130,6 +130,10 @@ int main(int argc, char** argv) auto& file_menu = window->add_menu("&File"); + preview_widget.on_theme_load_from_file = [&](String const& new_path) { + path = new_path; + }; + auto save_to_result = [&](FileSystemAccessClient::Result const& result) { if (result.error != 0) return;