summaryrefslogtreecommitdiff
path: root/padmin
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-24 23:10:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-25 15:37:20 +0000
commitd6bf32bab10e1bb115aea0c6e5d6ac1753760fe7 (patch)
tree7e41f115d726ef697fd61294c931577d6a31903e /padmin
parent141c1c7bc6ac9bfadaf3fad6aba16a03836701b1 (diff)
make padmin ByteString free
Diffstat (limited to 'padmin')
-rw-r--r--padmin/source/adddlg.cxx73
-rw-r--r--padmin/source/cmddlg.cxx4
-rw-r--r--padmin/source/newppdlg.cxx6
3 files changed, 41 insertions, 42 deletions
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx
index 9db6d152e324..382924c37b7f 100644
--- a/padmin/source/adddlg.cxx
+++ b/padmin/source/adddlg.cxx
@@ -498,15 +498,15 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
// read defaults
aConfig.SetGroup( "Xprinter,PostScript" );
- ByteString aDefPageSize( aConfig.ReadKey( "PageSize" ) );
- ByteString aDefOrientation( aConfig.ReadKey( "Orientation" ) );
- ByteString aDefMarginLeft( aConfig.ReadKey( "MarginLeft" ) );
- ByteString aDefMarginRight( aConfig.ReadKey( "MarginRight" ) );
- ByteString aDefMarginTop( aConfig.ReadKey( "MarginTop" ) );
- ByteString aDefMarginBottom( aConfig.ReadKey( "MarginBottom" ) );
- ByteString aDefScale( aConfig.ReadKey( "Scale" ) );
- ByteString aDefCopies( aConfig.ReadKey( "Copies" ) );
- ByteString aDefDPI( aConfig.ReadKey( "DPI" ) );
+ rtl::OString aDefPageSize( aConfig.ReadKey( "PageSize" ) );
+ rtl::OString aDefOrientation( aConfig.ReadKey( "Orientation" ) );
+ rtl::OString aDefMarginLeft( aConfig.ReadKey( "MarginLeft" ) );
+ rtl::OString aDefMarginRight( aConfig.ReadKey( "MarginRight" ) );
+ rtl::OString aDefMarginTop( aConfig.ReadKey( "MarginTop" ) );
+ rtl::OString aDefMarginBottom( aConfig.ReadKey( "MarginBottom" ) );
+ rtl::OString aDefScale( aConfig.ReadKey( "Scale" ) );
+ rtl::OString aDefCopies( aConfig.ReadKey( "Copies" ) );
+ rtl::OString aDefDPI( aConfig.ReadKey( "DPI" ) );
using comphelper::string::getToken;
@@ -540,8 +540,8 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
// read the command
aConfig.SetGroup( "ports" );
- ByteString aCommand( aConfig.ReadKey( aPort ) );
- if( ! aCommand.Len() )
+ rtl::OString aCommand( aConfig.ReadKey( aPort ) );
+ if (aCommand.isEmpty())
{
String aText( PaResId( RID_TXT_PRINTERWITHOUTCOMMAND ) );
aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rtl::OStringToOUString(aPrinter, aEncoding) );
@@ -603,23 +603,22 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
aValue = aConfig.ReadKey( "Orientation", aDefOrientation );
if (!aValue.isEmpty())
- aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCase( "landscape" ) == COMPARE_EQUAL ? orientation::Landscape : orientation::Portrait;
+ aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("landscape")) ? orientation::Landscape : orientation::Portrait;
int nGroupKeys = aConfig.GetKeyCount();
for( int nPPDKey = 0; nPPDKey < nGroupKeys; nPPDKey++ )
{
- ByteString aPPDKey( aConfig.GetKeyName( nPPDKey ) );
+ rtl::OString aPPDKey( aConfig.GetKeyName( nPPDKey ) );
// ignore page region
// there are some ppd keys in old Xpdefaults that
// should never have been writte because they are defaults
// PageRegion leads to problems in conjunction
// with a not matching PageSize
- if( aPPDKey.CompareTo( "PPD_", 4 ) == COMPARE_EQUAL &&
- aPPDKey != "PPD_PageRegion"
- )
+ if (comphelper::string::matchL(aPPDKey, RTL_CONSTASCII_STRINGPARAM("PPD_")) &&
+ !aPPDKey.equalsL(RTL_CONSTASCII_STRINGPARAM("PPD_PageRegion")))
{
aValue = aConfig.ReadKey( nPPDKey );
- aPPDKey.Erase( 0, 4 );
- const PPDKey* pKey = aInfo.m_pParser->getKey( String( aPPDKey, RTL_TEXTENCODING_ISO_8859_1 ) );
+ aPPDKey = aPPDKey.copy(4);
+ const PPDKey* pKey = aInfo.m_pParser->getKey( rtl::OStringToOUString(aPPDKey, RTL_TEXTENCODING_ISO_8859_1) );
const PPDValue* pValue = pKey ? ( aValue.equalsL(RTL_CONSTASCII_STRINGPARAM("*nil")) ? NULL : pKey->getValue(rtl::OStringToOUString(aValue, RTL_TEXTENCODING_ISO_8859_1)) ) : NULL;
if( pKey )
aInfo.m_aContext.setValue( pKey, pValue, true );
@@ -1097,40 +1096,40 @@ String AddPrinterDialog::uniquePrinterName( const String& rBase )
String AddPrinterDialog::getOldPrinterLocation()
{
static const char* pHome = getenv( "HOME" );
- String aRet;
- ByteString aFileName;
+ rtl::OString aFileName;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
if( pHome )
{
- aFileName = pHome;
- aFileName.Append( "/.Xpdefaults" );
- if( access( aFileName.GetBuffer(), F_OK ) )
+ aFileName = rtl::OStringBuffer().append(pHome).
+ append(RTL_CONSTASCII_STRINGPARAM("/.Xpdefaults")).
+ makeStringAndClear();
+ if (access(aFileName.getStr(), F_OK))
{
- aFileName = pHome;
- aFileName.Append( "/.sversionrc" );
- Config aSVer( String( aFileName, aEncoding ) );
+ aFileName = rtl::OStringBuffer().append(pHome).
+ append(RTL_CONSTASCII_STRINGPARAM("/.sversionrc")).
+ makeStringAndClear();
+ Config aSVer(rtl::OStringToOUString(aFileName, aEncoding));
aSVer.SetGroup( "Versions" );
aFileName = aSVer.ReadKey( "StarOffice 5.2" );
- if( aFileName.Len() )
- aFileName.Append( "/share/xp3/Xpdefaults" );
+ if (!aFileName.isEmpty())
+ aFileName = aFileName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("/share/xp3/Xpdefaults"));
else if(
- (aFileName = aSVer.ReadKey( "StarOffice 5.1" ) ).Len()
+ (aFileName = aSVer.ReadKey( "StarOffice 5.1" ) ).getLength()
||
- (aFileName = aSVer.ReadKey( "StarOffice 5.0" ) ).Len()
+ (aFileName = aSVer.ReadKey( "StarOffice 5.0" ) ).getLength()
||
- (aFileName = aSVer.ReadKey( "StarOffice 4.0" ) ).Len()
+ (aFileName = aSVer.ReadKey( "StarOffice 4.0" ) ).getLength()
)
{
- aFileName.Append( "/xp3/Xpdefaults" );
+ aFileName = aFileName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("/xp3/Xpdefaults"));
}
- if( aFileName.Len() && access( aFileName.GetBuffer(), F_OK ) )
- aFileName.Erase();
+ if (!aFileName.isEmpty() && access(aFileName.getStr(), F_OK))
+ aFileName = rtl::OString();
}
}
- if( aFileName.Len() )
- aRet = String( aFileName, aEncoding );
- return aRet;
+
+ return !aFileName.isEmpty() ? rtl::OStringToOUString(aFileName, aEncoding) : rtl::OUString();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx
index 4a54aab5b0c5..74ba8008dac3 100644
--- a/padmin/source/cmddlg.cxx
+++ b/padmin/source/cmddlg.cxx
@@ -82,7 +82,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
int nLen = strlen( pBuffer );
if( pBuffer[nLen-1] == '\n' ) // strip newline
pBuffer[--nLen] = 0;
- aCommand = String( ByteString( pBuffer ), aEncoding );
+ aCommand = rtl::OUString(pBuffer, nLen, aEncoding);
if( ( ( aCommand.GetChar( 0 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
@@ -105,7 +105,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
int nLen = strlen( pBuffer );
if( pBuffer[nLen-1] == '\n' ) // strip newline
pBuffer[--nLen] = 0;
- aCommand = String( ByteString( pBuffer ), aEncoding );
+ aCommand = rtl::OUString(pBuffer, nLen, aEncoding);
if( ( ( aCommand.GetChar( 0 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx
index 593c09cb6c35..de04c7331a56 100644
--- a/padmin/source/newppdlg.cxx
+++ b/padmin/source/newppdlg.cxx
@@ -80,9 +80,9 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) :
m_aPathBox.SetText( rtl::OStringToOUString(rConfig.ReadKey("LastDir"), RTL_TEXTENCODING_UTF8) );
for (sal_Int32 i = 0; i < 11; ++i)
{
- ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i)));
- if( aEntry.Len() )
- m_aPathBox.InsertEntry( String( aEntry, RTL_TEXTENCODING_UTF8 ) );
+ rtl::OString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i)));
+ if (!aEntry.isEmpty())
+ m_aPathBox.InsertEntry(rtl::OStringToOUString(aEntry, RTL_TEXTENCODING_UTF8));
}
m_aOKBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) );