Commit 491dad09 authored by Philipp Hörist's avatar Philipp Hörist

Correctly open email links

parent 8566d036
......@@ -348,11 +348,18 @@ def show_next_pending_event(action, param):
app.interface.handle_event(account, jid, event.type_)
def open_link(_action, param):
def open_mail(_action, param):
uri = param.get_string()
if not uri.startswith('mailto:'):
uri = 'mailto:%s' % uri
helpers.open_uri(uri)
def open_link(_action, param):
account, uri = param.get_string()
helpers.open_uri(uri, account=account)
def copy_text(_action, param):
text = param.get_string()
clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
......
......@@ -460,10 +460,14 @@ class GajimApplication(Gtk.Application):
act.connect("activate", app_actions.copy_text)
self.add_action(act)
act = Gio.SimpleAction.new('open-link', GLib.VariantType.new('s'))
act = Gio.SimpleAction.new('open-link', GLib.VariantType.new('as'))
act.connect("activate", app_actions.open_link)
self.add_action(act)
act = Gio.SimpleAction.new('open-mail', GLib.VariantType.new('s'))
act.connect("activate", app_actions.open_mail)
self.add_action(act)
act = Gio.SimpleAction.new('create-groupchat', GLib.VariantType.new('s'))
act.connect("activate", app_actions.on_create_gc)
self.add_action(act)
......
......@@ -790,7 +790,7 @@ def get_conv_context_menu(account, uri):
elif uri.type == URIType.MAIL:
context_menu = [
('copy-text', _('Copy Email Address')),
('open-link', _('Open Email Composer')),
('open-mail', _('Open Email Composer')),
]
elif uri.type == URIType.GEO:
......@@ -802,7 +802,7 @@ def get_conv_context_menu(account, uri):
elif uri.type == URIType.AT:
context_menu = [
('copy-text', _('Copy XMPP Address/Email')),
('open-link', _('Open Email Composer')),
('open-mail', _('Open Email Composer')),
('-start-chat', _('Start Chat')),
('groupchat-join', _('Join Groupchat')),
('-add-contact', _('Add to Contact List…')),
......@@ -826,7 +826,7 @@ def get_conv_context_menu(account, uri):
if uri.type == URIType.XMPP:
data = uri.data['jid']
if action in ('app.open-link', 'app.copy-text'):
if action in ('app.open-mail', 'app.copy-text'):
value = GLib.Variant.new_string(data)
else:
value = GLib.Variant.new_strv([account, data])
......
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