summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-06-01 05:05:53 +0100
committerMichael Meeks <michael.meeks@collabora.com>2017-06-02 16:32:37 +0200
commitbda955398d38f8f7d2de5e03cc5ad4908b85c0d9 (patch)
tree16cc81565b01c7652ee9681e811d2a20fa96d1c4 /vcl
parent97fa7024ce608b7908aca369e8c643a5de9ebf78 (diff)
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@collabora.co.uk> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx9
2 files changed, 12 insertions, 1 deletions
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 );
}
}