summaryrefslogtreecommitdiffstats
path: root/kdeprint/cups
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-20 14:44:12 -0600
committerSlávek Banko <slavek.banko@axis.cz>2015-12-23 02:22:56 +0100
commit8f2e8767e9b4d3fa8213cbd7c21af592432e4da6 (patch)
tree8723ae6cef7ebcc23de8e455d12e262fc809ac51 /kdeprint/cups
parent3051002fc6c543f7c1bb5403ada3a3d5a31c4023 (diff)
downloadtdelibs-8f2e8767e9b4d3fa8213cbd7c21af592432e4da6.tar.gz
tdelibs-8f2e8767e9b4d3fa8213cbd7c21af592432e4da6.zip
Make compressed PPD loading and usage functional
(cherry picked from commit 5a97ffdaae6532a39f1ebc1f0594833b1a253585)
Diffstat (limited to 'kdeprint/cups')
-rw-r--r--kdeprint/cups/kmcupsmanager.cpp12
-rw-r--r--kdeprint/cups/make_driver_db_cups.cpp5
2 files changed, 15 insertions, 2 deletions
diff --git a/kdeprint/cups/kmcupsmanager.cpp b/kdeprint/cups/kmcupsmanager.cpp
index df2c5d91e..b1c776004 100644
--- a/kdeprint/cups/kmcupsmanager.cpp
+++ b/kdeprint/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))
{
diff --git a/kdeprint/cups/make_driver_db_cups.cpp b/kdeprint/cups/make_driver_db_cups.cpp
index 0f77380a2..1651ca6f3 100644
--- a/kdeprint/cups/make_driver_db_cups.cpp
+++ b/kdeprint/cups/make_driver_db_cups.cpp
@@ -276,10 +276,15 @@ int parseCompressedPpdFile(const char *ppdfilename, const char *origin, const ch
}
}
+ manufacturer = manufacturer.stripWhiteSpace();
+ modelName = modelName.stripWhiteSpace();
+ driver = driver.stripWhiteSpace();
+
TQStringList driverList = TQStringList::split(",", driver, TRUE);
driver = driverList[0];
if (driver.startsWith("D")) {
driver = driver.mid(1);
+ driver = driver.stripWhiteSpace();
}
model = manufacturer + " " + modelName + " " + driver;
description = description + " [" + languageVersion + "]";