<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>180051</bug_id>
          
          <creation_ts>2009-01-08 19:02:22 +0000</creation_ts>
          <short_desc>[KDE4] Need a way to have default printer settings</short_desc>
          <delta_ts>2021-12-04 17:44:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kdelibs</product>
          <component>print-dialog</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>UPSTREAM</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nicos Gollan">gtdev</reporter>
          <assigned_to name="KDEPrint Devel Mailinglist">kde-print-bugs-null</assigned_to>
          <cc>a</cc>
    
    <cc>adam</cc>
    
    <cc>alanjprescott</cc>
    
    <cc>anders.nilsson</cc>
    
    <cc>arthur</cc>
    
    <cc>aspotashev</cc>
    
    <cc>atorgovitsky</cc>
    
    <cc>c.w.j.lemmens</cc>
    
    <cc>cfreier</cc>
    
    <cc>codestruct</cc>
    
    <cc>colin</cc>
    
    <cc>dhaumann</cc>
    
    <cc>dhertel</cc>
    
    <cc>djarvie</cc>
    
    <cc>dsteeghs</cc>
    
    <cc>E.microcorys</cc>
    
    <cc>ed38</cc>
    
    <cc>emilio.recio</cc>
    
    <cc>ermonnezza</cc>
    
    <cc>exabyte</cc>
    
    <cc>florian</cc>
    
    <cc>guefz</cc>
    
    <cc>hans_meine</cc>
    
    <cc>hvengel</cc>
    
    <cc>jakob</cc>
    
    <cc>jarauh</cc>
    
    <cc>jeremy</cc>
    
    <cc>KaiUweBroulik2</cc>
    
    <cc>kde-print-bugs-null</cc>
    
    <cc>kdebugs</cc>
    
    <cc>kevin.kofler</cc>
    
    <cc>m.weghorn</cc>
    
    <cc>mail4ilia</cc>
    
    <cc>mdspam</cc>
    
    <cc>mskala+kdebugs</cc>
    
    <cc>ncoghlan</cc>
    
    <cc>ntropia</cc>
    
    <cc>paul</cc>
    
    <cc>pete</cc>
    
    <cc>philipp.woelfel</cc>
    
    <cc>psychonaut</cc>
    
    <cc>rauchwolke</cc>
    
    <cc>reescf</cc>
    
    <cc>rmj</cc>
    
    <cc>schmuker</cc>
    
    <cc>simonandric5</cc>
    
    <cc>tom-kde.bugs</cc>
    
    <cc>vidakris</cc>
    
    <cc>vivo75+kde</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>1410</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>696270</commentid>
    <comment_count>0</comment_count>
    <who name="Nicos Gollan">gtdev</who>
    <bug_when>2009-01-08 19:02:22 +0000</bug_when>
    <thetext>Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

There needs to be some way to have persistent printer settings. From looking around on the web, it seems like:

* KDE 4 wants to use whatever Qt provides
* Qt does not seem to provide any useful printer settings tools

The current situation is that KDE defaults to non-duplex color printing, and completely ignores existing printer settings e.g. from CUPS (fun enough, it still exposes those settings in the advanced printer setup), making it necessary to re-select those settings. This is *not* a wishlist issue, this is instead a regression from pretty much any KDE 3.

The most convenient solution would of course be an applet in systemsettings.

To get with the expected behavior bulletpoint:
 (1) Start System Settings tool
 (2) Choose &quot;Printers&quot; or something similar
 (3) Be able to configure standards for all settings available in the normal KDE print dialog

Alternatively:
 (1) KDE uses defaults from underlying print system, e.g. CUPS</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>729961</commentid>
    <comment_count>1</comment_count>
    <who name="Praveen Srinivasan">popapa</who>
    <bug_when>2009-03-13 19:45:03 +0000</bug_when>
    <thetext>*** This bug has been confirmed by popular vote. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>782496</commentid>
    <comment_count>2</comment_count>
    <who name="Danny Steeghs">dsteeghs</who>
    <bug_when>2009-06-26 19:03:17 +0000</bug_when>
    <thetext>Sorry to be a moaner, but I do feel bad about all the paper wasted since our duplex printers only print duplex if we remember to change the print options for ALL print jobs. This really is the second most annoying feature of my KDE4 experience at present. 

Surely setting the default to duplex if the printer supports duplex is an achievable fix that the trees will thank us for? But really, having settings saved is a rather basic feature.

Any update on this regression is appreciated....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845941</commentid>
    <comment_count>3</comment_count>
    <who name="Philipp Woelfel">philipp.woelfel</who>
    <bug_when>2009-10-16 18:47:21 +0000</bug_when>
    <thetext>&gt; This really is the second most annoying feature of my KDE4
experience at present.

I second that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>848743</commentid>
    <comment_count>4</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2009-10-22 11:42:29 +0000</bug_when>
    <thetext>With version 4.3, KDE4 is now finally an improvement over KDE3 in _all_ areas. If it wasn&apos;t for this bug. It is definitely not 21st century style having to re-select duplex every time I need to print something. Neither is it good design to ignore the settings in the underlying backend (cups). 

KDE4 should use the duplex settings from CUPS, or at least provide an option to save the settings in the printer dialog like KDE3 offered it. Do it for the trees :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>851755</commentid>
    <comment_count>5</comment_count>
    <who name="Colin Coles">colin</who>
    <bug_when>2009-10-27 23:14:51 +0000</bug_when>
    <thetext>In Konqueror print dialog &gt;&gt; Options &gt;&gt; HTML Tab the check boxes are reset each time a page is printed. This is not the behaviour experienced in 3.5 which remembers the previous settings, which to me is far more intuitive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852039</commentid>
    <comment_count>6</comment_count>
    <who name="">jarauh</who>
    <bug_when>2009-10-28 16:05:08 +0000</bug_when>
    <thetext>*** Bug 195107 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852055</commentid>
    <comment_count>7</comment_count>
    <who name="Brice Hunt">shoalcreek5</who>
    <bug_when>2009-10-28 16:35:15 +0000</bug_when>
    <thetext>Ok, if the other bug is a duplicate of this bug, something funny is going on. I&apos;m using the same (manufacturer-provided) ppd for CUPS now that I used in KDE 3.5, CUPS is set to not print duplex by default, the printer is internally set to not print duplex by default, and yet, whenever I print from a KDE application, it prints in duplex, long-side, regardless of what setting I choose in the KDE print dialog. I am printing to a Brother HL-5250DN. All non-KDE apps (evince, openoffice.org, iceweasel, etc.) act as they should, printing duplex only when I tell them to print in duplex. This is most definitely a regression from KDE 3.5, as KDE 3.5 printing was nearly perfect in every way with my printer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852156</commentid>
    <comment_count>8</comment_count>
    <who name="">guefz</who>
    <bug_when>2009-10-28 18:23:11 +0000</bug_when>
    <thetext>I see the same behaviour than described in #7 here on my system with a HP CLJ5550DTN. Even using a PPD without duplex definition results in duplex printing. I&apos;m running Debian Sid with currently KDE 4.3.2 and qt 4.5.3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852508</commentid>
    <comment_count>9</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2009-10-29 14:52:18 +0000</bug_when>
    <thetext>Although this bug has first been reported 3 months ago it is not yet assigned to anyone. Point is, there is no &quot;About&quot; dialog in the print dialog, which is where normally developers, maintainers and translators are credited. Hence, we have no idea who is actually maintaining that part of KDE (and I have no clue how to find out).

It might very well be that this bug lives a life which is invisible to the people who could fix it. Does anyone have an idea how to find out who is working on this part of KDE?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852525</commentid>
    <comment_count>10</comment_count>
    <who name="Danny Steeghs">dsteeghs</who>
    <bug_when>2009-10-29 15:13:31 +0000</bug_when>
    <thetext>As far as I know, the decision was made not to develop a full-blown KDE print infrastructure in KDE4, but instead rely on the print infra-structure provided by QT. I can appreciate the development effort needed to develop a KDE4 print system, but the problem is that the QT printing infra-structure is clearly inferior to KDE3 printing and insufficient. There appears to little development activity on the QT end, while some KDE4 developers are saying this is a QT problem, not a KDE4 problem. I think this circular argument of blame is partly responsible for the lack of progress here. By choosing Qt print infra-structure it IS a KDE4 problem to fix/deal with it, so I would think kde-print-devel to be the right community.

I wish I had more hands-on help to offer here, but I do find it hard to understand why printing remains crippled even at KDE4.3.2 while most other parts of KDE4 have made huge strides. IMHO, deciding to rely on Qt for printing has proven to be a big problem for KDE4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852545</commentid>
    <comment_count>11</comment_count>
    <who name="Nicos Gollan">gtdev</who>
    <bug_when>2009-10-29 16:19:15 +0000</bug_when>
    <thetext>IIRC the argument was that the print handling in KDE 3 was unmaintained. Last I checked, any printing issues were marked to be handled at some undetermined point in time.

By now, I found it to be a neat solution to just use non-KDE applications in any area where printing might be necessary. Gnome somehow manages to at least have a working print settings dialog (i.e. it works for our environment). However, that does not make this bug any less annoying.

As for printer settings overriding QT, I can not confirm that, since over here, QT will always override CUPS/printer settings.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>852585</commentid>
    <comment_count>12</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2009-10-29 17:53:00 +0000</bug_when>
    <thetext>I added a bug report against QT&apos;s QPrintDialog. 

http://bugreports.qt.nokia.com/browse/QTBUG-5196

Let&apos;s see what comes out of that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>853048</commentid>
    <comment_count>13</comment_count>
    <who name="Hal V. Engel">hvengel</who>
    <bug_when>2009-10-30 18:18:07 +0000</bug_when>
    <thetext>Is anyone considering this:

http://www.linuxfoundation.org/collaborate/workgroups/openprinting/commonprintingdialog

The OpenPrinting folks have been working on this for some time and it includes fronts ends in both Qt and GTK+ so the Qt front end should fit in a KDE environment nicely.  The UI is designed by a usability expert who does this type of work professionally.  There have been Google Summer of Code projects on this for the last two summers and it is close to being ready for real world use.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>854286</commentid>
    <comment_count>14</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2009-11-02 10:29:29 +0000</bug_when>
    <thetext>There was a reaction on the Qt side: the bug is now marked as a duplicate of an existing bug: http://bugreports.qt.nokia.com/browse/QTBUG-3567

This other bug has been reported in February, is unassigned and has no schedule. So I guess there&apos;s nothing to expect from the Qt side anytime soon.

In the meantime I keep being annoyed by paper waste in my lab, because all KDE4 users send their print jobs non-duplex. I understand that printing may not have top priority among KDE developers, but still it would be nice to see at least some reaction, like acknowledging this bug, or rejecting it. 

The point is, a KDE developer might have more impact on the Qt devs than some random internet user who reports a duplicate bug. So if some KDE dev would accept this bug and poke the Qt devs this might save a few thousand trees.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>854294</commentid>
    <comment_count>15</comment_count>
    <who name="Danny Steeghs">dsteeghs</who>
    <bug_when>2009-11-02 10:42:22 +0000</bug_when>
    <thetext>Indeed noticed that and couldn&apos;t help but wonder how the duplication was picked up almost instantly, yet the parent bug is still unassigned, and surprisingly marked as &apos;minor&apos; priority.  This bug is the highest ranked &apos;kde-print-devel&apos; bug in KDE&apos;s &apos;most hated bugs&apos; list... 

I cannot see a response yet from a KDE print developer, but I would be interested to see if anyone is actually looking at this bug and to what extent KDE print talks to QT devel. We are not after more features in the print dialog at this point, just a way to make them persistent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>855023</commentid>
    <comment_count>16</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2009-11-03 18:21:21 +0000</bug_when>
    <thetext>Since neither KDE nor QT shows any reaction I submitted a bug against OpenSUSE (which I&apos;m using). In the past they have been a huge supporter of KDE, and KDE 4.3.1 will be the default desktop in their upcoming 11.2 release. Perhaps they are more inclined to address printing related issues than the KDE ot QT team because they also target enterprise users with their distro.

See https://bugzilla.novell.com/show_bug.cgi?id=552218</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>865362</commentid>
    <comment_count>17</comment_count>
    <who name="C W J Lemmens">c.w.j.lemmens</who>
    <bug_when>2009-11-20 11:44:47 +0000</bug_when>
    <thetext>Dear fellow KDE4 users,

I solved most of my problems for now by using some workarounds :

1) For our non-KDE programs (firefox, openoffice and some older stuff) I found a perfect replacement for &quot;kprinter&quot; : gtklp !! Take a look here : it solved more than half of my problems : http://gtklp.sourceforge.net/

2) To force doublesided printing inside KDE4 applications I used this :

* I downloaded the source of qt-4.5.3 and configured and compiled the whole bunch.
* Then I hacked the src/gui/dialog/qprintdialog_unix.cpp and added this :

— qprintdialog_unix.cpp.org 2009-10-19 20:19:20.000000000 +0200
+++ qprintdialog_unix.cpp 2009-11-19 14:22:08.000000000 +0100
@@ -424,6 +424,15 @@

