Mercurial > libervia-desktop-kivy
changeset 198:60b63c3e63a1
plugin file sharing: use new EntitiesSelectorMenu to select entities which can access shared files
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 23 May 2018 21:28:16 +0200 |
parents | c7d15ef4bfa8 |
children | b80d275e437f |
files | cagou/plugins/plugin_wid_file_sharing.py |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_file_sharing.py Wed May 23 21:27:28 2018 +0200 +++ b/cagou/plugins/plugin_wid_file_sharing.py Wed May 23 21:28:16 2018 +0200 @@ -27,6 +27,7 @@ from sat_frontends.tools import jid from cagou.core.constants import Const as C from cagou.core import cagou_widget +from cagou.core.menu import EntitiesSelectorMenu from cagou.core.utils import FilterBehavior from cagou import G from kivy import properties @@ -408,13 +409,17 @@ ## Share methods ## - def share(self, menu): - item = self.menu_item - self.clear_menu() + def do_share(self, entities_jids, item): + if entities_jids: + access = {u'read': {u'type': 'whitelist', + u'jids': entities_jids}} + else: + access = {} + G.host.bridge.FISSharePath( item.name, item.filepath, - json.dumps({}, ensure_ascii=False), + json.dumps(access, ensure_ascii=False), self.profile, callback=lambda name: G.host.addNote( _(u"sharing folder"), @@ -423,6 +428,12 @@ title=_(u"sharing folder"), message=_(u"can't share folder: {msg}"))) + def share(self, menu): + item = self.menu_item + self.clear_menu() + EntitiesSelectorMenu(instructions=SELECT_INSTRUCTIONS, + callback=partial(self.do_share, item=item)).show() + def unshare(self, menu): item = self.menu_item self.clear_menu()