Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marcin Mielniczuk
gajim
Commits
3fe77688
Verified
Commit
3fe77688
authored
May 04, 2021
by
Marcin Mielniczuk
Browse files
Show an info message if some of the paths are skipped during a drag&drop.
Related to #10544
parent
5e8ef4a3
Pipeline
#8041
passed with stages
in 7 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gajim/chat_control_base.py
View file @
3fe77688
...
...
@@ -967,12 +967,13 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
self
.
xml
.
drop_area
.
set_no_show_all
(
False
)
self
.
xml
.
drop_area
.
show_all
()
def
drag_data_file_transfer
(
self
,
selection
)
:
def
drag_data_file_transfer
(
self
,
selection
:
Gtk
.
SelectionData
)
->
None
:
# we may have more than one file dropped
uri_splitted
=
selection
.
get_uris
()
for
uri
in
uri_splitted
:
path
=
helpers
.
get_file_path_from_dnd_dropped_uri
(
uri
)
if
not
os
.
path
.
isfile
(
path
):
# is it a file?
self
.
add_info_message
(
_
(
"The following file could not be accessed and was not uploaded: "
)
+
path
)
continue
self
.
_start_filetransfer
(
path
)
...
...
gajim/common/helpers.py
View file @
3fe77688
...
...
@@ -352,7 +352,7 @@ def build_command(executable, parameter):
command
=
'%s "%s"'
%
(
executable
,
parameter
)
return
command
def
get_file_path_from_dnd_dropped_uri
(
uri
)
:
def
get_file_path_from_dnd_dropped_uri
(
uri
:
str
)
->
str
:
path
=
urllib
.
parse
.
unquote
(
uri
)
# escape special chars
path
=
path
.
strip
(
'
\r\n\x00
'
)
# remove \r\n and NULL
# get the path to file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment