Bug 143225 - [KDE4] Remove remaining usage of private CUPS API functions (use ~/.cups/loptions instead ~/.lpoptions for CUPS 1.2.0 + later)
Summary: [KDE4] Remove remaining usage of private CUPS API functions (use ~/.cups/lopt...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdeprint
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-19 18:11 UTC by Frank Thommen
Modified: 2011-05-27 18:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch for KDE 3.5.x (1.05 KB, text/plain)
2007-09-06 16:29 UTC, Stephan Johach
Details
Correct Patch for KDE 3.5.x (1.05 KB, patch)
2007-09-06 16:59 UTC, Stephan Johach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Thommen 2007-03-19 18:11:14 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Fedora RPMs
OS:                Linux

When printing through CUPS with `kprinter`, CUPS printer instances added with `lpoptions -p ...` are not recognized and not available in kprinter's popup-menu.  Only centrally installed printers and centrally installed printer instances from /etc/cups/lpoptions are seen.  If printer instances are defined in ~/.lpoptions, kprinter sees them, but the `lpoptions` command adds them always to ~/.cups/lpoptions.

This problem exists in Fedora FC6 with KDE 3.5.6/CUPS 1.2.7-1.8 and Fedore FC5 with KDE 3.5.5/CUPS 1.2.8-1


frank
Comment 1 Kurt Pfeifle 2007-03-22 20:04:34 UTC
   "If printer instances are defined in ~/.lpoptions, kprinter sees them, 
    but the `lpoptions` command adds them always to ~/.cups/lpoptions."

KDEPrint is guilty of ab-using a few "private" interfaces of the CUPS API. When CUPS moved from 1.1.x to 1.2.0, some of these interfaces changed, and KDEPrint does now no longer understand some little details of CUPS' doing.

One of the things that changed is the location of the file to store "lpoptions".

You can fix this on your side locally, like so:


  * copy the contents of ~/.loptions to ~/.cups/lpoptions:
 
    mkdir ~/.cups   # in case this directory is not yet there
    cat ~/.loptions >> ~/.cups/lpoptions   # in case the file already exists

 
  * remove ~/.loptions and create a symlink pointing from ~/.loptions to ~/.cups/lpoptions:

    rm ~/.loptions 
    ln -s ~/.cups/lpoptions ~/.loptions


The symlink will ensure that KDEPrint will use the right file for CUPS even if it only knows to access the "old" filename.



------------
wrote a new $summary; old one was "kprinter does not recognize CUPS printer instances and their options (~/.cups/lpoptions)".
Comment 2 Kurt Pfeifle 2007-03-22 20:29:18 UTC
fixed typo in new $summary
Comment 3 Frank Thommen 2007-03-26 15:14:18 UTC
Hi Kurt,

thanks for the hint.  Unfortunately the symlink you propose doesn't work in that direction.  The `lpoptions` command will always remove an ~/.lpoptions file and move the data into ~/.cups/lpoptions if ~/.lpoptions is a symlink.  But the symlink solution works the other way round (~/.cups/lpoptions is the symlink):

  cat ~/.cups/lpoptions >> ~/.lpoptions
  cd ~/.cups
  rm -f lpoptions
  ln -s ../.lpoptions ./lpoptions

Thanks for pointing out the symlink idea.

   frank
Comment 4 Stephan Johach 2007-09-05 12:41:35 UTC
I had a look at the sources. In kdeprint/kmvirtualmanager.cpp the filename is hardcoded to .lpoptions. I am not an expert but it seems to me kdeprint should use the functions cupsGetDest(s)/cupsSetDest(s) from the API to get the printer list. The question is why the api is not used, as these functions seem to be available from the beginning. There's no hint for a required cups version.
Comment 5 Stephan Johach 2007-09-06 11:20:03 UTC
I guess I found out, why the cups api is not used there. Kmvirtualmanager is not cups specific but a generic class. So ignore comment #4.
Comment 6 Stephan Johach 2007-09-06 16:29:18 UTC
Created attachment 21552 [details]
patch for KDE 3.5.x

The patch looks if ~/.cups/loptions exists and reads the printer list from
there. Otherwise the file  ~/.loptions is used.
Comment 7 Stephan Johach 2007-09-06 16:56:10 UTC
Comment on attachment 21552 [details]
patch for KDE 3.5.x

Sorry, wrong patch. The fallback does not work.
Comment 8 Stephan Johach 2007-09-06 16:59:50 UTC
Created attachment 21553 [details]
Correct Patch for KDE 3.5.x

Reads ~./.cups/lpoptions or if it does not exist ~/.lpoptions.
Comment 9 John Layt 2011-05-27 18:29:49 UTC
KDEPrint is obsolete, unmaintained and will never be revived.  Closing all open bugs.