diff --git a/mDriveOOo.update.xml b/mDriveOOo.update.xml index cd1005b9..245014f9 100644 --- a/mDriveOOo.update.xml +++ b/mDriveOOo.update.xml @@ -28,7 +28,7 @@ xmlns="http://openoffice.org/extensions/update/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + @@ -40,7 +40,7 @@ mDriveOOo - - + + diff --git a/source/mDriveOOo/Options.xcu b/source/mDriveOOo/Options.xcu index 9e0c8cb7..b643d396 100644 --- a/source/mDriveOOo/Options.xcu +++ b/source/mDriveOOo/Options.xcu @@ -43,7 +43,7 @@ Documents partagés - 60 + 600 CLIENT_IS_MASTER diff --git a/source/mDriveOOo/service/OptionsHandler.py b/source/mDriveOOo/service/OptionsHandler.py index 3f222a60..109cc758 100644 --- a/source/mDriveOOo/service/OptionsHandler.py +++ b/source/mDriveOOo/service/OptionsHandler.py @@ -79,9 +79,15 @@ def callHandlerMethod(self, window, event, method): elif method == 'DisableSync': self._manager.enableSync(False) handled = True + elif method == 'Reset': + self._manager.setReset(bool(event.Source.State)) + handled = True elif method == 'ViewData': self._manager.viewData() handled = True + elif method == 'ViewFile': + self._manager.viewFile() + handled = True elif method == 'Download': self._manager.download() handled = True @@ -110,7 +116,9 @@ def getSupportedMethodNames(self): 'EnableShare', 'EnableSync', 'DisableSync', + 'Reset', 'ViewData', + 'ViewFile', 'Download', 'Upload', 'SpinUp1', diff --git a/uno/lib/uno/dbtool/dbtool.py b/uno/lib/uno/dbtool/dbtool.py index 3aac9210..5d74302a 100644 --- a/uno/lib/uno/dbtool/dbtool.py +++ b/uno/lib/uno/dbtool/dbtool.py @@ -172,7 +172,7 @@ def checkDataBase(ctx, connection): logger = getLogger(ctx, g_errorlog, g_basename) state = logger.resolveString(101) msg = logger.resolveString(102, g_jar, g_version, version) - logger.logp(SEVERE, g_basename, 'checkDataBase()', msg) + logger.logp(SEVERE, g_basename, 'checkDataBase', msg) error = getSqlException(state, 1112, msg) return version, error diff --git a/uno/lib/uno/logger/dialog/logmanager.py b/uno/lib/uno/logger/dialog/logmanager.py index 889a4f54..aab1b9f3 100644 --- a/uno/lib/uno/logger/dialog/logmanager.py +++ b/uno/lib/uno/logger/dialog/logmanager.py @@ -115,7 +115,7 @@ def viewLog(self): # LogManager setter methods called by DialogHandler def logInfos(self): - self._model.logInfos(INFO, 'LogManager', 'logInfos()', self._requirements) + self._model.logInfos(INFO, 'LogManager', 'logInfos', self._requirements) # LogManager setter methods called by LoggerListener def updateLogger(self): diff --git a/uno/lib/uno/logger/logcontroller.py b/uno/lib/uno/logger/logcontroller.py index 7887cc3c..7a3428e6 100644 --- a/uno/lib/uno/logger/logcontroller.py +++ b/uno/lib/uno/logger/logcontroller.py @@ -71,7 +71,7 @@ def clearLogger(self): msg = resolver.resolveString(111) handler = RollerHandler(self._ctx, self.Name) self.addRollerHandler(handler) - self._logger.logp(SEVERE, 'Logger', 'clearLogger()', msg) + self._logger.logp(SEVERE, 'Logger', 'clearLogger', msg) self.removeRollerHandler(handler) def addModifyListener(self, listener): diff --git a/uno/lib/uno/options/ucb/optionsmanager.py b/uno/lib/uno/options/ucb/optionsmanager.py index a6a4c704..0c0b86d4 100644 --- a/uno/lib/uno/options/ucb/optionsmanager.py +++ b/uno/lib/uno/options/ucb/optionsmanager.py @@ -35,6 +35,7 @@ from ..unotool import executeDispatch from ..unotool import getDesktop +from ..unotool import getFilePicker from ..logger import getLogger from ..logger import LogManager @@ -54,14 +55,14 @@ def __init__(self, ctx, window): self._logmanager = LogManager(ctx, window, 'requirements.txt', g_defaultlog, g_synclog) self._view = OptionsView(window, *self._model.getInitData()) self._view.setViewData(*self._model.getViewData(OptionsManager._restart)) - self._logger.logprb(INFO, 'OptionsManager', '__init__()', 151) + self._logger.logprb(INFO, 'OptionsManager', '__init__', 151) _restart = False def loadSetting(self): self._view.setViewData(*self._model.getViewData(OptionsManager._restart)) self._logmanager.loadSetting() - self._logger.logprb(INFO, 'OptionsManager', 'loadSetting()', 161) + self._logger.logprb(INFO, 'OptionsManager', 'loadSetting', 161) def saveSetting(self): reset, share, name, index, timeout, download, upload = self._view.getViewData() @@ -70,7 +71,7 @@ def saveSetting(self): if changed: OptionsManager._restart = True self._view.setRestart(True) - self._logger.logprb(INFO, 'OptionsManager', 'saveSetting()', 171, option, changed) + self._logger.logprb(INFO, 'OptionsManager', 'saveSetting', 171, option, changed) def enableShare(self, enabled): self._view.enableShare(enabled) @@ -78,10 +79,19 @@ def enableShare(self, enabled): def enableSync(self, enabled): self._view.enableSync(enabled, OptionsManager._restart, self._model.hasDataBase()) + def setReset(self, enabled): + self._view.enableResetFile(enabled) + def viewData(self): url = self._model.getDatasourceUrl() getDesktop(self._ctx).loadComponentFromURL(url, '_default', 0, ()) + def viewFile(self): + fp = getFilePicker(self._ctx) + fp.setDisplayDirectory(self._model.getFileUrl()) + fp.execute() + fp.dispose() + def download(self): self._view.setStep(1, OptionsManager._restart) diff --git a/uno/lib/uno/options/ucb/optionsmodel.py b/uno/lib/uno/options/ucb/optionsmodel.py index 441f6040..ad1e537e 100644 --- a/uno/lib/uno/options/ucb/optionsmodel.py +++ b/uno/lib/uno/options/ucb/optionsmodel.py @@ -48,12 +48,12 @@ class OptionsModel(): def __init__(self, ctx): self._config = getConfiguration(ctx, g_identifier, True) - folder = g_folder + g_ucbseparator + g_scheme - location = getResourceLocation(ctx, g_identifier, folder) - self._url = location + '.odb' - self._exist = getSimpleFile(ctx).exists(self._url) + self._url = getResourceLocation(ctx, g_identifier) self._policies = {'SERVER_IS_MASTER': 1, 'CLIENT_IS_MASTER': 2, 'NONE_IS_MASTER': 3} self._factors = {'Timeout': 60, 'Chunk': 1024} + sf = getSimpleFile(ctx) + self._hasdatabase = sf.exists(self.getDatasourceUrl()) + self._hasfile = sf.exists(self.getFileUrl()) @property def _ResetSync(self): @@ -87,18 +87,23 @@ def _SupportShare(self): # OptionsModel getter methods def getInitData(self): resumable = self._config.getByName('ResumableUpload') - return self._exist, resumable + return self._hasdatabase, self._hasfile, resumable def hasDataBase(self): - return self._exist + return self._hasdatabase def getViewData(self, restart): - return (self._exist, self._ResetSync, self._SupportShare, + return (self._hasdatabase, self._ResetSync, self._SupportShare, self._IsShared, self._ShareName, self._Policy, self._Timeout, self._Download, self._Upload, restart) def getDatasourceUrl(self): - return self._url + folder = g_ucbseparator + g_folder + g_ucbseparator + g_scheme + return self._url + folder + '.odb' + + def getFileUrl(self): + folder = g_ucbseparator + g_scheme + return self._url + folder # OptionsModel setter methods def setViewData(self, reset, share, name, index, timeout, download, upload): diff --git a/uno/lib/uno/options/ucb/optionsview.py b/uno/lib/uno/options/ucb/optionsview.py index 4ae2b5a0..a6430d7b 100644 --- a/uno/lib/uno/options/ucb/optionsview.py +++ b/uno/lib/uno/options/ucb/optionsview.py @@ -31,17 +31,20 @@ class OptionsView(): - def __init__(self, window, exist, resumable): + def __init__(self, window, exist, hasfile, resumable): self._window = window if exist: self._disableShare() - self._getReset().Model.Enabled = exist + self._getResetSync().Model.Enabled = exist + self._getResetFile().Model.Enabled = exist self._getDatasource().Model.Enabled = exist + self._getFile().Model.Enabled = hasfile self._getUpload().Model.Enabled = resumable # OptionsView getter methods def getViewData(self): - reset = bool(self._getReset().State) + reset = self._getResetSync().State + reset += self._getResetFile().State share = bool(self._getShare().State) name = self._getShareName().Text index = self._getOptionIndex() @@ -61,9 +64,12 @@ def setStep(self, step, restart): self.setRestart(restart) def setViewData(self, exist, reset, support, share, name, index, timeout, download, upload, restart): - self._getReset().State = int(reset) + self._getResetSync().State = int(reset != 0) + self._getResetFile().State = int(reset == 2) + self.enableResetFile(reset != 0) if support: self._getShare().State = int(share) + self._getShare().Model.Enabled = True self._getShareName().Text = name self.enableShare(share) else: @@ -82,11 +88,16 @@ def enableShare(self, enabled): self._getShareName().Model.Enabled = enabled def enableSync(self, enabled, restart, exist): - self._getReset().Model.Enabled = enabled and exist + self._getResetSync().Model.Enabled = enabled and exist self._getTimeoutLabel().Model.Enabled = enabled self._getTimeout().Model.Enabled = enabled self._enableUpload(enabled, restart) + def enableResetFile(self, enabled): + self._getResetFile().Model.Enabled = enabled + if not enabled: + self._getResetFile().State = 0 + def setRestart(self, enabled): self._getRestart().setVisible(enabled) @@ -128,12 +139,15 @@ def _enableUpload(self, enabled, restart): control.Model.Enabled = enabled # OptionsView private control methods - def _getReset(self): + def _getResetSync(self): return self._window.getControl('CheckBox1') - def _getShare(self): + def _getResetFile(self): return self._window.getControl('CheckBox2') + def _getShare(self): + return self._window.getControl('CheckBox3') + def _getShareName(self): return self._window.getControl('TextField1') @@ -149,12 +163,15 @@ def _getTimeout(self): def _getDatasource(self): return self._window.getControl('CommandButton1') + def _getFile(self): + return self._window.getControl('CommandButton2') + def _getSpinUp(self, index): - index += 2 + index += 3 return self._window.getControl('CommandButton%s' % index) def _getSpinDown(self, index): - index += 4 + index += 5 return self._window.getControl('CommandButton%s' % index) def _getDownload(self): diff --git a/uno/lib/uno/unolib/unolib.py b/uno/lib/uno/unolib/unolib.py index 3a8c79f2..90465d5e 100644 --- a/uno/lib/uno/unolib/unolib.py +++ b/uno/lib/uno/unolib/unolib.py @@ -54,14 +54,14 @@ def getProperties(self): return tuple(self.properties.values()) def getPropertyByName(self, name): if self._logger is not None: - self._logger.logprb(INFO, 'PropertySetInfo', 'getPropertyByName()', 711, name) + self._logger.logprb(INFO, 'PropertySetInfo', 'getPropertyByName', 711, name) if name in self.properties: return self.properties[name] raise UnknownPropertyException("UnknownPropertyException", None) def hasPropertyByName(self, name): has = name in self.properties if self._logger is not None: - self._logger.logprb(INFO, 'PropertySetInfo', 'hasPropertyByName()', 721, name, has) + self._logger.logprb(INFO, 'PropertySetInfo', 'hasPropertyByName', 721, name, has) return has