[Libreoffice-commits] core.git: vcl/unx
Michael Meeks
michael.meeks at collabora.com
Fri Jun 2 14:33:36 UTC 2017
vcl/unx/generic/printer/cupsmgr.cxx | 4 +++-
vcl/unx/generic/printer/ppdparser.cxx | 9 +++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
New commits:
commit bda955398d38f8f7d2de5e03cc5ad4908b85c0d9
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Jun 1 05:05:53 2017 +0100
PPD parsing: set default as well as value, add more parsing info.
Change-Id: I44ea2518d957b5ceee70df1b9a15779ffd5eb7a4
Reviewed-on: https://gerrit.libreoffice.org/38317
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 41a6cfc54a83..b7e531e1f2ad 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -473,7 +473,8 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
SAL_INFO("vcl.unx.print", "ppdOpenFile failed, falling back to generic driver");
// remove temporary PPD file
- unlink( aPPDFile.getStr() );
+ if (!getenv("SAL_CUPS_PPD_RETAIN_TMP"))
+ unlink( aPPDFile.getStr() );
}
else
SAL_INFO("vcl.unx.print", "cupsGetPPD failed, falling back to generic driver");
@@ -490,6 +491,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
{
// get the default PPD
pNewParser = PPDParser::getParser( "SGENPRT" );
+ SAL_WARN("vcl.unx.print", "Parsing default SGENPRT PPD" );
PrinterInfo& rInfo = m_aPrinters[ aPrinter ].m_aInfo;
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 569f424dd5b9..12c8a1480a85 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -548,6 +548,10 @@ const PPDParser* PPDParser::getParser( const OUString& rFile )
<< rFile << "\" !");
return nullptr;
}
+ else
+ SAL_INFO("vcl.unx.print", "Parsing printer info from \""
+ << rFile << "\" !");
+
PPDCache &rPPDCache = thePPDCache::get();
for( ::std::list< PPDParser* >::const_iterator it = rPPDCache.aAllParsers.begin(); it != rPPDCache.aAllParsers.end(); ++it )
@@ -865,6 +869,9 @@ void PPDParser::parse( ::std::list< OString >& rLines )
{
OString aCurrentLine( *line );
++line;
+
+ SAL_INFO("vcl.unx.print", "Parse line '" << aCurrentLine << "'");
+
if (aCurrentLine.getLength() < 2 || aCurrentLine[0] != '*')
continue;
if( aCurrentLine[1] == '%' )
@@ -1124,6 +1131,7 @@ void PPDParser::parse( ::std::list< OString >& rLines )
OString aLine(*line);
if (aLine.startsWith("*Default"))
{
+ SAL_INFO("vcl.unx.print", "Found a default: '" << aLine << "'");
OUString aKey(OStringToOUString(aLine.copy(8), RTL_TEXTENCODING_MS_1252));
sal_Int32 nPos = aKey.indexOf( ':' );
if( nPos != -1 )
@@ -1148,6 +1156,7 @@ void PPDParser::parse( ::std::list< OString >& rLines )
// so invent that key here and have a default value
PPDKey* pKey = new PPDKey( aKey );
pKey->insertValue( aOption, eInvocation /*or what ?*/ );
+ pKey->m_pDefaultValue = pKey->getValue( aOption );
insertKey( aKey, pKey );
}
}
More information about the Libreoffice-commits
mailing list