void QPrintDialogPrivate::applyPrinterProperties(QPrinter *p)
{
+ // Force some decent defaults, e.g. for Duplex printing !!!
+ p-&gt;setDoubleSidedPrinting(true);
+ p-&gt;setColorMode(QPrinter::GrayScale);
+ p-&gt;setPageSize(QPrinter::A4);
+
+ fprintf(stderr,
+ &quot;Using QPrintDialogPrivate::applyPrinterProperties() hack by KL !\n&quot;);
+
if (p-&gt;colorMode() == QPrinter::Color)

This forces everything to be grayscale, A4 and duplex unless the user explicitly chooses something else (this is the cheapest for our department !) The extra fprintf statement is only for me to see that I am indeed using the hacked library and not the original.

* Then I reran &quot;make&quot; in src/gui to recompile just a new libQtGui

* I copied the modified libQtGui.so.4.5.3 and its softlinks to a directory /opt/qt-4.5.3-hack/lib/

* Now I had to make sure that each KDE session uses this new library instead of the original one. I did that by hacking /etc/profile.d/qt4.sh (or qt4.csh if you wish) and added this at the end :

export LD_LIBRARY_PATH=/opt/qt-4.5.3-hack/lib

* If you then login again each user will use the new libQtGui library and thus have changed printing settings. I admit it isn&apos;t very elegant and still doesn&apos;t remember previous settings but at least we have some decent defaults now.

Hope this helps some of you until the Qt or KDE people come up with something more permanent !

Regards,
KL</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>867763</commentid>
    <comment_count>18</comment_count>
    <who name="Paul Cullum">paul</who>
    <bug_when>2009-11-24 18:27:30 +0000</bug_when>
    <thetext>Is the use of QT for print support mentioned here the reason for the infuriating bug 174354?  Is that bug basically blocked because of this issue?  Every time I print our office printer blocks because it thinks it should be printing A4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879341</commentid>
    <comment_count>19</comment_count>
    <who name="Paul Cullum">paul</who>
    <bug_when>2009-12-14 00:47:10 +0000</bug_when>
    <thetext>Vote for http://bugreports.qt.nokia.com/browse/QTBUG-6471

This problem has existed for well over a year and they barely notice that it exists.

There are a lot of bugs opened there trying to explain this problem but this one seems to be the most clear with code that demonstrates the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879470</commentid>
    <comment_count>20</comment_count>
    <who name="Roderick Johnstone">rmj</who>
    <bug_when>2009-12-14 11:22:32 +0000</bug_when>
    <thetext>Paul

You have my vote on this one in the qt BZ.

I&apos;ve had problems with the defaults for selecting duplex for ages (which I think is releated) and have opened, voted for and followed various bugs at kde and qt o nthe printing system. I really hope http://bugreports.qt.nokia.com/browse/QTBUG-6471 starts to get some traction. I can&apos;t believe how this doesn&apos;t have a higher profile and some urgency to fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909166</commentid>
    <comment_count>21</comment_count>
    <who name="Jeremy Sanders">jeremy</who>
    <bug_when>2010-01-31 17:46:00 +0000</bug_when>
    <thetext>I&apos;ve got an (ugly) patch which fixes some problems. It sets the duplex, collation and colour options, in new QPrinter objects and when switching printers in the print dialog, from the default cups ppd settings.

It doesn&apos;t do anything with page sizes (is this a problem for some people?), doesn&apos;t tell cups to use the new options as defaults and doesn&apos;t propagate cups options back from the advanced tab of the properies tab. These issues could probably be fixed.

It could be improved. Maybe the Qt people would decide whether it is a useful way to advance. I think this code would probably be best moved into QPrinterInfo, to make it more general, but I&apos;m wary about messing with the API, especially as Windows versions might need adding.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909167</commentid>
    <comment_count>22</comment_count>
      <attachid>40415</attachid>
    <who name="Jeremy Sanders">jeremy</who>
    <bug_when>2010-01-31 17:46:54 +0000</bug_when>
    <thetext>Created attachment 40415
patch to fix some printer issues</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909684</commentid>
    <comment_count>23</comment_count>
    <who name="Danny Steeghs">dsteeghs</who>
    <bug_when>2010-02-01 15:48:02 +0000</bug_when>
    <thetext>Its been over a year since this bug was raised, and its votes now not only make it the most-hated KDE print bug, but it is also in the top 20 of all most-hated KDE bugs. Its clear that from the user point of view, this has some urgency to it, yet I struggle to find any activity at either KDE or Qt that indicates that this is receiving active developer attention.

Thanks for the suggestive patches, but does anyone have any ideas how this awareness can be achieved at kde-print/QT since doing the proper thing of filing a bug and voting for it does not seem to work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909716</commentid>
    <comment_count>24</comment_count>
    <who name="Roderick Johnstone">rmj</who>
    <bug_when>2010-02-01 16:47:02 +0000</bug_when>
    <thetext>I reported kde printing problems in Fedora 10 more than a year ago at https://bugzilla.redhat.com/show_bug.cgi?id=480954

I was asked to upstream it, which i did by adding comment #12 in https://bugs.kde.org/show_bug.cgi?id=176999.

This was upstreamed to qt as  http://bugreports.qt.nokia.com/browse/QTBUG-6468 and http://bugreports.qt.nokia.com/browse/QTBUG-6469

and these are still open. I&apos;m wondering if maybe the problems that we see in the distro (printing from kde apps has a problems) is too far removed from the source of the problem, Qt. It takes some effort to follow these though three bugzillas.


It would be great if someone at kde could champion these issues and help get them resolved. As it is, I have no idea whether the Qt people will ever resolve them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909718</commentid>
    <comment_count>25</comment_count>
    <who name="Nicos Gollan">gtdev</who>
    <bug_when>2010-02-01 16:56:16 +0000</bug_when>
    <thetext>Thing is, Qt provides a framework. They have a printer widget, it can print (even if it&apos;s bad at it).

KDE wants to provide a productive desktop environment. So they either use a framework that provides what is needed needed, or they extend an existing one. The first part obviously doesn&apos;t work.

This is not about adding a constant-time prime factorization algorithm, it&apos;s about remembering a bunch of settings. This also isn&apos;t about a return of KDEPrint (oh how I miss thee), it&apos;s about remembering a bunch of settings.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909735</commentid>
    <comment_count>26</comment_count>
    <who name="Jeremy Sanders">jeremy</who>
    <bug_when>2010-02-01 17:22:17 +0000</bug_when>
    <thetext>I&apos;m pretty sure that the right way to save the options is in cups, so that all applications, including non-qt applications, save these settings.

I think it&apos;s a matter of taking the patch I uploaded above, and modifying it to also save modified settings to the users&apos; lpoptions file with Cups. Indeed Qt, already reads this file when the user clicks on printer properties - just use a command like
lpoptions -p deskjet -o media=Legal

It really needs to be done in Qt, unless KDE wants to have its own printer dialog (which wouldn&apos;t be hard, just inconvenient).

It would be easy to make a Cups printer dialog for KDE. Perhaps it could be nicer than the default one. However, it wouldn&apos;t work under Windows. It would also make KDE rely on cups, unless you revert to the old one if it wasn&apos;t there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>925866</commentid>
    <comment_count>27</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-02-28 03:39:51 +0000</bug_when>
    <thetext>That patch as is causes https://bugzilla.redhat.com/show_bug.cgi?id=566304

The offending lines:
+     // set default color
+     if( cups-&gt;currentPPD()-&gt;color_device )
+       options.color-&gt;setChecked(true);
+     else
+       options.grayscale-&gt;setChecked(true);
and later:
+     // set default color
+     if( cups.currentPPD()-&gt;color_device )
+   setColorMode(Color);
+     else
+   setColorMode(GrayScale);

They should be changed to:
    if ( cups-&gt;currentPPD() )
      {
        // set default color
        if( cups-&gt;currentPPD()-&gt;color_device )
          options.color-&gt;setChecked(true);
        else
          options.grayscale-&gt;setChecked(true);
      }
and:
    if ( cups.currentPPD() )
      {
        // set default color
        if( cups.currentPPD()-&gt;color_device )
          setColorMode(Color);
        else
          setColorMode(GrayScale);
      }
(I matched the coding style of the surrounding code.)

I&apos;m going to try changing this in the Fedora package and will attach a fixed patch if this works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>925873</commentid>
    <comment_count>28</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-02-28 04:37:00 +0000</bug_when>
    <thetext>By the way, your patch doesn&apos;t match the coding standards used in the surrounding code (and Qt code in general) at all. I&apos;m also reformatting it to match those standards (which also make much more sense to me personally than yours ;-) ).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>925886</commentid>
    <comment_count>29</comment_count>
      <attachid>41187</attachid>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-02-28 06:23:00 +0000</bug_when>
    <thetext>Created attachment 41187
patch to fix some printer issues (fixed)

Here&apos;s a version of the patch fixed to not crash when currentPPD is NULL and reformatted according to the Qt coding style.

