Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
gajim
Commits
ae9cbc67
Commit
ae9cbc67
authored
May 14, 2022
by
Daniel Brötzmann
Browse files
fix: Jingle: Use SendFileDialog for DND and paste events
parent
77c8d623
Changes
2
Hide whitespace changes
Inline
Side-by-side
gajim/gtk/controls/base.py
View file @
ae9cbc67
...
...
@@ -35,6 +35,7 @@
import
time
import
uuid
import
tempfile
from
functools
import
partial
from
gi.repository
import
Gtk
from
gi.repository
import
Gdk
...
...
@@ -69,6 +70,7 @@
from
gajim.gui.dialogs
import
DialogButton
from
gajim.gui.dialogs
import
ErrorDialog
from
gajim.gui.dialogs
import
PastePreviewDialog
from
gajim.gui.file_transfer_send
import
SendFileDialog
from
gajim.gui.message_input
import
MessageInputTextView
from
gajim.gui.security_label_selector
import
SecurityLabelSelector
from
gajim.gui.util
import
get_hardware_key_codes
...
...
@@ -807,10 +809,12 @@ def _start_filetransfer(self, path: str) -> None:
if
method
==
'httpupload'
:
app
.
interface
.
send_httpupload
(
self
,
path
)
else
:
app
.
interface
.
instances
[
'file_transfers'
].
send_file
(
self
.
account
,
self
.
contact
,
path
)
send_callback
=
partial
(
app
.
interface
.
instances
[
'file_transfers'
].
send_file
,
self
.
account
,
self
.
contact
)
SendFileDialog
(
self
.
contact
,
send_callback
,
app
.
window
,
[
path
])
def
_on_send_file
(
self
,
action
:
Gio
.
SimpleAction
,
...
...
gajim/gtk/file_transfer_send.py
View file @
ae9cbc67
...
...
@@ -21,6 +21,7 @@
from
typing
import
Callable
from
typing
import
cast
from
typing
import
Optional
from
pathlib
import
Path
...
...
@@ -44,7 +45,8 @@ class SendFileDialog(Gtk.ApplicationWindow):
def
__init__
(
self
,
contact
:
BareContact
,
send_callback
:
Callable
[...,
bool
],
transient_for
:
Gtk
.
Window
transient_for
:
Gtk
.
Window
,
files
:
Optional
[
list
[
str
]]
=
None
)
->
None
:
Gtk
.
ApplicationWindow
.
__init__
(
self
)
self
.
set_application
(
app
.
app
)
...
...
@@ -75,6 +77,9 @@ def __init__(self,
self
.
_ui
.
resource_box
.
pack_start
(
self
.
_resource_selector
,
True
,
False
,
0
)
if
files
is
not
None
:
self
.
set_files
(
files
)
self
.
connect
(
'key-press-event'
,
self
.
_on_key_press
)
self
.
_ui
.
connect_signals
(
self
)
self
.
show_all
()
...
...
@@ -110,7 +115,7 @@ def _send_files(self, resource_jid: JID) -> None:
self
.
destroy
()
def
_select_files
(
self
,
_button
:
Gtk
.
Button
)
->
None
:
FileChooserDialog
(
self
.
_
set_files
,
FileChooserDialog
(
self
.
set_files
,
select_multiple
=
True
,
transient_for
=
self
,
path
=
app
.
settings
.
get
(
'last_send_dir'
))
...
...
@@ -120,7 +125,7 @@ def _remove_files(self, _button: Gtk.Button) -> None:
for
item
in
selected
:
self
.
_ui
.
listbox
.
remove
(
item
)
def
_
set_files
(
self
,
file_names
:
str
)
->
None
:
def
set_files
(
self
,
file_names
:
list
[
str
]
)
->
None
:
last_dir
=
''
for
file
in
file_names
:
row
=
FileRow
(
file
)
...
...
@@ -130,6 +135,7 @@ def _set_files(self, file_names: str) -> None:
self
.
_ui
.
listbox
.
add
(
row
)
self
.
_ui
.
listbox
.
show_all
()
app
.
settings
.
set
(
'last_send_dir'
,
str
(
last_dir
))
self
.
_ui
.
files_send
.
set_sensitive
(
True
)
def
_get_description
(
self
)
->
str
:
buffer_
=
self
.
_ui
.
description
.
get_buffer
()
...
...
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