From 94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:17:25 +0200 Subject: 4.5 --- lib/folder_history_box.cpp | 7 +++---- lib/folder_history_box.h | 6 +++--- lib/resolve_path.cpp | 13 ++++++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/folder_history_box.cpp b/lib/folder_history_box.cpp index b395cbf4..c8bd042a 100644 --- a/lib/folder_history_box.cpp +++ b/lib/folder_history_box.cpp @@ -60,8 +60,8 @@ void FolderHistoryBox::OnHideDropDown(wxCommandEvent& event) } #endif - -void FolderHistoryBox::update(const wxString& dirname) +//set value and update list are technically entangled: see potential bug description below +void FolderHistoryBox::setValueAndUpdateList(const wxString& dirname) { //it may be a little lame to update the list on each mouse-button click, but it should be working and we dont't have to manipulate wxComboBox internals @@ -69,8 +69,7 @@ void FolderHistoryBox::update(const wxString& dirname) //add some aliases to allow user changing to volume name and back, if possible #ifdef FFS_WIN - const Zstring activePath = toZ(GetValue()); - std::vector aliases = getDirectoryAliases(activePath); + std::vector aliases = getDirectoryAliases(toZ(dirname)); dirList.insert(dirList.end(), aliases.begin(), aliases.end()); #endif diff --git a/lib/folder_history_box.h b/lib/folder_history_box.h index 28b85c90..859234cc 100644 --- a/lib/folder_history_box.h +++ b/lib/folder_history_box.h @@ -80,7 +80,7 @@ public: void setValue(const wxString& dirname) { - update(dirname); //required for setting value correctly + Linux to ensure the dropdown is shown as being populated + setValueAndUpdateList(dirname); //required for setting value correctly + Linux to ensure the dropdown is shown as being populated } // GetValue @@ -88,9 +88,9 @@ public: private: void OnKeyEvent(wxKeyEvent& event); void OnSelection(wxCommandEvent& event); - void OnUpdateList(wxEvent& event) { update(GetValue()); event.Skip(); } + void OnUpdateList(wxEvent& event) { setValueAndUpdateList(GetValue()); event.Skip(); } - void update(const wxString& dirname); + void setValueAndUpdateList(const wxString& dirname); #if wxCHECK_VERSION(2, 9, 1) void OnShowDropDown(wxCommandEvent& event); diff --git a/lib/resolve_path.cpp b/lib/resolve_path.cpp index feeb98e3..df65b98b 100644 --- a/lib/resolve_path.cpp +++ b/lib/resolve_path.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef FFS_WIN #include @@ -354,6 +355,7 @@ Zstring volumenNameToPath(const Zstring& volumeName) //return empty string on er #ifdef FFS_WIN +//attention: this call may seriously block if network volume is not available!!! Zstring volumePathToName(const Zstring& volumePath) //return empty string on error { const DWORD bufferSize = MAX_PATH + 1; @@ -440,9 +442,14 @@ void getDirectoryAliasesRecursive(const Zstring& dirname, std::set futVolName = zen::async([=] { return volumePathToName(Zstring(dirname.c_str(), 3)); }); + if (futVolName.timed_wait(boost::posix_time::seconds(1))) + { + Zstring volname = futVolName.get(); + if (!volname.empty()) + output.insert(L"[" + volname + L"]" + Zstring(dirname.c_str() + 2)); + } } //2. replace volume name by volume path: [SYSTEM]\dirname -> c:\dirname -- cgit