From 1c2a934548ed7937f3df7f766a0165a538f0a5f1 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 22 Jun 2011 13:31:19 +0200 Subject: Show warning: Do you want to overwrite the file? --- wizards/com/sun/star/wizards/common/SystemDialog.py | 5 ++--- .../com/sun/star/wizards/document/OfficeDocument.py | 18 +++++++++++++----- .../com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 19 +++++++++++-------- 3 files changed, 26 insertions(+), 16 deletions(-) (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py index f6bca5b64a21..d0e8400b7c97 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.py +++ b/wizards/com/sun/star/wizards/common/SystemDialog.py @@ -25,9 +25,8 @@ class SystemDialog(object): self.xMSF = xMSF self.systemDialog = xMSF.createInstance(ServiceName) self.xStringSubstitution = self.createStringSubstitution(xMSF) - #if self.systemDialog != None: - #COMMENTED - #self.systemDialog.initialize(Type) + if self.systemDialog != None: + self.systemDialog.initialize(Type) except Exception, exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py index a14f42ba9f71..e2636d026c40 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.py +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py @@ -5,6 +5,7 @@ from ui.event.CommonListener import TerminateListenerProcAdapter from common.Desktop import Desktop from com.sun.star.awt import WindowDescriptor from com.sun.star.awt import Rectangle +import unohelper #Window Constants com_sun_star_awt_WindowAttribute_BORDER \ @@ -172,7 +173,7 @@ class OfficeDocument(object): return xComponent @classmethod - def store(self, xMSF, xComponent, StorePath, FilterName, bStoreToUrl): + def store(self, xMSF, xComponent, StorePath, FilterName): try: if len(FilterName): oStoreProperties = range(2) @@ -188,10 +189,17 @@ class OfficeDocument(object): else: oStoreProperties = range(0) - if bStoreToUrl: - xComponent.storeToURL(StorePath, tuple(oStoreProperties)) - else: - xComponent.storeAsURL(StorePath, tuple(oStoreProperties)) + if StorePath.startswith("file://"): + #Unix + StorePath = StorePath[7:] + + sPath = StorePath[:(StorePath.rfind("/") + 1)] + sFile = StorePath[(StorePath.rfind("/") + 1):] + xComponent.storeToURL( + unohelper.absolutize( + unohelper.systemPathToFileUrl(sPath), + unohelper.systemPathToFileUrl(sFile)), + tuple(oStoreProperties)) return True except Exception, exception: diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 2d49456f90ee..0ba6064e4078 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -135,6 +135,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.myFaxDoc.setWizardTemplateDocInfo( \ self.resources.resFaxWizardDialog_title, self.resources.resTemplateDescription) + endWizard = True try: fileAccess = FileAccess(self.xMSF) self.sPath = self.myPathSelection.getSelectedPath() @@ -149,9 +150,11 @@ class FaxWizardDialogImpl(FaxWizardDialog): if not self.__filenameChanged: if fileAccess.exists(self.sPath, True): answer = SystemDialog.showMessageBox( - self.xMSF, self.xUnoDialog.Peer, "MessBox", - YES_NO + DEF_NO, self.resources.resOverwriteWarning) - if answer == 3: # user said: no, do not overwrite... + self.xMSF, "MessBox", YES_NO + DEF_NO, + self.resources.resOverwriteWarning, self.xUnoDialog.Peer) + if answer == 3: + # user said: no, do not overwrite... + endWizard = False return False @@ -164,7 +167,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): (self.chkUseCommunicationType.State is not 0) self.myFaxDoc.killEmptyFrames() self.bSaveSuccess = OfficeDocument.store(self.xMSF, self.xTextDocument, - self.sPath, "writer8_template", False) + self.sPath, "writer8_template") if self.bSaveSuccess: self.saveConfiguration() xIH = self.xMSF.createInstance( \ @@ -202,8 +205,9 @@ class FaxWizardDialogImpl(FaxWizardDialog): except Exception, e: traceback.print_exc() finally: - self.xUnoDialog.endExecute() - self.running = False + if endWizard: + self.xUnoDialog.endExecute() + self.running = False return True @@ -307,8 +311,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.setControlProperty("chkUseDate", PropertyNames.PROPERTY_ENABLED, self.myFaxDoc.hasElement("Date")) - #COMMENTED - #self.myFaxDoc.updateDateFields() + self.myFaxDoc.updateDateFields() def initializeSalutation(self): self.setControlProperty("lstSalutation", "StringItemList", -- cgit