Skip to content
Snippets Groups Projects
Commit 47e9aa46 authored by nkour's avatar nkour
Browse files

dnd now should work for all(?) file managers

parent 86443c49
No related branches found
No related tags found
No related merge requests found
......@@ -51,8 +51,8 @@ def __init__(self, user, plugin, account):
self.possible_paused_timeout_id = {}
# keep check for possible inactive timeouts per jid
self.possible_inactive_timeout_id = {}
self.TARGET_TYPE_TEXT = 80
self.dnd_list = [ ( 'text/plain', 0, self.TARGET_TYPE_TEXT ) ]
self.TARGET_TYPE_URI_LIST = 80
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
self.new_user(user)
self.show_title()
......@@ -104,9 +104,10 @@ def on_tabbed_chat_window_motion_notify_event(self, widget, event):
def on_drag_data_received(self, widget, context, x, y, selection, target_type,
timestamp, contact):
if target_type == self.TARGET_TYPE_TEXT:
path = selection.data.strip() # get path to file
if path.startswith('file://'):
if target_type == self.TARGET_TYPE_URI_LIST:
uri = selection.data.strip()
path = urllib.url2pathname(uri) # escape special chars
if path.startswith('file://'): # get the path to file
path = path[7:] # 7 is len('file://')
if os.path.isfile(path): # is it file?
self.plugin.windows['file_transfers'].send_file(self.account,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment