Store last path for adding KDMs (#2348).
authorCarl Hetherington <cth@carlh.net>
Sat, 11 Nov 2023 21:55:27 +0000 (22:55 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 11 Nov 2023 21:55:27 +0000 (22:55 +0100)
src/lib/config.cc
src/wx/content_menu.cc

index d032e6c64b165049c1fd79efd202548cbb2e4447..aea54aa237c59144553b3d508a0560f5a215c2b5 100644 (file)
@@ -187,6 +187,7 @@ Config::set_defaults ()
        _custom_languages.clear ();
        _initial_paths.clear();
        _initial_paths["AddFilesPath"] = boost::none;
+       _initial_paths["AddKDMPath"] = boost::none;
        _initial_paths["AddDKDMPath"] = boost::none;
        _initial_paths["SelectCertificatePath"] = boost::none;
        _initial_paths["AddCombinerInputPath"] = boost::none;
index 5d98659702d89494eb796d7bed226f22c3450475..b9214e6a78689c0c8ba2140cbb5186e87fee1e67 100644 (file)
@@ -24,6 +24,7 @@
 #include "content_menu.h"
 #include "content_properties_dialog.h"
 #include "dir_dialog.h"
+#include "file_dialog.h"
 #include "film_viewer.h"
 #include "repeat_dialog.h"
 #include "timeline_video_content_view.h"
@@ -402,15 +403,15 @@ ContentMenu::kdm ()
        auto dcp = dynamic_pointer_cast<DCPContent> (_content.front());
        DCPOMATIC_ASSERT (dcp);
 
-       wxFileDialog dialog(_parent, _("Select KDM"));
+       FileDialog dialog(_parent, _("Select KDM"), wxT("XML files|*.xml|All files|*.*"), wxFD_MULTIPLE, "AddKDMPath");
 
-       if (dialog.ShowModal() != wxID_OK) {
+       if (!dialog.show()) {
                return;
        }
 
        optional<dcp::EncryptedKDM> kdm;
        try {
-               kdm = dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(dialog.GetPath()), MAX_KDM_SIZE));
+               kdm = dcp::EncryptedKDM(dcp::file_to_string(dialog.path(), MAX_KDM_SIZE));
        } catch (exception& e) {
                error_dialog (_parent, _("Could not load KDM"), std_to_wx(e.what()));
                return;