Commit a506226d authored by Sophie Herold's avatar Sophie Herold Committed by Philipp Hörist

Add paste from clipboard in JoinGroupchat dialog

Closes #9237
parent d9eb3e68
......@@ -323,6 +323,7 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="_on_jid_detection_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
......@@ -388,6 +389,7 @@
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="caps_lock_warning">False</property>
<signal name="changed" handler="_on_jid_detection_changed" swapped="no"/>
</object>
</child>
</object>
......
......@@ -2452,6 +2452,23 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
self.nick_entry.set_text(app.nicks[account])
self._fill_recent_and_servers(account)
def _on_jid_detection_changed(self, widget):
text = widget.get_text()
if text.startswith('xmpp:'):
text = text[5:]
if '@' in text:
room, server = text.split('@', 1)
server = server.split('?')[0]
widget.set_text('')
if room:
self.room_entry.set_text(room)
if server:
self.server_combo.get_child().set_text(server)
else:
self.server_combo.grab_focus()
def _on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.destroy()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment