Version: (using KDE KDE 3.4.2) Installed from: Unspecified Linux For example, create a printer called: My B/W Printer And in the KPrintDialog instead of a plain combo box, it has a tree structure: +My B `---W Printer Crazy :-) I think the fix is in kdelibs/kdeprint/kprintdialog.cpp on line 571 change: d->m_printers->insertItem(QPixmap(), QString::fromLatin1("--------")); To: d->m_printers->insertItem(QPixmap(), QString::fromLatin1("--------"), true); Though I haven't tested it.
Err make that: d->m_printers->insertItem(SmallIcon(it.current()->pixmap(),0,(it.current()->isValid() ? (int)KIcon::DefaultState : (int)KIcon::LockOverlay)),it.current()->name(),false/*sep*/); to d->m_printers->insertItem(SmallIcon(it.current()->pixmap(),0,(it.current()->isValid() ? (int)KIcon::DefaultState : (int)KIcon::LockOverlay)),it.current()->name(),true);
The fix proposed is not the correct one because it would completely disable the usefulness of the TreeComboBox class. As the class name tells it, this class is a combobox with a treeview instead of a listbox. This is used in kdeprint to be able to show printers and instances (pseudo-printers) in a nice tree view where the instances are children of the real printer. The fix proposed completely disabled this. The problem here is that the printer name uses a slash (which is used in KMPrinter::name() to separate the printer and the instance name) and this is not forseen in the simple handling in KPrintDialog. A direct fix is to set the 3rd argument of "insertItem()" depending on the virtualness of the printer, that is KMPrinter::isVirtual(). Indeed, if the printer is not virtual, then it should be a top-level item. OTOH, a problem still exists if this "My B/W printer" printer has an instance defined on it. Here, the code could probably easily adapted by making smart use of the KMPrinter available functions: printerName(), instanceName(), isVirtual()... For example, TreeComboBox::insertItem() could accept a string list (instead of a string that it has to decompose itself) and KPrintDialog could directly give as list {mPrinter->printerName(), mPrinter->instanceName()}. Michael.
That's a little silly. Surely whoever wrote KMPrinter::name() would have forseen slashes in printer names. Anyway, I've never really used virtual printers, but it seems to me that it KMPrinter should do it properly and split the string up into two separate strings rather than one string separated by a /. I'll leave that for someone else though!
The use of the / as a separator comes from CUPS. KDEPrint uses it to be compatible with CUPS, otherwise virtual printers created by KDEPrint would be unusable by CUPS-only applications.
Tim, CUPS specifies that its printer names do not allow for slashes. Slashes are reserved to separate printer instances from the main print queue. (Think of a CUPS printer instance as "print job setting profile of a printer that can be used by just using a name". You may have a main printer "hp". Then you can create printer instances by the name of hp/A3paper hp/A4duplex hp/landscape_A3 and so on (and set all job options as you want them for each instance). This is supported by KDEPrint. So by far this is not at all a bug, it is a feature to group CUPS instances. Cheers, Kurt
Closing old Resolved status bug.