diff --git a/uno/.gitrepo b/uno/.gitrepo index c0838f50..1f8bd311 100644 --- a/uno/.gitrepo +++ b/uno/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/prrvchr/uno.git branch = main - commit = f2ac5004f925fbde2bfaf7d193eb4cceef0789a2 - parent = c94f68abf13be39f14e0112113bfbd7603a34072 + commit = 1cf8089e4fc86ff074c122ba29412b69e190a921 + parent = b4cb553bdc95117543e8c56ac660f9c2833c42ee method = merge cmdver = 0.4.3 diff --git a/uno/lib/uno/ucb/ucp/content.py b/uno/lib/uno/ucb/ucp/content.py index a4aedd55..532eca30 100644 --- a/uno/lib/uno/ucb/ucp/content.py +++ b/uno/lib/uno/ucb/ucp/content.py @@ -240,9 +240,8 @@ def createCommandIdentifier(self): print("Content.createCommandIdentifier() 1") return 1 def execute(self, command, cmdid, environment): - self._logger.logprb(INFO, 'Content', 'execute()', 636, command.Name, self._identifier) + self._logger.logprb(INFO, 'Content', 'execute()', 631, command.Name, self._identifier) if command.Name == 'getCommandInfo': - self._logger.logprb(INFO, 'Content', 'execute()', 631, 'getCommandInfo', self.IsFolder) return CommandInfo(self._getCommandInfo()) elif command.Name == 'getPropertySetInfo': @@ -260,97 +259,66 @@ def execute(self, command, cmdid, environment): self._user.updateContent(self.Id, 'Trashed', True) elif command.Name == 'open': - print("Content.execute() open") - for property in command.Argument.Properties: - print("Content.execute() open Property: %s" % property.Name) - try: - self._logger.logprb(INFO, 'Content', 'execute()', 631, 'open', self.IsFolder) - print("Content.execute() open Mode: %s" % command.Argument.Mode) - if self.IsFolder: - print("Content.execute() open 1") - select = self._getFolderContent(command.Argument.Properties) - print("Content.execute() open 2") - msg = " IsFolder: %s" % self.IsFolder - print("Content.execute() open 3") - return DynamicResultSet(self._user, self._authority, select) - elif self.IsDocument: - print("Content.execute() open 4") - sf = getSimpleFile(self._ctx) - url, size = self._getDocumentContent(sf) - if not size: - title = self.MetaData.get('Title') - msg = "Error while downloading file: %s" % title - print("Content.execute() %s" % msg) - raise CommandAbortedException(msg, self) - sink = command.Argument.Sink - isreadonly = self.MetaData.get('IsReadOnly') - if hasInterface(sink, 'com.sun.star.io.XActiveDataSink'): - sink.setInputStream(sf.openFileRead(url)) - elif not isreadonly and hasInterface(sink, 'com.sun.star.io.XActiveDataStreamer'): - sink.setStream(sf.openFileReadWrite(url)) - except Exception as e: - msg = "Content.Open() Error: %s" % traceback.format_exc() - print(msg) - raise e + if self.IsFolder: + select = self._getFolderContent(command.Argument.Properties) + return DynamicResultSet(self._user, self._authority, select) + elif self.IsDocument: + sf = getSimpleFile(self._ctx) + url, size = self._getDocumentContent(sf) + if not size: + msg = self._logger.resolveString(632, self._identifier) + raise CommandAbortedException(msg, self) + sink = command.Argument.Sink + isreadonly = self.MetaData.get('IsReadOnly') + if hasInterface(sink, 'com.sun.star.io.XActiveDataSink'): + sink.setInputStream(sf.openFileRead(url)) + elif not isreadonly and hasInterface(sink, 'com.sun.star.io.XActiveDataStreamer'): + sink.setStream(sf.openFileReadWrite(url)) elif command.Name == 'createNewContent' and self.IsFolder: - print("Content.execute() createNewContent") return self.createNewContent(command.Argument) elif command.Name == 'insert': - print("Content.execute() insert") # The Insert command is only used to create a new folder or a new document # (ie: File Save As). # It saves the content created by 'createNewContent' from the parent folder # right after the Title property is initialized - stream = command.Argument.Data - replace = command.Argument.ReplaceExisting - documentid = command.Argument.DocumentId - mimetype = command.Argument.MimeType - self._logger.logprb(INFO, 'Content', 'execute()', 635, replace, documentid, mimetype, self.IsFolder) - print("Content.execute() insert 1 - %s - %s - %s" % (self.IsFolder, - self.Id, - self.MetaData.get('Title'))) if self.IsDocument: sf = getSimpleFile(self._ctx) target = self._user.getTargetUrl(self.Id) + replace = command.Argument.ReplaceExisting if sf.exists(target) and not replace: return + stream = command.Argument.Data if hasInterface(stream, 'com.sun.star.io.XInputStream'): sf.writeFile(target, stream) + mimetype = command.Argument.MimeType # For document type resources, the media type is always unknown... mediatype = mimetype if mimetype else getMimeType(self._ctx, stream) stream.closeInput() self.MetaData['MediaType'] = mediatype - print("Content.execute() insert 2 ************** mediatype: %s - mimetype: %s" % (mediatype, mimetype)) if self._user.insertNewContent(self._authority, self.MetaData): - print("Content.execute() insert 3 ") # Need to consum the new Identifier if needed... self._user.deleteNewIdentifier(self.Id) - print("Content.execute() insert 5") elif command.Name == 'transfer': # see github/libreoffice/ucb/source/core/ucbcmds.cxx - self._logger.logprb(INFO, 'Content', 'execute()', 631, 'transfer', self.IsFolder) + if not self.IsFolder: + msg = self._logger.resolveString(633, self._identifier) + UnsupportedCommandException(msg, self) title = command.Argument.NewTitle source = command.Argument.SourceURL move = command.Argument.MoveData clash = command.Argument.NameClash - self._logger.logprb(INFO, 'Content', 'execute()', 633, title, source, move, clash) - if not self.IsFolder: - msg = "Couln't handle transfert, only Folder can handle transfert" - UnsupportedCommandException(msg, self) # Transfer command is used for document 'File Save' or 'File Save As' # NewTitle come from: # - Last segment path of 'XContent.getIdentifier().getContentIdentifier()' for OpenOffice # - Property 'Title' of 'XContent' for LibreOffice # If the content has been renamed, the last segment is the new Title of the content - print("Content.execute() transfert 1 %s - %s -%s - %s" % (title, source, move, clash)) # We check if 'NewTitle' is a child of this folder by recovering its ItemId itemid = self._user.DataBase.getChildId(self.Id, title) if itemid is None or clash != OVERWRITE: - print("Content.execute() transfert 2 %s" % itemid) # ItemId could not be found: 'NewTitle' does not exist in the folder... # or NewTitle exist but we don't have the OVERWRITE flag set... # When saving a new document with (File save) or when creating @@ -358,9 +326,8 @@ def execute(self, command, cmdid, environment): # - createNewContent: for creating an empty new Content # - Insert at new Content for committing change # To execute these commands, we must throw an exception - msg = "Couln't handle Url: %s" % source + msg = self._logger.resolveString(634, source, self._identifier) raise InteractiveBadTransferURLException(msg, self) - print("Content.execute() transfert 3 %s - %s" % (itemid, source)) sf = getSimpleFile(self._ctx) if not sf.exists(source): raise CommandAbortedException("Error while saving file: %s" % source, self) @@ -370,20 +337,18 @@ def execute(self, command, cmdid, environment): inputstream.closeInput() # We need to update the Size size = sf.getSize(target) - self._logger.logprb(INFO, 'Content', 'execute()', 634, self._identifier, size) + self._logger.logprb(INFO, 'Content', 'execute()', 635, self._identifier, size) self._user.updateContent(itemid, 'Size', size) if move: # TODO: must delete object pass elif command.Name == 'flush': - self._logger.logprb(INFO, 'Content', 'execute()', 631, 'flush', self.IsFolder) + pass def abort(self, id): - print("Content.abort() 1") pass def releaseCommandIdentifier(self, id): - print("Content.releaseCommandIdentifier() 1") pass # Private methods @@ -420,7 +385,6 @@ def _getPropertyValue(self, name): else: value = self.MetaData.get(name) msg = "Name: %s - Value: %s" % (name, value) - print("content._getPropertiesValues(): %s: %s" % (name, value)) return value, INFO, msg diff --git a/uno/resource/ucb/ContentProvider_en_US.properties b/uno/resource/ucb/ContentProvider_en_US.properties index d79c779d..b858a6d4 100644 --- a/uno/resource/ucb/ContentProvider_en_US.properties +++ b/uno/resource/ucb/ContentProvider_en_US.properties @@ -85,12 +85,11 @@ 621=The content of the folder: {} is obtained with Request!!! 630=Content.execute() -631=Content execute command: {} IsFolder: {} -632=The content execute command: update ************************* -633=Transfert content title: {} source: {} move: {} clash: {} -634=Save file: {} size: {} -635=Insert file replace: {} documentid {} mimetype: {} IsFolder {} -636=The content execute command: {} on identifier: {} +631=The content execute command: {} on identifier: {} +632=Error while downloading file: {} +633=Couldn't handle transfert on identifier: {}, only Folder can handle transfert +634=Couln't handle Url: {} on identifier: {} +635=Save file: {} size: {} 640=Content.getIdentifier() 641=Content identifier: {} diff --git a/uno/resource/ucb/ContentProvider_fr_FR.properties b/uno/resource/ucb/ContentProvider_fr_FR.properties index 5fef1981..c466c193 100644 --- a/uno/resource/ucb/ContentProvider_fr_FR.properties +++ b/uno/resource/ucb/ContentProvider_fr_FR.properties @@ -85,12 +85,11 @@ 621=Le contenu du dossier: {} est obtenu avec Request!!! 630=Content.execute() -631=Le contenu execute la commande: {} IsFolder: {} -632=Le contenu execute la commande: update ************************* -633=Transfert du contenu titre: {} soure: {} déplacer: {} conflit: {} -634=Sauvegarde du fichier: {} taille: {} -635=Insertion du fichier replace: {} documentid: {} mimetype: {} IsFolder {} -636=Le contenu execute la commande: {} sur l'identifieur: {} +631=Le contenu execute la commande: {} sur l'identifiant: {} +632=Erreur lors du téléchargement du fichier : {} +633=Impossible de gérer le transfert sur l'identifiant: {}, seul le dossier peut gérer le transfert +634=Impossible de gérer l'URL: {} sur l'identifiant: {} +635=Sauvegarde du fichier: {} taille: {} 640=Content.getIdentifier() 641=Identificateur de contenu: {}