[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - 3 commits - wizards/com
Xisco Fauli
xfauli at kemper.freedesktop.org
Wed Jun 22 06:52:00 PDT 2011
wizards/com/sun/star/wizards/common/Desktop.py | 32 ------
wizards/com/sun/star/wizards/common/FileAccess.py | 79 ----------------
wizards/com/sun/star/wizards/common/SystemDialog.py | 5 -
wizards/com/sun/star/wizards/document/OfficeDocument.py | 18 ++-
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 19 ++-
5 files changed, 26 insertions(+), 127 deletions(-)
New commits:
commit f09cc2981eaf054cdb2450576ae6b435ea6f4cfb
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jun 22 14:35:22 2011 +0200
Remove deprecated method
diff --git a/wizards/com/sun/star/wizards/common/Desktop.py b/wizards/com/sun/star/wizards/common/Desktop.py
index 0bdf961..3a64ece 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.py
+++ b/wizards/com/sun/star/wizards/common/Desktop.py
@@ -174,38 +174,6 @@ class Desktop(object):
scompname = _sElementName + _sSuffixSeparator + (a + 1)
return ""
- '''
- @deprecated use Configuration.getConfigurationRoot() with the same
- arameters instead
- @param xMSF
- @param KeyName
- @param bForUpdate
- @return
- '''
-
- @classmethod
- def getRegistryKeyContent(self, xMSF, KeyName, bForUpdate):
- try:
- aNodePath = range(1)
- oConfigProvider = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider")
- aNodePath[0] = uno.createUnoStruct(
- 'com.sun.star.beans.PropertyValue')
- aNodePath[0].Name = "nodepath"
- aNodePath[0].Value = KeyName
- if bForUpdate:
- return oConfigProvider.createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationUpdateAccess",
- aNodePath)
- else:
- return oConfigProvider.createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationAccess",
- aNodePath)
-
- except Exception, exception:
- exception.printStackTrace(System.out)
- return None
-
class OfficePathRetriever:
def OfficePathRetriever(self, xMSF):
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 3a1797e..384582b 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -370,17 +370,6 @@ class FileAccess(object):
sMsgFilePathInvalid)
return False
- '''
- searches a directory for files which start with a certain
- prefix, and returns their URLs and document-titles.
- @param xMSF
- @param FilterName the prefix of the filename. a "-" is added to the prefix
- @param FolderName the folder (URL) to look for files...
- @return an array with two array members. The first one, with document
- titles, the second with the corresponding URLs.
- @deprecated please use the getFolderTitles() with ArrayList
- '''
-
@classmethod
def getFolderTitles(self, xMSF, FilterName, FolderName):
LocLayoutFiles = [[2],[]]
commit 48947778966b7964733a2dde8b0bf056a24c1363
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jun 22 13:31:19 2011 +0200
Show warning: Do you want to overwrite the file?
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index f6bca5b..d0e8400 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 a14f42b..e2636d0 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 2d49456..0ba6064 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",
commit 29749aae3d06a7c68d2d86c4031a8a8e6f19f0d0
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Jun 22 10:09:44 2011 +0200
Remove deprecated method
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 7506336..3a1797e 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -484,74 +484,6 @@ class FileAccess(object):
return sTitle
- @classmethod
- def getFolderTitles2(self, xMSF, _sStartFilterName, FolderName,
- _sEndFilterName=""):
-
- LocLayoutFiles = [[2],[]]
- if FolderName.size() == 0:
- raise NoValidPathException (None, "Path not given.");
-
- TitleVector = []
- URLVector = []
- xInterface = None
- try:
- xInterface = xMSF.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- except com.sun.star.uno.Exception, e:
- traceback.print_exc()
- raise NoValidPathException (None, "Internal error.");
-
- j = 0
- while j < FolderName.size():
- sFolderName = FolderName.get(j)
- try:
- nameList = xInterface.getFolderContents(sFolderName, False)
- if _sStartFilterName == None or _sStartFilterName.equals(""):
- _sStartFilterName = None
- else:
- _sStartFilterName = _sStartFilterName + "-"
-
- fileName = ""
- i = 0
- while i < nameList.length:
- fileName = self.getFilename(i)
- if _sStartFilterName == None or \
- fileName.startsWith(_sStartFilterName):
- if _sEndFilterName.equals(""):
- sTitle = getTitle(xMSF, nameList[i])
- elif fileName.endsWith(_sEndFilterName):
- fileName = fileName.replaceAll(
- _sEndFilterName + "$", "")
- sTitle = fileName
- else:
- # no or wrong (start|end) filter
- continue
-
- URLVector.add(nameList[i])
- TitleVector.add(sTitle)
-
- i += 1
- except CommandAbortedException, exception:
- traceback.print_exc()
- except com.sun.star.uno.Exception, e:
- pass
-
- j += 1
- LocNameList = [URLVector.size()]
- LocTitleList = [TitleVector.size()]
- # LLA: we have to check if this works
- URLVector.toArray(LocNameList)
-
- TitleVector.toArray(LocTitleList)
-
- LocLayoutFiles[1] = LocNameList
- LocLayoutFiles[0] = LocTitleList
-
- #COMMENTED
- #JavaTools.bubblesortList(LocLayoutFiles);
- return LocLayoutFiles
-
def __init__(self, xmsf):
#get a simple file access...
self.fileAccess = xmsf.createInstance(
More information about the Libreoffice-commits
mailing list