summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-20 12:38:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-20 14:40:32 +0000
commited6171632005cdaa987214e84f0ad8fd0dbdd2da (patch)
tree4266a1c4de853724cc2377cc4d53c52b5b44316a /vcl/unx
parent872de529584cd001431a2090eca0f52eb0b16539 (diff)
Resolves: #i49980# Autosense fax4cups devices and configure automatically
If there is a "Dial" ppd key then it's a fax device. If the Dial is set to "Manually" then ignore that it's a fax device and don't prompt for a fax number. If we have a fax number, then set the jobname to the number given that "printing will result in sending the fax to the number contained in the job name" Remove the weird and wonderful non-macosx-unix-only, non-pdf-print-backend, text "scraping" of phone numbers out of the print out in the @@#PHONE@@ format. Allow the phone entry dialog to accept multiple fax numbers separated by ; Change-Id: Ie1d84b68584e82df15ceda5f32c7c75086b035c8 Related: rhbz#159153, #i49981#, #i49920#
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx23
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx2
2 files changed, 17 insertions, 8 deletions
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 2cfcbaab5ec1..3627cd7670d0 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -541,7 +541,7 @@ void CUPSManager::setupJobContextData( JobData& rData )
FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand )
{
- OSL_TRACE( "endSpool: %s, %s",
+ OSL_TRACE( "startSpool: %s, %s",
OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(),
bQuickCommand ? "true" : "false" );
@@ -612,7 +612,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
}
}
-bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner )
+bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString& rFaxNumber )
{
OSL_TRACE( "endSpool: %s, %s, copy count = %d",
OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -629,7 +629,7 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
if( dest_it == m_aCUPSDestMap.end() )
{
OSL_TRACE( "defer to PrinterInfoManager::endSpool" );
- return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData, bBanner );
+ return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData, bBanner, rFaxNumber );
}
boost::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
@@ -643,11 +643,20 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
cups_option_t* pOptions = NULL;
getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, (void**)&pOptions );
+ OString sJobName(OUStringToOString(rJobTitle, aEnc));
+
+ //fax4CUPS, "the job name will be dialled for you"
+ //so override the jobname with the desired number
+ if (!rFaxNumber.isEmpty())
+ {
+ sJobName = OUStringToOString(rFaxNumber, aEnc);
+ }
+
cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second;
- nJobID = cupsPrintFile( pDest->name,
- it->second.getStr(),
- OUStringToOString( rJobTitle, aEnc ).getStr(),
- nNumOptions, pOptions );
+ nJobID = cupsPrintFile(pDest->name,
+ it->second.getStr(),
+ sJobName.getStr(),
+ nNumOptions, pOptions);
SAL_INFO("vcl.unx.print", "cupsPrintFile( " << pDest->name << ", "
<< it->second << ", " << rJobTitle << ", " << nNumOptions
<< ", " << pOptions << " ) returns " << nJobID);
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 0c6e7138977f..01d6ce62a7dd 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -966,7 +966,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& rPrintername, bool bQuickC
return popen (aShellCommand.getStr(), "w");
}
-bool PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ )
+bool PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/, const OUString& /*rFaxNumber*/ )
{
return (0 == pclose( pFile ));
}