[Libreoffice-commits] .: 5 commits - basic/inc basic/source scripting/source sfx2/inc sfx2/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Aug 2 03:09:09 PDT 2011
basic/inc/basic/sbxcore.hxx | 2
basic/source/runtime/iosys.cxx | 2
scripting/source/pyprov/mailmerge.py | 136 +++++++++++++++++++----------------
sfx2/inc/sfx2/app.hxx | 1
sfx2/inc/sfx2/childwin.hxx | 1
sfx2/inc/sfx2/sfxresid.hxx | 14 ---
sfx2/source/appl/appdde.cxx | 21 -----
sfx2/source/appl/childwin.cxx | 5 -
sfx2/source/bastyp/sfxresid.cxx | 8 --
9 files changed, 76 insertions(+), 114 deletions(-)
New commits:
commit 6bd6024e56ef7b5f53ba75a6dc0512ca5b06e975
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 2 09:57:59 2011 +0100
make logging less painful under windows
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 89302bb..6d19fd3 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -45,6 +45,13 @@ from email.Utils import parseaddr
import sys, smtplib, imaplib, poplib
dbg = False
+#no stderr under windows, output to pymailmerge.log
+#with no buffering
+if dbg and os.name == 'nt':
+ dbgout = open('pymailmerge.log', 'w', 0)
+else
+ dbgout = sys.stderr
+
class PyMailSMTPService(unohelper.Base, XSmtpService):
def __init__( self, ctx ):
self.ctx = ctx
@@ -54,29 +61,29 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self.connectioncontext = None
self.notify = EventObject()
if dbg:
- print >> sys.stderr, "PyMailSMPTService init"
+ print >> dbgout, "PyMailSMPTService init"
def addConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailSMPTService addConnectionListener"
+ print >> dbgout, "PyMailSMPTService addConnectionListener"
self.listeners.append(xListener)
def removeConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailSMPTService removeConnectionListener"
+ print >> dbgout, "PyMailSMPTService removeConnectionListener"
self.listeners.remove(xListener)
def getSupportedConnectionTypes(self):
if dbg:
- print >> sys.stderr, "PyMailSMPTService getSupportedConnectionTypes"
+ print >> dbgout, "PyMailSMPTService getSupportedConnectionTypes"
return self.supportedtypes
def connect(self, xConnectionContext, xAuthenticator):
self.connectioncontext = xConnectionContext
if dbg:
- print >> sys.stderr, "PyMailSMPTService connect"
+ print >> dbgout, "PyMailSMPTService connect"
server = xConnectionContext.getValueByName("ServerName")
if dbg:
- print >> sys.stderr, server
+ print >> dbgout, server
port = int(xConnectionContext.getValueByName("Port"))
if dbg:
- print >> sys.stderr, port
+ print >> dbgout, port
self.server = smtplib.SMTP(server, port)
#stderr not available for us under windows, but
#set_debuglevel outputs there, and so throw
@@ -86,7 +93,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self.server.set_debuglevel(1)
connectiontype = xConnectionContext.getValueByName("ConnectionType")
if dbg:
- print >> sys.stderr, connectiontype
+ print >> dbgout, connectiontype
if connectiontype == 'Ssl':
self.server.ehlo()
self.server.starttls()
@@ -96,14 +103,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
password = xAuthenticator.getPassword().encode('ascii')
if user != '':
if dbg:
- print >> sys.stderr, 'Logging in, username of', user
+ print >> dbgout, 'Logging in, username of', user
self.server.login(user, password)
for listener in self.listeners:
listener.connected(self.notify)
def disconnect(self):
if dbg:
- print >> sys.stderr, "PyMailSMPTService disconnect"
+ print >> dbgout, "PyMailSMPTService disconnect"
if self.server:
self.server.quit()
self.server = None
@@ -111,17 +118,17 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
listener.disconnected(self.notify)
def isConnected(self):
if dbg:
- print >> sys.stderr, "PyMailSMPTService isConnected"
+ print >> dbgout, "PyMailSMPTService isConnected"
return self.server != None
def getCurrentConnectionContext(self):
if dbg:
- print >> sys.stderr, "PyMailSMPTService getCurrentConnectionContext"
+ print >> dbgout, "PyMailSMPTService getCurrentConnectionContext"
return self.connectioncontext
def sendMailMessage(self, xMailMessage):
COMMASPACE = ', '
if dbg:
- print >> sys.stderr, "PyMailSMPTService sendMailMessage"
+ print >> dbgout, "PyMailSMPTService sendMailMessage"
recipients = xMailMessage.getRecipients()
sendermail = xMailMessage.SenderAddress
sendername = xMailMessage.SenderName
@@ -129,10 +136,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
ccrecipients = xMailMessage.getCcRecipients()
bccrecipients = xMailMessage.getBccRecipients()
if dbg:
- print >> sys.stderr, "PyMailSMPTService subject", subject
- print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8')
- print >> sys.stderr, "PyMailSMTPService from", sendermail
- print >> sys.stderr, "PyMailSMPTService send to", recipients
+ print >> dbgout, "PyMailSMPTService subject", subject
+ print >> dbgout, "PyMailSMPTService from", sendername.encode('utf-8')
+ print >> dbgout, "PyMailSMTPService from", sendermail
+ print >> dbgout, "PyMailSMPTService send to", recipients
attachments = xMailMessage.getAttachments()
@@ -141,13 +148,13 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
content = xMailMessage.Body
flavors = content.getTransferDataFlavors()
if dbg:
- print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors)
+ print >> dbgout, "PyMailSMPTService flavors len", len(flavors)
#Use first flavor that's sane for an email body
for flavor in flavors:
if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
if dbg:
- print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType
+ print >> dbgout, "PyMailSMPTService mimetype is", flavor.MimeType
textbody = content.getTransferData(flavor)
try:
textbody = textbody.value
@@ -225,7 +232,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
truerecipients = uniquer.keys()
if dbg:
- print >> sys.stderr, "PyMailSMPTService recipients are", truerecipients
+ print >> dbgout, "PyMailSMPTService recipients are", truerecipients
self.server.sendmail(sendermail, truerecipients, msg.as_string())
@@ -238,52 +245,52 @@ class PyMailIMAPService(unohelper.Base, XMailService):
self.connectioncontext = None
self.notify = EventObject()
if dbg:
- print >> sys.stderr, "PyMailIMAPService init"
+ print >> dbgout, "PyMailIMAPService init"
def addConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailIMAPService addConnectionListener"
+ print >> dbgout, "PyMailIMAPService addConnectionListener"
self.listeners.append(xListener)
def removeConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailIMAPService removeConnectionListener"
+ print >> dbgout, "PyMailIMAPService removeConnectionListener"
self.listeners.remove(xListener)
def getSupportedConnectionTypes(self):
if dbg:
- print >> sys.stderr, "PyMailIMAPService getSupportedConnectionTypes"
+ print >> dbgout, "PyMailIMAPService getSupportedConnectionTypes"
return self.supportedtypes
def connect(self, xConnectionContext, xAuthenticator):
if dbg:
- print >> sys.stderr, "PyMailIMAPService connect"
+ print >> dbgout, "PyMailIMAPService connect"
self.connectioncontext = xConnectionContext
server = xConnectionContext.getValueByName("ServerName")
if dbg:
- print >> sys.stderr, server
+ print >> dbgout, server
port = int(xConnectionContext.getValueByName("Port"))
if dbg:
- print >> sys.stderr, port
+ print >> dbgout, port
connectiontype = xConnectionContext.getValueByName("ConnectionType")
if dbg:
- print >> sys.stderr, connectiontype
- print >> sys.stderr, "BEFORE"
+ print >> dbgout, connectiontype
+ print >> dbgout, "BEFORE"
if connectiontype == 'Ssl':
self.server = imaplib.IMAP4_SSL(server, port)
else:
self.server = imaplib.IMAP4(server, port)
- print >> sys.stderr, "AFTER"
+ print >> dbgout, "AFTER"
user = xAuthenticator.getUserName().encode('ascii')
password = xAuthenticator.getPassword().encode('ascii')
if user != '':
if dbg:
- print >> sys.stderr, 'Logging in, username of', user
+ print >> dbgout, 'Logging in, username of', user
self.server.login(user, password)
for listener in self.listeners:
listener.connected(self.notify)
def disconnect(self):
if dbg:
- print >> sys.stderr, "PyMailIMAPService disconnect"
+ print >> dbgout, "PyMailIMAPService disconnect"
if self.server:
self.server.logout()
self.server = None
@@ -291,11 +298,11 @@ class PyMailIMAPService(unohelper.Base, XMailService):
listener.disconnected(self.notify)
def isConnected(self):
if dbg:
- print >> sys.stderr, "PyMailIMAPService isConnected"
+ print >> dbgout, "PyMailIMAPService isConnected"
return self.server != None
def getCurrentConnectionContext(self):
if dbg:
- print >> sys.stderr, "PyMailIMAPService getCurrentConnectionContext"
+ print >> dbgout, "PyMailIMAPService getCurrentConnectionContext"
return self.connectioncontext
class PyMailPOP3Service(unohelper.Base, XMailService):
@@ -307,44 +314,44 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
self.connectioncontext = None
self.notify = EventObject()
if dbg:
- print >> sys.stderr, "PyMailPOP3Service init"
+ print >> dbgout, "PyMailPOP3Service init"
def addConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service addConnectionListener"
+ print >> dbgout, "PyMailPOP3Service addConnectionListener"
self.listeners.append(xListener)
def removeConnectionListener(self, xListener):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service removeConnectionListener"
+ print >> dbgout, "PyMailPOP3Service removeConnectionListener"
self.listeners.remove(xListener)
def getSupportedConnectionTypes(self):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service getSupportedConnectionTypes"
+ print >> dbgout, "PyMailPOP3Service getSupportedConnectionTypes"
return self.supportedtypes
def connect(self, xConnectionContext, xAuthenticator):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service connect"
+ print >> dbgout, "PyMailPOP3Service connect"
self.connectioncontext = xConnectionContext
server = xConnectionContext.getValueByName("ServerName")
if dbg:
- print >> sys.stderr, server
+ print >> dbgout, server
port = int(xConnectionContext.getValueByName("Port"))
if dbg:
- print >> sys.stderr, port
+ print >> dbgout, port
connectiontype = xConnectionContext.getValueByName("ConnectionType")
if dbg:
- print >> sys.stderr, connectiontype
- print >> sys.stderr, "BEFORE"
+ print >> dbgout, connectiontype
+ print >> dbgout, "BEFORE"
if connectiontype == 'Ssl':
self.server = poplib.POP3_SSL(server, port)
else:
self.server = poplib.POP3(server, port)
- print >> sys.stderr, "AFTER"
+ print >> dbgout, "AFTER"
user = xAuthenticator.getUserName().encode('ascii')
password = xAuthenticator.getPassword().encode('ascii')
if dbg:
- print >> sys.stderr, 'Logging in, username of', user
+ print >> dbgout, 'Logging in, username of', user
self.server.user(user)
self.server.pass_(user, password)
@@ -352,7 +359,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
listener.connected(self.notify)
def disconnect(self):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service disconnect"
+ print >> dbgout, "PyMailPOP3Service disconnect"
if self.server:
self.server.quit()
self.server = None
@@ -360,21 +367,21 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
listener.disconnected(self.notify)
def isConnected(self):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service isConnected"
+ print >> dbgout, "PyMailPOP3Service isConnected"
return self.server != None
def getCurrentConnectionContext(self):
if dbg:
- print >> sys.stderr, "PyMailPOP3Service getCurrentConnectionContext"
+ print >> dbgout, "PyMailPOP3Service getCurrentConnectionContext"
return self.connectioncontext
class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
def __init__( self, ctx ):
if dbg:
- print >> sys.stderr, "PyMailServiceProvider init"
+ print >> dbgout, "PyMailServiceProvider init"
self.ctx = ctx
def create(self, aType):
if dbg:
- print >> sys.stderr, "PyMailServiceProvider create with", aType
+ print >> dbgout, "PyMailServiceProvider create with", aType
if aType == SMTP:
return PyMailSMTPService(self.ctx);
elif aType == POP3:
@@ -382,12 +389,12 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
elif aType == IMAP:
return PyMailIMAPService(self.ctx);
else:
- print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType
+ print >> dbgout, "PyMailServiceProvider, unknown TYPE", aType
class PyMailMessage(unohelper.Base, XMailMessage):
def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ):
if dbg:
- print >> sys.stderr, "PyMailMessage init"
+ print >> dbgout, "PyMailMessage init"
self.ctx = ctx
self.recipients = sTo,
@@ -402,38 +409,38 @@ class PyMailMessage(unohelper.Base, XMailMessage):
self.Subject = Subject
self.Body = Body
if dbg:
- print >> sys.stderr, "post PyMailMessage init"
+ print >> dbgout, "post PyMailMessage init"
def addRecipient( self, recipient ):
if dbg:
- print >> sys.stderr, "PyMailMessage.addRecipient", recipient
+ print >> dbgout, "PyMailMessage.addRecipient", recipient
self.recipients = self.recipients, recipient
def addCcRecipient( self, ccrecipient ):
if dbg:
- print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient
+ print >> dbgout, "PyMailMessage.addCcRecipient", ccrecipient
self.ccrecipients = self.ccrecipients, ccrecipient
def addBccRecipient( self, bccrecipient ):
if dbg:
- print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient
+ print >> dbgout, "PyMailMessage.addBccRecipient", bccrecipient
self.bccrecipients = self.bccrecipients, bccrecipient
def getRecipients( self ):
if dbg:
- print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients
+ print >> dbgout, "PyMailMessage.getRecipients", self.recipients
return self.recipients
def getCcRecipients( self ):
if dbg:
- print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients
+ print >> dbgout, "PyMailMessage.getCcRecipients", self.ccrecipients
return self.ccrecipients
def getBccRecipients( self ):
if dbg:
- print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients
+ print >> dbgout, "PyMailMessage.getBccRecipients", self.bccrecipients
return self.bccrecipients
def addAttachment( self, aMailAttachment ):
if dbg:
- print >> sys.stderr, "PyMailMessage.addAttachment"
+ print >> dbgout, "PyMailMessage.addAttachment"
self.aMailAttachments = self.aMailAttachments, aMailAttachment
def getAttachments( self ):
if dbg:
- print >> sys.stderr, "PyMailMessage.getAttachments"
+ print >> dbgout, "PyMailMessage.getAttachments"
return self.aMailAttachments
# pythonloader looks for a static g_ImplementationHelper variable
commit 4dd91d00d53bf2714550237049910808d002710a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 2 09:52:37 2011 +0100
can't use set_debuglevel under windows
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 04af53a..89302bb 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -14,6 +14,7 @@
import unohelper
import uno
import re
+import os
#to implement com::sun::star::mail::XMailServiceProvider
#and
@@ -77,7 +78,11 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print >> sys.stderr, port
self.server = smtplib.SMTP(server, port)
- if dbg:
+ #stderr not available for us under windows, but
+ #set_debuglevel outputs there, and so throw
+ #an exception under windows on debugging mode
+ #with this enabled
+ if dbg and os.name != 'nt':
self.server.set_debuglevel(1)
connectiontype = xConnectionContext.getValueByName("ConnectionType")
if dbg:
commit f600078e8a2f6d527459bf4993ab7adb512a408d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Aug 1 22:20:49 2011 +0100
get this visibilty of this right for debug builds
diff --git a/basic/inc/basic/sbxcore.hxx b/basic/inc/basic/sbxcore.hxx
index 8cbaf43..301938d 100644
--- a/basic/inc/basic/sbxcore.hxx
+++ b/basic/inc/basic/sbxcore.hxx
@@ -76,7 +76,7 @@ class SbxBase;
class SbxFactory;
class SbxObject;
-DBG_NAMEEX(SbxBase)
+DBG_NAMEEX_VISIBILITY(SbxBase, BASIC_DLLPUBLIC)
class SbxBaseImpl;
commit 2a703f5f8a3f1eab783e3c3067497dd948f4d149
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 31 23:49:51 2011 +0100
callcatcher: remove unused code
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index 3ed4975..7684757 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -176,7 +176,6 @@ public:
long DdeSetData( const String& rItem,
const String& rMimeType,
const ::com::sun::star::uno::Any & rValue );
- ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
sal_Bool InitializeDde();
const DdeService* GetDdeService() const;
DdeService* GetDdeService();
diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx
index f50a5c0..eed3d1f 100644
--- a/sfx2/inc/sfx2/childwin.hxx
+++ b/sfx2/inc/sfx2/childwin.hxx
@@ -218,7 +218,6 @@ public:
static SfxChildWindow* CreateChildWindow( sal_uInt16, ::Window*, SfxBindings*, SfxChildWinInfo&);
void SetHideNotDelete( sal_Bool bOn );
sal_Bool IsHideNotDelete() const;
- void SetHideAtToggle( sal_Bool bOn );
sal_Bool IsHideAtToggle() const;
sal_Bool IsVisible() const;
void SetWantsFocus( sal_Bool );
diff --git a/sfx2/inc/sfx2/sfxresid.hxx b/sfx2/inc/sfx2/sfxresid.hxx
index 46737fe..3c7aeee 100644
--- a/sfx2/inc/sfx2/sfxresid.hxx
+++ b/sfx2/inc/sfx2/sfxresid.hxx
@@ -40,20 +40,6 @@ public:
static void DeleteResMgr();
};
-//============================================================================
-class SfxSimpleResId
-{
- String m_sText;
-
-public:
- SfxSimpleResId(sal_uInt16 nID);
-
- String getText() const { return m_sText; }
-
- operator String() const { return getText(); }
-};
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index c7827ca..440308e 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -240,27 +240,6 @@ long SfxApplication::DdeSetData
return 0;
}
-//--------------------------------------------------------------------
-
-::sfx2::SvLinkSource* SfxApplication::DdeCreateLinkSource
-(
- const String& // the Item to be addressed
-)
-
-/* [Description]
-
- This method can be overloaded by application developers, to establish
- a DDE-hotlink to thier SfxApplication subclass.
-
- The base implementation is not generate a link and returns 0.
-*/
-
-{
- return 0;
-}
-
-//========================================================================
-
long SfxObjectShell::DdeExecute
(
const String& rCmd // Expressed in our BASIC-Syntax
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 894505f..c99f94a 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -583,11 +583,6 @@ sal_Bool SfxChildWindow::IsHideNotDelete() const
return pImp->bHideNotDelete;
}
-void SfxChildWindow::SetHideAtToggle( sal_Bool bOn )
-{
- pImp->bHideAtToggle = bOn;
-}
-
sal_Bool SfxChildWindow::IsHideAtToggle() const
{
return pImp->bHideAtToggle;
diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx
index 8c40eab..daf018e 100644
--- a/sfx2/source/bastyp/sfxresid.cxx
+++ b/sfx2/source/bastyp/sfxresid.cxx
@@ -44,14 +44,6 @@ SfxResId::SfxResId( sal_uInt16 nId ) :
{
}
-//============================================================================
-// SfxSimpleResId Implementation.
-//============================================================================
-
-SfxSimpleResId::SfxSimpleResId(sal_uInt16 nID):
- m_sText( SFX_APP()->GetSimpleResManager()->ReadString(nID) )
-{}
-
ResMgr* SfxResId::GetResMgr()
{
if ( !pMgr )
commit 3f3a5ead76102473dc2a93be57a0bd1b52935684
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 31 22:39:22 2011 +0100
use OSL_VERIFY instead
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 6967048..be5fb44 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -382,7 +382,7 @@ sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
rc = maFile.setPos( osl_Pos_End, 0 );
else
rc = maFile.setPos( osl_Pos_Absolut, (sal_uInt64)nPos );
- OSL_ENSURE(rc == ::osl::FileBase::E_None, "bad seek");
+ OSL_VERIFY(rc == ::osl::FileBase::E_None);
sal_uInt64 nRealPos(0);
maFile.getPos( nRealPos );
return sal::static_int_cast<sal_uIntPtr>(nRealPos);
More information about the Libreoffice-commits
mailing list