Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 1f9eb832ba1e4b88d9a5c2b384813bb4 > files > 2963

kdelibs3-apidocs-3.5.10-31.fc15.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">

<head>
  <title>kdeprint: kprinter.cpp Source File (kdeprint)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>

  <div id="nav_header_title" align="left">KDE API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_right" style="text-align: left;">
/ <a href="../..">API Reference</a>
 / <a href=".">kdeprint</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <a name="content"></a>


<!-- Generated by Doxygen 1.7.4 -->
<div class="header">
  <div class="headertitle">
<div class="title">kprinter.cpp</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *  This file is part of the KDE libraries</span>
<a name="l00003"></a>00003 <span class="comment"> *  Copyright (c) 2001 Michael Goffioul &lt;kdeprint@swing.be&gt;</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> *  This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment"> *  modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment"> *  License version 2 as published by the Free Software Foundation.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> *  This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment"> *  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment"> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment"> *  Library General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> *  You should have received a copy of the GNU Library General Public License</span>
<a name="l00015"></a>00015 <span class="comment"> *  along with this library; see the file COPYING.LIB.  If not, write to</span>
<a name="l00016"></a>00016 <span class="comment"> *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00017"></a>00017 <span class="comment"> *  Boston, MA 02110-1301, USA.</span>
<a name="l00018"></a>00018 <span class="comment"> **/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;config.h&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;kprinter.h&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;kprinterimpl.h&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;kprintdialog.h&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;kprintpreview.h&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;kmfactory.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;kmuimanager.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;kmmanager.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;driver.h&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;qpaintdevicemetrics.h&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;qfile.h&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;qtl.h&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;qdir.h&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;qguardedptr.h&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;kapplication.h&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;kstandarddirs.h&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;kglobal.h&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;kconfig.h&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;krun.h&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;knotifyclient.h&gt;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;klocale.h&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &lt;kprocess.h&gt;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;klibloader.h&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;kmessagebox.h&gt;</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keywordtype">void</span> dumpOptions(<span class="keyword">const</span> <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>&amp; opts);
<a name="l00049"></a>00049 <span class="keyword">static</span> <span class="keywordtype">void</span> reportError(<a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a>*);
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="comment">//**************************************************************************************</span>
<a name="l00052"></a>00052 <span class="comment">// KPrinterWrapper class</span>
<a name="l00053"></a>00053 <span class="comment">//**************************************************************************************</span>
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 <span class="keyword">class </span>KPrinterWrapper : <span class="keyword">public</span> <a class="codeRef" href="qprinter.html">QPrinter</a>
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a>;
<a name="l00058"></a>00058 <span class="keyword">public</span>:
<a name="l00059"></a>00059     KPrinterWrapper(<a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a>*, PrinterMode m = ScreenResolution);
<a name="l00060"></a>00060     ~KPrinterWrapper();
<a name="l00061"></a>00061 <span class="keyword">protected</span>:
<a name="l00062"></a>00062     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> cmd(<span class="keywordtype">int</span>, <a class="codeRef" href="qpainter.html">QPainter</a>*, QPDevCmdParam*);
<a name="l00063"></a>00063     <span class="keyword">virtual</span> <span class="keywordtype">int</span> metric(<span class="keywordtype">int</span>) <span class="keyword">const</span>;
<a name="l00064"></a>00064     <span class="keywordtype">int</span> qprinterMetric(<span class="keywordtype">int</span>) <span class="keyword">const</span>;
<a name="l00065"></a>00065 <span class="keyword">private</span>:
<a name="l00066"></a>00066     <a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a>    *m_printer;
<a name="l00067"></a>00067 };
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 KPrinterWrapper::KPrinterWrapper(<a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a> *prt, QPrinter::PrinterMode m)
<a name="l00070"></a>00070 : <a class="codeRef" href="qprinter.html">QPrinter</a>(m), m_printer(prt)
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 }
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 KPrinterWrapper::~KPrinterWrapper()
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="keywordtype">bool</span> KPrinterWrapper::cmd(<span class="keywordtype">int</span> c, <a class="codeRef" href="qpainter.html">QPainter</a> *painter, QPDevCmdParam *p)
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080     <span class="keywordflow">return</span> QPrinter::cmd(c,painter,p);
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 <span class="keywordtype">int</span> KPrinterWrapper::metric(<span class="keywordtype">int</span> m)<span class="keyword"> const</span>
<a name="l00084"></a>00084 <span class="keyword"></span>{
<a name="l00085"></a>00085     <span class="keywordflow">return</span> m_printer-&gt;metric(m);
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 
<a name="l00088"></a>00088 <span class="keywordtype">int</span> KPrinterWrapper::qprinterMetric(<span class="keywordtype">int</span> m)<span class="keyword"> const</span>
<a name="l00089"></a>00089 <span class="keyword"></span>{
<a name="l00090"></a>00090     <span class="keywordflow">return</span> QPrinter::metric(m);
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092 
<a name="l00093"></a>00093 <span class="comment">//**************************************************************************************</span>
<a name="l00094"></a>00094 <span class="comment">// KPrinterPrivate class</span>
<a name="l00095"></a>00095 <span class="comment">//**************************************************************************************</span>
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keyword">class </span>KPrinterPrivate
<a name="l00098"></a>00098 {
<a name="l00099"></a>00099 <span class="keyword">public</span>:
<a name="l00100"></a>00100     <a class="codeRef" href="qguardedptr.html">QGuardedPtr&lt;KPrinterImpl&gt;</a>   m_impl;
<a name="l00101"></a>00101     <span class="keywordtype">bool</span>        m_restore;
<a name="l00102"></a>00102     <span class="keywordtype">bool</span>        m_previewonly;
<a name="l00103"></a>00103     WId     m_parentId;
<a name="l00104"></a>00104     <a class="codeRef" href="qstring.html">QString</a>     m_docfilename;
<a name="l00105"></a>00105     <a class="codeRef" href="qstring.html">QString</a> m_docdirectory;
<a name="l00106"></a>00106     KPrinterWrapper     *m_wrapper;
<a name="l00107"></a>00107     <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>   m_options;
<a name="l00108"></a>00108     <a class="codeRef" href="qstring.html">QString</a>         m_tmpbuffer;
<a name="l00109"></a>00109     <a class="codeRef" href="qstring.html">QString</a>         m_printername;
<a name="l00110"></a>00110     <a class="codeRef" href="qstring.html">QString</a>         m_searchname;
<a name="l00111"></a>00111     <a class="codeRef" href="qstring.html">QString</a>         m_errormsg;
<a name="l00112"></a>00112     <span class="keywordtype">bool</span>            m_ready;
<a name="l00113"></a>00113     <span class="keywordtype">int</span>     m_pagenumber;
<a name="l00114"></a>00114     DrPageSize *m_pagesize;
<a name="l00115"></a>00115     <span class="keywordtype">bool</span> m_useprinterres;
<a name="l00116"></a>00116     <span class="keywordtype">int</span> m_defaultres;
<a name="l00117"></a>00117 };
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="comment">//**************************************************************************************</span>
<a name="l00120"></a>00120 <span class="comment">// KPrinter class</span>
<a name="l00121"></a>00121 <span class="comment">//**************************************************************************************</span>
<a name="l00122"></a>00122 
<a name="l00123"></a><a class="code" href="classKPrinter.html#a1f8ea151e7b11fa0b252747a9d57e014">00123</a> <a class="code" href="classKPrinter.html#a1f8ea151e7b11fa0b252747a9d57e014" title="Constructor.">KPrinter::KPrinter</a>(<span class="keywordtype">bool</span> restore, QPrinter::PrinterMode m)
<a name="l00124"></a>00124 : <a class="codeRef" href="qpaintdevice.html">QPaintDevice</a>(QInternal::Printer|QInternal::ExternalDevice)
<a name="l00125"></a>00125 {
<a name="l00126"></a>00126     init(restore, m);
<a name="l00127"></a>00127 }
<a name="l00128"></a>00128 
<a name="l00129"></a><a class="code" href="classKPrinter.html#ae8e7e8e8bdd1143a0e021082b0d5934d">00129</a> <a class="code" href="classKPrinter.html#ae8e7e8e8bdd1143a0e021082b0d5934d" title="Destructor.">KPrinter::~KPrinter</a>()
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131     <span class="comment">// delete Wrapper object</span>
<a name="l00132"></a>00132     <span class="keyword">delete</span> d-&gt;m_wrapper;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134     <span class="comment">// save current options</span>
<a name="l00135"></a>00135     <span class="keywordflow">if</span> (d-&gt;m_restore)
<a name="l00136"></a>00136         saveSettings();
<a name="l00137"></a>00137 
<a name="l00138"></a>00138     <span class="comment">// delete private data (along any data allocated internally)</span>
<a name="l00139"></a>00139     <span class="keyword">delete</span> d-&gt;m_pagesize;
<a name="l00140"></a>00140     <span class="keyword">delete</span> d;
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="keywordtype">void</span> KPrinter::init(<span class="keywordtype">bool</span> restore, QPrinter::PrinterMode m)
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145     <span class="comment">// Private data initialization</span>
<a name="l00146"></a>00146     d = <span class="keyword">new</span> KPrinterPrivate;
<a name="l00147"></a>00147     d-&gt;m_impl = KMFactory::self()-&gt;printerImplementation();
<a name="l00148"></a>00148     d-&gt;m_restore = restore;
<a name="l00149"></a>00149     d-&gt;m_previewonly = <span class="keyword">false</span>;
<a name="l00150"></a>00150     d-&gt;m_parentId = 0;
<a name="l00151"></a>00151     d-&gt;m_pagesize = 0;
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     <span class="comment">// initialize QPrinter wrapper</span>
<a name="l00154"></a>00154     d-&gt;m_wrapper = <span class="keyword">new</span> KPrinterWrapper(<span class="keyword">this</span>, m);
<a name="l00155"></a>00155 
<a name="l00156"></a>00156     <span class="comment">// other initialization</span>
<a name="l00157"></a>00157     d-&gt;m_tmpbuffer = d-&gt;m_impl-&gt;tempFile();
<a name="l00158"></a>00158     d-&gt;m_ready = <span class="keyword">false</span>;
<a name="l00159"></a>00159     d-&gt;m_defaultres = d-&gt;m_wrapper-&gt;resolution();
<a name="l00160"></a>00160     d-&gt;m_useprinterres = <span class="keyword">false</span>;
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     <span class="comment">// reload options from implementation (static object)</span>
<a name="l00163"></a>00163     <span class="keywordflow">if</span> (d-&gt;m_restore)
<a name="l00164"></a>00164         loadSettings();
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 
<a name="l00167"></a>00167 <span class="keywordtype">void</span> KPrinter::loadSettings()
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169     d-&gt;m_options = d-&gt;m_impl-&gt;loadOptions();
<a name="l00170"></a>00170 
<a name="l00171"></a>00171     <span class="comment">// load the last printer used in the current process (if any)</span>
<a name="l00172"></a>00172     <span class="comment">// and remove the corresponding entry in the option map, as it</span>
<a name="l00173"></a>00173     <span class="comment">// is not needed anymore</span>
<a name="l00174"></a>00174     <a class="code" href="classKPrinter.html#ae4ebbe35a92ba37bc7500c2ee2034389" title="Sets the search name of the KPrinter object.">setSearchName</a>(<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-searchname&quot;</span>));
<a name="l00175"></a>00175     d-&gt;m_options.remove(<span class="stringliteral">&quot;kde-searchname&quot;</span>);
<a name="l00176"></a>00176 
<a name="l00177"></a>00177     KConfig *conf = KGlobal::config(), *pconf = KMFactory::self()-&gt;printConfig();
<a name="l00178"></a>00178     conf-&gt;setGroup(<span class="stringliteral">&quot;KPrinter Settings&quot;</span>);
<a name="l00179"></a>00179     pconf-&gt;setGroup(<span class="stringliteral">&quot;General&quot;</span>);
<a name="l00180"></a>00180 
<a name="l00181"></a>00181     <span class="comment">// load latest used printer from config file, if required in the options</span>
<a name="l00182"></a>00182     <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#a4fa5ba95b3fe452e27f5c4ad84b25a05" title="Returns the search name of the printer selected by the user.">searchName</a>().isEmpty() &amp;&amp; pconf-&gt;readBoolEntry(<span class="stringliteral">&quot;UseLast&quot;</span>, <span class="keyword">true</span>))
<a name="l00183"></a>00183         <a class="code" href="classKPrinter.html#ae4ebbe35a92ba37bc7500c2ee2034389" title="Sets the search name of the KPrinter object.">setSearchName</a>(conf-&gt;readEntry(<span class="stringliteral">&quot;Printer&quot;</span>));
<a name="l00184"></a>00184 
<a name="l00185"></a>00185     <span class="comment">// latest used print command</span>
<a name="l00186"></a>00186     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-printcommand&quot;</span>,conf-&gt;readPathEntry(<span class="stringliteral">&quot;PrintCommand&quot;</span>));
<a name="l00187"></a>00187 
<a name="l00188"></a>00188     <span class="comment">// latest used document directory</span>
<a name="l00189"></a>00189     <a class="code" href="classKPrinter.html#a3f630e9701046916835f0d7796704a6f" title="Set the default document directory.">setDocDirectory</a>( conf-&gt;readPathEntry( <span class="stringliteral">&quot;DocDirectory&quot;</span> ) );
<a name="l00190"></a>00190     <a class="code" href="classKPrinter.html#a8c00510380a19b1474adbf158108b8ec" title="Set the default document filename.">setDocFileName</a>( <span class="stringliteral">&quot;print&quot;</span> );
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192 
<a name="l00193"></a>00193 <span class="keywordtype">void</span> KPrinter::saveSettings()
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195     <span class="keywordflow">if</span> (d-&gt;m_impl)
<a name="l00196"></a>00196     {
<a name="l00197"></a>00197         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-searchname&quot;</span>, <a class="code" href="classKPrinter.html#a4fa5ba95b3fe452e27f5c4ad84b25a05" title="Returns the search name of the printer selected by the user.">searchName</a>());
<a name="l00198"></a>00198         d-&gt;m_impl-&gt;saveOptions(d-&gt;m_options);
<a name="l00199"></a>00199     }
<a name="l00200"></a>00200 
<a name="l00201"></a>00201     <span class="comment">// save latest used printer to config file</span>
<a name="l00202"></a>00202     KConfig *conf = KGlobal::config();
<a name="l00203"></a>00203     conf-&gt;setGroup(<span class="stringliteral">&quot;KPrinter Settings&quot;</span>);
<a name="l00204"></a>00204     conf-&gt;writeEntry(<span class="stringliteral">&quot;Printer&quot;</span>,<a class="code" href="classKPrinter.html#a4fa5ba95b3fe452e27f5c4ad84b25a05" title="Returns the search name of the printer selected by the user.">searchName</a>());
<a name="l00205"></a>00205     <span class="comment">// latest used print command</span>
<a name="l00206"></a>00206     conf-&gt;writePathEntry(<span class="stringliteral">&quot;PrintCommand&quot;</span>,<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-printcommand&quot;</span>));
<a name="l00207"></a>00207 
<a name="l00208"></a>00208     <span class="comment">// latest used document directory</span>
<a name="l00209"></a>00209     <span class="keywordflow">if</span> ( d-&gt;m_docdirectory.isEmpty() )
<a name="l00210"></a>00210     {
<a name="l00211"></a>00211         KURL url( <a class="code" href="classKPrinter.html#a17bb43798803db343148c43826c6924e" title="See QPrinter::outputFileName().">outputFileName</a>() );
<a name="l00212"></a>00212         <span class="keywordflow">if</span> ( url.isValid() )
<a name="l00213"></a>00213             conf-&gt;writePathEntry( <span class="stringliteral">&quot;DocDirectory&quot;</span>, url.directory() );
<a name="l00214"></a>00214     }
<a name="l00215"></a>00215     <span class="keywordflow">else</span>
<a name="l00216"></a>00216         conf-&gt;writePathEntry( <span class="stringliteral">&quot;DocDirectory&quot;</span>, d-&gt;m_docdirectory );
<a name="l00217"></a>00217 }
<a name="l00218"></a>00218 
<a name="l00219"></a><a class="code" href="classKPrinter.html#a26976f55d230788ebf1ad2172f2f6e6d">00219</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#a26976f55d230788ebf1ad2172f2f6e6d" title="Sets up the KPrinter object using the print dialog, returns true if the user clicked OK...">KPrinter::setup</a>(<a class="codeRef" href="qwidget.html">QWidget</a> *parent, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; caption, <span class="keywordtype">bool</span> forceExpand)
<a name="l00220"></a>00220 {
<a name="l00221"></a>00221     <span class="keywordflow">if</span> (!kapp-&gt;authorize(<span class="stringliteral">&quot;print/dialog&quot;</span>))
<a name="l00222"></a>00222     {
<a name="l00223"></a>00223         <a class="code" href="classKPrinter.html#af0a86c9b60878eea68401e16d8fab3af" title="Configure the KPrinter object to be used with the printer named prname.">autoConfigure</a>(QString::null, parent);
<a name="l00224"></a>00224         <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Just print it</span>
<a name="l00225"></a>00225     }
<a name="l00226"></a>00226 
<a name="l00227"></a>00227     <span class="keywordflow">if</span> (parent)
<a name="l00228"></a>00228         d-&gt;m_parentId = parent-&gt;<a class="codeRef" href="qwidget.html#winId">winId</a>();
<a name="l00229"></a>00229 
<a name="l00230"></a>00230     KPrintDialog    *dlg = KPrintDialog::printerDialog(<span class="keyword">this</span>, parent, caption, forceExpand);
<a name="l00231"></a>00231     <span class="keywordtype">bool</span>    state = <span class="keyword">false</span>;
<a name="l00232"></a>00232     <span class="keywordflow">if</span> (dlg)
<a name="l00233"></a>00233     {
<a name="l00234"></a>00234         state = dlg-&gt;exec();
<a name="l00235"></a>00235         <span class="keyword">delete</span> dlg;
<a name="l00236"></a>00236     }
<a name="l00237"></a>00237     <span class="keywordflow">return</span> state;
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 
<a name="l00240"></a><a class="code" href="classKPrinter.html#af69ddc3443ad3d9c40abc26ffdef6b87">00240</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#af69ddc3443ad3d9c40abc26ffdef6b87" title="Adds a standard page to the print dialog.">KPrinter::addStandardPage</a>(<span class="keywordtype">int</span> p)
<a name="l00241"></a>00241 {
<a name="l00242"></a>00242     KMFactory::self()-&gt;settings()-&gt;standardDialogPages |= p;
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244 
<a name="l00245"></a><a class="code" href="classKPrinter.html#a149d52b98c0bfb8a56fa02b13c6eefdc">00245</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a149d52b98c0bfb8a56fa02b13c6eefdc" title="Removes a standard page from the print dialog.">KPrinter::removeStandardPage</a>(<span class="keywordtype">int</span> p)
<a name="l00246"></a>00246 {
<a name="l00247"></a>00247     KMFactory::self()-&gt;settings()-&gt;standardDialogPages &amp;= (~p);
<a name="l00248"></a>00248 }
<a name="l00249"></a>00249 
<a name="l00250"></a><a class="code" href="classKPrinter.html#a53ad09a804a214109f206eaea58cade7">00250</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a53ad09a804a214109f206eaea58cade7" title="Adds a customized page to the print dialog.">KPrinter::addDialogPage</a>(<a class="code" href="classKPrintDialogPage.html" title="This class is intended to be used as base class for customized print dialog page.">KPrintDialogPage</a> *page)
<a name="l00251"></a>00251 {
<a name="l00252"></a>00252     KMFactory::self()-&gt;uiManager()-&gt;addPrintDialogPage(page);
<a name="l00253"></a>00253 }
<a name="l00254"></a>00254 
<a name="l00255"></a><a class="code" href="classKPrinter.html#af575cae0694de359c43a147e983354bc">00255</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#af575cae0694de359c43a147e983354bc" title="Sets the page selection mode of the application.">KPrinter::setPageSelection</a>(<a class="code" href="classKPrinter.html#a7c59f005bf28b7cf7888b161f0b0cb4d" title="Defines whether the application can perform page selection itself or not.">PageSelectionType</a> t)
<a name="l00256"></a>00256 {
<a name="l00257"></a>00257     KMFactory::self()-&gt;settings()-&gt;pageSelection = t;
<a name="l00258"></a>00258 }
<a name="l00259"></a>00259 
<a name="l00260"></a><a class="code" href="classKPrinter.html#acc152e94ba787c1c6460cab9daae8b17">00260</a> <a class="code" href="classKPrinter.html#a7c59f005bf28b7cf7888b161f0b0cb4d" title="Defines whether the application can perform page selection itself or not.">KPrinter::PageSelectionType</a> <a class="code" href="classKPrinter.html#acc152e94ba787c1c6460cab9daae8b17" title="Returns the page selection mode of the current application.">KPrinter::pageSelection</a>()
<a name="l00261"></a>00261 {
<a name="l00262"></a>00262     <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a7c59f005bf28b7cf7888b161f0b0cb4d" title="Defines whether the application can perform page selection itself or not.">PageSelectionType</a>)KMFactory::self()-&gt;settings()-&gt;pageSelection;
<a name="l00263"></a>00263 }
<a name="l00264"></a>00264 
<a name="l00265"></a><a class="code" href="classKPrinter.html#ad42130fc4bc2630cf16dfc0c92e044c7">00265</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#ad42130fc4bc2630cf16dfc0c92e044c7" title="Sets the application type concerning the print dialog.">KPrinter::setApplicationType</a>(<a class="code" href="classKPrinter.html#a42d86b7b7d9c88237937748d7c128355" title="Defines the type of the application, this affects the GUI of the print dialog:">ApplicationType</a> t)
<a name="l00266"></a>00266 {
<a name="l00267"></a>00267     KMFactory::self()-&gt;settings()-&gt;application = t;
<a name="l00268"></a>00268 }
<a name="l00269"></a>00269 
<a name="l00270"></a><a class="code" href="classKPrinter.html#adb4716090b361f154a9b9dbc328b74d2">00270</a> <a class="code" href="classKPrinter.html#a42d86b7b7d9c88237937748d7c128355" title="Defines the type of the application, this affects the GUI of the print dialog:">KPrinter::ApplicationType</a> <a class="code" href="classKPrinter.html#adb4716090b361f154a9b9dbc328b74d2" title="Returns the application type concerning the print dialog.">KPrinter::applicationType</a>()
<a name="l00271"></a>00271 {
<a name="l00272"></a>00272     <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a42d86b7b7d9c88237937748d7c128355" title="Defines the type of the application, this affects the GUI of the print dialog:">ApplicationType</a>)KMFactory::self()-&gt;settings()-&gt;application;
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 
<a name="l00275"></a>00275 <span class="keywordtype">bool</span> KPrinter::cmd(<span class="keywordtype">int</span> c, <a class="codeRef" href="qpainter.html">QPainter</a> *painter, QPDevCmdParam *p)
<a name="l00276"></a>00276 {
<a name="l00277"></a>00277     <span class="keywordtype">bool</span> value(<span class="keyword">true</span>);
<a name="l00278"></a>00278     <span class="keywordflow">if</span> (c == QPaintDevice::PdcBegin)
<a name="l00279"></a>00279     {
<a name="l00280"></a>00280         d-&gt;m_impl-&gt;statusMessage(i18n(<span class="stringliteral">&quot;Initialization...&quot;</span>), <span class="keyword">this</span>);
<a name="l00281"></a>00281         d-&gt;m_pagenumber = 1;
<a name="l00282"></a>00282         preparePrinting();
<a name="l00283"></a>00283         d-&gt;m_impl-&gt;statusMessage(i18n(<span class="stringliteral">&quot;Generating print data: page %1&quot;</span>).arg(d-&gt;m_pagenumber), <span class="keyword">this</span>);
<a name="l00284"></a>00284     }
<a name="l00285"></a>00285     value = d-&gt;m_wrapper-&gt;cmd(c,painter,p);
<a name="l00286"></a>00286     <span class="keywordflow">if</span> (c == QPaintDevice::PdcEnd)
<a name="l00287"></a>00287     {
<a name="l00288"></a>00288         <span class="comment">// this call should take care of everything (preview, output-to-file, filtering, ...)</span>
<a name="l00289"></a>00289         value = value &amp;&amp; <a class="code" href="classKPrinter.html#ae592e741799547bb58f044fc04ea1543" title="Prints the files given in argument.">printFiles</a>(<a class="codeRef" href="qstringlist.html">QStringList</a>(d-&gt;m_wrapper-&gt;outputFileName()),<span class="keyword">true</span>);
<a name="l00290"></a>00290         <span class="comment">// reset &quot;ready&quot; state</span>
<a name="l00291"></a>00291         finishPrinting();
<a name="l00292"></a>00292     }
<a name="l00293"></a>00293     <span class="keywordflow">return</span> value;
<a name="l00294"></a>00294 }
<a name="l00295"></a>00295 
<a name="l00296"></a><a class="code" href="classKPrinter.html#a0891873329771d4e9f34459e85e7a554">00296</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a0891873329771d4e9f34459e85e7a554">KPrinter::translateQtOptions</a>()
<a name="l00297"></a>00297 {
<a name="l00298"></a>00298     d-&gt;m_wrapper-&gt;setCreator(<a class="code" href="classKPrinter.html#a0b17587ffcf63d147c6c4e0cffc59ab7" title="See QPrinter::creator().">creator</a>());
<a name="l00299"></a>00299     d-&gt;m_wrapper-&gt;setDocName(<a class="code" href="classKPrinter.html#aeeeca49093fbecea784d4d3afd6967be" title="See QPrinter::docName().">docName</a>());
<a name="l00300"></a>00300     d-&gt;m_wrapper-&gt;setFullPage(<a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0" title="See QPrinter::fullPage().">fullPage</a>());
<a name="l00301"></a>00301     d-&gt;m_wrapper-&gt;setColorMode((QPrinter::ColorMode)<a class="code" href="classKPrinter.html#a0fa2ae3d6081ec3a8d081455c8a3f954" title="See QPrinter::colorMode().">colorMode</a>());
<a name="l00302"></a>00302     d-&gt;m_wrapper-&gt;setOrientation((QPrinter::Orientation)<a class="code" href="classKPrinter.html#a254dc41b19b57f78276010ed80055341" title="See QPrinter::orientation().">orientation</a>());
<a name="l00303"></a>00303     <span class="keywordflow">if</span> ( !<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>( <span class="stringliteral">&quot;kde-printsize&quot;</span> ).isEmpty() )
<a name="l00304"></a>00304         d-&gt;m_wrapper-&gt;setPageSize( ( QPrinter::PageSize )<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>( <span class="stringliteral">&quot;kde-printsize&quot;</span> ).toInt() );
<a name="l00305"></a>00305     <span class="keywordflow">else</span>
<a name="l00306"></a>00306         d-&gt;m_wrapper-&gt;setPageSize((QPrinter::PageSize)<a class="code" href="classKPrinter.html#a943525e8337dc7c1df37ce2e3033c2be" title="See QPrinter::pageSize().">pageSize</a>());
<a name="l00307"></a>00307     d-&gt;m_wrapper-&gt;setOutputToFile(<span class="keyword">true</span>);
<a name="l00308"></a>00308     d-&gt;m_wrapper-&gt;setOutputFileName(d-&gt;m_tmpbuffer);
<a name="l00309"></a>00309     d-&gt;m_wrapper-&gt;setNumCopies(<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-qtcopies&quot;</span>).isEmpty() ? 1 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-qtcopies&quot;</span>).toInt());
<a name="l00310"></a>00310     <span class="keywordflow">if</span> (!<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-margin-top&quot;</span>).isEmpty())
<a name="l00311"></a>00311     {
<a name="l00318"></a>00318         <span class="keywordtype">int</span> res = <a class="code" href="classKPrinter.html#a5fc70b55c17254190eed4545f11488c5" title="Resturns the resolution of the current KPrinter object.">resolution</a>();
<a name="l00319"></a>00319         d-&gt;m_wrapper-&gt;setMargins(
<a name="l00320"></a>00320                 ( <span class="keywordtype">int</span> )( ( <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-margin-top&quot;</span>).toFloat() * res + 71 ) / 72 ),
<a name="l00321"></a>00321                 ( <span class="keywordtype">int</span> )( ( <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-margin-left&quot;</span>).toFloat() * res + 71 ) / 72 ),
<a name="l00322"></a>00322                 ( <span class="keywordtype">int</span> )( ( <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-margin-bottom&quot;</span>).toFloat() * res + 71 ) / 72 ),
<a name="l00323"></a>00323                 ( <span class="keywordtype">int</span> )( ( <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-margin-right&quot;</span>).toFloat() * res + 71 ) / 72 ) );
<a name="l00324"></a>00324     }
<a name="l00325"></a>00325     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( d-&gt;m_pagesize != NULL )
<a name="l00326"></a>00326     {
<a name="l00327"></a>00327         <span class="keywordtype">int</span> res = <a class="code" href="classKPrinter.html#a5fc70b55c17254190eed4545f11488c5" title="Resturns the resolution of the current KPrinter object.">resolution</a>();
<a name="l00328"></a>00328         DrPageSize *ps = d-&gt;m_pagesize;
<a name="l00329"></a>00329         <span class="keywordtype">int</span> top = ( int )( ps-&gt;topMargin() * res + 71 ) / 72;
<a name="l00330"></a>00330         <span class="keywordtype">int</span> left = ( int )( ps-&gt;leftMargin() * res + 71 ) / 72;
<a name="l00331"></a>00331         <span class="keywordtype">int</span> bottom = ( int )( ps-&gt;bottomMargin() * res + 71 ) / 72;
<a name="l00332"></a>00332         <span class="keywordtype">int</span> right = ( int )( ps-&gt;rightMargin() * res + 71 ) / 72;
<a name="l00333"></a>00333         <span class="keywordflow">if</span> ( !<a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0" title="See QPrinter::fullPage().">fullPage</a>() )
<a name="l00334"></a>00334         {
<a name="l00335"></a>00335             <span class="comment">// Printers can often print very close to the edges (PPD files say ImageArea==PaperDimension).</span>
<a name="l00336"></a>00336             <span class="comment">// But that doesn&#39;t mean it looks good. Apps which use setFullPage(false) assume that</span>
<a name="l00337"></a>00337             <span class="comment">// KPrinter will give them reasonable margins, so let&#39;s QMAX with defaults from Qt in that case.</span>
<a name="l00338"></a>00338             <span class="comment">// Keep this in sync with KPMarginPage::initPageSize</span>
<a name="l00339"></a>00339             <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> it, il, ib, ir;
<a name="l00340"></a>00340             d-&gt;m_wrapper-&gt;margins( &amp;it, &amp;il, &amp;ib, &amp;ir );
<a name="l00341"></a>00341             top = QMAX( top, (<span class="keywordtype">int</span>)it );
<a name="l00342"></a>00342             left = QMAX( left, (<span class="keywordtype">int</span>)il );
<a name="l00343"></a>00343             bottom = QMAX( bottom, (<span class="keywordtype">int</span>)ib );
<a name="l00344"></a>00344             right = QMAX( right, (<span class="keywordtype">int</span>)ir );
<a name="l00345"></a>00345         }
<a name="l00346"></a>00346         d-&gt;m_wrapper-&gt;setMargins( top, left, bottom, right );
<a name="l00347"></a>00347     }
<a name="l00348"></a>00348     <span class="comment">/*else</span>
<a name="l00349"></a>00349 <span class="comment">    {</span>
<a name="l00350"></a>00350 <span class="comment">        int res = d-&gt;m_wrapper-&gt;resolution();</span>
<a name="l00351"></a>00351 <span class="comment">        d-&gt;m_wrapper-&gt;setMargins( res/3, res/2, res/3, res/2 );</span>
<a name="l00352"></a>00352 <span class="comment">    }*/</span>
<a name="l00353"></a>00353     <span class="comment">// for special printers, copies are handled by Qt</span>
<a name="l00354"></a>00354     <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00355"></a>00355         d-&gt;m_wrapper-&gt;setNumCopies(<a class="code" href="classKPrinter.html#aa6946fd1f3c4d8ff005ad7a6d0c4ee1c" title="See QPrinter::numCopies().">numCopies</a>());
<a name="l00356"></a>00356 }
<a name="l00357"></a>00357 
<a name="l00358"></a><a class="code" href="classKPrinter.html#ae592e741799547bb58f044fc04ea1543">00358</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#ae592e741799547bb58f044fc04ea1543" title="Prints the files given in argument.">KPrinter::printFiles</a>(<span class="keyword">const</span> <a class="codeRef" href="qstringlist.html">QStringList</a>&amp; l, <span class="keywordtype">bool</span> flag, <span class="keywordtype">bool</span> startviewer)
<a name="l00359"></a>00359 {
<a name="l00360"></a>00360     <a class="codeRef" href="qstringlist.html">QStringList</a> files(l);
<a name="l00361"></a>00361     <span class="keywordtype">bool</span>        status(<span class="keyword">true</span>);
<a name="l00362"></a>00362 
<a name="l00363"></a>00363     <span class="comment">// First apply possible filters, and update &quot;remove&quot; flag if filters has</span>
<a name="l00364"></a>00364     <span class="comment">// been applied (result == 0, means nothing happened).</span>
<a name="l00365"></a>00365     <span class="keywordtype">int</span> fresult = d-&gt;m_impl-&gt;filterFiles(<span class="keyword">this</span>, files, flag);
<a name="l00366"></a>00366     <span class="keywordflow">if</span> (fresult == -1)
<a name="l00367"></a>00367     {
<a name="l00368"></a>00368         reportError(<span class="keyword">this</span>);
<a name="l00369"></a>00369         status = <span class="keyword">false</span>;
<a name="l00370"></a>00370     }
<a name="l00371"></a>00371     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (fresult == 1)
<a name="l00372"></a>00372         flag = <span class="keyword">true</span>;
<a name="l00373"></a>00373 
<a name="l00374"></a>00374     <span class="keywordflow">if</span> (status)
<a name="l00375"></a>00375     {
<a name="l00376"></a>00376         <span class="comment">// Automatic conversion to format supported by print system</span>
<a name="l00377"></a>00377         fresult = d-&gt;m_impl-&gt;autoConvertFiles(<span class="keyword">this</span>, files, flag);
<a name="l00378"></a>00378         <span class="keywordflow">if</span> (fresult == -1)
<a name="l00379"></a>00379         {
<a name="l00380"></a>00380             reportError(<span class="keyword">this</span>);
<a name="l00381"></a>00381             status = <span class="keyword">false</span>;
<a name="l00382"></a>00382         }
<a name="l00383"></a>00383         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (fresult == 1)
<a name="l00384"></a>00384             flag = <span class="keyword">true</span>;
<a name="l00385"></a>00385     }
<a name="l00386"></a>00386 
<a name="l00387"></a>00387     <span class="comment">// Continue if status is OK (filtering succeeded) and no output-to-file</span>
<a name="l00388"></a>00388     <span class="keywordflow">if</span> (status &amp;&amp; files.count() &gt; 0)
<a name="l00389"></a>00389     {
<a name="l00390"></a>00390         <span class="comment">// Show preview if needed (only possible for a single file !), and stop</span>
<a name="l00391"></a>00391         <span class="comment">// if the user requested it. Force preview if preview-only mode has been set: it</span>
<a name="l00392"></a>00392         <span class="comment">// then use by default the first file in the list.</span>
<a name="l00393"></a>00393         <span class="keywordflow">if</span> (((files.count() != 1 || <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-preview&quot;</span>) != <span class="stringliteral">&quot;1&quot;</span>) &amp;&amp; !d-&gt;m_previewonly) || doPreview(files[0]))
<a name="l00394"></a>00394         {
<a name="l00395"></a>00395             <span class="comment">// check if printing has been prepared (it may be not prepared if the KPrinter object is not</span>
<a name="l00396"></a>00396             <span class="comment">// use as a QPaintDevice object)</span>
<a name="l00397"></a>00397             preparePrinting();
<a name="l00398"></a>00398 
<a name="l00399"></a>00399             <span class="keywordflow">if</span> (!d-&gt;m_impl-&gt;printFiles(<span class="keyword">this</span>, files, flag))
<a name="l00400"></a>00400             {
<a name="l00401"></a>00401                 reportError(<span class="keyword">this</span>);
<a name="l00402"></a>00402                 status = <span class="keyword">false</span>;
<a name="l00403"></a>00403             }
<a name="l00404"></a>00404             <span class="keywordflow">else</span>
<a name="l00405"></a>00405             {
<a name="l00406"></a>00406                 <span class="keywordflow">if</span> (<span class="comment">/* !outputToFile() &amp;&amp; */</span> startviewer)
<a name="l00407"></a>00407                 {
<a name="l00408"></a>00408                     <a class="codeRef" href="qstringlist.html">QStringList</a> args;
<a name="l00409"></a>00409                     args &lt;&lt; <span class="stringliteral">&quot;-d&quot;</span>;
<a name="l00410"></a>00410                     args &lt;&lt; <a class="code" href="classKPrinter.html#a3535ad8e5bcb9f71983085ac40b4dab0" title="See QPrinter::printerName().">printerName</a>();
<a name="l00411"></a>00411                     args &lt;&lt; <span class="stringliteral">&quot;--noshow&quot;</span>;
<a name="l00412"></a>00412                     kapp-&gt;kdeinitExec(<span class="stringliteral">&quot;kjobviewer&quot;</span>, args);
<a name="l00413"></a>00413                 }
<a name="l00414"></a>00414             }
<a name="l00415"></a>00415         }
<a name="l00416"></a>00416         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (flag)
<a name="l00417"></a>00417         <span class="comment">// situation: only one file, it has been previewed and printing has been canceled, then</span>
<a name="l00418"></a>00418         <span class="comment">//            we should remove the file ourself</span>
<a name="l00419"></a>00419         {
<a name="l00420"></a>00420             <a class="codeRef" href="qfile.html#remove">QFile::remove</a>(files[0]);
<a name="l00421"></a>00421         }
<a name="l00422"></a>00422     }
<a name="l00423"></a>00423     finishPrinting();
<a name="l00424"></a>00424     <span class="keywordflow">return</span> status;
<a name="l00425"></a>00425 }
<a name="l00426"></a>00426 
<a name="l00427"></a>00427 <span class="keywordtype">bool</span> KPrinter::doPreview(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; file)
<a name="l00428"></a>00428 {
<a name="l00429"></a>00429     d-&gt;m_impl-&gt;statusMessage(i18n(<span class="stringliteral">&quot;Previewing...&quot;</span>), <span class="keyword">this</span>);
<a name="l00430"></a>00430     d-&gt;m_impl-&gt;statusMessage(QString::null, <span class="keyword">this</span>);
<a name="l00431"></a>00431     <span class="keywordflow">return</span> KPrintPreview::preview(file, d-&gt;m_previewonly, d-&gt;m_parentId);
<a name="l00432"></a>00432 }
<a name="l00433"></a>00433 
<a name="l00434"></a>00434 <span class="keywordtype">void</span> KPrinter::preparePrinting()
<a name="l00435"></a>00435 {
<a name="l00436"></a>00436     <span class="comment">// check if already prepared (-&gt; do nothing)</span>
<a name="l00437"></a>00437     <span class="keywordflow">if</span> (d-&gt;m_ready) <span class="keywordflow">return</span>;
<a name="l00438"></a>00438 
<a name="l00439"></a>00439     <span class="comment">// re-initialize error</span>
<a name="l00440"></a>00440     <a class="code" href="classKPrinter.html#a9a3c2e6176797e69b158edac2f6a7868" title="Sets the last error message.">setErrorMessage</a>(QString::null);
<a name="l00441"></a>00441 
<a name="l00442"></a>00442     <span class="comment">// re-initialize margins and page size (by default, use Qt mechanism)</span>
<a name="l00443"></a>00443     <a class="code" href="classKPrinter.html#a2aed8fa276ace8a2a1b17ad8459f9331" title="DO NOT USE, WILL BE REMOVED.">setRealPageSize</a>(NULL);
<a name="l00444"></a>00444 
<a name="l00445"></a>00445     <span class="comment">// print-system-specific setup, only if not printing to file</span>
<a name="l00446"></a>00446     <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>) != <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00447"></a>00447         d-&gt;m_impl-&gt;preparePrinting(<span class="keyword">this</span>);
<a name="l00448"></a>00448 
<a name="l00449"></a>00449     <span class="comment">// set the correct resolution, if needed (or reset it)</span>
<a name="l00450"></a>00450     <span class="keywordtype">int</span> res = <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>( <span class="stringliteral">&quot;kde-resolution&quot;</span> ).<a class="codeRef" href="qstring.html#toInt">toInt</a>();
<a name="l00451"></a>00451     <span class="keywordflow">if</span> ( d-&gt;m_useprinterres &amp;&amp; res &gt; 0 )
<a name="l00452"></a>00452         d-&gt;m_wrapper-&gt;setResolution( res );
<a name="l00453"></a>00453     <span class="keywordflow">else</span>
<a name="l00454"></a>00454         d-&gt;m_wrapper-&gt;setResolution( d-&gt;m_defaultres );
<a name="l00455"></a>00455 
<a name="l00456"></a>00456     <span class="comment">// standard Qt settings</span>
<a name="l00457"></a>00457     <a class="code" href="classKPrinter.html#a0891873329771d4e9f34459e85e7a554">translateQtOptions</a>();
<a name="l00458"></a>00458 
<a name="l00459"></a>00459     d-&gt;m_ready = <span class="keyword">true</span>;
<a name="l00460"></a>00460 dumpOptions(d-&gt;m_options);
<a name="l00461"></a>00461 }
<a name="l00462"></a>00462 
<a name="l00463"></a>00463 <span class="keywordtype">void</span> KPrinter::finishPrinting()
<a name="l00464"></a>00464 {
<a name="l00465"></a>00465     d-&gt;m_ready = <span class="keyword">false</span>;
<a name="l00466"></a>00466     <span class="comment">// close the status window</span>
<a name="l00467"></a>00467     d-&gt;m_impl-&gt;statusMessage(QString::null, <span class="keyword">this</span>);
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 
<a name="l00470"></a><a class="code" href="classKPrinter.html#a96ffeb8f69c66c5d30a67d96facc8c4d">00470</a> <a class="codeRef" href="qvaluelist.html">QValueList&lt;int&gt;</a> <a class="code" href="classKPrinter.html#a96ffeb8f69c66c5d30a67d96facc8c4d" title="Returns the page list to be printed, correpsonding to the options selected by the user...">KPrinter::pageList</a>()<span class="keyword"> const</span>
<a name="l00471"></a>00471 <span class="keyword"></span>{
<a name="l00472"></a>00472     <a class="codeRef" href="qvaluelist.html">QValueList&lt;int&gt;</a> list;
<a name="l00473"></a>00473     <span class="keywordtype">int</span> mp(<a class="code" href="classKPrinter.html#a752a5bdc83ca4e7628caf855c1ee0f08" title="See QPrinter::minPage().">minPage</a>()), MP(<a class="code" href="classKPrinter.html#ac5152fd05c0841958433d97552431442" title="See QPrinter::maxPage().">maxPage</a>());
<a name="l00474"></a>00474     <span class="keywordflow">if</span> (mp &gt; 0 &amp;&amp; MP &gt; 0 &amp;&amp; MP &gt;= mp)
<a name="l00475"></a>00475     { <span class="comment">// do something only if bounds specified</span>
<a name="l00476"></a>00476         <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-current&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span>)
<a name="l00477"></a>00477         { <span class="comment">// print only current page</span>
<a name="l00478"></a>00478             <span class="keywordtype">int</span> pp = <a class="code" href="classKPrinter.html#ac30ce3d0a62d69abef8599f9ce2eb533" title="Returns the current page number.">currentPage</a>();
<a name="l00479"></a>00479             <span class="keywordflow">if</span> (pp &gt;= mp &amp;&amp; pp &lt;= MP) list.<a class="codeRef" href="qvaluelist.html#append">append</a>(pp);
<a name="l00480"></a>00480         }
<a name="l00481"></a>00481         <span class="keywordflow">else</span>
<a name="l00482"></a>00482         {
<a name="l00483"></a>00483             <span class="comment">// process range specification</span>
<a name="l00484"></a>00484             <span class="keywordflow">if</span> (!<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-range&quot;</span>).isEmpty())
<a name="l00485"></a>00485             {
<a name="l00486"></a>00486                 <a class="codeRef" href="qstringlist.html">QStringList</a> ranges = <a class="codeRef" href="qstringlist.html#split">QStringList::split</a>(<span class="charliteral">&#39;,&#39;</span>,<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-range&quot;</span>),<span class="keyword">false</span>);
<a name="l00487"></a>00487                 <span class="keywordflow">for</span> (QStringList::ConstIterator it=ranges.begin();it!=ranges.end();++it)
<a name="l00488"></a>00488                 {
<a name="l00489"></a>00489                     <span class="keywordtype">int</span> p = (*it).find(<span class="charliteral">&#39;-&#39;</span>);
<a name="l00490"></a>00490                     <span class="keywordtype">bool</span>    ok;
<a name="l00491"></a>00491                     <span class="keywordflow">if</span> (p == -1)
<a name="l00492"></a>00492                     {
<a name="l00493"></a>00493                         <span class="keywordtype">int</span> pp = (*it).toInt(&amp;ok);
<a name="l00494"></a>00494                         <span class="keywordflow">if</span> (ok &amp;&amp; pp &gt;= mp &amp;&amp; pp &lt;= MP)
<a name="l00495"></a>00495                             list.<a class="codeRef" href="qvaluelist.html#append">append</a>(pp);
<a name="l00496"></a>00496                     }
<a name="l00497"></a>00497                     <span class="keywordflow">else</span>
<a name="l00498"></a>00498                     {
<a name="l00499"></a>00499                         <span class="keywordtype">int</span> p1(0), p2(0);
<a name="l00500"></a>00500                         p1 = (*it).left(p).toInt(&amp;ok);
<a name="l00501"></a>00501                         <span class="keywordflow">if</span> (ok) p2 = (*it).right((*it).length()-p-1).toInt(&amp;ok);
<a name="l00502"></a>00502                         <span class="keywordflow">if</span> (ok &amp;&amp; p1 &lt;= p2)
<a name="l00503"></a>00503                         {
<a name="l00504"></a>00504                             <span class="comment">// clip to min/max</span>
<a name="l00505"></a>00505                             p1 = QMAX(mp,p1);
<a name="l00506"></a>00506                             p2 = QMIN(MP,p2);
<a name="l00507"></a>00507                             <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=p1;i&lt;=p2;i++)
<a name="l00508"></a>00508                                 list.<a class="codeRef" href="qvaluelist.html#append">append</a>(i);
<a name="l00509"></a>00509                         }
<a name="l00510"></a>00510                     }
<a name="l00511"></a>00511                 }
<a name="l00512"></a>00512             }
<a name="l00513"></a>00513             <span class="keywordflow">else</span>
<a name="l00514"></a>00514             { <span class="comment">// add all pages between min and max</span>
<a name="l00515"></a>00515                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=mp;i&lt;=MP;i++) list.<a class="codeRef" href="qvaluelist.html#append">append</a>(i);
<a name="l00516"></a>00516             }
<a name="l00517"></a>00517 
<a name="l00518"></a>00518             <span class="comment">// revert the list if needed</span>
<a name="l00519"></a>00519             <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#acb61517a6f1fab18ccac4a3fbc618b6d" title="See QPrinter::pageOrder().">pageOrder</a>() == LastPageFirst)
<a name="l00520"></a>00520             {
<a name="l00521"></a>00521                 <span class="keywordflow">for</span> (uint i=0;i&lt;(list.<a class="codeRef" href="qvaluelist.html#count">count</a>()/2);i++)
<a name="l00522"></a>00522                     qSwap(list[i],list[list.<a class="codeRef" href="qvaluelist.html#count">count</a>()-1-i]);
<a name="l00523"></a>00523             }
<a name="l00524"></a>00524 
<a name="l00525"></a>00525             <span class="comment">// select page set if needed</span>
<a name="l00526"></a>00526             <span class="keywordflow">if</span> (<a class="code" href="classKPrinter.html#ab08533094878a1cf2cb20a6216080b65" title="Returns the page set of the current KPrinter object.">pageSet</a>() != AllPages)
<a name="l00527"></a>00527             {
<a name="l00528"></a>00528                 <span class="keywordtype">bool</span>    keepEven = (<a class="code" href="classKPrinter.html#ab08533094878a1cf2cb20a6216080b65" title="Returns the page set of the current KPrinter object.">pageSet</a>() == EvenPages);
<a name="l00529"></a>00529                 <span class="keywordflow">for</span> (<a class="codeRef" href="qvaluelist.html">QValueList&lt;int&gt;::Iterator</a> it=list.<a class="codeRef" href="qvaluelist.html#begin">begin</a>();it!=list.<a class="codeRef" href="qvaluelist.html#end">end</a>();)
<a name="l00530"></a>00530                     <span class="keywordflow">if</span> ((((*it) % 2) != 0 &amp;&amp; keepEven) ||
<a name="l00531"></a>00531                         (((*it) % 2) == 0 &amp;&amp; !keepEven)) it = list.<a class="codeRef" href="qvaluelist.html#remove">remove</a>(it);
<a name="l00532"></a>00532                     <span class="keywordflow">else</span> ++it;
<a name="l00533"></a>00533             }
<a name="l00534"></a>00534         }
<a name="l00535"></a>00535     }
<a name="l00536"></a>00536     <span class="keywordflow">return</span> list;
<a name="l00537"></a>00537 }
<a name="l00538"></a>00538 
<a name="l00539"></a>00539 <span class="comment">//**************************************************************************************</span>
<a name="l00540"></a>00540 <span class="comment">// QPrinter interface</span>
<a name="l00541"></a>00541 <span class="comment">//**************************************************************************************</span>
<a name="l00542"></a>00542 
<a name="l00543"></a><a class="code" href="classKPrinter.html#aa6946fd1f3c4d8ff005ad7a6d0c4ee1c">00543</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#aa6946fd1f3c4d8ff005ad7a6d0c4ee1c" title="See QPrinter::numCopies().">KPrinter::numCopies</a>()<span class="keyword"> const</span>
<a name="l00544"></a>00544 <span class="keyword"></span>{
<a name="l00545"></a>00545     <span class="keywordtype">bool</span>    ok;
<a name="l00546"></a>00546     <span class="keywordtype">int</span> p = <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-copies&quot;</span>).<a class="codeRef" href="qstring.html#toInt">toInt</a>(&amp;ok);
<a name="l00547"></a>00547     <span class="keywordflow">return</span> (ok ? p : 1);
<a name="l00548"></a>00548 }
<a name="l00549"></a>00549 
<a name="l00550"></a><a class="code" href="classKPrinter.html#a4e5a1ba05b3bf9b1b3864b94806691e6">00550</a> <a class="codeRef" href="qsize.html">QSize</a> <a class="code" href="classKPrinter.html#a4e5a1ba05b3bf9b1b3864b94806691e6" title="See QPrinter::margins().">KPrinter::margins</a>()<span class="keyword"> const</span>
<a name="l00551"></a>00551 <span class="keyword"></span>{
<a name="l00552"></a>00552     <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;margins();
<a name="l00553"></a>00553 }
<a name="l00554"></a>00554 
<a name="l00555"></a>00555 <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a4e5a1ba05b3bf9b1b3864b94806691e6" title="See QPrinter::margins().">KPrinter::margins</a>( uint *top, uint *left, uint *bottom, uint *right )<span class="keyword"> const</span>
<a name="l00556"></a>00556 <span class="keyword"></span>{
<a name="l00557"></a>00557     d-&gt;m_wrapper-&gt;margins( top, left, bottom, right );
<a name="l00558"></a>00558 }
<a name="l00559"></a>00559 
<a name="l00560"></a>00560 <span class="keywordtype">int</span> KPrinter::metric(<span class="keywordtype">int</span> m)<span class="keyword"> const</span>
<a name="l00561"></a>00561 <span class="keyword"></span>{
<a name="l00562"></a>00562     <span class="keywordflow">if</span> (d-&gt;m_pagesize == NULL || !<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>( <span class="stringliteral">&quot;kde-printsize&quot;</span> ).isEmpty())
<a name="l00563"></a>00563         <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;qprinterMetric(m);
<a name="l00564"></a>00564 
<a name="l00565"></a>00565     <span class="keywordtype">int</span> val(0);
<a name="l00566"></a>00566     <span class="keywordtype">bool</span>    land = (<a class="code" href="classKPrinter.html#a254dc41b19b57f78276010ed80055341" title="See QPrinter::orientation().">orientation</a>() == KPrinter::Landscape);
<a name="l00567"></a>00567     uint    res(d-&gt;m_wrapper-&gt;resolution()), top = res/2, left = res/2, bottom = res/3, right = res/2;
<a name="l00568"></a>00568     <a class="code" href="classKPrinter.html#a4e5a1ba05b3bf9b1b3864b94806691e6" title="See QPrinter::margins().">margins</a>( &amp;top, &amp;left, &amp;bottom, &amp;right );
<a name="l00569"></a>00569     <span class="keywordflow">switch</span> ( m )
<a name="l00570"></a>00570     {
<a name="l00571"></a>00571         <span class="keywordflow">case</span> QPaintDeviceMetrics::PdmWidth:
<a name="l00572"></a>00572             val = (land ? ( int )d-&gt;m_pagesize-&gt;pageHeight() : ( int )d-&gt;m_pagesize-&gt;pageWidth());
<a name="l00573"></a>00573             <span class="keywordflow">if</span> ( res != 72 )
<a name="l00574"></a>00574                 val = (val * res + 36) / 72;
<a name="l00575"></a>00575             <span class="keywordflow">if</span> ( !<a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0" title="See QPrinter::fullPage().">fullPage</a>() )
<a name="l00576"></a>00576                 val -= ( left + right );
<a name="l00577"></a>00577             <span class="keywordflow">break</span>;
<a name="l00578"></a>00578         <span class="keywordflow">case</span> QPaintDeviceMetrics::PdmHeight:
<a name="l00579"></a>00579             val = (land ? ( int )d-&gt;m_pagesize-&gt;pageWidth() : ( int )d-&gt;m_pagesize-&gt;pageHeight());
<a name="l00580"></a>00580             <span class="keywordflow">if</span> ( res != 72 )
<a name="l00581"></a>00581                 val = (val * res + 36) / 72;
<a name="l00582"></a>00582             <span class="keywordflow">if</span> ( !<a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0" title="See QPrinter::fullPage().">fullPage</a>() )
<a name="l00583"></a>00583                 val -= ( top + bottom );
<a name="l00584"></a>00584             <span class="keywordflow">break</span>;
<a name="l00585"></a>00585         <span class="keywordflow">case</span> QPaintDeviceMetrics::PdmWidthMM:
<a name="l00586"></a>00586             val = metric( QPaintDeviceMetrics::PdmWidth );
<a name="l00587"></a>00587             val = (val * 254 + 5*res) / (10*res); <span class="comment">// +360 to get the right rounding</span>
<a name="l00588"></a>00588             <span class="keywordflow">break</span>;
<a name="l00589"></a>00589         <span class="keywordflow">case</span> QPaintDeviceMetrics::PdmHeightMM:
<a name="l00590"></a>00590             val = metric( QPaintDeviceMetrics::PdmHeight );
<a name="l00591"></a>00591             val = (val * 254 + 5*res) / (10*res);
<a name="l00592"></a>00592             <span class="keywordflow">break</span>;
<a name="l00593"></a>00593         <span class="keywordflow">default</span>:
<a name="l00594"></a>00594             val = d-&gt;m_wrapper-&gt;qprinterMetric(m);
<a name="l00595"></a>00595             <span class="keywordflow">break</span>;
<a name="l00596"></a>00596     }
<a name="l00597"></a>00597     <span class="keywordflow">return</span> val;
<a name="l00598"></a>00598 }
<a name="l00599"></a>00599 
<a name="l00600"></a><a class="code" href="classKPrinter.html#af18187b482d5996f32d34ac67caa4ee8">00600</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#af18187b482d5996f32d34ac67caa4ee8" title="See QPrinter::setOrientation().">KPrinter::setOrientation</a>(<a class="code" href="classKPrinter.html#af41ac751bb785b2c998255180035ad89" title="Defines the orientation of the paper.">Orientation</a> o)
<a name="l00601"></a>00601 {
<a name="l00602"></a>00602     KMFactory::self()-&gt;settings()-&gt;orientation = o;
<a name="l00603"></a>00603     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-orientation&quot;</span>,(o == Landscape ? <span class="stringliteral">&quot;Landscape&quot;</span> : <span class="stringliteral">&quot;Portrait&quot;</span>));
<a name="l00604"></a>00604     d-&gt;m_impl-&gt;broadcastOption(<span class="stringliteral">&quot;kde-orientation&quot;</span>,(o == Landscape ? <span class="stringliteral">&quot;Landscape&quot;</span> : <span class="stringliteral">&quot;Portrait&quot;</span>));
<a name="l00605"></a>00605     d-&gt;m_impl-&gt;broadcastOption( <span class="stringliteral">&quot;kde-orientation-fixed&quot;</span>, <span class="stringliteral">&quot;1&quot;</span> );
<a name="l00606"></a>00606 }
<a name="l00607"></a>00607 
<a name="l00608"></a>00608 <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">KPrinter::setOption</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; key, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; value, <span class="keywordtype">bool</span> broadcast )
<a name="l00609"></a>00609 {
<a name="l00610"></a>00610     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>( key, value );
<a name="l00611"></a>00611     <span class="keywordflow">if</span> ( broadcast )
<a name="l00612"></a>00612         d-&gt;m_impl-&gt;broadcastOption( key, value );
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614 
<a name="l00615"></a><a class="code" href="classKPrinter.html#a2053831dec48bf330b41547ca72227c6">00615</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a2053831dec48bf330b41547ca72227c6" title="See QPrinter::setPageSize().">KPrinter::setPageSize</a>(<a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">PageSize</a> s)
<a name="l00616"></a>00616 {
<a name="l00617"></a>00617     KMFactory::self()-&gt;settings()-&gt;pageSize = s;
<a name="l00618"></a>00618     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-pagesize&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>((<span class="keywordtype">int</span>)s),<span class="keyword">true</span>);
<a name="l00619"></a>00619     d-&gt;m_impl-&gt;broadcastOption( <span class="stringliteral">&quot;kde-pagesize-fixed&quot;</span>, <span class="stringliteral">&quot;1&quot;</span> );
<a name="l00620"></a>00620 }
<a name="l00621"></a>00621 
<a name="l00622"></a><a class="code" href="classKPrinter.html#a689ca281f262e253bd3b22ada060ec1c">00622</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a689ca281f262e253bd3b22ada060ec1c" title="Sets the option set in one operation.">KPrinter::setOptions</a>(<span class="keyword">const</span> <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>&amp; opts)
<a name="l00623"></a>00623 { <span class="comment">// This functions remove all options except those with &quot;kde-...&quot;</span>
<a name="l00624"></a>00624   <span class="comment">// which correspond to externally-sets options (use the value</span>
<a name="l00625"></a>00625   <span class="comment">// from &quot;opts&quot; if specified</span>
<a name="l00626"></a>00626     <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>   tmpset = d-&gt;m_options;
<a name="l00627"></a>00627     d-&gt;m_options = opts;
<a name="l00628"></a>00628     <span class="comment">// remove some problematic options that may not be overwritten (ugly hack).</span>
<a name="l00629"></a>00629     <span class="comment">// Default values will be used instead, except if the dialog has set new ones.</span>
<a name="l00630"></a>00630     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-pagesize&quot;</span>);
<a name="l00631"></a>00631     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>( <span class="stringliteral">&quot;kde-printsize&quot;</span> );
<a name="l00632"></a>00632     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-orientation&quot;</span>);
<a name="l00633"></a>00633     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-colormode&quot;</span>);
<a name="l00634"></a>00634     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-margin-top&quot;</span>);
<a name="l00635"></a>00635     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-margin-left&quot;</span>);
<a name="l00636"></a>00636     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-margin-bottom&quot;</span>);
<a name="l00637"></a>00637     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>(<span class="stringliteral">&quot;kde-margin-right&quot;</span>);
<a name="l00638"></a>00638     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>( <span class="stringliteral">&quot;kde-resolution&quot;</span> );
<a name="l00639"></a>00639     tmpset.<a class="codeRef" href="qmap.html#remove">remove</a>( <span class="stringliteral">&quot;kde-fonts&quot;</span> );
<a name="l00640"></a>00640     <span class="keywordflow">for</span> (<a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;::ConstIterator</a> it=tmpset.<a class="codeRef" href="qmap.html#begin">begin</a>();it!=tmpset.<a class="codeRef" href="qmap.html#end">end</a>();++it)
<a name="l00641"></a>00641         <span class="keywordflow">if</span> (it.key().left(4) == <span class="stringliteral">&quot;kde-&quot;</span> &amp;&amp; !(d-&gt;m_options.contains(it.key())))
<a name="l00642"></a>00642             d-&gt;m_options[it.key()] = it.data();
<a name="l00643"></a>00643 }
<a name="l00644"></a>00644 
<a name="l00645"></a><a class="code" href="classKPrinter.html#a6593e3ff6779399074908296bb5bdb95">00645</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a6593e3ff6779399074908296bb5bdb95" title="For internal use only.">KPrinter::initOptions</a>(<span class="keyword">const</span> <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>&amp; opts)
<a name="l00646"></a>00646 { <span class="comment">// This function can be used to initialize the KPrinter object just after</span>
<a name="l00647"></a>00647   <span class="comment">// creation to set some options. Non global options will be propagated to</span>
<a name="l00648"></a>00648   <span class="comment">// all listed printers (non-global =&gt; start with &quot;kde-...&quot;)</span>
<a name="l00649"></a>00649     <span class="keywordflow">for</span> (<a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;::ConstIterator</a> it=opts.<a class="codeRef" href="qmap.html#begin">begin</a>(); it!=opts.<a class="codeRef" href="qmap.html#end">end</a>(); ++it)
<a name="l00650"></a>00650     {
<a name="l00651"></a>00651         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(it.key(), it.data());
<a name="l00652"></a>00652         <span class="keywordflow">if</span> (it.key().left(4) != <span class="stringliteral">&quot;kde-&quot;</span>)
<a name="l00653"></a>00653             d-&gt;m_impl-&gt;broadcastOption(it.key(),it.data());
<a name="l00654"></a>00654     }
<a name="l00655"></a>00655 }
<a name="l00656"></a>00656 
<a name="l00657"></a>00657 <span class="keywordtype">void</span> KPrinter::reload()
<a name="l00658"></a>00658 {
<a name="l00659"></a>00659     d-&gt;m_impl = KMFactory::self()-&gt;printerImplementation();
<a name="l00660"></a>00660     <span class="keywordtype">int</span> global = KMFactory::self()-&gt;settings()-&gt;orientation;
<a name="l00661"></a>00661     <span class="keywordflow">if</span> (global != -1) <a class="code" href="classKPrinter.html#af18187b482d5996f32d34ac67caa4ee8" title="See QPrinter::setOrientation().">setOrientation</a>((<a class="code" href="classKPrinter.html#af41ac751bb785b2c998255180035ad89" title="Defines the orientation of the paper.">KPrinter::Orientation</a>)global);
<a name="l00662"></a>00662     global = KMFactory::self()-&gt;settings()-&gt;pageSize;
<a name="l00663"></a>00663     <span class="keywordflow">if</span> (global != -1) <a class="code" href="classKPrinter.html#a2053831dec48bf330b41547ca72227c6" title="See QPrinter::setPageSize().">setPageSize</a>((<a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">KPrinter::PageSize</a>)global);
<a name="l00664"></a>00664     <span class="comment">//initOptions(d-&gt;m_options);</span>
<a name="l00665"></a>00665 }
<a name="l00666"></a>00666 
<a name="l00667"></a><a class="code" href="classKPrinter.html#af0a86c9b60878eea68401e16d8fab3af">00667</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#af0a86c9b60878eea68401e16d8fab3af" title="Configure the KPrinter object to be used with the printer named prname.">KPrinter::autoConfigure</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; prname, <a class="codeRef" href="qwidget.html">QWidget</a> *parent)
<a name="l00668"></a>00668 {
<a name="l00669"></a>00669     KMManager   *mgr = KMManager::self();
<a name="l00670"></a>00670     KMPrinter   *mprt(0);
<a name="l00671"></a>00671 
<a name="l00672"></a>00672     mgr-&gt;printerList(<span class="keyword">false</span>);
<a name="l00673"></a>00673     <span class="keywordflow">if</span> (prname.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>())
<a name="l00674"></a>00674         mprt = mgr-&gt;defaultPrinter();
<a name="l00675"></a>00675     <span class="keywordflow">else</span>
<a name="l00676"></a>00676         mprt = mgr-&gt;findPrinter(prname);
<a name="l00677"></a>00677 
<a name="l00678"></a>00678     <span class="keywordflow">if</span> (mprt)
<a name="l00679"></a>00679         <span class="keywordflow">return</span> mprt-&gt;autoConfigure(<span class="keyword">this</span>, parent);
<a name="l00680"></a>00680     <span class="keywordflow">else</span>
<a name="l00681"></a>00681         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00682"></a>00682 }
<a name="l00683"></a>00683 
<a name="l00684"></a>00684 <span class="comment">//**************************************************************************************</span>
<a name="l00685"></a>00685 <span class="comment">// Util functions</span>
<a name="l00686"></a>00686 <span class="comment">//**************************************************************************************</span>
<a name="l00687"></a>00687 
<a name="l00688"></a>00688 <span class="keywordtype">void</span> reportError(<a class="code" href="classKPrinter.html" title="This class is the main interface to access the KDE print framework.">KPrinter</a> *p)
<a name="l00689"></a>00689 {
<a name="l00690"></a>00690     <span class="keywordflow">if</span> (!KNotifyClient::event(0,<span class="stringliteral">&quot;printerror&quot;</span>,i18n(<span class="stringliteral">&quot;&lt;p&gt;&lt;nobr&gt;A print error occurred. Error message received from system:&lt;/nobr&gt;&lt;/p&gt;&lt;br&gt;%1&quot;</span>).arg(p-&gt;<a class="code" href="classKPrinter.html#aa8931f6878ba40f1e248e549bdb4b021" title="Returns the last error message issued by the print system.">errorMessage</a>())))
<a name="l00691"></a>00691         kdDebug(500) &lt;&lt; <span class="stringliteral">&quot;could not send notify event&quot;</span> &lt;&lt; endl;
<a name="l00692"></a>00692 }
<a name="l00693"></a>00693 
<a name="l00694"></a>00694 <a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">KPrinter::PageSize</a> pageNameToPageSize(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; _name)
<a name="l00695"></a>00695 {
<a name="l00696"></a>00696     <a class="codeRef" href="qstring.html">QString</a> name = _name.<a class="codeRef" href="qstring.html#upper">upper</a>();
<a name="l00697"></a>00697     <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;LETTER&quot;</span>) <span class="keywordflow">return</span> KPrinter::Letter;
<a name="l00698"></a>00698     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;LEGAL&quot;</span>) <span class="keywordflow">return</span> KPrinter::Legal;
<a name="l00699"></a>00699     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A4&quot;</span>) <span class="keywordflow">return</span> KPrinter::A4;
<a name="l00700"></a>00700     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A3&quot;</span>) <span class="keywordflow">return</span> KPrinter::A3;
<a name="l00701"></a>00701     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;EXECUTIVE&quot;</span>) <span class="keywordflow">return</span> KPrinter::Executive;
<a name="l00702"></a>00702     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;LEDGER&quot;</span>) <span class="keywordflow">return</span> KPrinter::Ledger;
<a name="l00703"></a>00703     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;TABLOID&quot;</span>) <span class="keywordflow">return</span> KPrinter::Tabloid;
<a name="l00704"></a>00704     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;FOLIO&quot;</span>) <span class="keywordflow">return</span> KPrinter::Folio;
<a name="l00705"></a>00705     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A5&quot;</span>) <span class="keywordflow">return</span> KPrinter::A5;
<a name="l00706"></a>00706     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A6&quot;</span>) <span class="keywordflow">return</span> KPrinter::A6;
<a name="l00707"></a>00707     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A7&quot;</span>) <span class="keywordflow">return</span> KPrinter::A7;
<a name="l00708"></a>00708     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A8&quot;</span>) <span class="keywordflow">return</span> KPrinter::A8;
<a name="l00709"></a>00709     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A9&quot;</span>) <span class="keywordflow">return</span> KPrinter::A9;
<a name="l00710"></a>00710     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A2&quot;</span>) <span class="keywordflow">return</span> KPrinter::A2;
<a name="l00711"></a>00711     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A1&quot;</span>) <span class="keywordflow">return</span> KPrinter::A1;
<a name="l00712"></a>00712     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;A0&quot;</span>) <span class="keywordflow">return</span> KPrinter::A0;
<a name="l00713"></a>00713     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B0&quot;</span> || name == <span class="stringliteral">&quot;B0ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B0;
<a name="l00714"></a>00714     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B1&quot;</span> || name == <span class="stringliteral">&quot;B1ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B1;
<a name="l00715"></a>00715     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B2&quot;</span> || name == <span class="stringliteral">&quot;B2ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B2;
<a name="l00716"></a>00716     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B3&quot;</span> || name == <span class="stringliteral">&quot;B3ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B3;
<a name="l00717"></a>00717     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B4&quot;</span> || name == <span class="stringliteral">&quot;B4ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B4;
<a name="l00718"></a>00718     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B5&quot;</span> || name == <span class="stringliteral">&quot;B5ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B5;
<a name="l00719"></a>00719     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B6&quot;</span> || name == <span class="stringliteral">&quot;B6ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B6;
<a name="l00720"></a>00720     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B7&quot;</span> || name == <span class="stringliteral">&quot;B7ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B7;
<a name="l00721"></a>00721     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B8&quot;</span> || name == <span class="stringliteral">&quot;B8ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B8;
<a name="l00722"></a>00722     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B9&quot;</span> || name == <span class="stringliteral">&quot;B9ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B9;
<a name="l00723"></a>00723     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;B10&quot;</span> || name == <span class="stringliteral">&quot;B10ISO&quot;</span>) <span class="keywordflow">return</span> KPrinter::B10;
<a name="l00724"></a>00724     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;C5&quot;</span> || name == <span class="stringliteral">&quot;C5E&quot;</span> || name == <span class="stringliteral">&quot;ENVC5&quot;</span>) <span class="keywordflow">return</span> KPrinter::C5E;
<a name="l00725"></a>00725     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;DL&quot;</span> || name == <span class="stringliteral">&quot;DLE&quot;</span> || name == <span class="stringliteral">&quot;ENVDL&quot;</span>) <span class="keywordflow">return</span> KPrinter::DLE;
<a name="l00726"></a>00726     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;COMM10&quot;</span> || name == <span class="stringliteral">&quot;COM10&quot;</span> || name == <span class="stringliteral">&quot;ENV10&quot;</span>) <span class="keywordflow">return</span> KPrinter::Comm10E;
<a name="l00727"></a>00727     <span class="keywordflow">else</span> <span class="keywordflow">return</span> KPrinter::A4;
<a name="l00728"></a>00728 }
<a name="l00729"></a>00729 
<a name="l00730"></a>00730 <span class="keyword">const</span> <span class="keywordtype">char</span>* pageSizeToPageName(<a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">KPrinter::PageSize</a> s)
<a name="l00731"></a>00731 {
<a name="l00732"></a>00732     <span class="keywordflow">switch</span>(s)
<a name="l00733"></a>00733     {
<a name="l00734"></a>00734         <span class="keywordflow">case</span> KPrinter::Letter: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Letter&quot;</span>;
<a name="l00735"></a>00735         <span class="keywordflow">case</span> KPrinter::Legal: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Legal&quot;</span>;
<a name="l00736"></a>00736         <span class="keywordflow">case</span> KPrinter::A4: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A4&quot;</span>;
<a name="l00737"></a>00737         <span class="keywordflow">case</span> KPrinter::A3: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A3&quot;</span>;
<a name="l00738"></a>00738         <span class="keywordflow">case</span> KPrinter::Executive: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Executive&quot;</span>;
<a name="l00739"></a>00739         <span class="keywordflow">case</span> KPrinter::Ledger: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Ledger&quot;</span>;
<a name="l00740"></a>00740         <span class="keywordflow">case</span> KPrinter::Tabloid: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Tabloid&quot;</span>;
<a name="l00741"></a>00741         <span class="keywordflow">case</span> KPrinter::Folio: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Folio&quot;</span>;
<a name="l00742"></a>00742         <span class="keywordflow">case</span> KPrinter::A5: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A5&quot;</span>;
<a name="l00743"></a>00743         <span class="keywordflow">case</span> KPrinter::A6: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A6&quot;</span>;
<a name="l00744"></a>00744         <span class="keywordflow">case</span> KPrinter::A7: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A7&quot;</span>;
<a name="l00745"></a>00745         <span class="keywordflow">case</span> KPrinter::A8: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A8&quot;</span>;
<a name="l00746"></a>00746         <span class="keywordflow">case</span> KPrinter::A9: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A9&quot;</span>;
<a name="l00747"></a>00747         <span class="keywordflow">case</span> KPrinter::A2: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A2&quot;</span>;
<a name="l00748"></a>00748         <span class="keywordflow">case</span> KPrinter::A1: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A1&quot;</span>;
<a name="l00749"></a>00749         <span class="keywordflow">case</span> KPrinter::A0: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A0&quot;</span>;
<a name="l00750"></a>00750         <span class="keywordflow">case</span> KPrinter::B0: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B0&quot;</span>;
<a name="l00751"></a>00751         <span class="keywordflow">case</span> KPrinter::B1: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B1&quot;</span>;
<a name="l00752"></a>00752         <span class="keywordflow">case</span> KPrinter::B2: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B2&quot;</span>;
<a name="l00753"></a>00753         <span class="keywordflow">case</span> KPrinter::B3: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B3&quot;</span>;
<a name="l00754"></a>00754         <span class="keywordflow">case</span> KPrinter::B4: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B4&quot;</span>;
<a name="l00755"></a>00755         <span class="keywordflow">case</span> KPrinter::B5: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B5&quot;</span>;
<a name="l00756"></a>00756         <span class="keywordflow">case</span> KPrinter::B6: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B6&quot;</span>;
<a name="l00757"></a>00757         <span class="keywordflow">case</span> KPrinter::B7: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B7&quot;</span>;
<a name="l00758"></a>00758         <span class="keywordflow">case</span> KPrinter::B8: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B8&quot;</span>;
<a name="l00759"></a>00759         <span class="keywordflow">case</span> KPrinter::B9: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B9&quot;</span>;
<a name="l00760"></a>00760         <span class="keywordflow">case</span> KPrinter::B10: <span class="keywordflow">return</span> <span class="stringliteral">&quot;B10&quot;</span>;
<a name="l00761"></a>00761         <span class="keywordflow">case</span> KPrinter::C5E: <span class="keywordflow">return</span> <span class="stringliteral">&quot;C5&quot;</span>;
<a name="l00762"></a>00762         <span class="keywordflow">case</span> KPrinter::DLE: <span class="keywordflow">return</span> <span class="stringliteral">&quot;DL&quot;</span>;
<a name="l00763"></a>00763         <span class="keywordflow">case</span> KPrinter::Comm10E: <span class="keywordflow">return</span> <span class="stringliteral">&quot;Comm10&quot;</span>;
<a name="l00764"></a>00764         <span class="keywordflow">default</span>: <span class="keywordflow">return</span> <span class="stringliteral">&quot;A4&quot;</span>;
<a name="l00765"></a>00765     }
<a name="l00766"></a>00766 }
<a name="l00767"></a>00767 
<a name="l00768"></a>00768 <span class="comment">// FIXME: remove for 4.0</span>
<a name="l00769"></a>00769 <a class="codeRef" href="qsize.html">QSize</a> rangeToSize( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; )
<a name="l00770"></a>00770 {
<a name="l00771"></a>00771     kdWarning( 500 ) &lt;&lt; <span class="stringliteral">&quot;rangeToSize(QString) is obsolete, do not use (no effect)&quot;</span> &lt;&lt; endl;
<a name="l00772"></a>00772     <span class="keywordflow">return</span> <a class="codeRef" href="qsize.html">QSize</a>();
<a name="l00773"></a>00773 }
<a name="l00774"></a>00774 
<a name="l00775"></a>00775 <span class="keyword">static</span> <span class="keywordtype">void</span> dumpOptions(<span class="keyword">const</span> <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>&amp; opts)
<a name="l00776"></a>00776 {
<a name="l00777"></a>00777     kdDebug(500) &lt;&lt; <span class="stringliteral">&quot;********************&quot;</span> &lt;&lt; endl;
<a name="l00778"></a>00778     <span class="keywordflow">for</span> (<a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;::ConstIterator</a> it=opts.<a class="codeRef" href="qmap.html#begin">begin</a>(); it!=opts.<a class="codeRef" href="qmap.html#end">end</a>(); ++it)
<a name="l00779"></a>00779         kdDebug(500) &lt;&lt; it.key() &lt;&lt; <span class="stringliteral">&quot; = &quot;</span> &lt;&lt; it.data() &lt;&lt; endl;
<a name="l00780"></a>00780 }
<a name="l00781"></a>00781 
<a name="l00782"></a><a class="code" href="classKPrinter.html#a5e0f54e26ca5a2ff9822cd70887071d7">00782</a> KPrinterImpl* <a class="code" href="classKPrinter.html#a5e0f54e26ca5a2ff9822cd70887071d7" title="For internal use only.">KPrinter::implementation</a>()<span class="keyword"> const</span>
<a name="l00783"></a>00783 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_impl; }
<a name="l00784"></a>00784 
<a name="l00785"></a><a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057">00785</a> <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">KPrinter::option</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; key)<span class="keyword"> const</span>
<a name="l00786"></a>00786 <span class="keyword"></span>{ <span class="keywordflow">return</span> ((<span class="keyword">const</span> KPrinterPrivate*)(d))-&gt;m_options[key]; }
<a name="l00787"></a>00787 
<a name="l00788"></a><a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f">00788</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">KPrinter::setOption</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; key, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; value)
<a name="l00789"></a>00789 { d-&gt;m_options[key] = value; }
<a name="l00790"></a>00790 
<a name="l00791"></a><a class="code" href="classKPrinter.html#aeeeca49093fbecea784d4d3afd6967be">00791</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#aeeeca49093fbecea784d4d3afd6967be" title="See QPrinter::docName().">KPrinter::docName</a>()<span class="keyword"> const</span>
<a name="l00792"></a>00792 <span class="keyword"></span>{ <span class="keywordflow">return</span> <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-docname&quot;</span>); }
<a name="l00793"></a>00793 
<a name="l00794"></a><a class="code" href="classKPrinter.html#a5308d52128c3a2054799cf9afc13ddbf">00794</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a5308d52128c3a2054799cf9afc13ddbf" title="See QPrinter::setDocName().">KPrinter::setDocName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; d)
<a name="l00795"></a>00795 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-docname&quot;</span>,d); }
<a name="l00796"></a>00796 
<a name="l00797"></a><a class="code" href="classKPrinter.html#a0b17587ffcf63d147c6c4e0cffc59ab7">00797</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a0b17587ffcf63d147c6c4e0cffc59ab7" title="See QPrinter::creator().">KPrinter::creator</a>()<span class="keyword"> const</span>
<a name="l00798"></a>00798 <span class="keyword"></span>{ <span class="keywordflow">return</span> <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-creator&quot;</span>); }
<a name="l00799"></a>00799 
<a name="l00800"></a><a class="code" href="classKPrinter.html#af1739e0dcfb11bd6c01f1fe859d8ce1a">00800</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#af1739e0dcfb11bd6c01f1fe859d8ce1a" title="See QPrinter::setCreator().">KPrinter::setCreator</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; d)
<a name="l00801"></a>00801 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-creator&quot;</span>,d); }
<a name="l00802"></a>00802 
<a name="l00803"></a><a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0">00803</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#a3eec43ebda3c2e6628a241792e46e9e0" title="See QPrinter::fullPage().">KPrinter::fullPage</a>()<span class="keyword"> const</span>
<a name="l00804"></a>00804 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-fullpage&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span>); }
<a name="l00805"></a>00805 
<a name="l00806"></a><a class="code" href="classKPrinter.html#a3f550f10ccc358ad06de1299ce66a2b9">00806</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a3f550f10ccc358ad06de1299ce66a2b9" title="See QPrinter::setFullPage().">KPrinter::setFullPage</a>(<span class="keywordtype">bool</span> on)
<a name="l00807"></a>00807 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-fullpage&quot;</span>,(on ? <span class="stringliteral">&quot;1&quot;</span> : <span class="stringliteral">&quot;0&quot;</span>)); }
<a name="l00808"></a>00808 
<a name="l00809"></a><a class="code" href="classKPrinter.html#a0fa2ae3d6081ec3a8d081455c8a3f954">00809</a> <a class="code" href="classKPrinter.html#acfe1b1ece0fa03e0758697feade17c20" title="Defines the color mode of the printer.">KPrinter::ColorMode</a> <a class="code" href="classKPrinter.html#a0fa2ae3d6081ec3a8d081455c8a3f954" title="See QPrinter::colorMode().">KPrinter::colorMode</a>()<span class="keyword"> const</span>
<a name="l00810"></a>00810 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#acfe1b1ece0fa03e0758697feade17c20" title="Defines the color mode of the printer.">KPrinter::ColorMode</a>)(<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-colormode&quot;</span>) == <span class="stringliteral">&quot;GrayScale&quot;</span> ? GrayScale : Color); }
<a name="l00811"></a>00811 
<a name="l00812"></a><a class="code" href="classKPrinter.html#a7896574c528e84b29d696f0268056dae">00812</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a7896574c528e84b29d696f0268056dae" title="See QPrinter::setColorMode().">KPrinter::setColorMode</a>(<a class="code" href="classKPrinter.html#acfe1b1ece0fa03e0758697feade17c20" title="Defines the color mode of the printer.">ColorMode</a> m)
<a name="l00813"></a>00813 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-colormode&quot;</span>,(m == Color ? <span class="stringliteral">&quot;Color&quot;</span> : <span class="stringliteral">&quot;GrayScale&quot;</span>)); }
<a name="l00814"></a>00814 
<a name="l00815"></a><a class="code" href="classKPrinter.html#a5f2cbb7d800ca1872880fbc36531a679">00815</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a5f2cbb7d800ca1872880fbc36531a679" title="See QPrinter::setNumCopies().">KPrinter::setNumCopies</a>(<span class="keywordtype">int</span> n)
<a name="l00816"></a>00816 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-copies&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(n)); }
<a name="l00817"></a>00817 
<a name="l00818"></a><a class="code" href="classKPrinter.html#a254dc41b19b57f78276010ed80055341">00818</a> <a class="code" href="classKPrinter.html#af41ac751bb785b2c998255180035ad89" title="Defines the orientation of the paper.">KPrinter::Orientation</a> <a class="code" href="classKPrinter.html#a254dc41b19b57f78276010ed80055341" title="See QPrinter::orientation().">KPrinter::orientation</a>()<span class="keyword"> const</span>
<a name="l00819"></a>00819 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-orientation&quot;</span>) == <span class="stringliteral">&quot;Landscape&quot;</span> ? Landscape : Portrait); }
<a name="l00820"></a>00820 
<a name="l00821"></a><a class="code" href="classKPrinter.html#acb61517a6f1fab18ccac4a3fbc618b6d">00821</a> <a class="code" href="classKPrinter.html#ab2c3814253a64f1d9f318571e9cbe22f" title="Defines the page order of the print job.">KPrinter::PageOrder</a> <a class="code" href="classKPrinter.html#acb61517a6f1fab18ccac4a3fbc618b6d" title="See QPrinter::pageOrder().">KPrinter::pageOrder</a>()<span class="keyword"> const</span>
<a name="l00822"></a>00822 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-pageorder&quot;</span>) == <span class="stringliteral">&quot;Reverse&quot;</span> ? LastPageFirst : FirstPageFirst); }
<a name="l00823"></a>00823 
<a name="l00824"></a><a class="code" href="classKPrinter.html#a6f889a07ae2693cd8b896066df49bec0">00824</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a6f889a07ae2693cd8b896066df49bec0" title="See QPrinter::setPageOrder().">KPrinter::setPageOrder</a>(<a class="code" href="classKPrinter.html#ab2c3814253a64f1d9f318571e9cbe22f" title="Defines the page order of the print job.">PageOrder</a> o)
<a name="l00825"></a>00825 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-pageorder&quot;</span>,(o == LastPageFirst ? <span class="stringliteral">&quot;Reverse&quot;</span> : <span class="stringliteral">&quot;Forward&quot;</span>)); }
<a name="l00826"></a>00826 
<a name="l00827"></a><a class="code" href="classKPrinter.html#a3c278417693195b889362bfe130a8692">00827</a> <a class="code" href="classKPrinter.html#aa6719cf21322ecd0bca4fc764d7ecd7c" title="Defines the collate property of the printer (if supported by the print system):">KPrinter::CollateType</a> <a class="code" href="classKPrinter.html#a3c278417693195b889362bfe130a8692" title="Returns the collate status of the current KPrinter.">KPrinter::collate</a>()<span class="keyword"> const</span>
<a name="l00828"></a>00828 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-collate&quot;</span>) == <span class="stringliteral">&quot;Collate&quot;</span> ? Collate : Uncollate); }
<a name="l00829"></a>00829 
<a name="l00830"></a><a class="code" href="classKPrinter.html#afe9b2f314d6221066a970eab974da18c">00830</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#afe9b2f314d6221066a970eab974da18c" title="Sets the collate status for the current KPrinter to type.">KPrinter::setCollate</a>(<a class="code" href="classKPrinter.html#aa6719cf21322ecd0bca4fc764d7ecd7c" title="Defines the collate property of the printer (if supported by the print system):">CollateType</a> c)
<a name="l00831"></a>00831 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-collate&quot;</span>,(c == Collate ? <span class="stringliteral">&quot;Collate&quot;</span> : <span class="stringliteral">&quot;Uncollate&quot;</span>)); }
<a name="l00832"></a>00832 
<a name="l00833"></a><a class="code" href="classKPrinter.html#a752a5bdc83ca4e7628caf855c1ee0f08">00833</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#a752a5bdc83ca4e7628caf855c1ee0f08" title="See QPrinter::minPage().">KPrinter::minPage</a>()<span class="keyword"> const</span>
<a name="l00834"></a>00834 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-minpage&quot;</span>).isEmpty() ? 0 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-minpage&quot;</span>).toInt()); }
<a name="l00835"></a>00835 
<a name="l00836"></a><a class="code" href="classKPrinter.html#ac5152fd05c0841958433d97552431442">00836</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#ac5152fd05c0841958433d97552431442" title="See QPrinter::maxPage().">KPrinter::maxPage</a>()<span class="keyword"> const</span>
<a name="l00837"></a>00837 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-maxpage&quot;</span>).isEmpty() ? 0 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-maxpage&quot;</span>).toInt()); }
<a name="l00838"></a>00838 
<a name="l00839"></a><a class="code" href="classKPrinter.html#ac8d702b046bbbd7a2c46db7940fdc08f">00839</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#ac8d702b046bbbd7a2c46db7940fdc08f" title="See QPrinter::setMinMax().">KPrinter::setMinMax</a>(<span class="keywordtype">int</span> m, <span class="keywordtype">int</span> M)
<a name="l00840"></a>00840 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-minpage&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(m)); <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-maxpage&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(M)); }
<a name="l00841"></a>00841 
<a name="l00842"></a><a class="code" href="classKPrinter.html#a599f9cbe79076c619a69ccdabff6c08c">00842</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#a599f9cbe79076c619a69ccdabff6c08c" title="Returns the first page to be printed.">KPrinter::fromPage</a>()<span class="keyword"> const</span>
<a name="l00843"></a>00843 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-frompage&quot;</span>).isEmpty() ? 0 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-frompage&quot;</span>).toInt()); }
<a name="l00844"></a>00844 
<a name="l00845"></a><a class="code" href="classKPrinter.html#ae17368cf1218e437fa4181449656fbd9">00845</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#ae17368cf1218e437fa4181449656fbd9" title="Returns the last page to be printed.">KPrinter::toPage</a>()<span class="keyword"> const</span>
<a name="l00846"></a>00846 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-topage&quot;</span>).isEmpty() ? 0 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-topage&quot;</span>).toInt()); }
<a name="l00847"></a>00847 
<a name="l00848"></a><a class="code" href="classKPrinter.html#a55e81218bb26d3986d1a01e04cbb64a9">00848</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a55e81218bb26d3986d1a01e04cbb64a9" title="Sets the first and last page to be printed.">KPrinter::setFromTo</a>(<span class="keywordtype">int</span> m, <span class="keywordtype">int</span> M)
<a name="l00849"></a>00849 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-frompage&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(m)); <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-topage&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(M)); <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-range&quot;</span>,(m&gt;0 &amp;&amp; M&gt;0 ? <a class="codeRef" href="qstring.html">QString</a>(<span class="stringliteral">&quot;%1-%2&quot;</span>).arg(m).arg(M) : <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">&quot;&quot;</span>))); }
<a name="l00850"></a>00850 
<a name="l00851"></a>00851 <span class="comment">// if no page size defined, use the localized one</span>
<a name="l00852"></a><a class="code" href="classKPrinter.html#a943525e8337dc7c1df37ce2e3033c2be">00852</a> <a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">KPrinter::PageSize</a> <a class="code" href="classKPrinter.html#a943525e8337dc7c1df37ce2e3033c2be" title="See QPrinter::pageSize().">KPrinter::pageSize</a>()<span class="keyword"> const</span>
<a name="l00853"></a>00853 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-pagesize&quot;</span>).isEmpty() ? (<a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">PageSize</a>)KGlobal::locale()-&gt;<a class="code" href="classKPrinter.html#a943525e8337dc7c1df37ce2e3033c2be" title="See QPrinter::pageSize().">pageSize</a>() : (<a class="code" href="classKPrinter.html#a14bad784daffaf6f9722907ed3c0d35b" title="Defines the paper size to use.">PageSize</a>)<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-pagesize&quot;</span>).toInt()); }
<a name="l00854"></a>00854 
<a name="l00855"></a><a class="code" href="classKPrinter.html#ab08533094878a1cf2cb20a6216080b65">00855</a> <a class="code" href="classKPrinter.html#a7f6940c97f979952f1099b0764e43961" title="Defines the page set to print:">KPrinter::PageSetType</a> <a class="code" href="classKPrinter.html#ab08533094878a1cf2cb20a6216080b65" title="Returns the page set of the current KPrinter object.">KPrinter::pageSet</a>()<span class="keyword"> const</span>
<a name="l00856"></a>00856 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-pageset&quot;</span>).isEmpty() ? AllPages : (<a class="code" href="classKPrinter.html#a7f6940c97f979952f1099b0764e43961" title="Defines the page set to print:">PageSetType</a>)(<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-pageset&quot;</span>).toInt())); }
<a name="l00857"></a>00857 
<a name="l00858"></a><a class="code" href="classKPrinter.html#ac30ce3d0a62d69abef8599f9ce2eb533">00858</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#ac30ce3d0a62d69abef8599f9ce2eb533" title="Returns the current page number.">KPrinter::currentPage</a>()<span class="keyword"> const</span>
<a name="l00859"></a>00859 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-currentpage&quot;</span>).isEmpty() ? 0 : <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-currentpage&quot;</span>).toInt()); }
<a name="l00860"></a>00860 
<a name="l00861"></a><a class="code" href="classKPrinter.html#ae4bba3fd8cd042733814776c5c22326c">00861</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#ae4bba3fd8cd042733814776c5c22326c" title="Sets the current page number.">KPrinter::setCurrentPage</a>(<span class="keywordtype">int</span> p)
<a name="l00862"></a>00862 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-currentpage&quot;</span>,<a class="codeRef" href="qstring.html#number">QString::number</a>(p)); }
<a name="l00863"></a>00863 
<a name="l00864"></a><a class="code" href="classKPrinter.html#a3535ad8e5bcb9f71983085ac40b4dab0">00864</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a3535ad8e5bcb9f71983085ac40b4dab0" title="See QPrinter::printerName().">KPrinter::printerName</a>()<span class="keyword"> const</span>
<a name="l00865"></a>00865 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_printername; }
<a name="l00866"></a>00866 
<a name="l00867"></a><a class="code" href="classKPrinter.html#aad4149a203b4c77dc959e1c30b80acbc">00867</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#aad4149a203b4c77dc959e1c30b80acbc" title="See QPrinter::setPrinterName().">KPrinter::setPrinterName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; s)
<a name="l00868"></a>00868 { d-&gt;m_printername = s; }
<a name="l00869"></a>00869 
<a name="l00870"></a><a class="code" href="classKPrinter.html#a234a9844c16dafa1cbc544f41acd62a3">00870</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a234a9844c16dafa1cbc544f41acd62a3" title="Returns the print program as set by setPrintProgram() or by the print dialog if a special printer has...">KPrinter::printProgram</a>()<span class="keyword"> const</span>
<a name="l00871"></a>00871 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span> ? <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-special-command&quot;</span>) : QString::null); }
<a name="l00872"></a>00872 
<a name="l00873"></a><a class="code" href="classKPrinter.html#a31fe9e053c99b4e88e042a0500e62192">00873</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a31fe9e053c99b4e88e042a0500e62192" title="Sets the command line to use when printing.">KPrinter::setPrintProgram</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; prg)
<a name="l00874"></a>00874 {
<a name="l00875"></a>00875     <span class="keywordflow">if</span> (prg.<a class="codeRef" href="qstring.html#isNull">isNull</a>())
<a name="l00876"></a>00876     {
<a name="l00877"></a>00877         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>, <span class="stringliteral">&quot;0&quot;</span>);
<a name="l00878"></a>00878         d-&gt;m_options.remove(<span class="stringliteral">&quot;kde-special-command&quot;</span>);
<a name="l00879"></a>00879     }
<a name="l00880"></a>00880     <span class="keywordflow">else</span>
<a name="l00881"></a>00881     {
<a name="l00882"></a>00882         <a class="codeRef" href="qstring.html">QString</a> s(prg);
<a name="l00883"></a>00883         <span class="keywordflow">if</span> (s.<a class="codeRef" href="qstring.html#find">find</a>(<span class="stringliteral">&quot;%in&quot;</span>) == -1)
<a name="l00884"></a>00884             s.<a class="codeRef" href="qstring.html#append">append</a>(<span class="stringliteral">&quot; %in&quot;</span>);
<a name="l00885"></a>00885         <a class="code" href="classKPrinter.html#a726f87792683bdcb335164d2fade151b" title="See QPrinter::setOutputToFile().">setOutputToFile</a>( s.<a class="codeRef" href="qstring.html#find">find</a>( <span class="stringliteral">&quot;%out&quot;</span> ) != -1 );
<a name="l00886"></a>00886         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00887"></a>00887         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-special-command&quot;</span>, s);
<a name="l00888"></a>00888     }
<a name="l00889"></a>00889 }
<a name="l00890"></a>00890 
<a name="l00891"></a><a class="code" href="classKPrinter.html#a6002c82515146f05c7966c446af0a61c">00891</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a6002c82515146f05c7966c446af0a61c" title="See QPrinter::printerSelectionOption().">KPrinter::printerSelectionOption</a>()<span class="keyword"> const</span>
<a name="l00892"></a>00892 <span class="keyword"></span>{ <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">&quot;&quot;</span>); }
<a name="l00893"></a>00893 
<a name="l00894"></a><a class="code" href="classKPrinter.html#a25cd794aa9c09ea1c20d80dfadf8a6ab">00894</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a25cd794aa9c09ea1c20d80dfadf8a6ab" title="See QPrinter::setPrinterSelectionOption().">KPrinter::setPrinterSelectionOption</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp;)
<a name="l00895"></a>00895 {}
<a name="l00896"></a>00896 
<a name="l00897"></a><a class="code" href="classKPrinter.html#ab74b06883bd3aeed3a0f8d1d22e5bcff">00897</a> <span class="keyword">const</span> <a class="codeRef" href="qmap.html">QMap&lt;QString,QString&gt;</a>&amp; <a class="code" href="classKPrinter.html#ab74b06883bd3aeed3a0f8d1d22e5bcff" title="Returns the complete set of print options from the KPrinter object.">KPrinter::options</a>()<span class="keyword"> const</span>
<a name="l00898"></a>00898 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_options; }
<a name="l00899"></a>00899 
<a name="l00900"></a><a class="code" href="classKPrinter.html#a4fa5ba95b3fe452e27f5c4ad84b25a05">00900</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a4fa5ba95b3fe452e27f5c4ad84b25a05" title="Returns the search name of the printer selected by the user.">KPrinter::searchName</a>()<span class="keyword"> const</span>
<a name="l00901"></a>00901 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_searchname; }
<a name="l00902"></a>00902 
<a name="l00903"></a><a class="code" href="classKPrinter.html#ae4ebbe35a92ba37bc7500c2ee2034389">00903</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#ae4ebbe35a92ba37bc7500c2ee2034389" title="Sets the search name of the KPrinter object.">KPrinter::setSearchName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; s)
<a name="l00904"></a>00904 { d-&gt;m_searchname = s; }
<a name="l00905"></a>00905 
<a name="l00906"></a><a class="code" href="classKPrinter.html#a1171e68e882bccf8746198c1d8a305e3">00906</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#a1171e68e882bccf8746198c1d8a305e3" title="See QPrinter::newPage().">KPrinter::newPage</a>()
<a name="l00907"></a>00907 {
<a name="l00908"></a>00908     d-&gt;m_pagenumber++;
<a name="l00909"></a>00909     d-&gt;m_impl-&gt;statusMessage(i18n(<span class="stringliteral">&quot;Generating print data: page %1&quot;</span>).arg(d-&gt;m_pagenumber), <span class="keyword">this</span>);
<a name="l00910"></a>00910     <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;newPage();
<a name="l00911"></a>00911 }
<a name="l00912"></a>00912 
<a name="l00913"></a><a class="code" href="classKPrinter.html#a17bb43798803db343148c43826c6924e">00913</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a17bb43798803db343148c43826c6924e" title="See QPrinter::outputFileName().">KPrinter::outputFileName</a>()<span class="keyword"> const</span>
<a name="l00914"></a>00914 <span class="keyword"></span>{ <span class="keywordflow">return</span> <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-outputfilename&quot;</span>); }
<a name="l00915"></a>00915 
<a name="l00916"></a><a class="code" href="classKPrinter.html#af2602407b1ee43d2b8dd53d5e71b0a50">00916</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#af2602407b1ee43d2b8dd53d5e71b0a50" title="See QPrinter::setOutputFileName().">KPrinter::setOutputFileName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; f)
<a name="l00917"></a>00917 { <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-outputfilename&quot;</span>,f); <a class="code" href="classKPrinter.html#a726f87792683bdcb335164d2fade151b" title="See QPrinter::setOutputToFile().">setOutputToFile</a>(!f.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()); }
<a name="l00918"></a>00918 
<a name="l00919"></a><a class="code" href="classKPrinter.html#adfe897914d6be489a7d70102496a8bae">00919</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#adfe897914d6be489a7d70102496a8bae" title="See QPrinter::outputToFile().">KPrinter::outputToFile</a>()<span class="keyword"> const</span>
<a name="l00920"></a>00920 <span class="keyword"></span>{ <span class="keywordflow">return</span> (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-outputtofile&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span> || (<a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>) == <span class="stringliteral">&quot;1&quot;</span> &amp;&amp; <a class="code" href="classKPrinter.html#a8aa402c9f0f6cea036252afb9a5c1057" title="Starts the add printer wizard.">option</a>(<span class="stringliteral">&quot;kde-special-command&quot;</span>).isEmpty())); }
<a name="l00921"></a>00921 
<a name="l00922"></a><a class="code" href="classKPrinter.html#a726f87792683bdcb335164d2fade151b">00922</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a726f87792683bdcb335164d2fade151b" title="See QPrinter::setOutputToFile().">KPrinter::setOutputToFile</a>(<span class="keywordtype">bool</span> on)
<a name="l00923"></a>00923 {
<a name="l00924"></a>00924     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-outputtofile&quot;</span>,(on ? <span class="stringliteral">&quot;1&quot;</span> : <span class="stringliteral">&quot;0&quot;</span>));
<a name="l00925"></a>00925     <span class="keywordflow">if</span> (on)
<a name="l00926"></a>00926     {
<a name="l00927"></a>00927         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-special-command&quot;</span>,QString::null);
<a name="l00928"></a>00928         <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>(<span class="stringliteral">&quot;kde-isspecial&quot;</span>,<span class="stringliteral">&quot;1&quot;</span>);
<a name="l00929"></a>00929     }
<a name="l00930"></a>00930 }
<a name="l00931"></a>00931 
<a name="l00932"></a><a class="code" href="classKPrinter.html#aae6db91434af7f5554363fb23fd4ef4d">00932</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#aae6db91434af7f5554363fb23fd4ef4d" title="See QPrinter::abort().">KPrinter::abort</a>()
<a name="l00933"></a>00933 { <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;abort(); }
<a name="l00934"></a>00934 
<a name="l00935"></a><a class="code" href="classKPrinter.html#a4c84e8e30ad97155914b59b88298cfcc">00935</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#a4c84e8e30ad97155914b59b88298cfcc" title="See QPrinter::aborted(.)">KPrinter::aborted</a>()<span class="keyword"> const</span>
<a name="l00936"></a>00936 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;aborted(); }
<a name="l00937"></a>00937 
<a name="l00938"></a><a class="code" href="classKPrinter.html#a18784d6f47e2213b172d405492c85ffe">00938</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a18784d6f47e2213b172d405492c85ffe" title="Not used yet.">KPrinter::setMargins</a>(<a class="codeRef" href="qsize.html">QSize</a> m)
<a name="l00939"></a>00939 {
<a name="l00940"></a>00940     <a class="code" href="classKPrinter.html#a18784d6f47e2213b172d405492c85ffe" title="Not used yet.">setMargins</a>( m.<a class="codeRef" href="qsize.html#height">height</a>(), m.<a class="codeRef" href="qsize.html#width">width</a>(), m.<a class="codeRef" href="qsize.html#height">height</a>(), m.<a class="codeRef" href="qsize.html#width">width</a>() );
<a name="l00941"></a>00941 }
<a name="l00942"></a>00942 
<a name="l00943"></a>00943 <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a18784d6f47e2213b172d405492c85ffe" title="Not used yet.">KPrinter::setMargins</a>( uint top, uint left, uint bottom, uint right )
<a name="l00944"></a>00944 {
<a name="l00945"></a>00945     d-&gt;m_wrapper-&gt;setMargins( top, left, bottom, right );
<a name="l00946"></a>00946     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>( <span class="stringliteral">&quot;kde-margin-top&quot;</span>, <a class="codeRef" href="qstring.html#number">QString::number</a>( top ), <span class="keyword">true</span> );
<a name="l00947"></a>00947     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>( <span class="stringliteral">&quot;kde-margin-left&quot;</span>, <a class="codeRef" href="qstring.html#number">QString::number</a>( left ), <span class="keyword">true</span> );
<a name="l00948"></a>00948     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>( <span class="stringliteral">&quot;kde-margin-bottom&quot;</span>, <a class="codeRef" href="qstring.html#number">QString::number</a>( bottom ), <span class="keyword">true</span> );
<a name="l00949"></a>00949     <a class="code" href="classKPrinter.html#acd9c70f6a4143fbcb084f08ff4e7441f" title="Adds or modifies an option in the KPrinter object.">setOption</a>( <span class="stringliteral">&quot;kde-margin-right&quot;</span>, <a class="codeRef" href="qstring.html#number">QString::number</a>( right ), <span class="keyword">true</span> );
<a name="l00950"></a>00950 }
<a name="l00951"></a>00951 
<a name="l00952"></a>00952 <span class="comment">// FIXME: remove for 4.0</span>
<a name="l00953"></a><a class="code" href="classKPrinter.html#a7b939b57da4d5d247c49fb0a85f5ab99">00953</a> <a class="codeRef" href="qsize.html">QSize</a> <a class="code" href="classKPrinter.html#a7b939b57da4d5d247c49fb0a85f5ab99" title="Returns the page size in dot unit ( 1 dot = 1/72th in ).">KPrinter::realPageSize</a>()<span class="keyword"> const</span>
<a name="l00954"></a>00954 <span class="keyword"></span>{
<a name="l00955"></a>00955     kdWarning( 500 ) &lt;&lt; <span class="stringliteral">&quot;KPrinter::realPageSize() is obsolete, do not use&quot;</span> &lt;&lt; endl;
<a name="l00956"></a>00956     <span class="keywordflow">if</span> ( d-&gt;m_pagesize )
<a name="l00957"></a>00957         <span class="keywordflow">return</span> d-&gt;m_pagesize-&gt;pageSize();
<a name="l00958"></a>00958     <span class="keywordflow">else</span>
<a name="l00959"></a>00959         <span class="keywordflow">return</span> <a class="codeRef" href="qsize.html">QSize</a>();
<a name="l00960"></a>00960 }
<a name="l00961"></a>00961 
<a name="l00962"></a>00962 <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a2aed8fa276ace8a2a1b17ad8459f9331" title="DO NOT USE, WILL BE REMOVED.">KPrinter::setRealPageSize</a>(DrPageSize *p)
<a name="l00963"></a>00963 {
<a name="l00964"></a>00964     <span class="keywordflow">if</span> ( p )
<a name="l00965"></a>00965     {
<a name="l00966"></a>00966         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size:  width =&quot;</span> &lt;&lt; p-&gt;pageWidth() &lt;&lt; endl;
<a name="l00967"></a>00967         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size: height =&quot;</span> &lt;&lt; p-&gt;pageHeight() &lt;&lt; endl;
<a name="l00968"></a>00968         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size:   left =&quot;</span> &lt;&lt; p-&gt;leftMargin() &lt;&lt; endl;
<a name="l00969"></a>00969         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size:    top =&quot;</span> &lt;&lt; p-&gt;topMargin() &lt;&lt; endl;
<a name="l00970"></a>00970         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size:  right =&quot;</span> &lt;&lt; p-&gt;rightMargin() &lt;&lt; endl;
<a name="l00971"></a>00971         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Page size: bottom =&quot;</span> &lt;&lt; p-&gt;bottomMargin() &lt;&lt; endl;
<a name="l00972"></a>00972     }
<a name="l00973"></a>00973     <span class="keywordflow">else</span>
<a name="l00974"></a>00974         kdDebug( 500 ) &lt;&lt; <span class="stringliteral">&quot;Resetting page size&quot;</span> &lt;&lt; endl;
<a name="l00975"></a>00975 
<a name="l00976"></a>00976     <span class="comment">/* we copy the page size structure internally</span>
<a name="l00977"></a>00977 <span class="comment">     * as the original object is owned by the driver</span>
<a name="l00978"></a>00978 <span class="comment">     * that control its destrution */</span>
<a name="l00979"></a>00979     <span class="keyword">delete</span> d-&gt;m_pagesize;
<a name="l00980"></a>00980     d-&gt;m_pagesize = 0;
<a name="l00981"></a>00981     <span class="keywordflow">if</span> ( p )
<a name="l00982"></a>00982         d-&gt;m_pagesize = <span class="keyword">new</span> DrPageSize( *p );
<a name="l00983"></a>00983 }
<a name="l00984"></a>00984 
<a name="l00985"></a>00985 <span class="comment">// FIXME: remove for 4.0</span>
<a name="l00986"></a><a class="code" href="classKPrinter.html#a2aed8fa276ace8a2a1b17ad8459f9331">00986</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a2aed8fa276ace8a2a1b17ad8459f9331" title="DO NOT USE, WILL BE REMOVED.">KPrinter::setRealPageSize</a>( <a class="codeRef" href="qsize.html">QSize</a> )
<a name="l00987"></a>00987 {
<a name="l00988"></a>00988     kdWarning( 500 ) &lt;&lt; <span class="stringliteral">&quot;KPrinter::setRealPageSize(QSize) is obsolete, do not use (no effect)&quot;</span> &lt;&lt; endl;
<a name="l00989"></a>00989 }
<a name="l00990"></a>00990 
<a name="l00991"></a>00991 <span class="comment">// FIXME: remove for 4.0</span>
<a name="l00992"></a><a class="code" href="classKPrinter.html#acf58fa896b6dbb4fdcf8b42ae744dcce">00992</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#acf58fa896b6dbb4fdcf8b42ae744dcce" title="DO NOT USE, WILL BE REMOVED.">KPrinter::setRealDrawableArea</a>( <span class="keyword">const</span> <a class="codeRef" href="qrect.html">QRect</a>&amp; )
<a name="l00993"></a>00993 {
<a name="l00994"></a>00994     kdWarning( 500 ) &lt;&lt; <span class="stringliteral">&quot;KPrinter::setRealDrawableArea(QRect) is obsolete, do not use (no effect)&quot;</span> &lt;&lt; endl;
<a name="l00995"></a>00995 }
<a name="l00996"></a>00996 
<a name="l00997"></a>00997 <span class="comment">// FIXME: remove for 4.0</span>
<a name="l00998"></a><a class="code" href="classKPrinter.html#a35bc5ba02ab26f22a3b0c6f93f881adb">00998</a> <a class="codeRef" href="qrect.html">QRect</a> <a class="code" href="classKPrinter.html#a35bc5ba02ab26f22a3b0c6f93f881adb" title="DO NOT USE, WILL BE REMOVED.">KPrinter::realDrawableArea</a>()<span class="keyword"> const</span>
<a name="l00999"></a>00999 <span class="keyword"></span>{
<a name="l01000"></a>01000     kdWarning( 500 ) &lt;&lt; <span class="stringliteral">&quot;KPrinter::realDrawableArea() is obsolete, do not use&quot;</span> &lt;&lt; endl;
<a name="l01001"></a>01001     <span class="keywordflow">if</span> ( d-&gt;m_pagesize )
<a name="l01002"></a>01002         <span class="keywordflow">return</span> d-&gt;m_pagesize-&gt;pageRect();
<a name="l01003"></a>01003     <span class="keywordflow">else</span>
<a name="l01004"></a>01004         <span class="keywordflow">return</span> <a class="codeRef" href="qrect.html">QRect</a>();
<a name="l01005"></a>01005 }
<a name="l01006"></a>01006 
<a name="l01007"></a><a class="code" href="classKPrinter.html#aa8931f6878ba40f1e248e549bdb4b021">01007</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#aa8931f6878ba40f1e248e549bdb4b021" title="Returns the last error message issued by the print system.">KPrinter::errorMessage</a>()<span class="keyword"> const</span>
<a name="l01008"></a>01008 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_errormsg; }
<a name="l01009"></a>01009 
<a name="l01010"></a><a class="code" href="classKPrinter.html#a9a3c2e6176797e69b158edac2f6a7868">01010</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a9a3c2e6176797e69b158edac2f6a7868" title="Sets the last error message.">KPrinter::setErrorMessage</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; msg)
<a name="l01011"></a>01011 { d-&gt;m_errormsg = msg; }
<a name="l01012"></a>01012 
<a name="l01013"></a>01013 <span class="comment">/* we&#39;re using a builtin member to store this state because we don&#39;t</span>
<a name="l01014"></a>01014 <span class="comment"> * want to keep it from object to object. So there&#39;s no need to use</span>
<a name="l01015"></a>01015 <span class="comment"> * the QMap structure to store this</span>
<a name="l01016"></a>01016 <span class="comment"> */</span>
<a name="l01017"></a><a class="code" href="classKPrinter.html#aadfbba392035d311c4388ce00df0da7f">01017</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#aadfbba392035d311c4388ce00df0da7f" title="Sets the KPrinter object to preview mode if on is true.">KPrinter::setPreviewOnly</a>(<span class="keywordtype">bool</span> on)
<a name="l01018"></a>01018 { d-&gt;m_previewonly = on; }
<a name="l01019"></a>01019 
<a name="l01020"></a><a class="code" href="classKPrinter.html#a742f18961faec99d34b8da68975d994c">01020</a> <span class="keywordtype">bool</span> <a class="code" href="classKPrinter.html#a742f18961faec99d34b8da68975d994c" title="Returns the preview-only state for this KPrinter object.">KPrinter::previewOnly</a>()<span class="keyword"> const</span>
<a name="l01021"></a>01021 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_previewonly; }
<a name="l01022"></a>01022 
<a name="l01023"></a><a class="code" href="classKPrinter.html#a8c00510380a19b1474adbf158108b8ec">01023</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a8c00510380a19b1474adbf158108b8ec" title="Set the default document filename.">KPrinter::setDocFileName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; s)
<a name="l01024"></a>01024 { d-&gt;m_docfilename = s; }
<a name="l01025"></a>01025 
<a name="l01026"></a><a class="code" href="classKPrinter.html#a1c1086eecac25c93a800367e50da1739">01026</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a1c1086eecac25c93a800367e50da1739" title="Get the default document filename, that is the default basename used for the output file...">KPrinter::docFileName</a>()<span class="keyword"> const</span>
<a name="l01027"></a>01027 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_docfilename; }
<a name="l01028"></a>01028 
<a name="l01029"></a><a class="code" href="classKPrinter.html#a3f630e9701046916835f0d7796704a6f">01029</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#a3f630e9701046916835f0d7796704a6f" title="Set the default document directory.">KPrinter::setDocDirectory</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; s )
<a name="l01030"></a>01030 { d-&gt;m_docdirectory = s; }
<a name="l01031"></a>01031 
<a name="l01032"></a><a class="code" href="classKPrinter.html#a32d22be3b5e589e04ccf00c00e80c66e">01032</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKPrinter.html#a32d22be3b5e589e04ccf00c00e80c66e" title="Get the default document directory, that is the directory used for any output file.">KPrinter::docDirectory</a>()<span class="keyword"> const</span>
<a name="l01033"></a>01033 <span class="keyword"></span>{ <span class="keywordflow">return</span> ( d-&gt;m_docdirectory.isEmpty() ? <a class="codeRef" href="qdir.html#homeDirPath">QDir::homeDirPath</a>() : d-&gt;m_docdirectory ); }
<a name="l01034"></a>01034 
<a name="l01035"></a><a class="code" href="classKPrinter.html#aaf40b2a20707f8b043e85fd8c0274109">01035</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#aaf40b2a20707f8b043e85fd8c0274109" title="Set the resolution of the current KPrinter object.">KPrinter::setResolution</a>(<span class="keywordtype">int</span> dpi)
<a name="l01036"></a>01036 {
<a name="l01037"></a>01037     d-&gt;m_wrapper-&gt;setResolution(dpi);
<a name="l01038"></a>01038     d-&gt;m_defaultres = dpi;
<a name="l01039"></a>01039 }
<a name="l01040"></a>01040 
<a name="l01041"></a><a class="code" href="classKPrinter.html#a5fc70b55c17254190eed4545f11488c5">01041</a> <span class="keywordtype">int</span> <a class="code" href="classKPrinter.html#a5fc70b55c17254190eed4545f11488c5" title="Resturns the resolution of the current KPrinter object.">KPrinter::resolution</a>()<span class="keyword"> const</span>
<a name="l01042"></a>01042 <span class="keyword"></span>{ <span class="keywordflow">return</span> d-&gt;m_wrapper-&gt;resolution(); }
<a name="l01043"></a>01043 
<a name="l01044"></a><a class="code" href="classKPrinter.html#ae94c9f3aa6a72ddaf2a80454c0c1813d">01044</a> <span class="keywordtype">void</span> <a class="code" href="classKPrinter.html#ae94c9f3aa6a72ddaf2a80454c0c1813d" title="Define the KPrinter object to use the actual printer resolution.">KPrinter::setUsePrinterResolution</a>( <span class="keywordtype">bool</span> on )
<a name="l01045"></a>01045 { d-&gt;m_useprinterres = on; }
</pre></div></div>
</div>
    </div></div>


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>kdeprint</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classKPrintDialogPage.html">kprintdialogpage</option>,  <option value="classKPrinter.html">kprinter</option>,  <option value="classTreeComboBox.html">treecombobox</option>,  <option value="classTreeListBox.html">treelistbox</option>,  <option value="classTreeListBoxItem.html">treelistboxitem</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../arts/html/index.html">arts</a></li><li><a href="../../dcop/html/index.html">dcop</a></li><li><a href="../../dnssd/html/index.html">dnssd</a></li><li><a href="../../interfaces/html/index.html">interfaces</a></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../interfaces/kimproxy/interface/html/index.html">interface</a></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../interfaces/kimproxy/library/html/index.html">library</a></li><li>&nbsp;&nbsp;<a href="../../interfaces/kspeech/html/index.html">kspeech</a></li><li>&nbsp;&nbsp;<a href="../../interfaces/ktexteditor/html/index.html">ktexteditor</a></li><li><a href="../../kabc/html/index.html">kabc</a></li><li><a href="../../kate/html/index.html">kate</a></li><li><a href="../../kcmshell/html/index.html">kcmshell</a></li><li><a href="../../kdecore/html/index.html">kdecore</a></li><li><a href="../../kded/html/index.html">kded</a></li><li><a href="../../kdefx/html/index.html">kdefx</a></li><li><a href="../../kdeprint/html/index.html">kdeprint</a></li><li><a href="../../kdesu/html/index.html">kdesu</a></li><li><a href="../../kdeui/html/index.html">kdeui</a></li><li><a href="../../kdoctools/html/index.html">kdoctools</a></li><li><a href="../../khtml/html/index.html">khtml</a></li><li><a href="../../kimgio/html/index.html">kimgio</a></li><li><a href="../../kinit/html/index.html">kinit</a></li><li><a href="../../kio/html/index.html">kio</a></li><li>&nbsp;&nbsp;<a href="../../kio/bookmarks/html/index.html">bookmarks</a></li><li>&nbsp;&nbsp;<a href="../../kio/httpfilter/html/index.html">httpfilter</a></li><li>&nbsp;&nbsp;<a href="../../kio/kfile/html/index.html">kfile</a></li><li>&nbsp;&nbsp;<a href="../../kio/kio/html/index.html">kio</a></li><li>&nbsp;&nbsp;<a href="../../kio/kioexec/html/index.html">kioexec</a></li><li>&nbsp;&nbsp;<a href="../../kio/kpasswdserver/html/index.html">kpasswdserver</a></li><li>&nbsp;&nbsp;<a href="../../kio/kssl/html/index.html">kssl</a></li><li><a href="../../kioslave/html/index.html">kioslave</a></li><li>&nbsp;&nbsp;<a href="../../kioslave/http/html/index.html">http</a></li><li><a href="../../kjs/html/index.html">kjs</a></li><li><a href="../../kmdi/html/index.html">kmdi</a></li><li>&nbsp;&nbsp;<a href="../../kmdi/kmdi/html/index.html">kmdi</a></li><li><a href="../../knewstuff/html/index.html">knewstuff</a></li><li><a href="../../kparts/html/index.html">kparts</a></li><li><a href="../../kresources/html/index.html">kresources</a></li><li><a href="../../kspell2/html/index.html">kspell2</a></li><li><a href="../../kunittest/html/index.html">kunittest</a></li><li><a href="../../kutils/html/index.html">kutils</a></li><li><a href="../../kwallet/html/index.html">kwallet</a></li><li><a href="../../libkmid/html/index.html">libkmid</a></li><li><a href="../../libkscreensaver/html/index.html">libkscreensaver</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>