parent
d9eb3e6891
commit
a506226d88
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue