From 6166ab28dd43304085b23c0d35698be9d90bb8a9 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Thu, 14 Dec 2017 14:27:49 -0800 Subject: Pull in Dullahan 1.1.929 (multiple file picking support) and update plugin code accordingly --- indra/media_plugins/cef/media_plugin_cef.cpp | 38 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'indra/media_plugins/cef') diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index dbd33a736b..558ae75c3c 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -68,7 +68,7 @@ private: void onNavigateURLCallback(std::string url, std::string target); bool onHTTPAuthCallback(const std::string host, const std::string realm, std::string& username, std::string& password); void onCursorChangedCallback(dullahan::ECursorType type); - const std::string onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default); + const std::vector onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default); void postDebugMessage(const std::string& msg); void authResponse(LLPluginMessage &message); @@ -94,7 +94,7 @@ private: bool mCanPaste; std::string mCachePath; std::string mCookiePath; - std::string mPickedFile; + std::vector mPickedFiles; VolumeCatcher mVolumeCatcher; F32 mCurVolume; dullahan* mCEFLib; @@ -124,7 +124,7 @@ MediaPluginBase(host_send_func, host_user_data) mCanPaste = false; mCachePath = ""; mCookiePath = ""; - mPickedFile = ""; + mPickedFiles.clear(); mCurVolume = 0.0; mCEFLib = new dullahan(); @@ -284,21 +284,34 @@ bool MediaPluginCEF::onHTTPAuthCallback(const std::string host, const std::strin //////////////////////////////////////////////////////////////////////////////// // -const std::string MediaPluginCEF::onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, std::string dialog_accept_filter, bool& use_default) +const std::vector MediaPluginCEF::onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, std::string dialog_accept_filter, bool& use_default) { // do not use the default CEF file picker use_default = false; if (dialog_type == dullahan::FD_OPEN_FILE) { - mPickedFile.clear(); + mPickedFiles.clear(); LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file"); message.setValueBoolean("blocking_request", true); + message.setValueBoolean("multiple_files", false); sendMessage(message); - return mPickedFile; + return mPickedFiles; + } + else if (dialog_type == dullahan::FD_OPEN_MULTIPLE_FILES) + { + mPickedFiles.clear(); + + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file"); + message.setValueBoolean("blocking_request", true); + message.setValueBoolean("multiple_files", true); + + sendMessage(message); + + return mPickedFiles; } else if (dialog_type == dullahan::FD_SAVE_FILE) { @@ -309,10 +322,10 @@ const std::string MediaPluginCEF::onFileDialog(dullahan::EFileDialogType dialog_ sendMessage(message); - return std::string(); + return std::vector(); } - return std::string(); + return std::vector(); } //////////////////////////////////////////////////////////////////////////////// @@ -659,7 +672,14 @@ void MediaPluginCEF::receiveMessage(const char* message_string) } if (message_name == "pick_file_response") { - mPickedFile = message_in.getValue("file"); + LLSD file_list_llsd = message_in.getValueLLSD("file_list"); + + LLSD::array_const_iterator iter = file_list_llsd.beginArray(); + LLSD::array_const_iterator end = file_list_llsd.endArray(); + for (; iter != end; ++iter) + { + mPickedFiles.push_back(((*iter).asString())); + } } if (message_name == "auth_response") { -- cgit v1.2.3