frontends: incoming files transfer management:
- quick app: getWaitingConf is used on profile connexion
- primitivus: askConfirmation is now managed, use new 'dir' style of FileDialog
This commit is contained in:
parent
75bb00a0d4
commit
297b439369
2 changed files with 73 additions and 11 deletions
|
|
@ -147,6 +147,10 @@ class QuickApp(object):
|
|||
callback=lambda watched: self.plug_profile_4(watched, autoconnect, profile), errback=self._getParamError)
|
||||
|
||||
def plug_profile_4(self, watched, autoconnect, profile):
|
||||
if autoconnect and not self.bridge.isConnected(profile):
|
||||
#Does the user want autoconnection ?
|
||||
self.bridge.connect(profile)
|
||||
|
||||
self.profiles[profile]['watched'] = watched.split() #TODO: put this in a plugin
|
||||
|
||||
## misc ##
|
||||
|
|
@ -186,10 +190,11 @@ class QuickApp(object):
|
|||
|
||||
for subject_args in self.bridge.getRoomsSubjects(profile):
|
||||
self.roomNewSubject(*subject_args, profile=profile)
|
||||
|
||||
if autoconnect and not self.bridge.isConnected(profile):
|
||||
#Does the user want autoconnection ?
|
||||
self.bridge.connect(profile)
|
||||
|
||||
#Finaly, we get the waiting confirmation requests
|
||||
for confirm_id, confirm_type, data in self.bridge.getWaitingConf(profile):
|
||||
self.askConfirmation(confirm_id, confirm_type, data, profile)
|
||||
|
||||
|
||||
|
||||
def unplug_profile(self, profile):
|
||||
|
|
@ -546,7 +551,7 @@ class QuickApp(object):
|
|||
self.contact_list.setCache(jid, 'avatar', filename)
|
||||
self.contact_list.replace(jid)
|
||||
|
||||
def askConfirmation(self, type, id, data, profile):
|
||||
def askConfirmation(self, confirm_id, confirm_type, data, profile):
|
||||
raise NotImplementedError
|
||||
|
||||
def actionResult(self, type, id, data):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
"""
|
||||
|
||||
from sat.tools.jid import JID
|
||||
from os.path import exists, splitext
|
||||
|
||||
def escapePrivate(ori_jid):
|
||||
"""Escape a private jid"""
|
||||
|
|
@ -31,3 +32,16 @@ def unescapePrivate(escaped_jid):
|
|||
escaped_split = tuple(escaped_jid[len(const_PRIVATE_PREFIX):].split('@'))
|
||||
assert(len(escaped_split) == 3)
|
||||
return JID("%s@%s/%s" % escaped_split)
|
||||
|
||||
def getNewPath(path):
|
||||
""" Check if path exists, and find a non existant path if needed """
|
||||
idx = 2
|
||||
if not exists(path):
|
||||
return path
|
||||
root, ext = splitext(path)
|
||||
while True:
|
||||
new_path = "%s_%d%s" % (root, idx, ext)
|
||||
if not exists(new_path):
|
||||
return new_path
|
||||
idx+=1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue