diff options
| author | Chris Townsend <christopher.townsend@canonical.com> | 2015-05-22 13:20:52 +0000 |
|---|---|---|
| committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-05-22 13:20:52 +0000 |
| commit | 5f041ab3ee4bc0766842591bd8d18812861c505a (patch) | |
| tree | 0b4fd0d3edcf65bb0d5287e1e2f7d357d219b6ad /dash | |
| parent | e4a81fe7b91b3acb375a9ee501f628aadc55ef83 (diff) | |
| parent | 48bbd01c26b9954b1f0008a2ed5e821c97eb0653 (diff) | |
If dragging an application:// uri type from the Dash to the desktop, change it to a file:// uri type so Nautilus can understand the type a make a copy of it on the desktop. Fixes: #1241972
Approved by: Marco Trevisan (TreviƱo), PS Jenkins bot (bzr r3969)
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/ResultViewGrid.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp index c57ad02ef..ee3e3c286 100644 --- a/dash/ResultViewGrid.cpp +++ b/dash/ResultViewGrid.cpp @@ -25,6 +25,7 @@ #include <Nux/VLayout.h> #include <NuxGraphics/GdkGraphics.h> #include <unity-protocol.h> +#include <boost/algorithm/string.hpp> #include "unity-shared/IntrospectableWrappers.h" #include "unity-shared/Timer.h" @@ -33,6 +34,7 @@ #include "unity-shared/GraphicsUtils.h" #include "unity-shared/RawPixel.h" #include "unity-shared/WindowManager.h" +#include <UnityCore/DesktopUtilities.h> #include "ResultViewGrid.h" #include "math.h" @@ -55,6 +57,8 @@ namespace const RawPixel WIDTH_PADDING = 25_em; const RawPixel SCROLLBAR_WIDTH = 3_em; + + const std::string APPLICATION_URI_PREFIX = "application://"; } NUX_IMPLEMENT_OBJECT_TYPE(ResultViewGrid); @@ -919,6 +923,15 @@ bool ResultViewGrid::DndSourceDragBegin() if (current_drag_result_.empty()) current_drag_result_.uri = current_drag_result_.uri.substr(current_drag_result_.uri.find(":") + 1); + if (boost::starts_with(current_drag_result_.uri, APPLICATION_URI_PREFIX)) + { + auto desktop_id = current_drag_result_.uri.substr(APPLICATION_URI_PREFIX.size()); + auto desktop_path = DesktopUtilities::GetDesktopPathById(desktop_id); + + if (!desktop_path.empty()) + current_drag_result_.uri = "file://" + desktop_path; + } + LOG_DEBUG (logger) << "Dnd begin at " << last_mouse_down_x_ << ", " << last_mouse_down_y_ << " - using; " << current_drag_result_.uri; |
