Sophie

Sophie

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

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>kio/kio: slaveinterface.cpp Source File (kio/kio)</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="../../html/index.html">kio</a> / <a href=".">kio</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">slaveinterface.cpp</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This file is part of the KDE libraries</span>
<a name="l00002"></a>00002 <span class="comment">   Copyright (C) 2000 David Faure &lt;faure@kde.org&gt;</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">   This library is free software; you can redistribute it and/or</span>
<a name="l00005"></a>00005 <span class="comment">   modify it under the terms of the GNU Library General Public</span>
<a name="l00006"></a>00006 <span class="comment">   License version 2 as published by the Free Software Foundation.</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">   This library is distributed in the hope that it will be useful,</span>
<a name="l00009"></a>00009 <span class="comment">   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00010"></a>00010 <span class="comment">   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00011"></a>00011 <span class="comment">   Library General Public License for more details.</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="comment">   You should have received a copy of the GNU Library General Public License</span>
<a name="l00014"></a>00014 <span class="comment">   along with this library; see the file COPYING.LIB.  If not, write to</span>
<a name="l00015"></a>00015 <span class="comment">   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00016"></a>00016 <span class="comment">   Boston, MA 02110-1301, USA.</span>
<a name="l00017"></a>00017 <span class="comment">*/</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;kio/slaveinterface.h&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;kio/slavebase.h&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;kio/connection.h&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;errno.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;assert.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;sys/time.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;signal.h&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;kio/observer.h&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;kapplication.h&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;dcopclient.h&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;qtimer.h&gt;</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keyword">using namespace </span>KIO;
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <a class="codeRef" href="qdatastream.html">QDataStream</a> &amp;operator &lt;&lt;(<a class="codeRef" href="qdatastream.html">QDataStream</a> &amp;s, <span class="keyword">const</span> <a class="codeRef" href="qvaluelist.html">KIO::UDSEntry</a> &amp;e )
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040     <span class="comment">// On 32-bit platforms we send UDS_SIZE with UDS_SIZE_LARGE in front</span>
<a name="l00041"></a>00041     <span class="comment">// of it to carry the 32 msb. We can&#39;t send a 64 bit UDS_SIZE because</span>
<a name="l00042"></a>00042     <span class="comment">// that would break the compatibility of the wire-protocol with KDE 2.</span>
<a name="l00043"></a>00043     <span class="comment">// We do the same on 64-bit platforms in case we run in a mixed 32/64bit</span>
<a name="l00044"></a>00044     <span class="comment">// environment.</span>
<a name="l00045"></a>00045 
<a name="l00046"></a>00046     Q_UINT32 size = 0;
<a name="l00047"></a>00047     <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = e.<a class="codeRef" href="qvaluelist.html#begin">begin</a>();
<a name="l00048"></a>00048     <span class="keywordflow">for</span>( ; it != e.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it )
<a name="l00049"></a>00049     {
<a name="l00050"></a>00050        size++;
<a name="l00051"></a>00051        <span class="keywordflow">if</span> ((*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa5a03d6c96cd6c9b7aa5d6fbc5c989deb" title="Size of the file.">KIO::UDS_SIZE</a>)
<a name="l00052"></a>00052           size++;
<a name="l00053"></a>00053     }
<a name="l00054"></a>00054     s &lt;&lt; size;
<a name="l00055"></a>00055     it = e.<a class="codeRef" href="qvaluelist.html#begin">begin</a>();
<a name="l00056"></a>00056     <span class="keywordflow">for</span>( ; it != e.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it )
<a name="l00057"></a>00057     {
<a name="l00058"></a>00058        <span class="keywordflow">if</span> ((*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa5a03d6c96cd6c9b7aa5d6fbc5c989deb" title="Size of the file.">KIO::UDS_SIZE</a>)
<a name="l00059"></a>00059        {
<a name="l00060"></a>00060           KIO::UDSAtom a;
<a name="l00061"></a>00061           a.m_uds = KIO::UDS_SIZE_LARGE;
<a name="l00062"></a>00062           a.m_long = (*it).m_long &gt;&gt; 32;
<a name="l00063"></a>00063           s &lt;&lt; a;
<a name="l00064"></a>00064        }
<a name="l00065"></a>00065        s &lt;&lt; *it;
<a name="l00066"></a>00066     }
<a name="l00067"></a>00067     <span class="keywordflow">return</span> s;
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <a class="codeRef" href="qdatastream.html">QDataStream</a> &amp;operator &gt;&gt;(<a class="codeRef" href="qdatastream.html">QDataStream</a> &amp;s, <a class="codeRef" href="qvaluelist.html">KIO::UDSEntry</a> &amp;e )
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072     e.<a class="codeRef" href="qvaluelist.html#clear">clear</a>();
<a name="l00073"></a>00073     Q_UINT32 size;
<a name="l00074"></a>00074     s &gt;&gt; size;
<a name="l00075"></a>00075 
<a name="l00076"></a>00076     <span class="comment">// On 32-bit platforms we send UDS_SIZE with UDS_SIZE_LARGE in front</span>
<a name="l00077"></a>00077     <span class="comment">// of it to carry the 32 msb. We can&#39;t send a 64 bit UDS_SIZE because</span>
<a name="l00078"></a>00078     <span class="comment">// that would break the compatibility of the wire-protocol with KDE 2.</span>
<a name="l00079"></a>00079     <span class="comment">// We do the same on 64-bit platforms in case we run in a mixed 32/64bit</span>
<a name="l00080"></a>00080     <span class="comment">// environment.</span>
<a name="l00081"></a>00081     Q_LLONG msb = 0;
<a name="l00082"></a>00082     <span class="keywordflow">for</span>(Q_UINT32 i = 0; i &lt; size; i++)
<a name="l00083"></a>00083     {
<a name="l00084"></a>00084        KIO::UDSAtom a;
<a name="l00085"></a>00085        s &gt;&gt; a;
<a name="l00086"></a>00086        <span class="keywordflow">if</span> (a.m_uds == KIO::UDS_SIZE_LARGE)
<a name="l00087"></a>00087        {
<a name="l00088"></a>00088           msb = a.m_long;
<a name="l00089"></a>00089        }
<a name="l00090"></a>00090        <span class="keywordflow">else</span>
<a name="l00091"></a>00091        {
<a name="l00092"></a>00092           <span class="keywordflow">if</span> (a.m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa5a03d6c96cd6c9b7aa5d6fbc5c989deb" title="Size of the file.">KIO::UDS_SIZE</a>)
<a name="l00093"></a>00093           {
<a name="l00094"></a>00094              <span class="keywordflow">if</span> (a.m_long &lt; 0)
<a name="l00095"></a>00095                 a.m_long += (Q_LLONG) 1 &lt;&lt; 32;
<a name="l00096"></a>00096              a.m_long += msb &lt;&lt; 32;
<a name="l00097"></a>00097           }
<a name="l00098"></a>00098           e.<a class="codeRef" href="qvaluelist.html#append">append</a>(a);
<a name="l00099"></a>00099           msb = 0;
<a name="l00100"></a>00100        }
<a name="l00101"></a>00101     }
<a name="l00102"></a>00102     <span class="keywordflow">return</span> s;
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max_nums = 8;
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 <span class="keyword">class </span>KIO::SlaveInterfacePrivate
<a name="l00108"></a>00108 {
<a name="l00109"></a>00109 <span class="keyword">public</span>:
<a name="l00110"></a>00110   SlaveInterfacePrivate() {
<a name="l00111"></a>00111     slave_calcs_speed = <span class="keyword">false</span>;
<a name="l00112"></a>00112     start_time.tv_sec = 0;
<a name="l00113"></a>00113     start_time.tv_usec = 0;
<a name="l00114"></a>00114     last_time = 0;
<a name="l00115"></a>00115     nums = 0;
<a name="l00116"></a>00116     filesize = 0;
<a name="l00117"></a>00117     offset = 0;
<a name="l00118"></a>00118   }
<a name="l00119"></a>00119   <span class="keywordtype">bool</span> slave_calcs_speed;
<a name="l00120"></a>00120   <span class="keyword">struct </span>timeval start_time;
<a name="l00121"></a>00121   uint nums;
<a name="l00122"></a>00122   <span class="keywordtype">long</span> times[max_nums];
<a name="l00123"></a>00123   <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> sizes[max_nums];
<a name="l00124"></a>00124   <span class="keywordtype">size_t</span> last_time;
<a name="l00125"></a>00125   <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> filesize, offset;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127   <a class="codeRef" href="qtimer.html">QTimer</a> speed_timer;
<a name="l00128"></a>00128 };
<a name="l00129"></a>00129 
<a name="l00131"></a>00131 
<a name="l00132"></a>00132 SlaveInterface::SlaveInterface( <a class="code" href="classKIO_1_1Connection.html" title="This class provides a simple means for IPC between two applications via a pipe.">Connection</a> * connection )
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134     m_pConnection = connection;
<a name="l00135"></a>00135     m_progressId = 0;
<a name="l00136"></a>00136 
<a name="l00137"></a>00137     d = <span class="keyword">new</span> SlaveInterfacePrivate;
<a name="l00138"></a>00138     <a class="codeRef" href="qobject.html#connect">connect</a>(&amp;d-&gt;speed_timer, SIGNAL(timeout()), SLOT(calcSpeed()));
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 SlaveInterface::~SlaveInterface()
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143     <span class="comment">// Note: no kdDebug() here (scheduler is deleted very late)</span>
<a name="l00144"></a>00144     m_pConnection = 0; <span class="comment">// a bit like the &quot;wasDeleted&quot; of QObject...</span>
<a name="l00145"></a>00145 
<a name="l00146"></a>00146     <span class="keyword">delete</span> d;
<a name="l00147"></a>00147 }
<a name="l00148"></a>00148 
<a name="l00149"></a>00149 <span class="keyword">static</span> <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> readFilesize_t(<a class="codeRef" href="qdatastream.html">QDataStream</a> &amp;stream)
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151    <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> result;
<a name="l00152"></a>00152    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ul;
<a name="l00153"></a>00153    stream &gt;&gt; ul;
<a name="l00154"></a>00154    result = ul;
<a name="l00155"></a>00155    <span class="keywordflow">if</span> (stream.<a class="codeRef" href="qdatastream.html#atEnd">atEnd</a>())
<a name="l00156"></a>00156       <span class="keywordflow">return</span> result;
<a name="l00157"></a>00157    stream &gt;&gt; ul;
<a name="l00158"></a>00158    result += ((<a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a>)ul) &lt;&lt; 32;
<a name="l00159"></a>00159    <span class="keywordflow">return</span> result;
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 
<a name="l00162"></a>00162 
<a name="l00163"></a>00163 <span class="keywordtype">bool</span> SlaveInterface::dispatch()
<a name="l00164"></a>00164 {
<a name="l00165"></a>00165     assert( m_pConnection );
<a name="l00166"></a>00166 
<a name="l00167"></a>00167     <span class="keywordtype">int</span> cmd;
<a name="l00168"></a>00168     <a class="codeRef" href="qbytearray.html">QByteArray</a> data;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <span class="keywordflow">if</span> (m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a484f8dada25c7d8315e1964b419278e7" title="Receive data.">read</a>( &amp;cmd, data ) == -1)
<a name="l00171"></a>00171       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173     <span class="keywordflow">return</span> dispatch( cmd, data );
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175 
<a name="l00176"></a>00176 <span class="keywordtype">void</span> SlaveInterface::calcSpeed()
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178   <span class="keywordflow">if</span> (d-&gt;slave_calcs_speed) {
<a name="l00179"></a>00179     d-&gt;speed_timer.stop();
<a name="l00180"></a>00180     <span class="keywordflow">return</span>;
<a name="l00181"></a>00181   }
<a name="l00182"></a>00182 
<a name="l00183"></a>00183   <span class="keyword">struct </span>timeval tv;
<a name="l00184"></a>00184   gettimeofday(&amp;tv, 0);
<a name="l00185"></a>00185 
<a name="l00186"></a>00186   <span class="keywordtype">long</span> diff = ((tv.tv_sec - d-&gt;start_time.tv_sec) * 1000000 +
<a name="l00187"></a>00187            tv.tv_usec - d-&gt;start_time.tv_usec) / 1000;
<a name="l00188"></a>00188   <span class="keywordflow">if</span> (diff - d-&gt;last_time &gt;= 900) {
<a name="l00189"></a>00189     d-&gt;last_time = diff;
<a name="l00190"></a>00190     <span class="keywordflow">if</span> (d-&gt;nums == max_nums) {
<a name="l00191"></a>00191       <span class="comment">// let&#39;s hope gcc can optimize that well enough</span>
<a name="l00192"></a>00192       <span class="comment">// otherwise I&#39;d try memcpy :)</span>
<a name="l00193"></a>00193       <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 1; i &lt; max_nums; ++i) {
<a name="l00194"></a>00194     d-&gt;times[i-1] = d-&gt;times[i];
<a name="l00195"></a>00195     d-&gt;sizes[i-1] = d-&gt;sizes[i];
<a name="l00196"></a>00196       }
<a name="l00197"></a>00197       d-&gt;nums--;
<a name="l00198"></a>00198     }
<a name="l00199"></a>00199     d-&gt;times[d-&gt;nums] = diff;
<a name="l00200"></a>00200     d-&gt;sizes[d-&gt;nums++] = d-&gt;filesize - d-&gt;offset;
<a name="l00201"></a>00201 
<a name="l00202"></a>00202     <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> lspeed = 1000 * (d-&gt;sizes[d-&gt;nums-1] - d-&gt;sizes[0]) / (d-&gt;times[d-&gt;nums-1] - d-&gt;times[0]);
<a name="l00203"></a>00203 
<a name="l00204"></a>00204 <span class="comment">//     kdDebug() &lt;&lt; &quot;proceeed &quot; &lt;&lt; (long)d-&gt;filesize &lt;&lt; &quot; &quot; &lt;&lt; diff &lt;&lt; &quot; &quot; </span>
<a name="l00205"></a>00205 <span class="comment">//        &lt;&lt; long(d-&gt;sizes[d-&gt;nums-1] - d-&gt;sizes[0]) &lt;&lt; &quot; &quot; </span>
<a name="l00206"></a>00206 <span class="comment">//        &lt;&lt;  d-&gt;times[d-&gt;nums-1] - d-&gt;times[0] &lt;&lt; &quot; &quot; </span>
<a name="l00207"></a>00207 <span class="comment">//        &lt;&lt; long(lspeed) &lt;&lt; &quot; &quot; &lt;&lt; double(d-&gt;filesize) / diff </span>
<a name="l00208"></a>00208 <span class="comment">//        &lt;&lt; &quot; &quot; &lt;&lt; convertSize(lspeed) &lt;&lt; &quot; &quot; </span>
<a name="l00209"></a>00209 <span class="comment">//        &lt;&lt; convertSize(long(double(d-&gt;filesize) / diff) * 1000) &lt;&lt; &quot; &quot; </span>
<a name="l00210"></a>00210 <span class="comment">//        &lt;&lt;  endl ;</span>
<a name="l00211"></a>00211 
<a name="l00212"></a>00212     <span class="keywordflow">if</span> (!lspeed) {
<a name="l00213"></a>00213       d-&gt;nums = 1;
<a name="l00214"></a>00214       d-&gt;times[0] = diff;
<a name="l00215"></a>00215       d-&gt;sizes[0] = d-&gt;filesize - d-&gt;offset;
<a name="l00216"></a>00216     }
<a name="l00217"></a>00217     emit speed(lspeed);
<a name="l00218"></a>00218   }
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220 
<a name="l00221"></a>00221 <span class="keywordtype">bool</span> SlaveInterface::dispatch( <span class="keywordtype">int</span> _cmd, <span class="keyword">const</span> <a class="codeRef" href="qbytearray.html">QByteArray</a> &amp;rawdata )
<a name="l00222"></a>00222 {
<a name="l00223"></a>00223     <span class="comment">//kdDebug(7007) &lt;&lt; &quot;dispatch &quot; &lt;&lt; _cmd &lt;&lt; endl;</span>
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <a class="codeRef" href="qdatastream.html">QDataStream</a> stream( rawdata, IO_ReadOnly );
<a name="l00226"></a>00226 
<a name="l00227"></a>00227     <a class="codeRef" href="qstring.html">QString</a> str1;
<a name="l00228"></a>00228     Q_INT32 i;
<a name="l00229"></a>00229     Q_INT8 b;
<a name="l00230"></a>00230     Q_UINT32 ul;
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="keywordflow">switch</span>( _cmd ) {
<a name="l00233"></a>00233     <span class="keywordflow">case</span> MSG_DATA:
<a name="l00234"></a>00234     emit data( rawdata );
<a name="l00235"></a>00235     <span class="keywordflow">break</span>;
<a name="l00236"></a>00236     <span class="keywordflow">case</span> MSG_DATA_REQ:
<a name="l00237"></a>00237         emit dataReq();
<a name="l00238"></a>00238     <span class="keywordflow">break</span>;
<a name="l00239"></a>00239     <span class="keywordflow">case</span> MSG_FINISHED:
<a name="l00240"></a>00240     <span class="comment">//kdDebug(7007) &lt;&lt; &quot;Finished [this = &quot; &lt;&lt; this &lt;&lt; &quot;]&quot; &lt;&lt; endl;</span>
<a name="l00241"></a>00241         d-&gt;offset = 0;
<a name="l00242"></a>00242         d-&gt;speed_timer.stop();
<a name="l00243"></a>00243     emit finished();
<a name="l00244"></a>00244     <span class="keywordflow">break</span>;
<a name="l00245"></a>00245     <span class="keywordflow">case</span> MSG_STAT_ENTRY:
<a name="l00246"></a>00246     {
<a name="l00247"></a>00247         <a class="codeRef" href="qvaluelist.html">UDSEntry</a> entry;
<a name="l00248"></a>00248         stream &gt;&gt; entry;
<a name="l00249"></a>00249         emit statEntry(entry);
<a name="l00250"></a>00250     }
<a name="l00251"></a>00251     <span class="keywordflow">break</span>;
<a name="l00252"></a>00252     <span class="keywordflow">case</span> MSG_LIST_ENTRIES:
<a name="l00253"></a>00253     {
<a name="l00254"></a>00254         Q_UINT32 count;
<a name="l00255"></a>00255         stream &gt;&gt; count;
<a name="l00256"></a>00256 
<a name="l00257"></a>00257         <a class="codeRef" href="qvaluelist.html">UDSEntryList</a> list;
<a name="l00258"></a>00258         <a class="codeRef" href="qvaluelist.html">UDSEntry</a> entry;
<a name="l00259"></a>00259         <span class="keywordflow">for</span> (uint i = 0; i &lt; count; i++) {
<a name="l00260"></a>00260         stream &gt;&gt; entry;
<a name="l00261"></a>00261         list.<a class="codeRef" href="qvaluelist.html#append">append</a>(entry);
<a name="l00262"></a>00262         }
<a name="l00263"></a>00263         emit listEntries(list);
<a name="l00264"></a>00264 
<a name="l00265"></a>00265     }
<a name="l00266"></a>00266     <span class="keywordflow">break</span>;
<a name="l00267"></a>00267     <span class="keywordflow">case</span> MSG_RESUME: <span class="comment">// From the put job</span>
<a name="l00268"></a>00268     {
<a name="l00269"></a>00269         d-&gt;offset = readFilesize_t(stream);
<a name="l00270"></a>00270         emit canResume( d-&gt;offset );
<a name="l00271"></a>00271     }
<a name="l00272"></a>00272     <span class="keywordflow">break</span>;
<a name="l00273"></a>00273     <span class="keywordflow">case</span> MSG_CANRESUME: <span class="comment">// From the get job</span>
<a name="l00274"></a>00274         d-&gt;filesize = d-&gt;offset;
<a name="l00275"></a>00275         emit canResume(0); <span class="comment">// the arg doesn&#39;t matter</span>
<a name="l00276"></a>00276         <span class="keywordflow">break</span>;
<a name="l00277"></a>00277     <span class="keywordflow">case</span> MSG_ERROR:
<a name="l00278"></a>00278     stream &gt;&gt; i &gt;&gt; str1;
<a name="l00279"></a>00279     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;error &quot;</span> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; str1 &lt;&lt; endl;
<a name="l00280"></a>00280     emit error( i, str1 );
<a name="l00281"></a>00281     <span class="keywordflow">break</span>;
<a name="l00282"></a>00282     <span class="keywordflow">case</span> MSG_SLAVE_STATUS:
<a name="l00283"></a>00283         {
<a name="l00284"></a>00284            pid_t pid;
<a name="l00285"></a>00285            <a class="codeRef" href="qcstring.html">QCString</a> protocol;
<a name="l00286"></a>00286            stream &gt;&gt; pid &gt;&gt; protocol &gt;&gt; str1 &gt;&gt; b;
<a name="l00287"></a>00287            emit slaveStatus(pid, protocol, str1, (b != 0));
<a name="l00288"></a>00288         }
<a name="l00289"></a>00289         <span class="keywordflow">break</span>;
<a name="l00290"></a>00290     <span class="keywordflow">case</span> MSG_CONNECTED:
<a name="l00291"></a>00291     emit connected();
<a name="l00292"></a>00292     <span class="keywordflow">break</span>;
<a name="l00293"></a>00293 
<a name="l00294"></a>00294     <span class="keywordflow">case</span> INF_TOTAL_SIZE:
<a name="l00295"></a>00295     {
<a name="l00296"></a>00296         <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> size = readFilesize_t(stream);
<a name="l00297"></a>00297         gettimeofday(&amp;d-&gt;start_time, 0);
<a name="l00298"></a>00298         d-&gt;last_time = 0;
<a name="l00299"></a>00299         d-&gt;filesize = d-&gt;offset;
<a name="l00300"></a>00300         d-&gt;sizes[0] = d-&gt;filesize - d-&gt;offset;
<a name="l00301"></a>00301         d-&gt;times[0] = 0;
<a name="l00302"></a>00302         d-&gt;nums = 1;
<a name="l00303"></a>00303         d-&gt;speed_timer.start(1000);
<a name="l00304"></a>00304         d-&gt;slave_calcs_speed = <span class="keyword">false</span>;
<a name="l00305"></a>00305         emit totalSize( size );
<a name="l00306"></a>00306     }
<a name="l00307"></a>00307     <span class="keywordflow">break</span>;
<a name="l00308"></a>00308     <span class="keywordflow">case</span> INF_PROCESSED_SIZE:
<a name="l00309"></a>00309     {
<a name="l00310"></a>00310         <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> size = readFilesize_t(stream);
<a name="l00311"></a>00311         emit processedSize( size );
<a name="l00312"></a>00312         d-&gt;filesize = size;
<a name="l00313"></a>00313     }
<a name="l00314"></a>00314     <span class="keywordflow">break</span>;
<a name="l00315"></a>00315     <span class="keywordflow">case</span> INF_SPEED:
<a name="l00316"></a>00316     stream &gt;&gt; ul;
<a name="l00317"></a>00317     d-&gt;slave_calcs_speed = <span class="keyword">true</span>;
<a name="l00318"></a>00318     d-&gt;speed_timer.stop();
<a name="l00319"></a>00319 
<a name="l00320"></a>00320     emit speed( ul );
<a name="l00321"></a>00321     <span class="keywordflow">break</span>;
<a name="l00322"></a>00322     <span class="keywordflow">case</span> INF_GETTING_FILE:
<a name="l00323"></a>00323     <span class="keywordflow">break</span>;
<a name="l00324"></a>00324     <span class="keywordflow">case</span> INF_ERROR_PAGE:
<a name="l00325"></a>00325     emit errorPage();
<a name="l00326"></a>00326     <span class="keywordflow">break</span>;
<a name="l00327"></a>00327     <span class="keywordflow">case</span> INF_REDIRECTION:
<a name="l00328"></a>00328       {
<a name="l00329"></a>00329     KURL url;
<a name="l00330"></a>00330     stream &gt;&gt; url;
<a name="l00331"></a>00331 
<a name="l00332"></a>00332     emit redirection( url );
<a name="l00333"></a>00333       }
<a name="l00334"></a>00334       <span class="keywordflow">break</span>;
<a name="l00335"></a>00335     <span class="keywordflow">case</span> INF_MIME_TYPE:
<a name="l00336"></a>00336     stream &gt;&gt; str1;
<a name="l00337"></a>00337 
<a name="l00338"></a>00338     emit mimeType( str1 );
<a name="l00339"></a>00339         <span class="keywordflow">if</span> (!m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a79b6ce832849d95a632eb8c0c1dc178a" title="Returns status of connection.">suspended</a>())
<a name="l00340"></a>00340             m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( CMD_NONE, <a class="codeRef" href="qbytearray.html">QByteArray</a>() );
<a name="l00341"></a>00341     <span class="keywordflow">break</span>;
<a name="l00342"></a>00342     <span class="keywordflow">case</span> INF_WARNING:
<a name="l00343"></a>00343     stream &gt;&gt; str1;
<a name="l00344"></a>00344 
<a name="l00345"></a>00345     emit warning( str1 );
<a name="l00346"></a>00346     <span class="keywordflow">break</span>;
<a name="l00347"></a>00347     <span class="keywordflow">case</span> INF_NEED_PASSWD: {
<a name="l00348"></a>00348         <a class="code" href="classKIO_1_1AuthInfo.html" title="This class is intended to make it easier to prompt for, cache and retrieve authorization information...">AuthInfo</a> info;
<a name="l00349"></a>00349         stream &gt;&gt; info;
<a name="l00350"></a>00350     <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">openPassDlg</a>( info );
<a name="l00351"></a>00351     <span class="keywordflow">break</span>;
<a name="l00352"></a>00352     }
<a name="l00353"></a>00353     <span class="keywordflow">case</span> INF_MESSAGEBOX: {
<a name="l00354"></a>00354     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;needs a msg box&quot;</span> &lt;&lt; endl;
<a name="l00355"></a>00355     <a class="codeRef" href="qstring.html">QString</a> text, caption, buttonYes, buttonNo, dontAskAgainName;
<a name="l00356"></a>00356         <span class="keywordtype">int</span> type;
<a name="l00357"></a>00357     stream &gt;&gt; type &gt;&gt; text &gt;&gt; caption &gt;&gt; buttonYes &gt;&gt; buttonNo;
<a name="l00358"></a>00358     <span class="keywordflow">if</span> (stream.<a class="codeRef" href="qdatastream.html#atEnd">atEnd</a>())
<a name="l00359"></a>00359     messageBox(type, text, caption, buttonYes, buttonNo);
<a name="l00360"></a>00360     <span class="keywordflow">else</span> {
<a name="l00361"></a>00361         stream &gt;&gt; dontAskAgainName;
<a name="l00362"></a>00362         messageBox(type, text, caption, buttonYes, buttonNo, dontAskAgainName);
<a name="l00363"></a>00363     }
<a name="l00364"></a>00364     <span class="keywordflow">break</span>;
<a name="l00365"></a>00365     }
<a name="l00366"></a>00366     <span class="keywordflow">case</span> INF_INFOMESSAGE: {
<a name="l00367"></a>00367         <a class="codeRef" href="qstring.html">QString</a> msg;
<a name="l00368"></a>00368         stream &gt;&gt; msg;
<a name="l00369"></a>00369         infoMessage(msg);
<a name="l00370"></a>00370         <span class="keywordflow">break</span>;
<a name="l00371"></a>00371     }
<a name="l00372"></a>00372     <span class="keywordflow">case</span> INF_META_DATA: {
<a name="l00373"></a>00373         <a class="code" href="classKIO_1_1MetaData.html" title="MetaData is a simple map of key/value strings.">MetaData</a> meta_data;
<a name="l00374"></a>00374         stream &gt;&gt; meta_data;
<a name="l00375"></a>00375         metaData(meta_data);
<a name="l00376"></a>00376         <span class="keywordflow">break</span>;
<a name="l00377"></a>00377     }
<a name="l00378"></a>00378     <span class="keywordflow">case</span> MSG_NET_REQUEST: {
<a name="l00379"></a>00379         <a class="codeRef" href="qstring.html">QString</a> host;
<a name="l00380"></a>00380     <a class="codeRef" href="qstring.html">QString</a> slaveid;
<a name="l00381"></a>00381         stream &gt;&gt; host &gt;&gt; slaveid;
<a name="l00382"></a>00382         requestNetwork(host, slaveid);
<a name="l00383"></a>00383         <span class="keywordflow">break</span>;
<a name="l00384"></a>00384     }
<a name="l00385"></a>00385     <span class="keywordflow">case</span> MSG_NET_DROP: {
<a name="l00386"></a>00386         <a class="codeRef" href="qstring.html">QString</a> host;
<a name="l00387"></a>00387     <a class="codeRef" href="qstring.html">QString</a> slaveid;
<a name="l00388"></a>00388         stream &gt;&gt; host &gt;&gt; slaveid;
<a name="l00389"></a>00389         dropNetwork(host, slaveid);
<a name="l00390"></a>00390         <span class="keywordflow">break</span>;
<a name="l00391"></a>00391     }
<a name="l00392"></a>00392     <span class="keywordflow">case</span> MSG_NEED_SUBURL_DATA: {
<a name="l00393"></a>00393         emit needSubURLData();
<a name="l00394"></a>00394         <span class="keywordflow">break</span>;
<a name="l00395"></a>00395     }
<a name="l00396"></a>00396     <span class="keywordflow">case</span> MSG_AUTH_KEY: {
<a name="l00397"></a>00397         <span class="keywordtype">bool</span> keep;
<a name="l00398"></a>00398         <a class="codeRef" href="qcstring.html">QCString</a> key, group;
<a name="l00399"></a>00399         stream &gt;&gt; key &gt;&gt; group &gt;&gt; keep;
<a name="l00400"></a>00400         kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;Got auth-key:      &quot;</span> &lt;&lt; key &lt;&lt; endl
<a name="l00401"></a>00401                       &lt;&lt; <span class="stringliteral">&quot;    group-key:     &quot;</span> &lt;&lt; group &lt;&lt; endl
<a name="l00402"></a>00402                       &lt;&lt; <span class="stringliteral">&quot;    keep password: &quot;</span> &lt;&lt; keep &lt;&lt; endl;
<a name="l00403"></a>00403         emit <a class="code" href="classKIO_1_1SlaveInterface.html#ae25e916e5e68076819a5cf597b6b345e">authorizationKey</a>( key, group, keep );
<a name="l00404"></a>00404         <span class="keywordflow">break</span>;
<a name="l00405"></a>00405     }
<a name="l00406"></a>00406     <span class="keywordflow">case</span> MSG_DEL_AUTH_KEY: {
<a name="l00407"></a>00407         <a class="codeRef" href="qcstring.html">QCString</a> key;
<a name="l00408"></a>00408         stream &gt;&gt; key;
<a name="l00409"></a>00409         kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;Delete auth-key: &quot;</span> &lt;&lt; key &lt;&lt; endl;
<a name="l00410"></a>00410         emit <a class="code" href="classKIO_1_1SlaveInterface.html#a0523747d11dfb00e339cc72c3d21ea1a">delAuthorization</a>( key );
<a name="l00411"></a>00411     }
<a name="l00412"></a>00412     <span class="keywordflow">default</span>:
<a name="l00413"></a>00413         kdWarning(7007) &lt;&lt; <span class="stringliteral">&quot;Slave sends unknown command (&quot;</span> &lt;&lt; _cmd &lt;&lt; <span class="stringliteral">&quot;), dropping slave&quot;</span> &lt;&lt; endl;
<a name="l00414"></a>00414     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00415"></a>00415     }
<a name="l00416"></a>00416     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00417"></a>00417 }
<a name="l00418"></a>00418 
<a name="l00419"></a>00419 <span class="keywordtype">void</span> SlaveInterface::setOffset( <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> o)
<a name="l00420"></a>00420 {
<a name="l00421"></a>00421     d-&gt;offset = o;
<a name="l00422"></a>00422 }
<a name="l00423"></a>00423 
<a name="l00424"></a>00424 <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> SlaveInterface::offset()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d-&gt;offset; }
<a name="l00425"></a>00425 
<a name="l00426"></a>00426 <span class="keywordtype">void</span> SlaveInterface::requestNetwork(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;host, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;slaveid)
<a name="l00427"></a>00427 {
<a name="l00428"></a>00428     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;requestNetwork &quot;</span> &lt;&lt; host &lt;&lt; slaveid &lt;&lt; endl;
<a name="l00429"></a>00429     <a class="codeRef" href="qbytearray.html">QByteArray</a> packedArgs;
<a name="l00430"></a>00430     <a class="codeRef" href="qdatastream.html">QDataStream</a> stream( packedArgs, IO_WriteOnly );
<a name="l00431"></a>00431     stream &lt;&lt; <span class="keyword">true</span>;
<a name="l00432"></a>00432     m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( INF_NETWORK_STATUS, packedArgs );
<a name="l00433"></a>00433 }
<a name="l00434"></a>00434 
<a name="l00435"></a>00435 <span class="keywordtype">void</span> SlaveInterface::dropNetwork(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;host, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;slaveid)
<a name="l00436"></a>00436 {
<a name="l00437"></a>00437     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;dropNetwork &quot;</span> &lt;&lt; host &lt;&lt; slaveid &lt;&lt; endl;
<a name="l00438"></a>00438 }
<a name="l00439"></a>00439 
<a name="l00440"></a><a class="code" href="classKIO_1_1SlaveInterface.html#a183de16a527f3bde79a151d4c8c46228">00440</a> <span class="keywordtype">void</span> <a class="code" href="classKIO_1_1SlaveInterface.html#a183de16a527f3bde79a151d4c8c46228" title="Send our answer to the MSG_RESUME (canResume) request (to tell the &quot;put&quot; job whether to resume or not...">SlaveInterface::sendResumeAnswer</a>( <span class="keywordtype">bool</span> resume )
<a name="l00441"></a>00441 {
<a name="l00442"></a>00442     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;SlaveInterface::sendResumeAnswer ok for resuming :&quot;</span> &lt;&lt; resume &lt;&lt; endl;
<a name="l00443"></a>00443     m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( resume ? CMD_RESUMEANSWER : CMD_NONE, <a class="codeRef" href="qbytearray.html">QByteArray</a>() );
<a name="l00444"></a>00444 }
<a name="l00445"></a>00445 
<a name="l00446"></a><a class="code" href="classKIO_1_1SlaveInterface.html#a670d4c22bd40ce7fa366da13dc084af9">00446</a> <span class="keywordtype">void</span> <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">SlaveInterface::openPassDlg</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; prompt, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; user, <span class="keywordtype">bool</span> readOnly )
<a name="l00447"></a>00447 {
<a name="l00448"></a>00448     <a class="code" href="classKIO_1_1AuthInfo.html" title="This class is intended to make it easier to prompt for, cache and retrieve authorization information...">AuthInfo</a> info;
<a name="l00449"></a>00449     info.<a class="code" href="classKIO_1_1AuthInfo.html#ae134d552753248d04e090e342108c864" title="Information to be displayed when prompting the user for authentication information.">prompt</a> = prompt;
<a name="l00450"></a>00450     info.<a class="code" href="classKIO_1_1AuthInfo.html#abc129ff4f95d42a753c227a8923e06fe" title="This is required for caching.">username</a> = user;
<a name="l00451"></a>00451     info.<a class="code" href="classKIO_1_1AuthInfo.html#aa62c5130b18da47c069935f77a6d0576" title="Flag which if set forces the username field to be read-only.">readOnly</a> = readOnly;
<a name="l00452"></a>00452     <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">openPassDlg</a>( info );
<a name="l00453"></a>00453 }
<a name="l00454"></a>00454 
<a name="l00455"></a><a class="code" href="classKIO_1_1SlaveInterface.html#a87d1a0c321cdcaeed41db7468f38cbc6">00455</a> <span class="keywordtype">void</span> <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">SlaveInterface::openPassDlg</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; prompt, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; user,
<a name="l00456"></a>00456                                   <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; caption, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; comment,
<a name="l00457"></a>00457                                   <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>&amp; label, <span class="keywordtype">bool</span> readOnly )
<a name="l00458"></a>00458 {
<a name="l00459"></a>00459     <a class="code" href="classKIO_1_1AuthInfo.html" title="This class is intended to make it easier to prompt for, cache and retrieve authorization information...">AuthInfo</a> info;
<a name="l00460"></a>00460     info.<a class="code" href="classKIO_1_1AuthInfo.html#ae134d552753248d04e090e342108c864" title="Information to be displayed when prompting the user for authentication information.">prompt</a> = prompt;
<a name="l00461"></a>00461     info.<a class="code" href="classKIO_1_1AuthInfo.html#abc129ff4f95d42a753c227a8923e06fe" title="This is required for caching.">username</a> = user;
<a name="l00462"></a>00462     info.<a class="code" href="classKIO_1_1AuthInfo.html#aaf1bf0b4eb67bb3c4ef7f7fb00fec72d" title="The text to displayed in the title bar of the password prompting dialog.">caption</a> = caption;
<a name="l00463"></a>00463     info.<a class="code" href="classKIO_1_1AuthInfo.html#a9d0e642bed9175c9585fa63b27225eed" title="Additional comment to be displayed when prompting the user for authentication information.">comment</a> = comment;
<a name="l00464"></a>00464     info.<a class="code" href="classKIO_1_1AuthInfo.html#ae2d3878a3063c70f92f22d53b617652c" title="Descriptive label to be displayed in front of the comment when prompting the user for password...">commentLabel</a> = label;
<a name="l00465"></a>00465     info.<a class="code" href="classKIO_1_1AuthInfo.html#aa62c5130b18da47c069935f77a6d0576" title="Flag which if set forces the username field to be read-only.">readOnly</a> = readOnly;
<a name="l00466"></a>00466     <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">openPassDlg</a>( info );
<a name="l00467"></a>00467 }
<a name="l00468"></a>00468 
<a name="l00469"></a><a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575">00469</a> <span class="keywordtype">void</span> <a class="code" href="classKIO_1_1SlaveInterface.html#a643a2485559b3963205e8a3ac4b6b575" title="Prompt the user for authrization info (login &amp; password).">SlaveInterface::openPassDlg</a>( <a class="code" href="classKIO_1_1AuthInfo.html" title="This class is intended to make it easier to prompt for, cache and retrieve authorization information...">AuthInfo</a>&amp; info )
<a name="l00470"></a>00470 {
<a name="l00471"></a>00471     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;SlaveInterface::openPassDlg: &quot;</span>
<a name="l00472"></a>00472                   &lt;&lt; <span class="stringliteral">&quot;User= &quot;</span> &lt;&lt; info.<a class="code" href="classKIO_1_1AuthInfo.html#abc129ff4f95d42a753c227a8923e06fe" title="This is required for caching.">username</a>
<a name="l00473"></a>00473                   &lt;&lt; <span class="stringliteral">&quot;, Message= &quot;</span> &lt;&lt; info.<a class="code" href="classKIO_1_1AuthInfo.html#ae134d552753248d04e090e342108c864" title="Information to be displayed when prompting the user for authentication information.">prompt</a> &lt;&lt; endl;
<a name="l00474"></a>00474     <span class="keywordtype">bool</span> result = <a class="code" href="classObserver.html#a819b33124c76017e32d90e88e676e8be" title="Returns the unique observer object.">Observer::self</a>()-&gt;<a class="code" href="classObserver.html#a24eadadbc4349f5f02a23a40c10d784a">openPassDlg</a>( info );
<a name="l00475"></a>00475     <span class="keywordflow">if</span> ( m_pConnection )
<a name="l00476"></a>00476     {
<a name="l00477"></a>00477         <a class="codeRef" href="qbytearray.html">QByteArray</a> data;
<a name="l00478"></a>00478         <a class="codeRef" href="qdatastream.html">QDataStream</a> stream( data, IO_WriteOnly );
<a name="l00479"></a>00479         <span class="keywordflow">if</span> ( result )
<a name="l00480"></a>00480         {
<a name="l00481"></a>00481             stream &lt;&lt; info;
<a name="l00482"></a>00482             kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;SlaveInterface:::openPassDlg got: &quot;</span>
<a name="l00483"></a>00483                           &lt;&lt; <span class="stringliteral">&quot;User= &quot;</span> &lt;&lt; info.<a class="code" href="classKIO_1_1AuthInfo.html#abc129ff4f95d42a753c227a8923e06fe" title="This is required for caching.">username</a>
<a name="l00484"></a>00484                           &lt;&lt; <span class="stringliteral">&quot;, Password= [hidden]&quot;</span> &lt;&lt; endl;
<a name="l00485"></a>00485             m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( CMD_USERPASS, data );
<a name="l00486"></a>00486         }
<a name="l00487"></a>00487         <span class="keywordflow">else</span>
<a name="l00488"></a>00488             m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( CMD_NONE, data );
<a name="l00489"></a>00489     }
<a name="l00490"></a>00490 }
<a name="l00491"></a>00491 
<a name="l00492"></a>00492 <span class="keywordtype">void</span> SlaveInterface::messageBox( <span class="keywordtype">int</span> type, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;text, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;_caption,
<a name="l00493"></a>00493                                  <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;buttonYes, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;buttonNo )
<a name="l00494"></a>00494 {
<a name="l00495"></a>00495     messageBox( type, text, _caption, buttonYes, buttonNo, QString::null );
<a name="l00496"></a>00496 }
<a name="l00497"></a>00497 
<a name="l00498"></a><a class="code" href="classKIO_1_1SlaveInterface.html#a4b14cc93dd9088ee0bb9505dde9fa769">00498</a> <span class="keywordtype">void</span> SlaveInterface::messageBox( <span class="keywordtype">int</span> type, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;text, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;_caption,
<a name="l00499"></a>00499                                  <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;buttonYes, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;buttonNo, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &amp;dontAskAgainName )
<a name="l00500"></a>00500 {
<a name="l00501"></a>00501     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;messageBox &quot;</span> &lt;&lt; type &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; text &lt;&lt; <span class="stringliteral">&quot; - &quot;</span> &lt;&lt; _caption &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; dontAskAgainName &lt;&lt; endl;
<a name="l00502"></a>00502     <a class="codeRef" href="qbytearray.html">QByteArray</a> packedArgs;
<a name="l00503"></a>00503     <a class="codeRef" href="qdatastream.html">QDataStream</a> stream( packedArgs, IO_WriteOnly );
<a name="l00504"></a>00504 
<a name="l00505"></a>00505     <a class="codeRef" href="qstring.html">QString</a> caption( _caption );
<a name="l00506"></a>00506     <span class="keywordflow">if</span> ( type == KIO::SlaveBase::SSLMessageBox )
<a name="l00507"></a>00507         caption = <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(kapp-&gt;dcopClient()-&gt;appId()); <span class="comment">// hack, see observer.cpp</span>
<a name="l00508"></a>00508 
<a name="l00509"></a>00509     emit needProgressId();
<a name="l00510"></a>00510     kdDebug(7007) &lt;&lt; <span class="stringliteral">&quot;SlaveInterface::messageBox m_progressId=&quot;</span> &lt;&lt; m_progressId &lt;&lt; endl;
<a name="l00511"></a>00511     <a class="codeRef" href="qguardedptr.html">QGuardedPtr&lt;SlaveInterface&gt;</a> me = <span class="keyword">this</span>;
<a name="l00512"></a>00512     m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a782c5bb48fb580734bef3315c14cde7b" title="Don&#39;t handle incoming data until resumed.">suspend</a>();
<a name="l00513"></a>00513     <span class="keywordtype">int</span> result = <a class="code" href="classObserver.html" title="Observer for KIO::Job progress information.">Observer</a>::<span class="comment">/*self()-&gt;*/</span>messageBox( m_progressId, type, text, caption, buttonYes, buttonNo, dontAskAgainName );
<a name="l00514"></a>00514     <span class="keywordflow">if</span> ( me &amp;&amp; m_pConnection ) <span class="comment">// Don&#39;t do anything if deleted meanwhile</span>
<a name="l00515"></a>00515     {
<a name="l00516"></a>00516         m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a012cb6fe4266b0c7c12e51cea3b1ddfe" title="Resume handling of incoming data.">resume</a>();
<a name="l00517"></a>00517         kdDebug(7007) &lt;&lt; <span class="keyword">this</span> &lt;&lt; <span class="stringliteral">&quot; SlaveInterface result=&quot;</span> &lt;&lt; result &lt;&lt; endl;
<a name="l00518"></a>00518         stream &lt;&lt; result;
<a name="l00519"></a>00519         m_pConnection-&gt;<a class="code" href="classKIO_1_1Connection.html#a3086baf78a1a26079f763bf04a68b8f8" title="Sends the given command immediately.">sendnow</a>( CMD_MESSAGEBOXANSWER, packedArgs );
<a name="l00520"></a>00520     }
<a name="l00521"></a>00521 }
<a name="l00522"></a>00522 
<a name="l00523"></a>00523 <span class="comment">// No longer used.</span>
<a name="l00524"></a>00524 <span class="comment">// Remove in KDE 4.0</span>
<a name="l00525"></a>00525 <span class="keywordtype">void</span> SlaveInterface::sigpipe_handler(<span class="keywordtype">int</span>)
<a name="l00526"></a>00526 {
<a name="l00527"></a>00527     <span class="keywordtype">int</span> saved_errno = errno;
<a name="l00528"></a>00528     <span class="comment">// Using kdDebug from a signal handler is not a good idea.</span>
<a name="l00529"></a>00529 <span class="preprocessor">#ifndef NDEBUG    </span>
<a name="l00530"></a>00530 <span class="preprocessor"></span>    <span class="keywordtype">char</span> msg[1000];
<a name="l00531"></a>00531     sprintf(msg, <span class="stringliteral">&quot;*** SIGPIPE *** (ignored, pid = %ld)\n&quot;</span>, (<span class="keywordtype">long</span>) getpid());
<a name="l00532"></a>00532     write(2, msg, strlen(msg));
<a name="l00533"></a>00533 <span class="preprocessor">#endif    </span>
<a name="l00534"></a>00534 <span class="preprocessor"></span>
<a name="l00535"></a>00535     <span class="comment">// Do nothing.</span>
<a name="l00536"></a>00536     <span class="comment">// dispatch will return false and that will trigger ERR_SLAVE_DIED in slave.cpp</span>
<a name="l00537"></a>00537     errno = saved_errno;
<a name="l00538"></a>00538 }
<a name="l00539"></a>00539 
<a name="l00540"></a>00540 <span class="keywordtype">void</span> SlaveInterface::virtual_hook( <span class="keywordtype">int</span>, <span class="keywordtype">void</span>* )
<a name="l00541"></a>00541 { <span class="comment">/*BASE::virtual_hook( id, data );*/</span> }
<a name="l00542"></a>00542 
<a name="l00543"></a>00543 <span class="preprocessor">#include &quot;slaveinterface.moc&quot;</span>
</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>kio/kio</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="modules.html">Modules</a></li><li><a href="namespaces.html">Namespace List</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="namespacemembers.html">Namespace Members</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="classKACL.html">kacl</option>,  <option value="classKAr.html">kar</option>,  <option value="classKArchive.html">karchive</option>,  <option value="classKArchiveDirectory.html">karchivedirectory</option>,  <option value="classKArchiveEntry.html">karchiveentry</option>,  <option value="classKArchiveFile.html">karchivefile</option>,  <option value="classKAutoMount.html">kautomount</option>,  <option value="classKAutoUnmount.html">kautounmount</option>,  <option value="classKDataTool.html">kdatatool</option>,  <option value="classKDataToolAction.html">kdatatoolaction</option>,  <option value="classKDataToolInfo.html">kdatatoolinfo</option>,  <option value="classKDCOPServiceStarter.html">kdcopservicestarter</option>,  <option value="classKDEDesktopMimeType.html">kdedesktopmimetype</option>,  <option value="classKDirLister.html">kdirlister</option>,  <option value="classKDirNotify.html">kdirnotify</option>,  <option value="classKDirWatch.html">kdirwatch</option>,  <option value="classKEMailSettings.html">kemailsettings</option>,  <option value="classKExecMimeType.html">kexecmimetype</option>,  <option value="classKFileFilter.html">kfilefilter</option>,  <option value="classKFileItem.html">kfileitem</option>,  <option value="classKFileMetaInfo.html">kfilemetainfo</option>,  <option value="classKFileMetaInfoGroup.html">kfilemetainfogroup</option>,  <option value="classKFileMetaInfoItem.html">kfilemetainfoitem</option>,  <option value="classKFileMimeTypeInfo.html">kfilemimetypeinfo</option>,  <option value="classKFileMimeTypeInfo_1_1GroupInfo.html">kfilemimetypeinfo::groupinfo</option>,  <option value="classKFileMimeTypeInfo_1_1ItemInfo.html">kfilemimetypeinfo::iteminfo</option>,  <option value="classKFilePlugin.html">kfileplugin</option>,  <option value="classKFileShare.html">kfileshare</option>,  <option value="classKFilterBase.html">kfilterbase</option>,  <option value="classKFilterDev.html">kfilterdev</option>,  <option value="classKFolderType.html">kfoldertype</option>,  <option value="classKImageIO.html">kimageio</option>,  <option value="classKIO_1_1AuthInfo.html">kio::authinfo</option>,  <option value="classKIO_1_1ChmodJob.html">kio::chmodjob</option>,  <option value="classKIO_1_1Connection.html">kio::connection</option>,  <option value="classKIO_1_1CopyJob.html">kio::copyjob</option>,  <option value="classKIO_1_1DataProtocol.html">kio::dataprotocol</option>,  <option value="classKIO_1_1DataSlave.html">kio::dataslave</option>,  <option value="classKIO_1_1DavJob.html">kio::davjob</option>,  <option value="classKIO_1_1DeleteJob.html">kio::deletejob</option>,  <option value="classKIO_1_1FileCopyJob.html">kio::filecopyjob</option>,  <option value="classKIO_1_1ForwardingSlaveBase.html">kio::forwardingslavebase</option>,  <option value="classKIO_1_1Job.html">kio::job</option>,  <option value="classKIO_1_1ListJob.html">kio::listjob</option>,  <option value="classKIO_1_1MetaData.html">kio::metadata</option>,  <option value="classKIO_1_1MetaInfoJob.html">kio::metainfojob</option>,  <option value="classKIO_1_1MimetypeJob.html">kio::mimetypejob</option>,  <option value="classKIO_1_1MkdirJob.html">kio::mkdirjob</option>,  <option value="classKIO_1_1MultiGetJob.html">kio::multigetjob</option>,  <option value="classKIO_1_1NetAccess.html">kio::netaccess</option>,  <option value="classKIO_1_1NetRC.html">kio::netrc</option>,  <option value="classKIO_1_1PasswordDialog.html">kio::passworddialog</option>,  <option value="classKIO_1_1PreviewJob.html">kio::previewjob</option>,  <option value="classKIO_1_1ProgressBase.html">kio::progressbase</option>,  <option value="classKIO_1_1RenameDlg.html">kio::renamedlg</option>,  <option value="classKIO_1_1Scheduler.html">kio::scheduler</option>,  <option value="classKIO_1_1SimpleJob.html">kio::simplejob</option>,  <option value="classKIO_1_1Slave.html">kio::slave</option>,  <option value="classKIO_1_1SlaveBase.html">kio::slavebase</option>,  <option value="classKIO_1_1SlaveConfig.html">kio::slaveconfig</option>,  <option value="classKIO_1_1SlaveInterface.html">kio::slaveinterface</option>,  <option value="classKIO_1_1StatJob.html">kio::statjob</option>,  <option value="classKIO_1_1StatusbarProgress.html">kio::statusbarprogress</option>,  <option value="classKIO_1_1StoredTransferJob.html">kio::storedtransferjob</option>,  <option value="classKIO_1_1TCPSlaveBase.html">kio::tcpslavebase</option>,  <option value="classKIO_1_1TransferJob.html">kio::transferjob</option>,  <option value="classKLimitedIODevice.html">klimitediodevice</option>,  <option value="classKMimeMagic.html">kmimemagic</option>,  <option value="classKMimeMagicResult.html">kmimemagicresult</option>,  <option value="classKMimeType.html">kmimetype</option>,  <option value="classKMimeTypeChooser.html">kmimetypechooser</option>,  <option value="classKMimeTypeChooserDialog.html">kmimetypechooserdialog</option>,  <option value="classKMimeTypeResolver.html">kmimetyperesolver</option>,  <option value="classKNFSShare.html">knfsshare</option>,  <option value="classKOCRDialog.html">kocrdialog</option>,  <option value="classKOCRDialogFactory.html">kocrdialogfactory</option>,  <option value="classKOpenWithHandler.html">kopenwithhandler</option>,  <option value="classKProtocolInfo.html">kprotocolinfo</option>,  <option value="classKProtocolManager.html">kprotocolmanager</option>,  <option value="classKRemoteEncoding.html">kremoteencoding</option>,  <option value="classKRun.html">krun</option>,  <option value="classKSambaShare.html">ksambashare</option>,  <option value="classKScanDialog.html">kscandialog</option>,  <option value="classKScanDialogFactory.html">kscandialogfactory</option>,  <option value="classKService.html">kservice</option>,  <option value="classKServiceGroup.html">kservicegroup</option>,  <option value="classKServiceOffer.html">kserviceoffer</option>,  <option value="classKServiceType.html">kservicetype</option>,  <option value="classKServiceTypeProfile.html">kservicetypeprofile</option>,  <option value="classKShellCompletion.html">kshellcompletion</option>,  <option value="classKShred.html">kshred</option>,  <option value="classKSimpleFileFilter.html">ksimplefilefilter</option>,  <option value="classKTar.html">ktar</option>,  <option value="classKTrader.html">ktrader</option>,  <option value="classKURIFilter.html">kurifilter</option>,  <option value="classKURIFilterData.html">kurifilterdata</option>,  <option value="classKURIFilterPlugin.html">kurifilterplugin</option>,  <option value="classKURIFilterPluginList.html">kurifilterpluginlist</option>,  <option value="classKURLCompletion.html">kurlcompletion</option>,  <option value="classKURLPixmapProvider.html">kurlpixmapprovider</option>,  <option value="classKZip.html">kzip</option>,  <option value="classObserver.html">observer</option>,  <option value="classRenameDlgPlugin.html">renamedlgplugin</option>,  <option value="classThumbCreator.html">thumbcreator</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>