Kaydet (Commit) 878f279f authored tarafından Noel Grandin's avatar Noel Grandin

convert include/sfx2/mailmodelapi.hxx from String to OUString

Change-Id: Ib6ea30bf17a30f7df9be8ce5643b34eed360a06e
üst 92cda0a9
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#include "sfx2/dllapi.h" #include "sfx2/dllapi.h"
// class AddressList_Impl ------------------------------------------------ // class AddressList_Impl ------------------------------------------------
typedef String* AddressItemPtr_Impl; typedef ::std::vector< OUString > AddressList_Impl;
typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
// class SfxMailModel_Impl ----------------------------------------------- // class SfxMailModel_Impl -----------------------------------------------
...@@ -74,13 +73,12 @@ private: ...@@ -74,13 +73,12 @@ private:
AddressList_Impl* mpToList; AddressList_Impl* mpToList;
AddressList_Impl* mpCcList; AddressList_Impl* mpCcList;
AddressList_Impl* mpBccList; AddressList_Impl* mpBccList;
String maFromAddress; OUString maFromAddress;
String maSubject; OUString maSubject;
MailPriority mePriority; MailPriority mePriority;
sal_Bool mbLoadDone; sal_Bool mbLoadDone;
void ClearList( AddressList_Impl* pList );
SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR, SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
const OUString& rFilterName, const OUString& rFilterName,
...@@ -102,9 +100,9 @@ public: ...@@ -102,9 +100,9 @@ public:
SfxMailModel(); SfxMailModel();
~SfxMailModel(); ~SfxMailModel();
void AddAddress( const String& rAddress, AddressRole eRole ); void AddAddress( const OUString& rAddress, AddressRole eRole );
void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; } void SetFromAddress( const OUString& rAddress ) { maFromAddress = rAddress; }
void SetSubject( const String& rSubject ) { maSubject = rSubject; } void SetSubject( const OUString& rSubject ) { maSubject = rSubject; }
void SetPriority( MailPriority ePrio ) { mePriority = ePrio; } void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
/** attaches a document to the current attachment list, can be called more than once. /** attaches a document to the current attachment list, can be called more than once.
...@@ -129,7 +127,7 @@ public: ...@@ -129,7 +127,7 @@ public:
sal_Bool IsEmpty() const; sal_Bool IsEmpty() const;
}; };
sal_Bool CreateFromAddress_Impl( String& rFrom ); sal_Bool CreateFromAddress_Impl( OUString& rFrom );
#endif // INCLUDED_SFX_MAILMODEL_HXX #endif // INCLUDED_SFX_MAILMODEL_HXX
......
...@@ -131,16 +131,6 @@ void PrepareListener_Impl::disposing(const css::lang::EventObject& /*rEvent*/) t ...@@ -131,16 +131,6 @@ void PrepareListener_Impl::disposing(const css::lang::EventObject& /*rEvent*/) t
static const char PDF_DOCUMENT_TYPE[] = "pdf_Portable_Document_Format"; static const char PDF_DOCUMENT_TYPE[] = "pdf_Portable_Document_Format";
void SfxMailModel::ClearList( AddressList_Impl* pList )
{
if ( pList )
{
for( size_t i = 0, n = pList->size(); i < n; ++i )
delete pList->at(i);
pList->clear();
}
}
sal_Bool HasDocumentValidSignature( const css::uno::Reference< css::frame::XModel >& xModel ) sal_Bool HasDocumentValidSignature( const css::uno::Reference< css::frame::XModel >& xModel )
{ {
try try
...@@ -701,18 +691,15 @@ SfxMailModel::SfxMailModel() : ...@@ -701,18 +691,15 @@ SfxMailModel::SfxMailModel() :
SfxMailModel::~SfxMailModel() SfxMailModel::~SfxMailModel()
{ {
ClearList( mpToList );
delete mpToList; delete mpToList;
ClearList( mpCcList );
delete mpCcList; delete mpCcList;
ClearList( mpBccList );
delete mpBccList; delete mpBccList;
} }
void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) void SfxMailModel::AddAddress( const OUString& rAddress, AddressRole eRole )
{ {
// don't add a empty address // don't add a empty address
if ( rAddress.Len() > 0 ) if ( !rAddress.isEmpty() )
{ {
AddressList_Impl* pList = NULL; AddressList_Impl* pList = NULL;
if ( ROLE_TO == eRole ) if ( ROLE_TO == eRole )
...@@ -744,8 +731,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) ...@@ -744,8 +731,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
if ( pList ) if ( pList )
{ {
// add address to list // add address to list
AddressItemPtr_Impl pAddress = new String( rAddress ); pList->push_back( rAddress );
pList->push_back( pAddress );
} }
} }
} }
...@@ -804,7 +790,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: ...@@ -804,7 +790,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
if ( xSimpleMailMessage.is() ) if ( xSimpleMailMessage.is() )
{ {
sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS; sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS;
if ( maFromAddress.Len() == 0 ) if ( maFromAddress.isEmpty() )
{ {
// from address not set, try figure out users e-mail address // from address not set, try figure out users e-mail address
CreateFromAddress_Impl( maFromAddress ); CreateFromAddress_Impl( maFromAddress );
...@@ -819,12 +805,12 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: ...@@ -819,12 +805,12 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
if ( nToCount > 1 ) if ( nToCount > 1 )
{ {
nCcSeqCount = nToCount - 1 + nCcCount; nCcSeqCount = nToCount - 1 + nCcCount;
xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) ); xSimpleMailMessage->setRecipient( mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
} }
else if ( nToCount == 1 ) else if ( nToCount == 1 )
{ {
xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) ); xSimpleMailMessage->setRecipient( mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
} }
...@@ -839,13 +825,13 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: ...@@ -839,13 +825,13 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
{ {
for ( size_t i = 1; i < nToCount; ++i ) for ( size_t i = 1; i < nToCount; ++i )
{ {
aCcRecipientSeq[nIndex++] = *mpToList->at(i); aCcRecipientSeq[nIndex++] = mpToList->at(i);
} }
} }
for ( size_t i = 0; i < nCcCount; i++ ) for ( size_t i = 0; i < nCcCount; i++ )
{ {
aCcRecipientSeq[nIndex++] = *mpCcList->at(i); aCcRecipientSeq[nIndex++] = mpCcList->at(i);
} }
xSimpleMailMessage->setCcRecipient( aCcRecipientSeq ); xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
} }
...@@ -856,7 +842,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: ...@@ -856,7 +842,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
Sequence< OUString > aBccRecipientSeq( nBccCount ); Sequence< OUString > aBccRecipientSeq( nBccCount );
for ( size_t i = 0; i < nBccCount; ++i ) for ( size_t i = 0; i < nBccCount; ++i )
{ {
aBccRecipientSeq[i] = *mpBccList->at(i); aBccRecipientSeq[i] = mpBccList->at(i);
} }
xSimpleMailMessage->setBccRecipient( aBccRecipientSeq ); xSimpleMailMessage->setBccRecipient( aBccRecipientSeq );
} }
...@@ -928,7 +914,7 @@ SfxMailModel::SendMailResult SfxMailModel::SaveAndSend( const css::uno::Referenc ...@@ -928,7 +914,7 @@ SfxMailModel::SendMailResult SfxMailModel::SaveAndSend( const css::uno::Referenc
// functions ------------------------------------------------------------- // functions -------------------------------------------------------------
sal_Bool CreateFromAddress_Impl( String& rFrom ) sal_Bool CreateFromAddress_Impl( OUString& rFrom )
/* [Description] /* [Description]
...@@ -953,7 +939,7 @@ sal_Bool CreateFromAddress_Impl( String& rFrom ) ...@@ -953,7 +939,7 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
rFrom = comphelper::string::strip(aFirstName, ' '); rFrom = comphelper::string::strip(aFirstName, ' ');
if ( aName.Len() ) if ( aName.Len() )
rFrom += ' '; rFrom += " ";
} }
rFrom += comphelper::string::strip(aName, ' '); rFrom += comphelper::string::strip(aName, ' ');
// remove illegal characters // remove illegal characters
...@@ -969,13 +955,13 @@ sal_Bool CreateFromAddress_Impl( String& rFrom ) ...@@ -969,13 +955,13 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
if ( aEmailName.Len() ) if ( aEmailName.Len() )
{ {
if ( rFrom.Len() ) if ( !rFrom.isEmpty() )
rFrom += ' '; rFrom += " ";
( ( rFrom += '<' ) += comphelper::string::strip(aEmailName, ' ') ) += '>'; rFrom = rFrom + "<" + comphelper::string::strip(aEmailName, ' ') + ">";
} }
else else
rFrom.Erase(); rFrom = "";
return ( rFrom.Len() > 0 ); return !rFrom.isEmpty();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment