summaryrefslogtreecommitdiffstats
path: root/tdeprint/cups/kmcupsmanager.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-20 14:44:12 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-20 14:44:12 -0600
commit5a97ffdaae6532a39f1ebc1f0594833b1a253585 (patch)
tree5f12e8bc5262ba55122d72ebe74d409b019d351d /tdeprint/cups/kmcupsmanager.cpp
parent880fec09182a500b7e19b5b1c73189040cf3421a (diff)
downloadtdelibs-5a97ffdaae6532a39f1ebc1f0594833b1a253585.tar.gz
tdelibs-5a97ffdaae6532a39f1ebc1f0594833b1a253585.zip
Make compressed PPD loading and usage functional
Diffstat (limited to 'tdeprint/cups/kmcupsmanager.cpp')
-rw-r--r--tdeprint/cups/kmcupsmanager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tdeprint/cups/kmcupsmanager.cpp b/tdeprint/cups/kmcupsmanager.cpp
index 7f06e0636..5271dcd12 100644
--- a/tdeprint/cups/kmcupsmanager.cpp
+++ b/tdeprint/cups/kmcupsmanager.cpp
@@ -114,6 +114,8 @@ TQString KMCupsManager::driverDirectory()
d.append(":/usr/local/share/foomatic/db/source");
#else
d.append(":/usr/share/foomatic/db/source");
+ // compressed foomatic support
+ d.append(":/usr/lib/cups/driver/foomatic-db-compressed-ppds");
#endif
return d;
}
@@ -626,6 +628,8 @@ DrMain* KMCupsManager::loadFileDriver(const TQString& filename)
{
if (filename.startsWith("ppd:"))
return loadDriverFile(filename.mid(4));
+ else if (filename.startsWith("compressed-ppd:"))
+ return loadDriverFile(filename);
else if (filename.startsWith("foomatic/"))
return loadMaticDriver(filename);
else
@@ -685,7 +689,7 @@ DrMain* KMCupsManager::loadMaticDriver(const TQString& drname)
DrMain* KMCupsManager::loadDriverFile(const TQString& fname)
{
- if (TQFile::exists(fname))
+ if ((fname.startsWith("compressed-ppd:")) || TQFile::exists(fname))
{
TQString msg; /* possible error message */
DrMain *driver = PPDLoader::loadDriver( fname, &msg );
@@ -704,7 +708,11 @@ DrMain* KMCupsManager::loadDriverFile(const TQString& fname)
void KMCupsManager::saveDriverFile(DrMain *driver, const TQString& filename)
{
kdDebug( 500 ) << "Saving PPD file with template=" << driver->get( "template" ) << endl;
- TQIODevice *in = KFilterDev::deviceForFile( driver->get( "template" ) );
+ TQString templateFile = driver->get( "template" );
+ if (templateFile.startsWith("compressed-ppd:")) {
+ templateFile = driver->get( "temporary-cppd" );
+ }
+ TQIODevice *in = KFilterDev::deviceForFile( templateFile );
TQFile out(filename);
if (in && in->open(IO_ReadOnly) && out.open(IO_WriteOnly))
{