Please note that I only know this builds, I haven&apos;t done any testing yet. (But all I changed except for formatting is that I added the checks for NULL to prevent crashes.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>926320</commentid>
    <comment_count>30</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-02-28 19:24:58 +0000</bug_when>
    <thetext>My fixed patch has now been confirmed to work and fix the crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028796</commentid>
    <comment_count>31</comment_count>
    <who name="Hans Meine">hans_meine</who>
    <bug_when>2010-10-07 09:56:02 +0000</bug_when>
    <thetext>I also suffer from paper wasted because of KDE&apos;s print dialogs defaulting to single-sided printing.

(In reply to comment #26)
&gt; I&apos;m pretty sure that the right way to save the options is in cups, so that all
&gt; applications, including non-qt applications, save these settings.

AFAICS, the situation actually is that the default in CUPS *is* duplex printing.  This *is* used successfully by other programs, just not by Qt&apos;s printing dialog.  Actually, there are two ways to configure duplex mode: one is via the cups properties, available in KDE&apos;s systemsettings and by pressing &quot;properties&quot; right next to the selected printer in the print dialog.  There, duplex is selected.  (This is the same thing as in comment #7 from Brice, only the other way round.)

However, the specialized GUI hidden behind the &quot;options&quot; button, in the settings tab, defaults to duplex OFF.

Looking at the code, the duplex mode GUI is set up from a QPrinter:
http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/dialogs/qprintdialog_unix.cpp#line434

I am not sure where the QPrinter comes from in general, and how to fix this properly.  (Maybe introducing a &quot;DefaultDuplex&quot; QPrinter mode which lets the GUI default to the CUPS setting?)

It actually looks more like a Qt bug to me, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028798</commentid>
    <comment_count>32</comment_count>
    <who name="Hans Meine">hans_meine</who>
    <bug_when>2010-10-07 09:59:01 +0000</bug_when>
    <thetext>(In reply to comment #30)
&gt; My fixed patch has now been confirmed to work and fix the crash.

While your patch looks sane, I don&apos;t think it has much to do with this bug.
(Furthermore, it should be sent to Qt, not KDE.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028811</commentid>
    <comment_count>33</comment_count>
    <who name="Marcel Dischinger">mdspam</who>
    <bug_when>2010-10-07 10:39:54 +0000</bug_when>
    <thetext>IMHO there is a usability problem here. The printing dialog includes two settings, the Cups printing settings in Properties-&gt;Advanced, and the Qt Printing options in Options. The Qt Printing Options override the Cups options in any case, which is very confusing.

To fix this, in the GUI, both option menus should be in sync to prevent &quot;surprising&quot; outcomes. That means, that on startup the Qt Printing Options should reflect the Cups printing settings (if duplex is the default in cups, it should be the default in Qt). If I change a setting in the advanced cups dialog, Qt should reflect that immediately. If I change a setting in Qt, the advanced dialog should also show that (but not necessarily change the default setting in cups without asking the user first).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028829</commentid>
    <comment_count>34</comment_count>
    <who name="Kai Uwe Broulik">KaiUweBroulik2</who>
    <bug_when>2010-10-07 11:39:52 +0000</bug_when>
    <thetext>The printing dialog is a mess anyway. Some settings you can set in the menu right away (such as color or black and white printing in kolourpaint and such) but printing mode (draft, normal, foto) is only available under printer settings. And often you cannot even set oritentation to landscape as it is just greyed out. 
KDE has such a nice file-open-dialog (which I don‘t think comes from qt directly?) so why not provide a nice printing dialog as well. You have one since Windows 95 and we‘re in 2010 here. (And when configuring my printer with KDE, it always spits out an additional testpage (or an empty one if I am quickly enough at the printer to press cancel) after each printing job)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028832</commentid>
    <comment_count>35</comment_count>
    <who name="Colin Coles">colin</who>
    <bug_when>2010-10-07 11:51:17 +0000</bug_when>
    <thetext>I recently reported this bug on RedHat Bugzilla for 6.0 Beta but that doesn&apos;t seem to have gone anywhere either.
https://bugzilla.redhat.com/show_bug.cgi?id=587016</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029025</commentid>
    <comment_count>36</comment_count>
    <who name="Philipp Woelfel">philipp.woelfel</who>
    <bug_when>2010-10-07 21:49:03 +0000</bug_when>
    <thetext>Here is a related problem. Seems to me the source of evil might be the same, so I&apos;m not filing a new bug report just yet: When I want to print a landscape document, in the printer dialog under &quot;Properties&quot; Orientation automatically is set to &quot;Landscape&quot;. The image next to it indicates a correct layout. However, the document is then printed in &quot;portrait mode&quot;, i.e., the landscape contents is printed on a page that&apos;s oriented vertically. Funnily enough, one can fix that simply by switching  the check box back to &quot;Portrait&quot;. This is really confusing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029036</commentid>
    <comment_count>37</comment_count>
    <who name="Philipp Woelfel">philipp.woelfel</who>
    <bug_when>2010-10-07 22:46:36 +0000</bug_when>
    <thetext>It seems to me that this &quot;duplex printing&quot; bug is not getting enough attention. The truth is that less experienced users are simply not printing in duplex. I know what I&apos;m talking about - I have two high-school kids and a wife who are using KDE. They all waste a lot of paper, and each time I notice, I explain over and over again that they are supposed to click on this darn check-box each time they want to print. From a non-developer point of view, this bug is embarrassing for KDE - it should be easy to fix (now, admittedly I don&apos;t know what I&apos;m talking about), but it&apos;s not being addressed. Even if the idealistic approach is to say this should be fixed in QT, this might not be the right way to deal with it. In particular, when such an (alleged simple to fix) bug makes it on the Top Ten list of the Most Hated KDE Bugs, I wish a more pragmatic approach would be applied.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029049</commentid>
    <comment_count>38</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-10-07 23:28:28 +0000</bug_when>
    <thetext>Get your distro to apply the Qt patch from comment #29. Fedora has been using that patch for months.

Bonus points if you can get Nokia to merge it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029066</commentid>
    <comment_count>39</comment_count>
    <who name="Philipp Woelfel">philipp.woelfel</who>
    <bug_when>2010-10-08 02:03:54 +0000</bug_when>
    <thetext>(In reply to comment #38)
&gt; Get your distro to apply the Qt patch from comment #29. Fedora has been using
&gt; that patch for months.
&gt; 
&gt; Bonus points if you can get Nokia to merge it.

There is little hope for success. The bug has been reported in OpenSUSE, but it is closed as upstream (see https://bugzilla.novell.com/show_bug.cgi?id=552218 )

In fact, fixing this bug downstream on distro level is far from ideal (it doesn&apos;t really help me much, that it&apos;s fixed in Fedora). Ideally, it would be fixed upstream in QT. But I am not very optimistic that this will happen in the near future (and apparently so are you). So I wonder whether fixing it on KDE level would be an appropriate and pragmatic solution. If not, I&apos;m curious why. After all, it is listed as  one of the top ten most hated bugs on the KDE(!) Bug Tracking System.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029092</commentid>
    <comment_count>40</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-10-08 07:33:15 +0000</bug_when>
    <thetext>It is impossible to fix this at KDE level without rewriting the whole print dialog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029096</commentid>
    <comment_count>41</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-10-08 07:37:42 +0000</bug_when>
    <thetext>&gt; There is little hope for success. The bug has been reported in OpenSUSE, but it
&gt; is closed as upstream (see https://bugzilla.novell.com/show_bug.cgi?id=552218 )

It was closed as upstream by somebody who doesn&apos;t seem to be an openSUSE packager. Just reopen it and link to the patch here.


FWIW, what KDE can do is to add the Qt patch to the qt-kde tree in git. Several distros ship the Qt patchset from there (I know Fedora does, I&apos;m not sure about openSUSE), so it&apos;d get picked up automatically by those. But I also think that getting that patch (or a better one, if Nokia doesn&apos;t like the patch as is) into upstream Qt is the best solution.


By the way, whatever you do, make sure you use the version of the patch I fixed, from comment #29, not the original one which contained a crash bug. (But the credits for the patch should still go to Jeremy Sanders, I only fixed the crasher.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029133</commentid>
    <comment_count>42</comment_count>
    <who name="Albert Astals Cid">aacid</who>
    <bug_when>2010-10-08 09:44:14 +0000</bug_when>
    <thetext>It can not be fixed in the KDE level, we use Qt for printing so the code is in Qt repository where we don&apos;t have access to commti fixes. So instead of complaining here that has *zero* effect on getting the patch fixed go an vote for the existing bugs in qt bug reporting webpage and open new ones if needed.

http://bugreports.qt.nokia.com/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029135</commentid>
    <comment_count>43</comment_count>
    <who name="Albert Astals Cid">aacid</who>
    <bug_when>2010-10-08 09:50:11 +0000</bug_when>
    <thetext>Too early in the morning, when i say &quot;getting the patch fixed go&quot; i meant &quot;getting the bugs fixed go&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029149</commentid>
    <comment_count>44</comment_count>
    <who name="Jeremy Sanders">jeremy</who>
    <bug_when>2010-10-08 10:28:30 +0000</bug_when>
    <thetext>This problem can be fixed at the KDE level.

If Nokia decide they don&apos;t want to add our patches, or work on the dialog box themselves, we could make the decision to implement a new KDE printing dialog box which would replace the Qt one. Applications could then move to using the new dialog box.

I&apos;d be interested in looking at doing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029155</commentid>
    <comment_count>45</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2010-10-08 10:45:14 +0000</bug_when>
    <thetext>I&apos;d also like to remind you of the existence of http://qt.gitorious.org/qt/kde-qt , a Qt tree to which all KDE developers can commit (you need to have an account on gitorious.org and request kde-developers group membership there), which is shipped by several distributions. (Fedora ships it as a patchset against Nokia&apos;s Qt. I know we&apos;re not the only ones.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029266</commentid>
    <comment_count>46</comment_count>
    <who name="Hans Meine">hans_meine</who>
    <bug_when>2010-10-08 15:04:00 +0000</bug_when>
    <thetext>(In reply to comment #32)
&gt; (In reply to comment #30)
&gt; &gt; My fixed patch has now been confirmed to work and fix the crash.
&gt; 
&gt; While your patch looks sane, I don&apos;t think it has much to do with this bug.

I stand corrected: I had not looked at the attachment, but only at the diff in your comment (and in comment #30 you wrote &quot;confirmed to work and fix the crash&quot;, but it does not only fix the crash, but actually let the dialog default to duplex - yeah!).

Your patch is exactly what I had in mind as the necessary solution, so I applied and compiled it and tried it out - IT WORKS! :-)

&gt; (Furthermore, it should be sent to Qt, not KDE.)

This is still valid; while you might want to try applying to qt-kde, the policy is that qt-kde should deviate from upstream as few as possible!

Anyhow, thanks a lot for the patch to both Jeremy and Kevin, this really bugged me a lot!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1029395</commentid>
    <comment_count>47</comment_count>
    <who name="Philipp Woelfel">philipp.woelfel</who>
    <bug_when>2010-10-08 21:06:40 +0000</bug_when>
    <thetext>Thanks for the comments and explanations (of course, Albert, my intention was not to complain, but rather to get movement into this, as this bug will soon celebrate its second anniversary). It&apos;s great that a patch exists, but I still like Jeremy&apos;s idea of reimplementing the print dialog, as the current one has several other problems besides the one that is, as I understand, addressed by the patch. E.g., those from #33, #34, and #36. In addition, e.g., the collate option can be set in the &quot;Advanced Properties&quot; but at the same time be unset in the main print dialog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1032229</commentid>
    <comment_count>48</comment_count>
    <who name="Hal V. Engel">hvengel</who>
    <bug_when>2010-10-14 20:05:24 +0000</bug_when>
    <thetext>It appears that OpenPrinting.org may have arranged funding to continue work on the Common Print Dialog.  As more details become available I will make sure this information is available here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1044550</commentid>
    <comment_count>49</comment_count>
    <who name="Tristan Miller">psychonaut</who>
    <bug_when>2010-11-15 13:17:20 +0000</bug_when>
    <thetext>I take it kdeprint is now unmaintained.  Could this bug be moved to the new product?  I take it this is the print-dialog component of kdelibs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1048035</commentid>
    <comment_count>50</comment_count>
    <who name="Jim Jones">rauchwolke</who>
    <bug_when>2010-11-22 17:23:42 +0000</bug_when>
    <thetext>every time i print a paper oriented in portrait - the printer paper orientation is set to portrait and when i print a landscape pdf the printer paper orientation is set to landscape - but my printer only has portrait oriented paper - therefor printing in landscape creates the wrong output for my printer - so i have to change this setting every time i print a landscape oriented file...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1065535</commentid>
    <comment_count>51</comment_count>
    <who name="Pino Toscano">pino</who>
    <bug_when>2010-12-30 09:57:43 +0000</bug_when>
    <thetext>*** Bug 261596 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1084329</commentid>
    <comment_count>52</comment_count>
    <who name="Milko Krachounov">exabyte</who>
    <bug_when>2011-02-05 22:29:27 +0000</bug_when>
    <thetext>How many issues are covered by this bug? I was browsing through similar bug reports because of issues with duplex printing, and none of them are worded well enough to figure out if it is the issue that I&apos;m having. The issue with the default settings (http://bugreports.qt.nokia.com/browse/QTBUG-6471) is claimed to be fixed in Qt 4.6.3 which was released about the time when I bought a printer and I haven&apos;t experienced it, but the override for the duplex in Options doesn&apos;t work for me, and I have to set the duplex setting from Properties -&gt; Advanced -&gt; Double-Sided Printing (this would also be http://bugreports.qt.nokia.com/browse/QTBUG-6468 I think).

Anyway, the new QPrintDialog is largely inferior to what KDE 3.5 had. First, this upstream issues that the upstream seems to be largely ignoring, then there is the lack of a nice application such as kprinter, and lastly I can use printing filters any more. 

KDE 3.5 allowed me to create booklets and all the crazy stuff with ps filters such as psnup, etc. None of them worked correctly for me, true, but I was planning on filing bug reports and/or trying to fix them myself, and I even got some of them working from the command line. The lack of ps filters is a major drawback of the new version. I have to learn to make those from the command line, and store everything in cheat sheets. With KDE 3.5 I could simply create a new filter that performed exactly what I was interested in, and then share it with everyone else, etc.

The idea of using an unified printing framework like org.openprinting.PrintDialog sounds really nice, but what about creating KDEPrintDialog that supports all the features kprinter did that I listed above *and* provides the org.openprinter.PrintDialog dbus interface at the same time? :) I&apos;m personally voting for that path, if it is possible at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1122539</commentid>
    <comment_count>53</comment_count>
    <who name="">ermonnezza</who>
    <bug_when>2011-05-24 14:18:23 +0000</bug_when>
    <thetext>I have been experiencing this issue since I switched to KDE4. I thought I was just stupid and did not know how to save the settings once for all. I find it
extremely annoying. This definitely gets the maximum votes I can give it.

In my humble opinion:
-default should be duplex if the printer driver supports it (trees matter)
-whatever the default is, the user should be able to save her/his own preference, instead of having to set them again at every single print</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1129641</commentid>
    <comment_count>54</comment_count>
    <who name="Tallowwood">E.microcorys</who>
    <bug_when>2011-06-10 20:08:16 +0000</bug_when>
    <thetext>Is this issue about duplex printing or the more fundamental problem of Non-Persistent Print Settings in the KDE+QT print system? 

There are many bug reports on the disto, KDE and QT trackers with unique headings that all relate to problems with non-persistent print settings in KDE apps. For example: KDE Bug 205802 and QT BUG-15351 relate to non-persistent margin settings. 

Installing the CUPS system-config-printer 1.2.5  (http://cyberelk.net/tim/software/system-config-printer/) will allow Printer related settings, such as Media Size, Print quality, Media Type, Media Source, Manual Feed, Duplex, Toner Save, Screen Lock &amp; BR-Script Level, to be changed persistently. (thanks Red Hat!)

But other source related print settings (such as: margins, page orientation, etc., etc.) are outside scope of this program. These remain non-persistent and a source of frustration for KDE users. Having to change 4 margin settings for each print job is a distraction and a big waste of time. The many &apos;user&apos; errors (!) that do slip through cause a shameful waste of paper. The problem is reproducible in many KDE apps, including Konqueror, Kwrite, Kate and Kmail. 

Entering, eg. margin settings, with the CUPS lpoptions command is not effective in my case (openSUSE 11.4 KDE 4.6). Such &apos;source related&apos; print settings tend to be a bit more transient than &apos;printer related&apos; settings so having to change them via CUPS may not be desirable, even if possible. 

Perhaps the many bug reports about non-persistent print settings in KDE + QT generally should be collated, analysed and actioned strategically? If so, that needs high level attention from the relevant distributions, KDE and QT, jointly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1129642</commentid>
    <comment_count>55</comment_count>
    <who name="Tallowwood">E.microcorys</who>
    <bug_when>2011-06-10 20:10:15 +0000</bug_when>
    <thetext>Is this issue about duplex printing or the more fundamental problem of Non-Persistent Print Settings in the KDE+QT print system? 

There are many bug reports on the disto, KDE and QT trackers with unique headings that all relate to problems with non-persistent print settings in KDE apps. For example: KDE Bug 205802 and QT BUG-15351 relate to non-persistent margin settings. 

Installing the CUPS system-config-printer 1.2.5  (http://cyberelk.net/tim/software/system-config-printer/) will allow Printer related settings, such as Media Size, Print quality, Media Type, Media Source, Manual Feed, Duplex, Toner Save, Screen Lock &amp; BR-Script Level, to be changed persistently. (thanks Red Hat!)

But other source related print settings (such as: margins, page orientation, etc., etc.) are outside scope of this program. These remain non-persistent and a source of frustration for KDE users. Having to change 4 margin settings for each print job is a distraction and a big waste of time. The many &apos;user&apos; errors (!) that do slip through cause a shameful waste of paper. The problem is reproducible in many KDE apps, including Konqueror, Kwrite, Kate and Kmail. 

Entering, eg. margin settings, with the CUPS lpoptions command is not effective in my case (openSUSE 11.4 KDE 4.6). Such &apos;source related&apos; print settings tend to be a bit more transient than &apos;printer related&apos; settings so having to change them via CUPS may not be desirable, even if possible. 

Perhaps the many bug reports about non-persistent print settings in KDE + QT generally should be collated, analysed and actioned strategically? If so, that needs high level attention from the relevant distributions, KDE and QT, jointly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1146076</commentid>
    <comment_count>56</comment_count>
      <attachid>62234</attachid>
    <who name="Fabian Kislat">fabian.kislat</who>
    <bug_when>2011-07-27 12:44:01 +0000</bug_when>
    <thetext>Created attachment 62234
Patch to make okular respect the printers default duplex setting

Apparently the duplex setting of QPrinter defaults to DuplexNone. Changing it to QPrinter::DuplexAuto fixed the issue for me (see attached patch).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1146079</commentid>
    <comment_count>57</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2011-07-27 12:55:04 +0000</bug_when>
    <thetext>That&apos;s not the correct solution. QPrinter needs to respect the default set in CUPS. If we override it in Okular,
1. it will only work in Okular and
2. it will ignore the user&apos;s setting in CUPS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1146082</commentid>
    <comment_count>58</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2011-07-27 12:55:55 +0000</bug_when>
    <thetext>The correct solution is the patch to Qt I attached (the fixed version of Jeremy Sanders&apos;s patch).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1150942</commentid>
    <comment_count>59</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2011-08-07 12:13:08 +0000</bug_when>
    <thetext>Margins are also not remembered in Kate/KWrite (nor any other KDE application, afaik). This is a huge issue, see bug #205802. A fix would make a lot of users happy, but it seems there is no interest, see https://bugreports.qt.nokia.com/browse/QTBUG-15351</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1150950</commentid>
    <comment_count>60</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2011-08-07 12:30:51 +0000</bug_when>
    <thetext>Git commit 1aa12bace62fffbcad357623842a0fc01607b3c0 by Dominik Haumann.
Committed on 07/08/2011 at 14:26.
Pushed by dhaumann into branch &apos;master&apos;.

attempt to work around Qt printing bugs

NOTE: Saving &amp; loading the margins works around QPrinter/QPrintDialog bugs:
- https://bugreports.qt.nokia.com/browse/QTBUG-15351
- https://bugs.kde.org/show_bug.cgi?id=205802
- https://bugs.kde.org/show_bug.cgi?id=180051
Changing the margins now works. However, when you reopen the print dialog
later, the WRONG margins are displayed. The correct ones are still used.
This is a critical bug in Qt.

The real issue is Qt. And it&apos;s a critical one. But since it wasn&apos;t fixed for
years, it probably will never get fixed. That&apos;s why this workaround is better
than nothing...

CCBUG: 205802
CCBUG: 180051

M  +43   -1    part/utils/kateprinter.cpp
M  +2    -0    part/utils/kateprinter.h

http://commits.kde.org/kate/1aa12bace62fffbcad357623842a0fc01607b3c0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1170597</commentid>
    <comment_count>61</comment_count>
    <who name="">ermonnezza</who>
    <bug_when>2011-10-06 14:53:54 +0000</bug_when>
    <thetext>Please go en masse to vote for this bug as it seems to be the bottleneck
blocking everything:
https://bugreports.qt.nokia.com/browse/QTBUG-3567
Ask reopening of this bug with a comment:
https://bugreports.qt.nokia.com/browse/QTBUG-6239

Save the trees! Fix this bug! :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1201758</commentid>
    <comment_count>62</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2011-12-19 08:30:27 +0000</bug_when>
    <thetext>I&apos;ve created an Ubuntu PPA with QT4-libs patched with the patch from comment #29... you can find it here: https://launchpad.net/~dhertel/+archive/qtprintfix1

The builds aren&apos;t compiled yet but I&apos;ve already tested them before on another PPA and they work... just made one for their own because they take up quite some space :) So they&apos;ll be avaliable as soon as Launchpad has built them...

Cheers</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1222348</commentid>
    <comment_count>63</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-03 01:35:34 +0000</bug_when>
    <thetext>*** Bug 293110 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1222350</commentid>
    <comment_count>64</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-03 01:55:05 +0000</bug_when>
    <thetext>I don&apos;t know about anything being fixed in 4.6.3. It isn&apos;t fixed here at 4.8.

In my case, I use multiple printers in different places and need to remember the settings for each. The vast majority can do duplex. Okular defaults to single-sided though its properties list for the printer claims duplex, I think, but the options say otherwise.

So there go some trees.

It defaults to colour though all the printers I use are either B&amp;W or being used to print B&amp;W. The print dialog is the same for every printer regardless of the printer&apos;s capabilities. There goes some time and energy.

It gets worse. Some more trees are about to go.

Okular defaults for every job for every printer to US letter paper. None of the printers I have ever used with this machine have this size of paper. None of the printers I am at all likely to use with it in the foreseeable future will have this size of paper. Most of the printers in the world don&apos;t have this size of paper. In most places, including this one, it is virtually impossible to obtain this size of paper even if, for some reason, you wish to do so.

CUPS is the right way to do it. Why even include the print settings in system settings? It has zero effect although it sometimes crashes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1222351</commentid>
    <comment_count>65</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-02-03 02:07:44 +0000</bug_when>
    <thetext>You need the Qt patch from comment #29 or from http://pkgs.fedoraproject.org/gitweb/?p=qt.git;a=blob;f=qt-everywhere-opensource-src-4.6.2-cups.patch;h=e0305e11b89aa6332573a0e9bb955f38038a8123;hb=HEAD (it&apos;s the same patch). (Thanks to Jeremy Sanders for the original patch which I fixed.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225072</commentid>
    <comment_count>66</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-10 01:02:28 +0000</bug_when>
    <thetext>Thanks for pointing to the patch referenced above.

I assume that would require compiling QT from sources and configuring things to use the hacked library as explained around comment 17?

I don&apos;t, frankly, think I am up to managing that. I&apos;ve tried compiling QT in the past and it has always ended in failure. I did once manage to compile something but as I remember it didn&apos;t actually work. Plus it is an awful lot of work and I don&apos;t really have time to do that for every update, something I&apos;d assume would be needed.

In any case, if I understand the patch&apos;s function correctly, it won&apos;t really help me much. It won&apos;t pick up the CUPS paper size so without intervention, KDE will still send everything formatted for letter paper rather than A4. It also won&apos;t pick up the quality settings I need set for some of the printers I use in order to get output which is dense enough to photocopy legibly. QT&apos;s print dialog doesn&apos;t even give display most of these options because it is insensitive to the actual capabilities of the printer as provided in the ppd. Non-saving of settings is only part of the problem - there are also the settings which I cannot set through the dialog but which should be available from CUPS. (QT&apos;s dialog shows them in Properties but I&apos;m not sure what the point of that bit of the dialog is. Doesn&apos;t seem to have a function.)

In any case, telling end-users that the fix for a problem involves patching QT source and building the whole thing from scratch is not a solution.

The available patch is also out of date. It is for 4.6.2 and the version installed from my distro is 4.8.0.

Is there any reason *not* to consider e.g. the openprinting dialog? That looks to be very thoroughly thought through and researched. I know that is in its infancy but even if it is a bit buggy, it may well be better than the current dialog. Wouldn&apos;t this offer a solution which would fit in well to the KDE interface (since there&apos;s a QT version) and avoid relying on the development by QT (which clearly won&apos;t happen any time soon), while not requiring KDE developers to build a separate dialog for printing themselves? Since that will also likely be adopted by other DEs, it would also have obvious advantages in terms of adhering to common standards etc., and early adoption would make it more likely that the specific needs of the KDE ecosystem will be fully reflected in the development.

I don&apos;t know much of anything about development but there seem to be compelling reasons to consider an alternative to the QT default dialog and a promising alternative already in the works.

But that solution seems not to have been addressed...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225085</commentid>
    <comment_count>67</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-02-10 04:11:04 +0000</bug_when>
    <thetext>&gt; I assume that would require compiling QT from sources and configuring things to
&gt; use the hacked library as explained around comment 17?

That&apos;s what a distribution is supposed to be for.

&gt; The available patch is also out of date. It is for 4.6.2 and the version
&gt; installed from my distro is 4.8.0.

The patch applies unchanged to 4.8.0. We apply it to the Fedora builds of 4.8.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225104</commentid>
    <comment_count>68</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-10 07:04:24 +0000</bug_when>
    <thetext>&gt; Is there any reason *not* to consider e.g. the openprinting dialog?
Yeah, I don&apos;t see any reason either. The rest of his reasoning is also sound... Now I have to find the KDE-Devel wishlist :-D If there&apos;s already a ticket voting for this, please someone point us to that so we can vote, too...

&gt; I assume that would require compiling QT from sources and configuring things to
use the hacked library as explained around comment 17?
Depends on your distribution. On Ubuntu it&apos;s just &quot;apt-get source qt4-x11&quot;, unpacking it, throwing the patch in the right directory, make a brief edit to 2 files, package the change via a single command and send it to your PPA on launchpad via a single command... After that it&apos;s waiting for launchpad to build the packages... When it&apos;s done, you can add your PPA as repository and upgrade the packages via apt... dunno if Fedora has such facilities...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225105</commentid>
    <comment_count>69</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-02-10 07:07:28 +0000</bug_when>
    <thetext>&gt; dunno if Fedora has such facilities...

Fedora already carries the patch in its official Qt packages.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225107</commentid>
    <comment_count>70</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-10 07:12:27 +0000</bug_when>
    <thetext>&gt; Fedora already carries the patch in its official Qt packages.
nevermind... I must have understood reescf@gmail.com as such that his distro was fedora somehow... it&apos;s still early in the morning and I&apos;ve only had one coffee yet :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225258</commentid>
    <comment_count>71</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-10 14:41:07 +0000</bug_when>
    <thetext>I&apos;m using Arch Linux and Arch is going to say (rightly, I think) that this is an upstream bug...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225259</commentid>
    <comment_count>72</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-10 14:44:31 +0000</bug_when>
    <thetext>In any case, even if I did use e.g. Fedora, as far as I can tell the patch wouldn&apos;t help very much. I&apos;d still be stuck with default letter paper and without access to quality settings needed to get output on some of the printers I use.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225497</commentid>
    <comment_count>73</comment_count>
    <who name="Alex">atorgovitsky</who>
    <bug_when>2012-02-11 02:55:22 +0000</bug_when>
    <thetext>I applied the patch from the PPA given in comment #62. A couple weeks later I made the mistake of accepting a bunch of updates, one of which was to the qt4 libraries. This of course brought the bug right back. Understandably, the PPA hasn&apos;t been updated to this version yet. Is there a way I can downgrade to the PPA version without breaking everything in my system? I&apos;m worried about messing with such a large number of packages, but I really need to have default settings for my printers, its an absolute nightmare not having it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225503</commentid>
    <comment_count>74</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-11 05:03:51 +0000</bug_when>
    <thetext>@reescf: we use a4 per default and the qt print dialog doesn&apos;t default to letter... did you set a4 in /etc/papersize? Also: Sure this is an upstream bug, but as in my filing on Launchpad, I&apos;d say it doesn&apos;t matter. Those distros incorporate lots of patches to their packages so this is not excuse. What&apos;s more: The users don&apos;t care and they shouldn&apos;t have to. The patch doesn&apos;t fix the underlying problem but it does fix 99% of the annoyance. And with distros like Ubuntu and Arch, still behaving like douchebags in that matter, acceptance for Linux on the desktop takes a hit for affected users...

@Alex: I&apos;ll update it as soon as I&apos;ve got some time for it... I also filed a bug on Launchpad against qt4-x11 and hopefully they incorporate the patch in their next release... It&apos;s gonna be an LTS release after all...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225859</commentid>
    <comment_count>75</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-12 02:19:58 +0000</bug_when>
    <thetext>(In reply to comment #74)
&gt; @reescf: we use a4 per default and the qt print dialog doesn&apos;t default to
&gt; letter... did you set a4 in /etc/papersize? Also: Sure this is an upstream bug,
&gt; but as in my filing on Launchpad, I&apos;d say it doesn&apos;t matter. Those distros
&gt; incorporate lots of patches to their packages so this is not excuse. What&apos;s
&gt; more: The users don&apos;t care and they shouldn&apos;t have to. The patch doesn&apos;t fix
&gt; the underlying problem but it does fix 99% of the annoyance. And with distros
&gt; like Ubuntu and Arch, still behaving like douchebags in that matter, acceptance
&gt; for Linux on the desktop takes a hit for affected users...

I don&apos;t have an /etc/papersize. I have never, ever used letter size paper from this machine. I do have a US-with-Euro keyboard but that&apos;s it. All printers I use, even CUPS PDF, are set to default to A4 in CUPS, texlive is set to default to A4, all my documents are produced for A4. But I have to set A4 in the QT print dialog every time.

Arch will only patch to fix &quot;serious breakage&quot; and even then, they&apos;d rather not. My understanding is that Arch does not include an enormous number of patches in the way that Debian, Ubuntu etc. do. Whatever you may think of that policy, it is unfair to accuse them of being &quot;douchebags&quot; on grounds of inconsistency. Ubuntu may be inconsistent on this but I can&apos;t see Arch is.

Also, I don&apos;t think that high a proportion of Arch users use KDE.

If you think not fixing it is problematic because of the hit on users, why doesn&apos;t KDE fix it or push for QT to fix it? 

You should at least get rid of the &quot;Advanced&quot; tab in the print dialog. Since the settings there have no effect on anything, it is simply confusing. Better to just have the QT options and a note saying, &quot;We know that these options don&apos;t reflect the capabilities of your printer or your CUPS defaults. We know they don&apos;t reflect the settings you customised via KDE&apos;s own print settings control module. (We put that in just to tease!) We should also tell you that any changes you make will be immediately lost and will need to be reset for every document you print. But that&apos;s somebody else&apos;s problem. We&apos;re not sure whether QT or your distro should fix it but we know we&apos;re not going to. If you don&apos;t like it, use GNOME.&quot;

At least that would be straightforward. 

Of course it puts me off Linux. I&apos;ve just switched from OS X and you&apos;re telling me I have to compile QT from scratch to get my print settings to stick?!

If I&apos;m fair, though, it puts me of KDE more than it puts me off Linux.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225874</commentid>
    <comment_count>76</comment_count>
    <who name="Ivo Anjo">ivo</who>
    <bug_when>2012-02-12 03:23:54 +0000</bug_when>
    <thetext>(In reply to comment #75)
@reescf: I agree with you that it is very sad that many years after KDE 4.0.0 and printing still completely and insanely sucks.

But, if you distro doesn&apos;t do what needs to be done, have you considered switching distros? You don&apos;t have to be put off Linux or KDE because of this issue. You could just be put off Arch.

Finally, and again, this has been this way for manymanymanymanymanymanymanymany years. I don&apos;t think arguing about this further on bugzilla is going to help a lot. We just have to either do it, or wait for those who can to do it (or offer incentives to help motivate those who can).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225894</commentid>
    <comment_count>77</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-02-12 08:14:25 +0000</bug_when>
    <thetext>&gt; Arch will only patch to fix &quot;serious breakage&quot; and even then, they&apos;d rather
&gt; not. My understanding is that Arch does not include an enormous number of
&gt; patches in the way that Debian, Ubuntu etc. do. Whatever you may think of that
&gt; policy, it is unfair to accuse them of being &quot;douchebags&quot; on grounds of
&gt; inconsistency. Ubuntu may be inconsistent on this but I can&apos;t see Arch is.

As much as sticking close to upstream makes sense in principle (it is also a Fedora policy), it doesn&apos;t make sense to make a religion out of it, the highest priority should be on making things work for the user! Otherwise, what do we even have a distribution for? A distribution which just redistributes unmodified upstream code is useless.


With that said, the paper size should already be read off CUPS settings by the existing Qt code. See QTBUG-6471, which got resolved in Qt 4.7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225930</commentid>
    <comment_count>78</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-12 10:08:02 +0000</bug_when>
    <thetext>@reescf: try installing libpaper and running &quot;paperconfig -p a4&quot; as root... and I didn&apos;t mean to accuse only arch... the same goes to KDE itself... if KDE just use this patch in their QT version or if they switched to and supported openprinting alltogether the problem would be fixed for all... but apparently KDE doesn&apos;t consider this a serious issue... Now with Gnome2 dead, XFCE too rudimentary for many and KDE with broken printing, what&apos;s left for Linux on the desktop?

So I guess this still makes sense to discuss here. It&apos;s still a valid bug in KDE. The bug in the code may be in upstream but the bug in usability is in KDE and that&apos;s the point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227432</commentid>
    <comment_count>79</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-16 00:53:41 +0000</bug_when>
    <thetext>Thanks. I did that. I also deleted printers I&apos;m not using and set a non CUPS_PDF printer as default. I think the papersize is now right. I now only see this option in the &quot;properties&quot; dialog and not the &quot;options&quot; dialog. But it still, naturally, ignores duplex/greyscale etc.

Somebody else using KDE on Arch claims that his settings (as made via KDE&apos;s printer kcm setup) do persist and do determine default printing in Okular etc. However, I checked the build file for QT on Arch and it definitely doesn&apos;t use the patch, so I&apos;m not sure how this is even possible.

Personally, I think KDE should move to the openprinting dialog. Even patched, the QT dialog is going to be unsatisfactory because it is insensitive to the actual capabilities of the printers installed and divorces printing from KDE apps from the KDE CUPS interface (which is billed as a way to configure printing and not merely as a way to configure CUPS). I don&apos;t really understand why the QT print dialog isn&apos;t regarded as *obviously* unsatisfactory and, for a sophisticated DE like KDE, *embarrassingly* stone-age.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227731</commentid>
    <comment_count>80</comment_count>
    <who name="Adam Porter">adam</who>
    <bug_when>2012-02-16 23:22:32 +0000</bug_when>
    <thetext>What all this confirms for me is that KDE is basically a developer
playground.  I feel like none of the devs in the KDE project care
whether KDE is actually a good DE, whether it&apos;s suitable for general,
widespread use, or whether anyone but themselves use it.  (This may
not be the case, but I feel like it generally is.)

KDE needs some by-example leadership.  Some devs need to step up and
fix the important bugs that are not fun to fix.  Doing so would make
KDE viable as an alternative to Windows and OSX for average users and
enterprises.  Unless this happens, KDE will languish in obscurity.

And maybe that&apos;s ok with the devs.  Maybe they&apos;re fine with a
take-it-or-leave-it approach.  Hey, they&apos;re just volunteers who
scratch their own itches, and that&apos;s their prerogative.  But it&apos;s a
shame, because KDE could be so much better.  It has the potential to
be a Free Desktop that actually competes with Microsoft and Apple.
And it&apos;s not about &quot;sticking it to the man&quot; or anything like
that--it&apos;s simply about doing it better, in an open and Free way, for
the good of others.

At least, that&apos;s how I think it ought to be.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227811</commentid>
    <comment_count>81</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-17 07:11:26 +0000</bug_when>
    <thetext>@Adam: This is not true. IMHO the KDE devs care MOST whether KDE is actually a good DE... KDE4 has become quite brilliant if you leave this unspeakable bug out of consideration. Now look at the other major DEs as of lately. At least KDE provides massive extensibility and customization features while still providing sane and sensible defaults AND providing a nicely working integrated experience if you use the KDE apps. No other DE does that... not even remotely! Think about it for a moment...

It would be nice though if an actual KDE dev would post something ontopic here...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227816</commentid>
    <comment_count>82</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-17 07:21:19 +0000</bug_when>
    <thetext>Also maybe someone should edit this bug... Severity should be Major instead of Normal.. From the guidelines:

Normal: regular issue, some loss of functionality under specific circumstances
Major: major loss of function

For this bug makes not only &quot;some&quot; loss of functionality and not only under &quot;specific&quot; but rather generic curcumstances, &quot;Normal&quot; doesn&apos;t cut it...

ALSO: DEAR KDE DEVS: Why not at least assign this to someone? Status &quot;NEW&quot;, really? For THREE YEARS?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227852</commentid>
    <comment_count>83</comment_count>
    <who name="sphakka">marcoep</who>
    <bug_when>2012-02-17 10:37:41 +0000</bug_when>
    <thetext>Hi all,

Just my two cents, with disclaimer of heavy off-topic derailments.

I&apos;ve been loving KDE since its inception, when hovering the mouse pointer over the &apos;K&apos; start button used to pop up a tooltip saying &quot;Where do you want to go tomorrow?&quot;... &apos;tomorrow&apos;, I guess it meant &apos;progress&apos; wrt to M$ Windoze.

Now, sadly, I don&apos;t see any more that desire to really improve things, at least not for my not-so-powerful laptop: it&apos;s mostly about eye candy, rather than functionality. I know there&apos;s plenty of good stuff under the hood, but, jeez, where is it? In order to have a functional DE capable of booting in less than an... age, I had to:
- disable all desktop effects -- and that&apos;s annoying &apos;cause I need the zooming feature as my sight, like my laptop, is a bit defective;
- split all the KDE virtual gentoo ebuild, to get rid of that plethora of useless/misbehaving apps and bits -- above all, akonadi and nepomuk... actually, those are not useless, though so buggy that the frontier is fuzzy.
- spend hours at no avail trying to synchronize all my mail/contacts/calendar with gmail + my nokia smartphone. Then, defeated, I decided to remove akonadi &amp; Co...
And still every now and then I must tidy up my ~/.kde folder where config junks accumulates like dust over scaffolds.

Where are we heading to? I don&apos;t believe in stupid OS/DE wars. I do believe in progress, cooperation and good management, even geeky and nerdy if you want, but *real*, i.e. one that makes things move forward.
I think that if we can just make it functional, without comparing it to anything else (who really cares when it&apos;s free?), that will be progress. What others do should be source of inspiration rather than term of comparison. F***ing hell, libre/open-source SW is not about *competition*, it&apos;s about FREEDOM and COOPERATION. Personally, I wouldn&apos;t want a MacOS clone; I couldn&apos;t care the less because I already decided that my life must be, as much as possible, proprietary-SW-free, so I don&apos;t need the illusion of owning what I cannot afford to buy (my salary, fortunately, would allow much more than that). The problem is convincing those who consider eye-candy stuff a paragon that they don&apos;t need it: priority is having good tools.

But this policy of just &quot;good looking stuff&quot; is making much of these efforts vane. Even though the recent Qt/Nokia debacle had a part in all this, I say, hey, now that&apos;s back and free to the community, let&apos;s take a chance to start think differently.

IMHO, KDE folks should look a bit closer at the development process of, as for my viewpoint, more stable projects, like Mozilla products. We users, keep on posting, prodding and proposing! As for this bug, I think that the priority is OK: as far as I can understand, there&apos;s a workaround... annoying, yes, but that&apos;s it.

Sorry for venting my frustration... I hope nobody got offended.

Cheers,

  ^s</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227882</commentid>
    <comment_count>84</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-17 12:43:37 +0000</bug_when>
    <thetext>@sphakka: what the hell? that wasn&apos;t even remotely on-topic but one sentence... and that one showed how little you cared to learn about the topic. I wouldn&apos;t call a hackish patch for recompiling the whole goddamn Qt framework a &quot;workaround&quot;...

The rest was just off-topic. Why you bitch about how current software doesn&apos;t run smoothly on ancient hardware it beyond me, especially since your salary, fortunately, would even allow for much more than a new Macbook. Also beyond me is what you need the magnifier from the effects for when there are tools that work without those or you could just increase the DPI setting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227884</commentid>
    <comment_count>85</comment_count>
    <who name="Krisztian Vida">vidakris</who>
    <bug_when>2012-02-17 13:01:44 +0000</bug_when>
    <thetext>It seems you didn&apos;t really get the point. KDE puts more effort to eye candy than to functionality. That might be the reason, why this bug is here, after three years, being the second on the &apos;most hated bugs&apos; list. Relatively small thing, but really annoying, convincing the users to leave KDE sooner or later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227889</commentid>
    <comment_count>86</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-17 13:22:14 +0000</bug_when>
    <thetext>I think the more probable reason is that no relevant KDE dev knows about or feels responsible for this bug. Because Printing is handled by Qt. And the responsibility for Qt lies at Nokia. Problem solved. Also this bug is not a &quot;relatively&quot; small thing... don&apos;t let the patch misguide you to that conclusion. the patch is a hackish fix which works for 99% of the people but doesn&apos;t fix the underlying problem properly...

Sure this bug will drive lots of people away as soon as Gnome3 has become mature and customizable enough and provides good working extensions to get back to a desktop metaphor...

How you percieve KDE to put more effort into eye candy than into functionality is beyond me however. After all the looks didn&apos;t change much since KDE 4.0 - they just stabilized the effects over time. However in the same time they fixed and improved a lot of the inner workings of KDE and the applications it comes with. While all doing this they still managed to come up with sane defaults end excelent integration...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227893</commentid>
    <comment_count>87</comment_count>
    <who name="Matthew Skala">mskala+kdebugs</who>
    <bug_when>2012-02-17 13:47:24 +0000</bug_when>
    <thetext>The wrong paper size on every single job, requiring a manual override individually on every single job, is not a &quot;sane default.&quot;  Providing two configuration dialogues for the same feature, one of which has no effect, and ignoring the configuration set elsewhere by the operating system component responsible for such things, is not &quot;excellent integration.&quot;

The big picture of KDE&apos;s general development philosophy is interesting, but let&apos;s not lose sight of the simple bug that is the reason we&apos;re gathered here:  CUPS provides default printer settings, which KDE ignores.  KDE should read and use CUPS&apos;s default printer settings.  That shouldn&apos;t be complicated or controversial.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227895</commentid>
    <comment_count>88</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-17 14:00:22 +0000</bug_when>
    <thetext>@Matthew: right, it&apos;s not a &quot;default&quot; at all... a default is a configuration setting... what you describe is a bug that&apos;s causing unexpected behaviour... you confuse that... also: for the paper size problem using and setting up libpaper seemingly worked for reescf... what&apos;s more: this is a Qt bug, not a KDE bug... while KDEs ignorance on this one hurts everyone you should really blame Nokia for not fixing the bug...

And again:
1. The bug is in no way &quot;simple&quot;.
2. The bug is not within KDE but in Qt.
3. Qt is owned and maintained by Nokia.
4. Nokia has known this for 3+ years and ignores it as well.

What you could blame KDE for though is to be so stubborn about not diverging from upstream Qt in this case. They have good reasons not to do this easily but in this case the patch and therefor the risk isn&apos;t very big but well understood and should be outweighted by the advantages that it brings. So this is not a technical issue but a policy/political issue and THAT&apos;s what makes it so frustrating...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227990</commentid>
    <comment_count>89</comment_count>
    <who name="Francesco Riosa">vivo75+kde</who>
    <bug_when>2012-02-17 23:03:01 +0000</bug_when>
    <thetext>Q:
&gt;Hi list,
&gt;  there is a rather heated discussion in a 3 years old kde bug [1]
&gt;regarding printing, more specifically the print dialog and how it should
&gt;keep/save settings between different call of it.
&gt;
&gt;Could you (as somebody involved in qt5 planning or development)  clarify
&gt;what the plan are for printing functionality, managment or whatever?
&gt;
&gt;Expecially a statment like &quot;printing will no be managed by qt&quot; could be
&gt;helpful, pushing somebody to take responsibility for it and solve the
&gt;problem.
&gt; 
&gt;best regards,
&gt;Francesco Riosa
&gt; 
&gt;[1] Bug 180051 &lt;https://bugs.kde.org/show_bug.cgi?id=180051&gt; - [KDE4]
&gt;Need a way to have default printer settings

A:
Currently we continue to have the Qt 4 printing subsystem in Qt5 (as
libQtPrintSupport), but the longer term plan is to replace this with a new
module, as some of the basic architecture of the old printing module is
not fixable.

For 5.0 however we continue with what we have.

Cheers,
Lars</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1228071</commentid>
    <comment_count>90</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-18 09:12:27 +0000</bug_when>
    <thetext>So there you have it... we&apos;ll have a working print dialog by the time we have flying cars... guess printing dialogs are np-hard... so, kde... finally ready to give up qt for printing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1228226</commentid>
    <comment_count>91</comment_count>
    <who name="Francesco Riosa">vivo75+kde</who>
    <bug_when>2012-02-18 16:52:08 +0000</bug_when>
    <thetext>I had the following today:

&gt;
&gt; I&apos;m the new community maintainer for printing support in Qt, so I can fill you
&gt; in on some of my plans.  You can find a more detailed description on my blog
&gt; at http://www.layt.net/john/blog/odysseus/kf5_localization_and_printing_plans
&gt;
&gt; As Lars has explained, the Qt4 print module has been cleaned up a little in
&gt; Qt5 but we do not plan to add any new features to this code in the future.
&gt; Instead we are planning a new module for 5.1 or 5.2 that conforms to modern
&gt; printing standards and features.  However that is a long time for KDE4 apps to
&gt; wait for the missing features and bug fixes.
&gt;
&gt; My current work plan is to complete the last few localisation features needed
&gt; for Qt 5.0, then to move on to a bug triage on the QPrintSupport module to get
&gt; it ready for 5.0.  The bug fixes here will where possible be back-ported to Qt
&gt; 4.8.  For example, I really want to get the CUPS settings bug fixes in to 4.8.
&gt;
&gt; Once that work is done, I plan to fork off a Qt4 version of QPrintSupport and
&gt; apply on top of it my old patches for adding many of the currently missing
&gt; features.  Once that is stabilised I&apos;ll release it as an interim experimental
&gt; print library that KDE4 apps can use if they want.
&gt;
&gt; From there I plan to start working on the new print module, which we will hold
&gt; design session for at the next Qt Contributors Summit.  Hopefully it will be
&gt; ready for Qt 5.1 and so the first full release of KDE Frameworks 5.
&gt;
&gt; I hope that answers a few of your questions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1228603</commentid>
    <comment_count>92</comment_count>
    <who name="Nick Coghlan">ncoghlan</who>
    <bug_when>2012-02-20 00:33:44 +0000</bug_when>
    <thetext>Thanks for the additional information Francesco. Unfortunately, searching for &quot;QPrinterNG&quot; suggests that the plan of improving the situation for KDE 4.8 never came to fruition (and the Feature Plan for 4.9 doesn&apos;t appear to include anything along those lines, either: http://techbase.kde.org/Schedules/KDE4/4.9_Feature_Plan).

I don&apos;t print very often, so the status quo is a minor irritation rather than a huge problem for me, but it would still be very nice to see this fixed. (I suspect many developers are in the same situation of only rarely printing things out, hence the historical lack of attention to critical printing problems like this one)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229632</commentid>
    <comment_count>93</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-23 00:03:35 +0000</bug_when>
    <thetext>It is certainly good to know that some attention is planned to be given to this issue at some point. However, I cannot help but feel the the severity of this bug is not appreciated by the developers.

Everyone here admits that the patches available are horrible hacks and do not address the underlying issues. But as I understand it, they would dramatically improve the experience for many users. What is the reason *not* to use the patch as a temporary fix until you have time to address the issue more thoroughly? I realise that there is a lot to be said for doing a job right but there is also a great deal to be said for solving a problem sooner rather than later. 

I just don&apos;t understand the reasons not to use the patch. It is there. Somebody has written it. People have tested it. Why *not* use it? Maybe it is a sticking plaster but if it can cover up some of the mess which is the current printing dialog, why not use it? I could understand it if the patch had to be developed from scratch but that&apos;s not the case. Is it a reluctance to use a less elegant, uglier patch (as everyone admits this one is)? But the current dialog is, frankly, hideous. So something hideous is better than something ugly if the former can be blamed on somebody else while you would feel responsible for the latter? Is that it? If so, I recommend a more utilitarian perspective...

I&apos;m also intrigued that the plans appear to include sitting down to design a new printing interface when openprinting appears to be a good way along the path to developing an excellent one. As far as I can tell - and I am certainly no expert - a great deal of effort is going into ensuring that that design actually works for users rather than merely seeming to the developers as though it should. I am not suggesting that KDE does not have people who know what they are doing in GUI design - clearly this would be grossly unfair. But can you really hope to put the same level of effort into designing one element of the overall system? And, even if you can, why should you duplicate that effort rather than putting those efforts into other areas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229633</commentid>
    <comment_count>94</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-02-23 00:17:02 +0000</bug_when>
    <thetext>I see that there may be some integration with openprinting. This is presented as a cups/linux vs. windows/osx issue. But presumably it is a cups/linux/osx vs. windows issue since osx uses cups as far as I know. (In fact, cups started there as far as I know.) 

My concern about this is that what will end up mattering is that it works on windows. Whether it works with cups or not will, once again, be considered a minor issue of little importance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1229675</commentid>
    <comment_count>95</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-02-23 05:17:32 +0000</bug_when>
    <thetext>I fully agree with reescf... I also want to add some perspective to the windows issue:

IMHO KDEs Windows/OSX ports are a &quot;nice to have&quot; but I can&apos;t imagine that these have significant user counts. It&apos;s the Linux desktop that draws in the most users, I guess. This is especially true since Gnome2 is dead now.

On the other hand I can&apos;t imagine an OSX user who&apos;d mainly use KDE - I wouldn&apos;t know what for... The same is true for Windows. I use KDE for Windows only for Kile and I don&apos;t care for printing. Under Linux this is a completely different story though.

So I share reescfs concern and I&apos;d really like to know - if it&apos;s true - what justifies this stance. Why do the developers think Windows and OSX are so important? Windows and OSX users WILL NOT use KDE as default desktop environment. Don&apos;t know about OSX but in Windows one reason for this is that the current implementation suffers from more fundamental flaws like the mediocre installer and unstable runtime.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235170</commentid>
    <comment_count>96</comment_count>
    <who name="">reescf</who>
    <bug_when>2012-03-11 17:10:03 +0000</bug_when>
    <thetext>I&apos;ve never used KDE on OS X. (kile was probably *the* reason I chose KDE on Linux - on OS X, I use TeXShop.) I&apos;ve never known anybody use KDE on OS X. 

But as far as this bug is concerned, OS X integration should follow automatically from Linux integration. Both use CUPS for printing. (Unless Apple have stopped using CUPS in later versions of the OS. I haven&apos;t checked, but I would be extremely surprised if they have.)

To reiterate, I still haven&apos;t heard any reason not to use the available patch as a temporary, albeit hackish, work around. &quot;Get somebody else to apply it&quot; or &quot;somebody else could apply it&quot; is not a reason. I&apos;m not saying it is a poor reason. I&apos;m saying it is not a reason at all. It is simply irrelevant.

Given that the promised fixes have not made it into 4.8 and that QT 5 is likely to have just the same setup, complete with bugs, as QT 4, I suspect that a &quot;proper&quot; fix is years, probably decades and possibly centuries, off. That makes the case for the temporary fix all the more compelling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235238</commentid>
    <comment_count>97</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-03-11 18:37:40 +0000</bug_when>
    <thetext>KDE cannot apply this patch because they discontinued the repository whose purpose was to carry exactly this kind of patches, the kde-qt repository. (git.kde.org now carries a 1:1 mirror of the qt.gitorious.org repository instead.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235460</commentid>
    <comment_count>98</comment_count>
    <who name="Dominik Hertel">dhertel</who>
    <bug_when>2012-03-12 06:31:19 +0000</bug_when>
    <thetext>@reescf: Exactly!

@Kevin Kofler: So? What&apos;s the sense of having a 1:1 clone of another repository? Why have an own repository at all then? Why use git then after all? That&apos;s not a reason but an excuse and a poor one on top of that.

Plus: This fix is likely to work as long as the bug stays this way so there&apos;d much likely be no trouble applying it to future versions of QT that carry this bug. It&apos;s a no-brainer, really. Is the KDE board even aware of this issue and how serious it and its implications are?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235464</commentid>
    <comment_count>99</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2012-03-12 07:09:32 +0000</bug_when>
    <thetext>&gt; @Kevin Kofler: So? What&apos;s the sense of having a 1:1 clone of another repository? Why have an own &gt; repository at all then?

Don&apos;t ask me! I&apos;ve always said that dropping kde-qt was a mistake and this is an example of why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235605</commentid>
    <comment_count>100</comment_count>
    <who name="mijk esmoug">schmuker</who>
    <bug_when>2012-03-12 12:51:35 +0000</bug_when>
    <thetext>Just want to point out that OpenSUSE has fixed the issue in their distro already more than a year ago (see also comment #16).

https://bugzilla.novell.com/show_bug.cgi?id=552218

Maybe those of you using distros without the patch should consider bugging your distributors to include it. Point them to OpenSUSE and that they _have_ the patch. 

Chances are that at some point the insight will percolate that it would be much more efficient to include the patch upstream instead of having a copy of it in every distribution. AFAICT rants in this bug report have gotten us nowhere and are not very likely to get us anywhere in the future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1317682</commentid>
    <comment_count>101</comment_count>
    <who name="Tristan Miller">psychonaut</who>
    <bug_when>2012-11-23 07:36:45 +0000</bug_when>
    <thetext>One of the upstream bugs has just been marked as resolved for Qt 5.0: https://bugreports.qt-project.org/browse/QTBUG-6239</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1426516</commentid>
    <comment_count>102</comment_count>
    <who name="emilio.recio@jefferson.edu">emilio.recio</who>
    <bug_when>2014-01-23 18:35:12 +0000</bug_when>
    <thetext>I have three printers. GTK/Gnome based apps maintain the OS default. KDE apps default to the first printer alphabetically in my printer list, and there&apos;s no way to set a default printer in KDE. This is annoying because I end up sending my print jobs to another office.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1443675</commentid>
    <comment_count>103</comment_count>
    <who name="Peter Lemieux">kdebugs</who>
    <bug_when>2014-04-26 15:14:56 +0000</bug_when>
    <thetext>Searching for bugs about saving printer options in Okular brings one here.  Most of this discussion centers on duplex printing, but my issue concerns printing in reverse order.  This is possible on-the-fly in Okular, but there is no way to make it the default.  That doesn&apos;t seem possible even using the 4.13 version of KDE in the just-released Kubuntu 14.04 (4:4.13.0-0ubuntu1).

I can select the option to print in reverse order on the fly in Okular, but I cannot make that the default for all documents and for all KDE applications.  The reverse printing option doesn&apos;t appear in the System Settings printer dialog, probably because it also does not appear as an option using CUPS via the localhost:631 interface.  

Still I can tell Okular to print a document in reverse order, so it should be possible to set it globally for Okular and for all other KDE apps as well.  I don&apos;t know whether it&apos;s a KDE or a Qt or a CUPS problem, but it should be possible to make any printer option a default.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1611273</commentid>
    <comment_count>104</comment_count>
      <attachid>100374</attachid>
    <who name="David Jarvie">djarvie</who>
    <bug_when>2016-07-29 16:04:20 +0000</bug_when>
    <thetext>Created attachment 100374
Patch to initialise Qt printer dialog with CUPS settings

There is a Qt code review, https://codereview.qt-project.org/#/c/32127/, with a patch for initialising the Qt printer dialog with all the CUPS settings, including default printer, duplex mode and greyscale/colour. This worked for me with Qt 4.8.6.

I attach a patch file obtained from this code review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1751243</commentid>
    <comment_count>105</comment_count>
    <who name="Michael Weghorn">m.weghorn</who>
    <bug_when>2018-05-10 18:46:34 +0000</bug_when>
    <thetext>The issue that a printer&apos;s default CUPS options are not properly initialized in the print dialog has been fixed upstream in Qt now, along with several other improvements of the Qt print dialog.

Most of the improvements will be contained in Qt version 5.11 already (s. [1] for more details), while the proper initialization of the duplex option -- which is mentioned in this bug report pretty often -- will be implemented in Qt 5.12 (s. [2]).

I therefore suggest to close this bug as RESOLVED UPSTREAM - and will do so soon unless any objections are brought up here in the meantime.

[1] https://www.kdab.com/better-support-for-cups-features-in-qt-5-11/
[2] https://codereview.qt-project.org/#/c/226881/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1757157</commentid>
    <comment_count>106</comment_count>
    <who name="Michael Weghorn">m.weghorn</who>
    <bug_when>2018-06-06 14:15:00 +0000</bug_when>
    <thetext>(In reply to Michael Weghorn from comment #105)
&gt; [...] 
&gt; I therefore suggest to close this bug as RESOLVED UPSTREAM - and will do so
&gt; soon unless any objections are brought up here in the meantime.

I&apos;m doing this now, since nobody raised any objections.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921506</commentid>
    <comment_count>107</comment_count>
    <who name="MichaelL">a</who>
    <bug_when>2020-04-10 19:34:24 +0000</bug_when>
    <thetext>Sorry, it seems that the issue isn&apos;t resolved.
Okular doesn&apos;t save the margins values nor the &quot;Force rasterization&quot; checkbox.
If I try to set the values as default, the print tool ignores them while a command-line lp works :
lpoptions -p Zebra -o page-bottom=0 -o page-left=0 -o page-right=0 -o page-top=0 -o fitplot

Kubuntu 19.04
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

Quite the same as https://bugs.kde.org/show_bug.cgi?id=404510 or https://bugs.kde.org/show_bug.cgi?id=383697
So I tried with Kate and the values are saved in katerc : 
[Kate Print Settings][Margins]
bottom=0
left=0
right=0
top=0

Strangely I just migrated from Kubuntu 14.04 (KDE 4.13) to Kubuntu 19.04 (KDE 5.62) and I didn&apos;t face this issue on the previous computer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921527</commentid>
    <comment_count>108</comment_count>
    <who name="Kevin Kofler">kevin.kofler</who>
    <bug_when>2020-04-10 22:32:06 +0000</bug_when>
    <thetext>The issue in this bug is already resolved in upstream Qt.

Your issue is a different issue, i.e., that there is no UI to set default margins. Any settings you make in the print dialog are not intended to be stored as defaults.

The place where you set default settings is using the print-manager KCM, i.e., the Printer tab in Plasma System Settings. But there is no setting for margins there. And of course not for &quot;Force rasterization&quot; which is an Okular-specific setting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2082678</commentid>
    <comment_count>109</comment_count>
    <who name="">Yvan.Velenik</who>
    <bug_when>2021-12-04 17:44:06 +0000</bug_when>
    <thetext>*** This bug has been confirmed by popular vote. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>40415</attachid>
            <date>2010-01-31 17:46:54 +0000</date>
            <delta_ts>2010-02-28 06:23:00 +0000</delta_ts>
            <desc>patch to fix some printer issues</desc>
            <filename>printer.patch</filename>
            <type>text/plain</type>
            <size>2836</size>
            <attacher name="Jeremy Sanders">jeremy</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3NyYy9ndWkvZGlhbG9ncy9xcHJpbnRkaWFsb2dfdW5peC5jcHAgYi9zcmMv
Z3VpL2RpYWxvZ3MvcXByaW50ZGlhbG9nX3VuaXguY3BwCmluZGV4IDIzZjU4MzEuLmYzNDI3N2Eg
MTAwNjQ0Ci0tLSBhL3NyYy9ndWkvZG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CSAgc2V0Q29sb3JNb2RlKEdyYXlTY2FsZSk7CisKKyAgICAJLy8g
c2V0IGNvbGxhdGlvbgorICAgIAljb25zdCBwcGRfb3B0aW9uX3QgKmNvbGxhdGUgPSBjdXBzLnBw
ZE9wdGlvbigiQ29sbGF0ZSIpOworICAgIAlpZiggY29sbGF0ZSApCisgICAgCSAgeworICAgIAkg
ICAgc2V0Q29sbGF0ZUNvcGllcyhxc3RyY21wKGNvbGxhdGUtPmRlZmNob2ljZSwgIlRydWUiKT09
MCk7CisgICAgCSAgfQorICAgICAgfQorCisjZW5kaWYKIH0KIAogLyohCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>41187</attachid>
            <date>2010-02-28 06:23:00 +0000</date>
            <delta_ts>2010-02-28 06:23:00 +0000</delta_ts>
            <desc>patch to fix some printer issues (fixed)</desc>
            <filename>qt-everywhere-opensource-src-4.6.2-cups.patch</filename>
            <type>text/plain</type>
            <size>3297</size>
            <attacher name="Kevin Kofler">kevin.kofler</attacher>
            
              <data encoding="base64">ZGlmZiAtdXIgcXQtZXZlcnl3aGVyZS1vcGVuc291cmNlLXNyYy00LjYuMi9zcmMvZ3VpL2RpYWxv
Z3MvcXByaW50ZGlhbG9nX3VuaXguY3BwIHF0LWV2ZXJ5d2hlcmUtb3BlbnNvdXJjZS1zcmMtNC42
LjItY3Vwcy9zcmMvZ3VpL2RpYWxvZ3MvcXByaW50ZGlhbG9nX3VuaXguY3BwCi0tLSBxdC1ldmVy
eXdoZXJlLW9wZW5zb3VyY2Utc3JjLTQuNi4yL3NyYy9ndWkvZGlhbG9ncy9xcHJpbnRkaWFsb2df
dW5peC5jcHAJMjAxMC0wMi0xMSAxNjo1NToyMi4wMDAwMDAwMDAgKzAxMDAKKysrIHF0LWV2ZXJ5
d2hlcmUtb3BlbnNvdXJjZS1zcmMtNC42LjItY3Vwcy9zcmMvZ3VpL2RpYWxvZ3MvcXByaW50ZGlh
bG9nX3Vu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YXQoUVBy
aW50ZXI6OlBkZkZvcm1hdCk7CiAgICAgfQorCisjaWYgIWRlZmluZWQoUVRfTk9fQ1VQUykgJiYg
IWRlZmluZWQoUVRfTk9fTElCUkFSWSkKKyAgICAvLyBmaWxsIGluIGRlZmF1bHRzIGZyb20gcHBk
IGZpbGUKKyAgICBRQ1VQU1N1cHBvcnQgY3VwczsKKworICAgIGludCBwcmludGVybnVtID0gLTE7
CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjdXBzLmF2YWlsYWJsZVByaW50ZXJzQ291bnQoKTsg
aSsrKSB7CisgICAgICAgIGlmIChwcmludGVyTmFtZSgpLnRvTG9jYWw4Qml0KCkgPT0gY3Vwcy5h
dmFpbGFibGVQcmludGVycygpW2ldLm5hbWUpCisgICAgICAgICAgICBwcmludGVybnVtID0gaTsK
KyAgICB9CisgICAgaWYgKHByaW50ZXJudW0gPj0gMCkgeworICAgICAgICBjdXBzLnNldEN1cnJl
bnRQcmludGVyKHByaW50ZXJudW0pOworCisgICAgICAgIGNvbnN0IHBwZF9vcHRpb25fdCogZHVw
bGV4ID0gY3Vwcy5wcGRPcHRpb24oIkR1cGxleCIpOworICAgICAgICBpZiAoZHVwbGV4KSB7Cisg
ICAgICAgICAgICAvLyBjb3B5IGRlZmF1bHQgcHBkIGR1cGxleCB0byBxdCBkaWFsb2cKKyAgICAg
ICAgICAgIGlmIChxc3RyY21wKGR1cGxleC0+ZGVmY2hvaWNlLCAiRHVwbGV4VHVtYmxlIikgPT0g
MCkKKyAgICAgICAgICAgICAgICBzZXREdXBsZXgoRHVwbGV4U2hvcnRTaWRlKTsKKyAgICAgICAg
ICAgIGVsc2UgaWYgKHFzdHJjbXAoZHVwbGV4LT5kZWZjaG9pY2UsICJEdXBsZXhOb1R1bWJsZSIp
ID09IDApCisgICAgICAgICAgICAgICAgc2V0RHVwbGV4KER1cGxleExvbmdTaWRlKTsKKyAgICAg
ICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBzZXREdXBsZXgoRHVwbGV4Tm9uZSk7CisgICAg
ICAgIH0KKworICAgICAgICBpZiAoY3Vwcy5jdXJyZW50UFBEKCkpIHsKKyAgICAgICAgICAgIC8v
IHNldCBkZWZhdWx0IGNvbG9yCisgICAgICAgICAgICBpZiAoY3Vwcy5jdXJyZW50UFBEKCktPmNv
bG9yX2RldmljZSkKKyAgICAgICAgICAgICAgICBzZXRDb2xvck1vZGUoQ29sb3IpOworICAgICAg
ICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHNldENvbG9yTW9kZShHcmF5U2NhbGUpOworICAg
ICAgICB9CisKKyAgICAgICAgLy8gc2V0IGNvbGxhdGlvbgorICAgICAgICBjb25zdCBwcGRfb3B0
aW9uX3QgKmNvbGxhdGUgPSBjdXBzLnBwZE9wdGlvbigiQ29sbGF0ZSIpOworICAgICAgICBpZiAo
Y29sbGF0ZSkKKyAgICAgICAgICAgIHNldENvbGxhdGVDb3BpZXMocXN0cmNtcChjb2xsYXRlLT5k
ZWZjaG9pY2UsICJUcnVlIik9PTApOworICAgIH0KKyNlbmRpZgogfQogCiAvKiEK
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>62234</attachid>
            <date>2011-07-27 12:44:01 +0000</date>
            <delta_ts>2011-07-27 12:56:17 +0000</delta_ts>
            <desc>Patch to make okular respect the printers default duplex setting</desc>
            <filename>okular_printing_duplex.patch</filename>
            <type>text/plain</type>
            <size>378</size>
            <attacher name="Fabian Kislat">fabian.kislat</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3BhcnQuY3BwIGIvcGFydC5jcHAKaW5kZXggNWIwMzQ2ZC4uNzQxZWRlNyAx
MDA2NDQKLS0tIGEvcGFydC5jcHAKKysrIGIvcGFydC5jcHAKQEAgLTIwMTgsNiArMjAxOCw3IEBA
IHZvaWQgUGFydDo6c2xvdFByaW50KCkKICAgICBRUHJpbnRlciBwcmludGVyOwogICAgIFFQcmlu
dERpYWxvZyAqcHJpbnREaWFsb2cgPSAwOwogICAgIFFXaWRnZXQgKnByaW50Q29uZmlnV2lkZ2V0
ID0gMDsKKyAgICBwcmludGVyLnNldER1cGxleChRUHJpbnRlcjo6RHVwbGV4QXV0byk7CiAKICAg
ICAvLyBNdXN0IGRvIGNlcnRhaW4gUVByaW50ZXIgc2V0dXAgYmVmb3JlIGNyZWF0aW5nIFFQcmlu
dERpYWxvZwogICAgIHNldHVwUHJpbnQoIHByaW50ZXIgKTsK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>100374</attachid>
            <date>2016-07-29 16:04:20 +0000</date>
            <delta_ts>2016-07-29 16:04:20 +0000</delta_ts>
            <desc>Patch to initialise Qt printer dialog with CUPS settings</desc>
            <filename>qprinter-4.8.6.patch</filename>
            <type>text/plain</type>
            <size>21836</size>
            <attacher name="David Jarvie">djarvie</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3NyYy9ndWkvZGlhbG9ncy9xcGFnZXNldHVwZGlhbG9nX3VuaXguY3BwIGIv
c3JjL2d1aS9kaWFsb2dzL3FwYWdlc2V0dXBkaWFsb2dfdW5peC5jcHAKaW5kZXggMjBhMzg1My4u
NTdhZmFiNSAxMDA2NDQKLS0tIGEvc3JjL2d1aS9kaWFsb2dzL3FwYWdlc2V0dXBkaWFsb2dfdW5p
eC5jcHAKKysrIGIvc3JjL2d1aS9kaWFsb2dzL3FwYWdlc2V0dXBkaWFsb2dfdW5peC5jcHAKQEAg
LTM2MiwyMSArMzYyLDIxIEBACiAgICAgICAgIGVuZ2luZS0+c2V0UHJvcGVydHkoUFBLX0N1cHNP
cHRpb25zLCBtX2N1cHMtPm9wdGlvbnMoKSk7CiAKICAgICAgICAgUVJlY3QgcGFnZVJlY3QgPSBt
X2N1cHMtPnBhZ2VSZWN0KGN1cHNQYWdlU2l6ZSk7CiAgICAgICAgIGVuZ2luZS0+c2V0UHJvcGVy
dHkoUFBLX0N1cHNQYW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GVyID0gdGFiV2lk
Z2V0cy5iZWdpbigpOwogICAgIHdoaWxlKGl0ZXIgIT0gdGFiV2lkZ2V0cy5jb25zdEVuZCgpKSB7
CiAgICAgICAgIFFXaWRnZXQgKnRhYiA9ICppdGVyOwogICAgICAgICBvcHRpb25zLnRhYnMtPmFk
ZFRhYih0YWIsIHRhYi0+d2luZG93VGl0bGUoKSk7CiAgICAgICAgICsraXRlcjsKICAgICB9CiB9
CiAKICNpZiAhZGVmaW5lZChRVF9OT19DVVBTKSAmJiAhZGVmaW5lZChRVF9OT19MSUJSQVJZKQor
dm9pZCBRUHJpbnREaWFsb2dQcml2YXRlOjpzZXRDdXBzUHJpbnRlckRlZmF1bHRzKFFQcmludGVy
ICpwKQoreworICAgIGlmIChRQ1VQU1N1cHBvcnQ6OmlzQXZhaWxhYmxlKCkpIHsKKyAgICAgICAg
UUNVUFNTdXBwb3J0IGN1cHM7CisKKyAgICAgICAgaW50IHByaW50ZXJOdW0gPSAtMTsKKyAgICAg
ICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjdXBzLmF2YWlsYWJsZVByaW50ZXJzQ291bnQoKTsgaSsr
KSB7CisgICAgICAgICAgICBpZiAocC0+cHJpbnRlck5hbWUoKS50b0xvY2FsOEJpdCgpID09IGN1
cHMuYXZhaWxhYmxlUHJpbnRlcnMoKVtpXS5uYW1lKSB7CisgICAgICAgICAgICAgICAgcHJpbnRl
ck51bSA9IGk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAg
IH0KKyAgICAgICAgaWYgKHByaW50ZXJOdW0gPj0gMCkgeworICAgICAgICAgICAgY3Vwcy5zZXRD
dXJyZW50UHJpbnRlcihwcmludGVyTnVtKTsKKworICAgICAgICAgICAgY29uc3QgcHBkX29wdGlv
bl90ICpkdXBsZXggPSBjdXBzLnBwZE9wdGlvbigiRHVwbGV4Iik7CisgICAgICAgICAgICBpZiAo
ZHVwbGV4KSB7CisgICAgICAgICAgICAgICAgaWYgKHFzdHJjbXAoZHVwbGV4LT5kZWZjaG9pY2Us
ICJEdXBsZXhUdW1ibGUiKSA9PSAwKQorICAgICAgICAgICAgICAgICAgICBwLT5zZXREdXBsZXgo
UVByaW50ZXI6OkR1cGxleFNob3J0U2lkZSk7CisgICAgICAgICAgICAgICAgZWxzZSBpZiAocXN0
cmNtcChkdXBsZXgtPmRlZmNob2ljZSwgIkR1cGxleE5vVHVtYmxlIikgPT0gMCkKKyAgICAgICAg
ICAgICAgICAgICAgcC0+c2V0RHVwbGV4KFFQcmludGVyOjpEdXBsZXhMb25nU2lkZSk7CisgICAg
ICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICBwLT5zZXREdXBsZXgoUVByaW50
ZXI6OkR1cGxleE5vbmUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoY3Vwcy5j
dXJyZW50UFBEKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoY3Vwcy5jdXJyZW50UFBEKCktPmNv
bG9yX2RldmljZSkKKyAgICAgICAgICAgICAgICAgICAgcC0+c2V0Q29sb3JNb2RlKFFQcmludGVy
OjpDb2xvcik7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICBwLT5z
ZXRDb2xvck1vZGUoUVByaW50ZXI6OkdyYXlTY2FsZSk7CisgICAgICAgICAgICB9CisKKyAgICAg
ICAgICAgIGNvbnN0IHBwZF9vcHRpb25fdCAqY29sbGF0ZSA9IGN1cHMucHBkT3B0aW9uKCJDb2xs
YXRlIik7CisgICAgICAgICAgICBpZiAoY29sbGF0ZSkKKyAgICAgICAgICAgICAgICBwLT5zZXRD
b2xsYXRlQ29waWVzKHFzdHJjbXAoY29sbGF0ZS0+ZGVmY2hvaWNlLCAiVHJ1ZSIpPT0wKTsKKwor
ICAgICAgICAgICAgY29uc3QgcHBkX29wdGlvbl90KiBwYWdlU2l6ZXMgPSBjdXBzLnBhZ2VTaXpl
cygpOworICAgICAgICAgICAgUUJ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aXplIHNpemUg
PSBRUGRmOjpwYXBlclNpemUoUVByaW50ZXI6OlBhcGVyU2l6ZShwcykpOworICAgICAgICAgICAg
ICAgIGlmIChxQWJzKHNpemUud2lkdGggLSBwYXBlclJlY3Qud2lkdGgoKSkgPCA1ICYmIHFBYnMo
c2l6ZS5oZWlnaHQgLSBwYXBlclJlY3QuaGVpZ2h0KCkpIDwgNSkgeworICAgICAgICAgICAgICAg
ICAgICBwLT5zZXRQYXBlclNpemUoc3RhdGljX2Nhc3Q8UVByaW50ZXI6OlBhcGVyU2l6ZT4ocHMp
KTsKKworICAgICAgICAgICAgICAgICAgICBxcmVhbCBsZWZ0LCB0b3AsIHJpZ2h0LCBib3R0b207
CisgICAgICAgICAgICAgICAgICAgIGxlZnQgPSBwYWdlUmVjdC54KCkgLSBwYXBlclJlY3QueCgp
OworICAgICAgICAgICAgICAgICAgICB0b3AgPSBwYWdlUmVjdC55KCkgLSBwYXBlclJlY3QueSgp
OworICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcGVyUmVjdC5yaWdodCgpIC0gcGFnZVJl
Y3QucmlnaHQoKTsKKyAgICAgICAgICAgICAgICAgICAgYm90dG9tID0gcGFwZXJSZWN0LmJvdHRv
bSgpIC0gcGFnZVJlY3QuYm90dG9tKCk7CisKKyAgICAgICAgICAgICAgICAgICAgcC0+c2V0UGFn
ZU1hcmdpbnMobGVmdCwgdG9wLCByaWdodCwgYm90dG9tLCBRUHJpbnRlcjo6UG9pbnQpOworICAg
ICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KKwogdm9p
ZCBRUHJpbnREaWFsb2dQcml2YXRlOjpzZWxlY3RQcmludGVyKFFDVVBTU3VwcG9ydCAqY3VwcykK
IHsKLSAgICBvcHRpb25zLmR1cGxleC0+c2V0RW5hYmxlZChjdXBzICYmIGN1cHMtPnBwZE9wdGlv
bigiRHVwbGV4IikpOworICAgIFFfUShRUHJpbnREaWFsb2cpOworICAgIGlmIChjdXBzICYmIFFD
VVBTU3VwcG9ydDo6aXNBdmFpbGFibGUoKSkgeworICAgICAgICBjb25zdCBwcGRfb3B0aW9uX3Qg
KmR1cGxleCA9IGN1cHMtPnBwZE9wdGlvbigiRHVwbGV4Iik7CisgICAgICAgIGlmIChkdXBsZXgp
IHsKKyAgICAgICAgICAgIG9wdGlvbnMuZHVwbGV4LT5zZXRFbmFibGVkKHRydWUpOworICAgICAg
ICAgICAgaWYgKHFzdHJjbXAoZHVwbGV4LT5kZWZjaG9pY2UsICJEdXBsZXhUdW1ibGUiKSA9PSAw
KXsKKyAgICAgICAgICAgICAgICBvcHRpb25zLmR1cGxleFNob3J0LT5zZXRDaGVja2VkKHRydWUp
OworICAgICAgICAgICAgfSBlbHNlIGlmIChxc3RyY21wKGR1cGxleC0+ZGVmY2hvaWNlLCAiRHVw
bGV4Tm9UdW1ibGUiKSA9PSAwKXsKKyAgICAgICAgICAgICAgICBvcHRpb25zLmR1cGxleExvbmct
PnNldENoZWNrZWQodHJ1ZSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAg
IG9wdGlvbnMubm9EdXBsZXgtPnNldENoZWNrZWQodHJ1ZSk7CisgICAgICAgICAgICB9CisgICAg
ICAgIH0KKyAgICAgICAgaWYgKGN1cHMtPmN1cnJlbnRQUEQoKSkgeworICAgICAgICAgICAgaWYg
KGN1cHMtPmN1cnJlbnRQUEQoKS0+Y29sb3JfZGV2aWNlKXsKKyAgICAgICAgICAgICAgICBvcHRp
b25zLmNvbG9yLT5zZXRDaGVja2VkKHRydWUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAg
ICAgICAgICAgICBvcHRpb25zLmdyYXlzY2FsZS0+c2V0Q2hlY2tlZCh0cnVlKTsKKyAgICAgICAg
ICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNvbnN0IHBwZF9vcHRpb25fdCAqY29sbGF0ZSA9
IGN1cHMtPnBwZE9wdGlvbigiQ29sbGF0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AgICAgICAgUVJlY3QgcGFn
ZVJlY3QgPSBjdXBzLT5wYWdlUmVjdChjdXBzUGFnZVNpemUpOworICAgICAgICBlbmdpbmUtPnNl
dFByb3BlcnR5KFBQS19DdXBzUGFnZVJlY3QsIHBhZ2VSZWN0KTsKKworICAgICAgICBmb3IgKGlu
dCBwcyA9IDA7IHBzIDwgUVByaW50ZXI6Ok5QYWdlU2l6ZTsgKytwcykgeworICAgICAgICAgICAg
UVBkZjo6UGFwZXJTaXplIHNpemUgPSBRUGRmOjpwYXBlclNpemUoUVByaW50ZXI6OlBhcGVyU2l6
ZShwcykpOworICAgICAgICAgICAgaWYgKHFBYnMoc2l6ZS53aWR0aCAtIHBhcGVyUmVjdC53aWR0
aCgpKSA8IDUgJiYgcUFicyhzaXplLmhlaWdodCA9PSBwYXBlclJlY3QuaGVpZ2h0KCkpIDwgNSkg
eworICAgICAgICAgICAgICAgIHAtPnNldFBhcGVyU2l6ZShzdGF0aWNfY2FzdDxRUHJpbnRlcjo6
UGFwZXJTaXplPihwcykpOworCisgICAgICAgICAgICAgICAgcXJlYWwgbGVmdCwgdG9wLCByaWdo
dCwgYm90dG9tOworICAgICAgICAgICAgICAgIGxlZnQgPSBwYWdlUmVjdC54KCkgLSBwYXBlclJl
Y3QueCgpOworICAgICAgICAgICAgICAgIHRvcCA9IHBhZ2VSZWN0LnkoKSAtIHBhcGVyUmVjdC55
KCk7CisgICAgICAgICAgICAgICAgcmlnaHQgPSBwYXBlclJlY3QucmlnaHQoKSAtIHBhZ2VSZWN0
LnJpZ2h0KCk7CisgICAgICAgICAgICAgICAgYm90dG9tID0gcGFwZXJSZWN0LmJvdHRvbSgpIC0g
cGFnZVJlY3QuYm90dG9tKCk7CisgICAgICAgICAgICAgICAgcC0+c2V0UGFnZU1hcmdpbnMobGVm
dCwgdG9wLCByaWdodCwgYm90dG9tLCBRUHJpbnRlcjo6UG9pbnQpOworCisgICAgICAgICAgICAg
ICAgYnJlYWs7CisgICAgICAgICAgICB9Cis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2NyaXB0CiAgICAgICAgICAgICBib29sIHBkZlByaW50ZXIgPSAoaW5kZXggPT0g
cHJpbnRlckNvdW50IC0gMik7CiAgICAgICAgICAgICB3aWRnZXQubG9jYXRpb24tPnNldFRleHQo
UVByaW50RGlhbG9nOjp0cigiTG9jYWwgZmlsZSIpKTsKICAgICAgICAgICAgIHdpZGdldC50eXBl
LT5zZXRUZXh0KFFQcmludERpYWxvZzo6dHIoIldyaXRlICUxIGZpbGUiKS5hcmcocGRmUHJpbnRl
ciA/IFFTdHJpbmc6OmZyb21MYXRpbjEoIlBERiIpCiAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogUVN0cmluZzo6
ZnJvbUxhdGluMSgiUG9zdFNjcmlwdCIpKSk7CiAgICAgICAgICAgICB3aWRnZXQucHJvcGVydGll
cy0+c2V0RW5hYmxlZCh0cnVlKTsKICAgICAgICAgICAgIHdpZGdldC5maWxlbmFtZS0+c2V0RW5h
YmxlZCh0cnVlKTsKICAgICAgICAgICAgIFFTdHJpbmcgZmlsZW5hbWUgPSB3aWRnZXQuZmlsZW5h
bWUtPnRleHQoKTsKICAgICAgICAgICAgIFFTdHJpbmcgc3VmZml4ID0gUUZpbGVJbmZvKGZpbGVu
YW1lKS5zdWZmaXgoKTsKICAgICAgICAgICAgIGlmIChwZGZQcmludGVyICYmIHN1ZmZpeCA9PSBR
TGF0aW4xU3RyaW5nKCJwcyIpKQogICAgICAgICAgICAgICAgIGZpbGVuYW1lID0gZmlsZW5hbWUu
cmVwbGFjZShRTGF0aW4xU3RyaW5nKCIucHMiKSwgUUxhdGluMVN0cmluZygiLnBkZiIpKTsKICAg
ICAgICAgICAgIGlmICghcGRmUHJpbnRlciAmJiBzdWZmaXggPT0gUUxhdGluMVN0cmluZygicGRm
IikpCiAgICAgICAgICAgICAgICAgZmlsZW5hbWUgPSBmaWxlbmFtZS5yZXBsYWNlKFFMYXRpbjFT
dHJpbmcoIi5wZGYiKSwgUUxhdGluMVN0cmluZygiLnBzIikpOwogICAgICAgICAgICAgd2lkZ2V0
LmZpbGVuYW1lLT5zZXRUZXh0KGZpbGVuYW1lKTsKICAgICAgICAgICAgIHdpZGdldC5sT3V0cHV0
LT5zZXRFbmFibGVkKHRydWUpOwotICAgICAgICAgICAgaWYgKHByb3BlcnRpZXNEaWFsb2cpCi0g
ICAgICAgICAgICAgICAgcHJvcGVydGllc0RpYWxvZy0+c2VsZWN0UGRmUHNQcmludGVyKHByaW50
ZXIpOwogI2lmICFkZWZpbmVkKFFUX05PX0NVUFMpICYmICFkZWZpbmVkKFFUX05PX0xJQlJBUlkp
CiAgICAgICAgICAgICBpZiAob3B0aW9uc1BhbmUpCiAgICAgICAgICAgICAgICAgb3B0aW9uc1Bh
bmUtPnNlbGVjdFByaW50ZXIoMCk7CiAjZW5kaWYKICAgICAgICAgICAgIHJldHVybjsKICAgICAg
ICAgfQogICAgIH0KIAogICAgIHdpZGdldC5sb2NhdGlvbi0+c2V0VGV4dChRU3RyaW5nKCkpOwog
I2lmICFkZWZpbmVkKFFUX05PX0NVUFMpICYmICFkZWZpbmVkKFFUX05PX0xJQlJBUlkpCkBAIC04
MDYsMzUgKzk0MywzMSBAQAogICAgICAgICBpZiAob3B0KQogICAgICAgICAgICAgbG9jYXRpb24g
PSBRU3RyaW5nOjpmcm9tTG9jYWw4Qml0KG9wdC0+dmFsdWUpOwogICAgICAgICB3aWRnZXQubG9j
YXRpb24tPnNldFRleHQobG9jYXRpb24pOwogCiAgICAgICAgIGN1cHNQUEQgPSBjdXBzLT5jdXJy
ZW50UFBEKCk7CiAgICAgICAgIC8vIHNldCBwcmludGVyIHR5cGUgbGluZQogICAgICAgICBRU3Ry
aW5nIHR5cGU7CiAgICAgICAgIGlmIChjdXBzUFBEKQogICAgICAgICAgICAgdHlwZSA9IFFTdHJp
bmc6OmZyb21Mb2NhbDhCaXQoY3Vwc1BQRC0+bWFudWZhY3R1cmVyKSArIFFMYXRpbjFTdHJpbmco
IiAtICIpICsgUVN0cmluZzo6ZnJvbUxvY2FsOEJpdChjdXBzUFBELT5tb2RlbG5hbWUpOwogICAg
ICAgICB3aWRnZXQudHlwZS0+c2V0VGV4dCh0eXBlKTsKLSAgICAgICAgaWYgKHByb3BlcnRpZXNE
aWFsb2cpCi0gICAgICAgICAgICBwcm9wZXJ0aWVzRGlhbG9nLT5zZWxlY3RQcmludGVyKCk7CiAg
ICAgICAgIGlmIChvcHRpb25zUGFuZSkKICAgICAgICAgICAgIG9wdGlvbnNQYW5lLT5zZWxlY3RQ
cmludGVyKGN1cHMpOwogICAgIH0gZWxzZSB7CiAgICAgICAgIGlmIChvcHRpb25zUGFuZSkKICAg
ICAgICAgICAgIG9wdGlvbnNQYW5lLT5zZWxlY3RQcmludGVyKDApOwogI2VuZGlmCiAgICAgICAg
IGlmIChscHJQcmludGVycy5jb3VudCgpID4gMCkgewogICAgICAgICAgICAgUVN0cmluZyB0eXBl
ID0gbHByUHJpbnRlcnMuYXQoaW5kZXgpLm5hbWUgKyBRTGF0aW4xQ2hhcignQCcpICsgbHByUHJp
bnRlcnMuYXQoaW5kZXgpLmhvc3Q7CiAgICAgICAgICAgICBpZiAoIWxwclByaW50ZXJzLmF0KGlu
ZGV4KS5jb21tZW50LmlzRW1wdHkoKSkKICAgICAgICAgICAgIHR5cGUgKz0gUUxhdGluMVN0cmlu
ZygiLCAiKSArIGxwclByaW50ZXJzLmF0KGluZGV4KS5jb21tZW50OwogICAgICAgICAgICAgd2lk
Z2V0LnR5cGUtPnNldFRleHQodHlwZSk7Ci0gICAgICAgICAgICBpZiAocHJvcGVydGllc0RpYWxv
ZykKLSAgICAgICAgICAgICAgICBwcm9wZXJ0aWVzRGlhbG9nLT5zZWxlY3RQcmludGVyKCk7CiAg
ICAgICAgIH0KICNpZiAhZGVmaW5lZChRVF9OT19DVVBTKSAmJiAhZGVmaW5lZChRVF9OT19MSUJS
QVJZKQogICAgIH0KICNlbmRpZgogfQ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ZXIp
OwogfQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>