<?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: kfileitem.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">kfileitem.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 project</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 1999 David Faure <faure@kde.org></span> <a name="l00003"></a>00003 <span class="comment"> 2001 Carsten Pfeiffer <pfeiffer@kde.org></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 as published by the Free Software Foundation; either</span> <a name="l00008"></a>00008 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> Library General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment"> You should have received a copy of the GNU Library General Public License</span> <a name="l00016"></a>00016 <span class="comment"> along with this library; see the file COPYING.LIB. If not, write to</span> <a name="l00017"></a>00017 <span class="comment"> the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span> <a name="l00018"></a>00018 <span class="comment"> Boston, MA 02110-1301, USA.</span> <a name="l00019"></a>00019 <span class="comment">*/</span> <a name="l00020"></a>00020 <span class="comment">// $Id: kfileitem.cpp 717004 2007-09-25 20:52:46Z dfaure $</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#include <sys/time.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <pwd.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <grp.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <sys/types.h></span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#include <assert.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <unistd.h></span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include "kfileitem.h"</span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#include <qdir.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <qfile.h></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <qmap.h></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <qstylesheet.h></span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="preprocessor">#include <kdebug.h></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <kfilemetainfo.h></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <ksambashare.h></span> <a name="l00040"></a>00040 <span class="preprocessor">#include <knfsshare.h></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <kglobal.h></span> <a name="l00042"></a>00042 <span class="preprocessor">#include <kglobalsettings.h></span> <a name="l00043"></a>00043 <span class="preprocessor">#include <kiconloader.h></span> <a name="l00044"></a>00044 <span class="preprocessor">#include <klargefile.h></span> <a name="l00045"></a>00045 <span class="preprocessor">#include <klocale.h></span> <a name="l00046"></a>00046 <span class="preprocessor">#include <kmimetype.h></span> <a name="l00047"></a>00047 <span class="preprocessor">#include <krun.h></span> <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keyword">class </span>KFileItem::KFileItemPrivate { <a name="l00050"></a>00050 <span class="keyword">public</span>: <a name="l00051"></a>00051 <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#ae9bca1f9843f11ac8e1aabe909f646d6" title="Returns the full path name to the icon that represents this mime type.">iconName</a>; <a name="l00052"></a>00052 }; <a name="l00053"></a>00053 <a name="l00054"></a><a class="code" href="classKFileItem.html#a56106c566fa11a9f3ceae33407ac7710">00054</a> <a class="code" href="classKFileItem.html#a56106c566fa11a9f3ceae33407ac7710" title="Creates an item representing a file, from a UDSEntry.">KFileItem::KFileItem</a>( <span class="keyword">const</span> <a class="codeRef" href="qvaluelist.html">KIO::UDSEntry</a>& _entry, <span class="keyword">const</span> KURL& _url, <a name="l00055"></a>00055 <span class="keywordtype">bool</span> _determineMimeTypeOnDemand, <span class="keywordtype">bool</span> _urlIsDirectory ) : <a name="l00056"></a>00056 m_entry( _entry ), <a name="l00057"></a>00057 m_url( _url ), <a name="l00058"></a>00058 m_pMimeType( 0 ), <a name="l00059"></a>00059 m_fileMode( <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a>::Unknown ), <a name="l00060"></a>00060 m_permissions( <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a>::Unknown ), <a name="l00061"></a>00061 m_bMarked( false ), <a name="l00062"></a>00062 m_bLink( false ), <a name="l00063"></a>00063 m_bIsLocalURL( _url.isLocalFile() ), <a name="l00064"></a>00064 m_bMimeTypeKnown( false ), <a name="l00065"></a>00065 m_hidden( Auto ), <a name="l00066"></a>00066 d(0) <a name="l00067"></a>00067 { <a name="l00068"></a>00068 <a class="code" href="classKFileItem.html#aeabdbd8b43ef82f91903f28496b143b5" title="Extracts the data from the UDSEntry member and updates the KFileItem accordingly.">readUDSEntry</a>( _urlIsDirectory ); <a name="l00069"></a>00069 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( _determineMimeTypeOnDemand ); <a name="l00070"></a>00070 } <a name="l00071"></a>00071 <a name="l00072"></a><a class="code" href="classKFileItem.html#abeb77f5976012616b24919241e9a4afc">00072</a> <a class="code" href="classKFileItem.html#a56106c566fa11a9f3ceae33407ac7710" title="Creates an item representing a file, from a UDSEntry.">KFileItem::KFileItem</a>( mode_t _mode, mode_t _permissions, <span class="keyword">const</span> KURL& _url, <span class="keywordtype">bool</span> _determineMimeTypeOnDemand ) : <a name="l00073"></a>00073 m_entry(), <span class="comment">// warning !</span> <a name="l00074"></a>00074 m_url( _url ), <a name="l00075"></a>00075 m_strName( _url.fileName() ), <a name="l00076"></a>00076 m_strText( KIO::decodeFileName( m_strName ) ), <a name="l00077"></a>00077 m_pMimeType( 0 ), <a name="l00078"></a>00078 m_fileMode ( _mode ), <a name="l00079"></a>00079 m_permissions( _permissions ), <a name="l00080"></a>00080 m_bMarked( false ), <a name="l00081"></a>00081 m_bLink( false ), <a name="l00082"></a>00082 m_bIsLocalURL( _url.isLocalFile() ), <a name="l00083"></a>00083 m_bMimeTypeKnown( false ), <a name="l00084"></a>00084 m_hidden( Auto ), <a name="l00085"></a>00085 d(0) <a name="l00086"></a>00086 { <a name="l00087"></a>00087 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( _determineMimeTypeOnDemand ); <a name="l00088"></a>00088 } <a name="l00089"></a>00089 <a name="l00090"></a><a class="code" href="classKFileItem.html#a8c178dc51ab8b4177b924992c70946a4">00090</a> <a class="code" href="classKFileItem.html#a56106c566fa11a9f3ceae33407ac7710" title="Creates an item representing a file, from a UDSEntry.">KFileItem::KFileItem</a>( <span class="keyword">const</span> KURL &url, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &mimeType, mode_t mode ) <a name="l00091"></a>00091 : m_url( url ), <a name="l00092"></a>00092 m_strName( url.fileName() ), <a name="l00093"></a>00093 m_strText( KIO::decodeFileName( m_strName ) ), <a name="l00094"></a>00094 m_pMimeType( 0 ), <a name="l00095"></a>00095 m_fileMode( mode ), <a name="l00096"></a>00096 m_permissions( <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a>::Unknown ), <a name="l00097"></a>00097 m_bMarked( false ), <a name="l00098"></a>00098 m_bLink( false ), <a name="l00099"></a>00099 m_bIsLocalURL( url.isLocalFile() ), <a name="l00100"></a>00100 m_bMimeTypeKnown( !mimeType.isEmpty() ), <a name="l00101"></a>00101 m_hidden( Auto ), <a name="l00102"></a>00102 d(0) <a name="l00103"></a>00103 { <a name="l00104"></a>00104 <span class="keywordflow">if</span> (m_bMimeTypeKnown) <a name="l00105"></a>00105 m_pMimeType = <a class="code" href="classKMimeType.html#a1fd115a75a84e762e31d8424eee683c0" title="Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...">KMimeType::mimeType</a>( mimeType ); <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( <span class="keyword">false</span> ); <a name="l00108"></a>00108 } <a name="l00109"></a>00109 <a name="l00110"></a><a class="code" href="classKFileItem.html#a00c6f3d2af7c051717af236c48bcbf99">00110</a> <a class="code" href="classKFileItem.html#a56106c566fa11a9f3ceae33407ac7710" title="Creates an item representing a file, from a UDSEntry.">KFileItem::KFileItem</a>( <span class="keyword">const</span> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & item ) : <a name="l00111"></a>00111 d(0) <a name="l00112"></a>00112 { <a name="l00113"></a>00113 <a class="code" href="classKFileItem.html#a6adc540938a5c4d2851a8adf05b56b91" title="Somewhat like an assignment operator, but more explicit.">assign</a>( item ); <a name="l00114"></a>00114 } <a name="l00115"></a>00115 <a name="l00116"></a><a class="code" href="classKFileItem.html#a1230aeeda96269f906c82455423fc7f8">00116</a> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a>& <a class="code" href="classKFileItem.html#a1230aeeda96269f906c82455423fc7f8" title="Assignment operator, calls assign()">KFileItem::operator=</a>( <span class="keyword">const</span> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & item ) <a name="l00117"></a>00117 { <a name="l00118"></a>00118 <a class="code" href="classKFileItem.html#a6adc540938a5c4d2851a8adf05b56b91" title="Somewhat like an assignment operator, but more explicit.">assign</a>( item ); <a name="l00119"></a>00119 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00120"></a>00120 } <a name="l00121"></a>00121 <a name="l00122"></a><a class="code" href="classKFileItem.html#a2c8b439cd4d86b1a68a51a3d6fdb4831">00122</a> <a class="code" href="classKFileItem.html#a2c8b439cd4d86b1a68a51a3d6fdb4831" title="Destructs the KFileItem.">KFileItem::~KFileItem</a>() <a name="l00123"></a>00123 { <a name="l00124"></a>00124 <span class="keyword">delete</span> d; <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <a name="l00127"></a><a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f">00127</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">KFileItem::init</a>( <span class="keywordtype">bool</span> _determineMimeTypeOnDemand ) <a name="l00128"></a>00128 { <a name="l00129"></a>00129 m_access = QString::null; <a name="l00130"></a>00130 m_size = (<a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a>) -1; <a name="l00131"></a>00131 <span class="comment">// metaInfo = KFileMetaInfo();</span> <a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < NumFlags; i++ ) <a name="l00133"></a>00133 m_time[i] = (time_t) -1; <a name="l00134"></a>00134 <a name="l00135"></a>00135 <span class="comment">// determine mode and/or permissions if unknown</span> <a name="l00136"></a>00136 <span class="keywordflow">if</span> ( m_fileMode == KFileItem::Unknown || m_permissions == KFileItem::Unknown ) <a name="l00137"></a>00137 { <a name="l00138"></a>00138 mode_t <a class="code" href="classKFileItem.html#af506df34a95e060e42e792321e8babc3" title="Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).">mode</a> = 0; <a name="l00139"></a>00139 <span class="keywordflow">if</span> ( m_url.isLocalFile() ) <a name="l00140"></a>00140 { <a name="l00141"></a>00141 <span class="comment">/* directories may not have a slash at the end if</span> <a name="l00142"></a>00142 <span class="comment"> * we want to stat() them; it requires that we</span> <a name="l00143"></a>00143 <span class="comment"> * change into it .. which may not be allowed</span> <a name="l00144"></a>00144 <span class="comment"> * stat("/is/unaccessible") -> rwx------</span> <a name="l00145"></a>00145 <span class="comment"> * stat("/is/unaccessible/") -> EPERM H.Z.</span> <a name="l00146"></a>00146 <span class="comment"> * This is the reason for the -1</span> <a name="l00147"></a>00147 <span class="comment"> */</span> <a name="l00148"></a>00148 KDE_struct_stat buf; <a name="l00149"></a>00149 <a class="codeRef" href="qcstring.html">QCString</a> path = <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path( -1 )); <a name="l00150"></a>00150 <span class="keywordflow">if</span> ( KDE_lstat( path.data(), &buf ) == 0 ) <a name="l00151"></a>00151 { <a name="l00152"></a>00152 mode = buf.st_mode; <a name="l00153"></a>00153 <span class="keywordflow">if</span> ( S_ISLNK( mode ) ) <a name="l00154"></a>00154 { <a name="l00155"></a>00155 m_bLink = <span class="keyword">true</span>; <a name="l00156"></a>00156 <span class="keywordflow">if</span> ( KDE_stat( path.data(), &buf ) == 0 ) <a name="l00157"></a>00157 mode = buf.st_mode; <a name="l00158"></a>00158 <span class="keywordflow">else</span> <span class="comment">// link pointing to nowhere (see kio/file/file.cc)</span> <a name="l00159"></a>00159 mode = (S_IFMT-1) | S_IRWXU | S_IRWXG | S_IRWXO; <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <span class="comment">// While we're at it, store the times</span> <a name="l00162"></a>00162 m_time[ Modification ] = buf.st_mtime; <a name="l00163"></a>00163 m_time[ Access ] = buf.st_atime; <a name="l00164"></a>00164 <span class="keywordflow">if</span> ( m_fileMode == KFileItem::Unknown ) <a name="l00165"></a>00165 m_fileMode = mode & S_IFMT; <span class="comment">// extract file type</span> <a name="l00166"></a>00166 <span class="keywordflow">if</span> ( m_permissions == KFileItem::Unknown ) <a name="l00167"></a>00167 m_permissions = mode & 07777; <span class="comment">// extract permissions</span> <a name="l00168"></a>00168 } <a name="l00169"></a>00169 } <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="comment">// determine the mimetype</span> <a name="l00173"></a>00173 <span class="keywordflow">if</span> (!m_pMimeType && !m_url.isEmpty()) <a name="l00174"></a>00174 { <a name="l00175"></a>00175 <span class="keywordtype">bool</span> accurate = <span class="keyword">false</span>; <a name="l00176"></a>00176 <span class="keywordtype">bool</span> isLocalURL; <a name="l00177"></a>00177 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l00178"></a>00178 <a name="l00179"></a>00179 m_pMimeType = <a class="code" href="classKMimeType.html#a19c6563574d22a7395c4686c06e1dec9" title="Finds a KMimeType with the given _url.">KMimeType::findByURL</a>( url, m_fileMode, isLocalURL, <a name="l00180"></a>00180 <span class="comment">// use fast mode if not mimetype on demand</span> <a name="l00181"></a>00181 _determineMimeTypeOnDemand, &accurate ); <a name="l00182"></a>00182 <span class="comment">//kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl;</span> <a name="l00183"></a>00183 <span class="comment">// if we didn't use fast mode, or if we got a result, then this is the mimetype</span> <a name="l00184"></a>00184 <span class="comment">// otherwise, determineMimeType will be able to do better.</span> <a name="l00185"></a>00185 m_bMimeTypeKnown = (!_determineMimeTypeOnDemand) || accurate; <a name="l00186"></a>00186 } <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a name="l00189"></a><a class="code" href="classKFileItem.html#aeabdbd8b43ef82f91903f28496b143b5">00189</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#aeabdbd8b43ef82f91903f28496b143b5" title="Extracts the data from the UDSEntry member and updates the KFileItem accordingly.">KFileItem::readUDSEntry</a>( <span class="keywordtype">bool</span> _urlIsDirectory ) <a name="l00190"></a>00190 { <a name="l00191"></a>00191 <span class="comment">// extract the mode and the filename from the KIO::UDS Entry</span> <a name="l00192"></a>00192 <span class="keywordtype">bool</span> UDS_URL_seen = <span class="keyword">false</span>; <a name="l00193"></a>00193 <a name="l00194"></a>00194 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00195"></a>00195 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) { <a name="l00196"></a>00196 <span class="keywordflow">switch</span> ((*it).m_uds) { <a name="l00197"></a>00197 <a name="l00198"></a>00198 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa4590810bdb9f536e059b4b56d20eaa80" title="File type, part of the mode returned by stat (for a link, this returns the file type of the pointed i...">KIO::UDS_FILE_TYPE</a>: <a name="l00199"></a>00199 m_fileMode = (mode_t)((*it).m_long); <a name="l00200"></a>00200 <span class="keywordflow">break</span>; <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fab031d28b4167ef62f3ee443a6a9faad8" title="Access permissions (part of the mode returned by stat)">KIO::UDS_ACCESS</a>: <a name="l00203"></a>00203 m_permissions = (mode_t)((*it).m_long); <a name="l00204"></a>00204 <span class="keywordflow">break</span>; <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa4c7df384be883aec80ad883562a794de" title="User ID of the file owner.">KIO::UDS_USER</a>: <a name="l00207"></a>00207 m_user = ((*it).m_str); <a name="l00208"></a>00208 <span class="keywordflow">break</span>; <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa3f6d30183bf075ef698abbca27fdb4fb" title="Group ID of the file owner.">KIO::UDS_GROUP</a>: <a name="l00211"></a>00211 m_group = ((*it).m_str); <a name="l00212"></a>00212 <span class="keywordflow">break</span>; <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa94e07a8780517ea4b39a276e31f8c34c" title="Filename - as displayed in directory listings etc.">KIO::UDS_NAME</a>: <a name="l00215"></a>00215 m_strName = (*it).m_str; <a name="l00216"></a>00216 m_strText = <a class="code" href="namespaceKIO.html#ae9b548badbdfb20fa0c40350bc58b8e0" title="Decodes (from the filename to the text displayed) This translates %2[fF] into / and %% into %...">KIO::decodeFileName</a>( m_strName ); <a name="l00217"></a>00217 <span class="keywordflow">break</span>; <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa13f881c377fd2b93883a0eab616ab372" title="An alternative URL (If different from the caption)">KIO::UDS_URL</a>: <a name="l00220"></a>00220 UDS_URL_seen = <span class="keyword">true</span>; <a name="l00221"></a>00221 m_url = KURL((*it).m_str); <a name="l00222"></a>00222 <span class="keywordflow">if</span> ( m_url.isLocalFile() ) <a name="l00223"></a>00223 m_bIsLocalURL = <span class="keyword">true</span>; <a name="l00224"></a>00224 <span class="keywordflow">break</span>; <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa395a47a2c972e9f25892b0d36f801f05" title="A mime type; prevents guessing.">KIO::UDS_MIME_TYPE</a>: <a name="l00227"></a>00227 m_pMimeType = <a class="code" href="classKMimeType.html#a1fd115a75a84e762e31d8424eee683c0" title="Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...">KMimeType::mimeType</a>((*it).m_str); <a name="l00228"></a>00228 m_bMimeTypeKnown = <span class="keyword">true</span>; <a name="l00229"></a>00229 <span class="keywordflow">break</span>; <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa74b94fc1ee16c0890d33ec52a862221f" title="A mime type to be used for displaying only.">KIO::UDS_GUESSED_MIME_TYPE</a>: <a name="l00232"></a>00232 m_guessedMimeType = (*it).m_str; <a name="l00233"></a>00233 <span class="keywordflow">break</span>; <a name="l00234"></a>00234 <a name="l00235"></a>00235 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa3956eae3bdc1a21c6b5f41945d9fe391" title="Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !)...">KIO::UDS_LINK_DEST</a>: <a name="l00236"></a>00236 m_bLink = !(*it).m_str.isEmpty(); <span class="comment">// we don't store the link dest</span> <a name="l00237"></a>00237 <span class="keywordflow">break</span>; <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31facd20a6f9f2968cc29c366664c425f523" title="Name of the icon, that should be used for displaying.">KIO::UDS_ICON_NAME</a>: <a name="l00240"></a>00240 <span class="keywordflow">if</span> ( !d ) <a name="l00241"></a>00241 d = <span class="keyword">new</span> KFileItemPrivate(); <a name="l00242"></a>00242 d->iconName = (*it).m_str; <a name="l00243"></a>00243 <span class="keywordflow">break</span>; <a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa6d64d46661eeb18357cd9379ae2bd36c" title="Treat the file as a hidden file or as a normal file, regardless of (the absence of) a leading dot in ...">KIO::UDS_HIDDEN</a>: <a name="l00246"></a>00246 <span class="keywordflow">if</span> ( (*it).m_long ) <a name="l00247"></a>00247 m_hidden = Hidden; <a name="l00248"></a>00248 <span class="keywordflow">else</span> <a name="l00249"></a>00249 m_hidden = Shown; <a name="l00250"></a>00250 <span class="keywordflow">break</span>; <a name="l00251"></a>00251 } <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <a name="l00254"></a>00254 <span class="comment">// avoid creating these QStrings again and again</span> <a name="l00255"></a>00255 <span class="keyword">static</span> <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>& dot = KGlobal::staticQString(<span class="stringliteral">"."</span>); <a name="l00256"></a>00256 <span class="keywordflow">if</span> ( _urlIsDirectory && !UDS_URL_seen && !m_strName.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() && m_strName != dot ) <a name="l00257"></a>00257 m_url.addPath( m_strName ); <a name="l00258"></a>00258 } <a name="l00259"></a>00259 <a name="l00260"></a><a class="code" href="classKFileItem.html#afcd50458f3068076a1101c5b6a3b140a">00260</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#afcd50458f3068076a1101c5b6a3b140a" title="Throw away and re-read (for local files) all information about the file.">KFileItem::refresh</a>() <a name="l00261"></a>00261 { <a name="l00262"></a>00262 m_fileMode = KFileItem::Unknown; <a name="l00263"></a>00263 m_permissions = KFileItem::Unknown; <a name="l00264"></a>00264 m_pMimeType = 0L; <a name="l00265"></a>00265 m_user = QString::null; <a name="l00266"></a>00266 m_group = QString::null; <a name="l00267"></a>00267 m_metaInfo = <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a>(); <a name="l00268"></a>00268 m_hidden = Auto; <a name="l00269"></a>00269 <a name="l00270"></a>00270 <span class="comment">// Basically, we can't trust any information we got while listing.</span> <a name="l00271"></a>00271 <span class="comment">// Everything could have changed...</span> <a name="l00272"></a>00272 <span class="comment">// Clearing m_entry makes it possible to detect changes in the size of the file,</span> <a name="l00273"></a>00273 <span class="comment">// the time information, etc.</span> <a name="l00274"></a>00274 m_entry = <a class="codeRef" href="qvaluelist.html">KIO::UDSEntry</a>(); <a name="l00275"></a>00275 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( <span class="keyword">false</span> ); <a name="l00276"></a>00276 } <a name="l00277"></a>00277 <a name="l00278"></a><a class="code" href="classKFileItem.html#ac156df49d355c2d9b1039ace72fa25cd">00278</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#ac156df49d355c2d9b1039ace72fa25cd" title="Re-reads mimetype information.">KFileItem::refreshMimeType</a>() <a name="l00279"></a>00279 { <a name="l00280"></a>00280 m_pMimeType = 0L; <a name="l00281"></a>00281 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( <span class="keyword">false</span> ); <span class="comment">// Will determine the mimetype</span> <a name="l00282"></a>00282 } <a name="l00283"></a>00283 <a name="l00284"></a><a class="code" href="classKFileItem.html#a62fe8d1866b48322b1f2cd1114d0c143">00284</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a62fe8d1866b48322b1f2cd1114d0c143" title="Sets the item's URL.">KFileItem::setURL</a>( <span class="keyword">const</span> KURL &url ) <a name="l00285"></a>00285 { <a name="l00286"></a>00286 m_url = <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a>; <a name="l00287"></a>00287 <a class="code" href="classKFileItem.html#affc9e408d0140daf4a87f56646a20627" title="Sets the item's name (i.e.">setName</a>( url.fileName() ); <a name="l00288"></a>00288 } <a name="l00289"></a>00289 <a name="l00290"></a><a class="code" href="classKFileItem.html#affc9e408d0140daf4a87f56646a20627">00290</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#affc9e408d0140daf4a87f56646a20627" title="Sets the item's name (i.e.">KFileItem::setName</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>& name ) <a name="l00291"></a>00291 { <a name="l00292"></a>00292 m_strName = <a class="code" href="classKFileItem.html#a6974c0e2d9e74c77a8bed531bc1e7b34" title="Return the name of the file item (without a path).">name</a>; <a name="l00293"></a>00293 m_strText = <a class="code" href="namespaceKIO.html#ae9b548badbdfb20fa0c40350bc58b8e0" title="Decodes (from the filename to the text displayed) This translates %2[fF] into / and %% into %...">KIO::decodeFileName</a>( m_strName ); <a name="l00294"></a>00294 } <a name="l00295"></a>00295 <a name="l00296"></a><a class="code" href="classKFileItem.html#a297821bebb5d81dfe379553277be512d">00296</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a297821bebb5d81dfe379553277be512d" title="Returns the link destination if isLink() == true.">KFileItem::linkDest</a>()<span class="keyword"> const</span> <a name="l00297"></a>00297 <span class="keyword"></span>{ <a name="l00298"></a>00298 <span class="comment">// Extract it from the KIO::UDSEntry</span> <a name="l00299"></a>00299 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00300"></a>00300 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) <a name="l00301"></a>00301 <span class="keywordflow">if</span> ( (*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa3956eae3bdc1a21c6b5f41945d9fe391" title="Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !)...">KIO::UDS_LINK_DEST</a> ) <a name="l00302"></a>00302 <span class="keywordflow">return</span> (*it).m_str; <a name="l00303"></a>00303 <span class="comment">// If not in the KIO::UDSEntry, or if UDSEntry empty, use readlink() [if local URL]</span> <a name="l00304"></a>00304 if ( m_bIsLocalURL ) <a name="l00305"></a>00305 { <a name="l00306"></a>00306 <span class="keywordtype">char</span> buf[1000]; <a name="l00307"></a>00307 <span class="keywordtype">int</span> n = readlink( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path( -1 )), buf, <span class="keyword">sizeof</span>(buf)-1 ); <a name="l00308"></a>00308 <span class="keywordflow">if</span> ( n != -1 ) <a name="l00309"></a>00309 { <a name="l00310"></a>00310 buf[ n ] = 0; <a name="l00311"></a>00311 <span class="keywordflow">return</span> <a class="codeRef" href="qfile.html#decodeName">QFile::decodeName</a>( buf ); <a name="l00312"></a>00312 } <a name="l00313"></a>00313 } <a name="l00314"></a>00314 <span class="keywordflow">return</span> QString::null; <a name="l00315"></a>00315 } <a name="l00316"></a>00316 <a name="l00317"></a><a class="code" href="classKFileItem.html#aa0ea703232934902e9132073da38037e">00317</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#aa0ea703232934902e9132073da38037e" title="Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...">KFileItem::localPath</a>()<span class="keyword"> const</span> <a name="l00318"></a>00318 <span class="keyword"></span>{ <a name="l00319"></a>00319 <span class="keywordflow">if</span> ( m_bIsLocalURL ) <a name="l00320"></a>00320 { <a name="l00321"></a>00321 <span class="keywordflow">return</span> m_url.path(); <a name="l00322"></a>00322 } <a name="l00323"></a>00323 <span class="keywordflow">else</span> <a name="l00324"></a>00324 { <a name="l00325"></a>00325 <span class="comment">// Extract the local path from the KIO::UDSEntry</span> <a name="l00326"></a>00326 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00327"></a>00327 <span class="keyword">const</span> <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> end = m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); <a name="l00328"></a>00328 <span class="keywordflow">for</span>( ; it != end; ++it ) <a name="l00329"></a>00329 <span class="keywordflow">if</span> ( (*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa8c80e3448e660ec63ab98ae043711188" title="A local file path if the ioslave display files sitting on the local filesystem (but in another hierar...">KIO::UDS_LOCAL_PATH</a> ) <a name="l00330"></a>00330 <span class="keywordflow">return</span> (*it).m_str; <a name="l00331"></a>00331 } <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="keywordflow">return</span> QString::null; <a name="l00334"></a>00334 } <a name="l00335"></a>00335 <a name="l00336"></a><a class="code" href="classKFileItem.html#a0c6087141d904cfac4454e737c4d12ba">00336</a> <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">KFileItem::size</a>(<span class="keywordtype">bool</span> &exists)<span class="keyword"> const</span> <a name="l00337"></a>00337 <span class="keyword"></span>{ <a name="l00338"></a>00338 exists = <span class="keyword">true</span>; <a name="l00339"></a>00339 <span class="keywordflow">if</span> ( m_size != (<a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a>) -1 ) <a name="l00340"></a>00340 <span class="keywordflow">return</span> m_size; <a name="l00341"></a>00341 <a name="l00342"></a>00342 <span class="comment">// Extract it from the KIO::UDSEntry</span> <a name="l00343"></a>00343 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00344"></a>00344 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) <a name="l00345"></a>00345 <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="l00346"></a>00346 m_size = (*it).m_long; <a name="l00347"></a>00347 <span class="keywordflow">return</span> m_size; <a name="l00348"></a>00348 } <a name="l00349"></a>00349 <span class="comment">// If not in the KIO::UDSEntry, or if UDSEntry empty, use stat() [if local URL]</span> <a name="l00350"></a>00350 <span class="keywordflow">if</span> ( m_bIsLocalURL ) <a name="l00351"></a>00351 { <a name="l00352"></a>00352 KDE_struct_stat buf; <a name="l00353"></a>00353 <span class="keywordflow">if</span> ( KDE_stat( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path( -1 )), &buf ) == 0 ) <a name="l00354"></a>00354 <span class="keywordflow">return</span> buf.st_size; <a name="l00355"></a>00355 } <a name="l00356"></a>00356 exists = <span class="keyword">false</span>; <a name="l00357"></a>00357 <span class="keywordflow">return</span> 0L; <a name="l00358"></a>00358 } <a name="l00359"></a>00359 <a name="l00360"></a><a class="code" href="classKFileItem.html#a7b7aa7baf5c1b4b4e4fd1716709bc489">00360</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#a7b7aa7baf5c1b4b4e4fd1716709bc489" title="Tells if the file has extended access level information ( Posix ACL )">KFileItem::hasExtendedACL</a>()<span class="keyword"> const</span> <a name="l00361"></a>00361 <span class="keyword"></span>{ <a name="l00362"></a>00362 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00363"></a>00363 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); it++ ) <a name="l00364"></a>00364 <span class="keywordflow">if</span> ( (*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa8506a0f7a5e67874101594fbcfdd528e" title="Indicates that the entry has extended ACL entries.">KIO::UDS_EXTENDED_ACL</a> ) { <a name="l00365"></a>00365 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00366"></a>00366 } <a name="l00367"></a>00367 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00368"></a>00368 } <a name="l00369"></a>00369 <a name="l00370"></a><a class="code" href="classKFileItem.html#a8fb34b5708180e210f915caa925d801f">00370</a> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a> <a class="code" href="classKFileItem.html#a8fb34b5708180e210f915caa925d801f" title="Returns the access control list for the file.">KFileItem::ACL</a>()<span class="keyword"> const</span> <a name="l00371"></a>00371 <span class="keyword"></span>{ <a name="l00372"></a>00372 <span class="keywordflow">if</span> ( <a class="code" href="classKFileItem.html#a7b7aa7baf5c1b4b4e4fd1716709bc489" title="Tells if the file has extended access level information ( Posix ACL )">hasExtendedACL</a>() ) { <a name="l00373"></a>00373 <span class="comment">// Extract it from the KIO::UDSEntry</span> <a name="l00374"></a>00374 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00375"></a>00375 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) <a name="l00376"></a>00376 <span class="keywordflow">if</span> ( (*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa0b5a0fffe6ff27f187a1c4e2d8795fc2" title="The access control list serialized into a single string.">KIO::UDS_ACL_STRING</a> ) <a name="l00377"></a>00377 <span class="keywordflow">return</span> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a>((*it).m_str); <a name="l00378"></a>00378 } <a name="l00379"></a>00379 <span class="comment">// create one from the basic permissions</span> <a name="l00380"></a>00380 <span class="keywordflow">return</span> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a>( m_permissions ); <a name="l00381"></a>00381 } <a name="l00382"></a>00382 <a name="l00383"></a><a class="code" href="classKFileItem.html#ab23718ce8eb1d9da21589480a61ff005">00383</a> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a> <a class="code" href="classKFileItem.html#ab23718ce8eb1d9da21589480a61ff005" title="Returns the default access control list for the directory.">KFileItem::defaultACL</a>()<span class="keyword"> const</span> <a name="l00384"></a>00384 <span class="keyword"></span>{ <a name="l00385"></a>00385 <span class="comment">// Extract it from the KIO::UDSEntry</span> <a name="l00386"></a>00386 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00387"></a>00387 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) <a name="l00388"></a>00388 <span class="keywordflow">if</span> ( (*it).m_uds == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fae7a3f8caa1572f2a62ce2c20ce0d17c4" title="The default access control list serialized into a single string.">KIO::UDS_DEFAULT_ACL_STRING</a> ) <a name="l00389"></a>00389 <span class="keywordflow">return</span> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a>((*it).m_str); <a name="l00390"></a>00390 <span class="keywordflow">return</span> <a class="code" href="classKACL.html" title="The KCAL class encapsulates a POSIX Access Control List.">KACL</a>(); <a name="l00391"></a>00391 } <a name="l00392"></a>00392 <a name="l00393"></a><a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e">00393</a> <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">KFileItem::size</a>()<span class="keyword"> const</span> <a name="l00394"></a>00394 <span class="keyword"></span>{ <a name="l00395"></a>00395 <span class="keywordtype">bool</span> exists; <a name="l00396"></a>00396 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">size</a>(exists); <a name="l00397"></a>00397 } <a name="l00398"></a>00398 <a name="l00399"></a><a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936">00399</a> time_t <a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">KFileItem::time</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> which )<span class="keyword"> const</span> <a name="l00400"></a>00400 <span class="keyword"></span>{ <a name="l00401"></a>00401 <span class="keywordtype">bool</span> hasTime; <a name="l00402"></a>00402 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">time</a>(which, hasTime); <a name="l00403"></a>00403 } <a name="l00404"></a><a class="code" href="classKFileItem.html#a655f1a5b11f99e83cdd97214f1c25615">00404</a> time_t <a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">KFileItem::time</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> which, <span class="keywordtype">bool</span> &hasTime )<span class="keyword"> const</span> <a name="l00405"></a>00405 <span class="keyword"></span>{ <a name="l00406"></a>00406 hasTime = <span class="keyword">true</span>; <a name="l00407"></a>00407 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mappedWhich = 0; <a name="l00408"></a>00408 <a name="l00409"></a>00409 <span class="keywordflow">switch</span>( which ) { <a name="l00410"></a>00410 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa2870258f5a68f7dd13a18703c7144d10" title="The last time the file was modified.">KIO::UDS_MODIFICATION_TIME</a>: <a name="l00411"></a>00411 mappedWhich = Modification; <a name="l00412"></a>00412 <span class="keywordflow">break</span>; <a name="l00413"></a>00413 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa26b4cb0f839e572b3f1158e3e08cda21" title="The last time the file was opened.">KIO::UDS_ACCESS_TIME</a>: <a name="l00414"></a>00414 mappedWhich = Access; <a name="l00415"></a>00415 <span class="keywordflow">break</span>; <a name="l00416"></a>00416 <span class="keywordflow">case</span> <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa3554c1700aa5a0095249db6a67a643a5" title="The time the file was created.">KIO::UDS_CREATION_TIME</a>: <a name="l00417"></a>00417 mappedWhich = Creation; <a name="l00418"></a>00418 <span class="keywordflow">break</span>; <a name="l00419"></a>00419 } <a name="l00420"></a>00420 <a name="l00421"></a>00421 <span class="keywordflow">if</span> ( m_time[mappedWhich] != (time_t) -1 ) <a name="l00422"></a>00422 <span class="keywordflow">return</span> m_time[mappedWhich]; <a name="l00423"></a>00423 <a name="l00424"></a>00424 <span class="comment">// Extract it from the KIO::UDSEntry</span> <a name="l00425"></a>00425 <a class="codeRef" href="qvaluelist.html#ConstIterator">KIO::UDSEntry::ConstIterator</a> it = m_entry.<a class="codeRef" href="qvaluelist.html#begin">begin</a>(); <a name="l00426"></a>00426 <span class="keywordflow">for</span>( ; it != m_entry.<a class="codeRef" href="qvaluelist.html#end">end</a>(); ++it ) <a name="l00427"></a>00427 <span class="keywordflow">if</span> ( (*it).m_uds == which ) { <a name="l00428"></a>00428 m_time[mappedWhich] = <span class="keyword">static_cast<</span>time_t<span class="keyword">></span>((*it).m_long); <a name="l00429"></a>00429 <span class="keywordflow">return</span> m_time[mappedWhich]; <a name="l00430"></a>00430 } <a name="l00431"></a>00431 <a name="l00432"></a>00432 <span class="comment">// If not in the KIO::UDSEntry, or if UDSEntry empty, use stat() [if local URL]</span> <a name="l00433"></a>00433 <span class="keywordflow">if</span> ( m_bIsLocalURL ) <a name="l00434"></a>00434 { <a name="l00435"></a>00435 KDE_struct_stat buf; <a name="l00436"></a>00436 <span class="keywordflow">if</span> ( KDE_stat( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path(-1)), &buf ) == 0 ) <a name="l00437"></a>00437 { <a name="l00438"></a>00438 <span class="keywordflow">if</span>(which == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa3554c1700aa5a0095249db6a67a643a5" title="The time the file was created.">KIO::UDS_CREATION_TIME</a>) { <a name="l00439"></a>00439 <span class="comment">// We can't determine creation time for local files</span> <a name="l00440"></a>00440 hasTime = <span class="keyword">false</span>; <a name="l00441"></a>00441 m_time[mappedWhich] = <span class="keyword">static_cast<</span>time_t<span class="keyword">></span>(0); <a name="l00442"></a>00442 <span class="keywordflow">return</span> m_time[mappedWhich]; <a name="l00443"></a>00443 } <a name="l00444"></a>00444 m_time[mappedWhich] = (which == <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa2870258f5a68f7dd13a18703c7144d10" title="The last time the file was modified.">KIO::UDS_MODIFICATION_TIME</a>) ? <a name="l00445"></a>00445 buf.st_mtime : <a name="l00446"></a>00446 <span class="comment">/* which == KIO::UDS_ACCESS_TIME)*/</span> <a name="l00447"></a>00447 buf.st_atime; <a name="l00448"></a>00448 <span class="keywordflow">return</span> m_time[mappedWhich]; <a name="l00449"></a>00449 } <a name="l00450"></a>00450 } <a name="l00451"></a>00451 hasTime = <span class="keyword">false</span>; <a name="l00452"></a>00452 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span>time_t<span class="keyword">></span>(0); <a name="l00453"></a>00453 } <a name="l00454"></a>00454 <a name="l00455"></a>00455 <a name="l00456"></a><a class="code" href="classKFileItem.html#a4aea36ab5a5b94d1582c10eaf2a2f3c6">00456</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a4aea36ab5a5b94d1582c10eaf2a2f3c6" title="Returns the owner of the file.">KFileItem::user</a>()<span class="keyword"> const</span> <a name="l00457"></a>00457 <span class="keyword"></span>{ <a name="l00458"></a>00458 <span class="keywordflow">if</span> ( m_user.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() && m_bIsLocalURL ) <a name="l00459"></a>00459 { <a name="l00460"></a>00460 KDE_struct_stat buff; <a name="l00461"></a>00461 <span class="keywordflow">if</span> ( KDE_lstat( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path( -1 )), &buff ) == 0) <span class="comment">// get uid/gid of the link, if it's a link</span> <a name="l00462"></a>00462 { <a name="l00463"></a>00463 <span class="keyword">struct </span>passwd *<a class="code" href="classKFileItem.html#a4aea36ab5a5b94d1582c10eaf2a2f3c6" title="Returns the owner of the file.">user</a> = getpwuid( buff.st_uid ); <a name="l00464"></a>00464 <span class="keywordflow">if</span> ( user != 0L ) <a name="l00465"></a>00465 m_user = <a class="codeRef" href="qstring.html#fromLocal8Bit">QString::fromLocal8Bit</a>(user->pw_name); <a name="l00466"></a>00466 } <a name="l00467"></a>00467 } <a name="l00468"></a>00468 <span class="keywordflow">return</span> m_user; <a name="l00469"></a>00469 } <a name="l00470"></a>00470 <a name="l00471"></a><a class="code" href="classKFileItem.html#a740d81934f194d2154e239f7f0cfff9a">00471</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a740d81934f194d2154e239f7f0cfff9a" title="Returns the group of the file.">KFileItem::group</a>()<span class="keyword"> const</span> <a name="l00472"></a>00472 <span class="keyword"></span>{ <a name="l00473"></a>00473 <span class="preprocessor">#ifdef Q_OS_UNIX</span> <a name="l00474"></a>00474 <span class="preprocessor"></span> <span class="keywordflow">if</span> (m_group.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() && m_bIsLocalURL ) <a name="l00475"></a>00475 { <a name="l00476"></a>00476 KDE_struct_stat buff; <a name="l00477"></a>00477 <span class="keywordflow">if</span> ( KDE_lstat( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path( -1 )), &buff ) == 0) <span class="comment">// get uid/gid of the link, if it's a link</span> <a name="l00478"></a>00478 { <a name="l00479"></a>00479 <span class="keyword">struct </span><a class="code" href="classKFileItem.html#a740d81934f194d2154e239f7f0cfff9a" title="Returns the group of the file.">group</a> *ge = getgrgid( buff.st_gid ); <a name="l00480"></a>00480 <span class="keywordflow">if</span> ( ge != 0L ) { <a name="l00481"></a>00481 m_group = <a class="codeRef" href="qstring.html#fromLocal8Bit">QString::fromLocal8Bit</a>(ge->gr_name); <a name="l00482"></a>00482 <span class="keywordflow">if</span> (m_group.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l00483"></a>00483 m_group.<a class="codeRef" href="qstring.html#sprintf">sprintf</a>(<span class="stringliteral">"%d"</span>,ge->gr_gid); <a name="l00484"></a>00484 } <span class="keywordflow">else</span> <a name="l00485"></a>00485 m_group.<a class="codeRef" href="qstring.html#sprintf">sprintf</a>(<span class="stringliteral">"%d"</span>,buff.st_gid); <a name="l00486"></a>00486 } <a name="l00487"></a>00487 } <a name="l00488"></a>00488 <span class="preprocessor">#endif</span> <a name="l00489"></a>00489 <span class="preprocessor"></span> <span class="keywordflow">return</span> m_group; <a name="l00490"></a>00490 } <a name="l00491"></a>00491 <a name="l00492"></a><a class="code" href="classKFileItem.html#af0dff9baf66407473b41d63065a93567">00492</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#af0dff9baf66407473b41d63065a93567" title="Returns the mimetype of the file item.">KFileItem::mimetype</a>()<span class="keyword"> const</span> <a name="l00493"></a>00493 <span class="keyword"></span>{ <a name="l00494"></a>00494 <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> * that = <span class="keyword">const_cast<</span><a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> *<span class="keyword">></span>(<span class="keyword">this</span>); <a name="l00495"></a>00495 <span class="keywordflow">return</span> that-><a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">determineMimeType</a>()->name(); <a name="l00496"></a>00496 } <a name="l00497"></a>00497 <a name="l00498"></a><a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432">00498</a> KMimeType::Ptr <a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">KFileItem::determineMimeType</a>() <a name="l00499"></a>00499 { <a name="l00500"></a>00500 <span class="keywordflow">if</span> ( !m_pMimeType || !m_bMimeTypeKnown ) <a name="l00501"></a>00501 { <a name="l00502"></a>00502 <span class="keywordtype">bool</span> isLocalURL; <a name="l00503"></a>00503 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l00504"></a>00504 <a name="l00505"></a>00505 m_pMimeType = <a class="code" href="classKMimeType.html#a19c6563574d22a7395c4686c06e1dec9" title="Finds a KMimeType with the given _url.">KMimeType::findByURL</a>( url, m_fileMode, isLocalURL ); <a name="l00506"></a>00506 <span class="comment">//kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl;</span> <a name="l00507"></a>00507 m_bMimeTypeKnown = <span class="keyword">true</span>; <a name="l00508"></a>00508 } <a name="l00509"></a>00509 <a name="l00510"></a>00510 <span class="keywordflow">return</span> m_pMimeType; <a name="l00511"></a>00511 } <a name="l00512"></a>00512 <a name="l00513"></a>00513 <span class="keywordtype">bool</span> KFileItem::isMimeTypeKnown()<span class="keyword"> const</span> <a name="l00514"></a>00514 <span class="keyword"></span>{ <a name="l00515"></a>00515 <span class="comment">// The mimetype isn't known if determineMimeType was never called (on-demand determination)</span> <a name="l00516"></a>00516 <span class="comment">// or if this fileitem has a guessed mimetype (e.g. ftp symlink) - in which case</span> <a name="l00517"></a>00517 <span class="comment">// it always remains "not fully determined"</span> <a name="l00518"></a>00518 <span class="keywordflow">return</span> m_bMimeTypeKnown && m_guessedMimeType.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>(); <a name="l00519"></a>00519 } <a name="l00520"></a>00520 <a name="l00521"></a><a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6">00521</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6" title="Returns the descriptive comment for this mime type, or the mime type itself if none is present...">KFileItem::mimeComment</a>() <a name="l00522"></a>00522 { <a name="l00523"></a>00523 KMimeType::Ptr mType = <a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">determineMimeType</a>(); <a name="l00524"></a>00524 <a name="l00525"></a>00525 <span class="keywordtype">bool</span> isLocalURL; <a name="l00526"></a>00526 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l00527"></a>00527 <a name="l00528"></a>00528 <a class="codeRef" href="qstring.html">QString</a> comment = mType->comment( url, isLocalURL ); <a name="l00529"></a>00529 <span class="comment">//kdDebug() << "finding comment for " << url.url() << " : " << m_pMimeType->name() << endl;</span> <a name="l00530"></a>00530 <span class="keywordflow">if</span> (!comment.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l00531"></a>00531 <span class="keywordflow">return</span> comment; <a name="l00532"></a>00532 <span class="keywordflow">else</span> <a name="l00533"></a>00533 <span class="keywordflow">return</span> mType->name(); <a name="l00534"></a>00534 } <a name="l00535"></a>00535 <a name="l00536"></a><a class="code" href="classKFileItem.html#ae9bca1f9843f11ac8e1aabe909f646d6">00536</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#ae9bca1f9843f11ac8e1aabe909f646d6" title="Returns the full path name to the icon that represents this mime type.">KFileItem::iconName</a>() <a name="l00537"></a>00537 { <a name="l00538"></a>00538 <span class="keywordflow">if</span> (d && (!d->iconName.isEmpty())) <span class="keywordflow">return</span> d->iconName; <a name="l00539"></a>00539 <a name="l00540"></a>00540 <span class="keywordtype">bool</span> isLocalURL; <a name="l00541"></a>00541 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l00542"></a>00542 <a name="l00543"></a>00543 <span class="comment">//kdDebug() << "finding icon for " << url.url() << " : " << m_pMimeType->name() << endl;</span> <a name="l00544"></a>00544 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">determineMimeType</a>()->icon(url, isLocalURL); <a name="l00545"></a>00545 } <a name="l00546"></a>00546 <a name="l00547"></a><a class="code" href="classKFileItem.html#a7b52afe0fdea1b1c52a3a064bc43a6df">00547</a> <span class="keywordtype">int</span> <a class="code" href="classKFileItem.html#a7b52afe0fdea1b1c52a3a064bc43a6df" title="Returns the overlays (bitfield of KIcon::*Overlay flags) that are used for this item's pixmap...">KFileItem::overlays</a>()<span class="keyword"> const</span> <a name="l00548"></a>00548 <span class="keyword"></span>{ <a name="l00549"></a>00549 <span class="keywordtype">int</span> _state = 0; <a name="l00550"></a>00550 <span class="keywordflow">if</span> ( m_bLink ) <a name="l00551"></a>00551 _state |= KIcon::LinkOverlay; <a name="l00552"></a>00552 <a name="l00553"></a>00553 <span class="keywordflow">if</span> ( !S_ISDIR( m_fileMode ) <span class="comment">// Locked dirs have a special icon, use the overlay for files only</span> <a name="l00554"></a>00554 && !<a class="code" href="classKFileItem.html#a4c5c7907daa4098876a1753f52023bdb" title="Checks whether the file or directory is readable.">isReadable</a>()) <a name="l00555"></a>00555 _state |= KIcon::LockOverlay; <a name="l00556"></a>00556 <a name="l00557"></a>00557 <span class="keywordflow">if</span> ( <a class="code" href="classKFileItem.html#a634254ded940b344506a79093459ac8c" title="Checks whether the file is hidden.">isHidden</a>() ) <a name="l00558"></a>00558 _state |= KIcon::HiddenOverlay; <a name="l00559"></a>00559 <a name="l00560"></a>00560 <span class="keywordflow">if</span>( S_ISDIR( m_fileMode ) && m_bIsLocalURL) <a name="l00561"></a>00561 { <a name="l00562"></a>00562 <span class="keywordflow">if</span> (<a class="code" href="classKSambaShare.html#af0257c475438ef0628bc6f7fb3c91180" title="Returns the one and only instance of KSambaShare.">KSambaShare::instance</a>()->isDirectoryShared( m_url.path() ) || <a name="l00563"></a>00563 <a class="code" href="classKNFSShare.html#a58b66c2d67762195d6dff2b4f09142e1" title="Returns the one and only instance of KNFSShare.">KNFSShare::instance</a>()-><a class="code" href="classKNFSShare.html#a33e8b1be7992871ac57777938675df86" title="Wether or not the given path is shared by NFS.">isDirectoryShared</a>( m_url.path() )) <a name="l00564"></a>00564 { <a name="l00565"></a>00565 <span class="comment">//kdDebug()<<"KFileShare::isDirectoryShared : "<<m_url.path()<<endl;</span> <a name="l00566"></a>00566 _state |= KIcon::ShareOverlay; <a name="l00567"></a>00567 } <a name="l00568"></a>00568 } <a name="l00569"></a>00569 <a name="l00570"></a>00570 <span class="keywordflow">if</span> ( m_pMimeType->name() == <span class="stringliteral">"application/x-gzip"</span> && m_url.fileName().right(3) == <span class="stringliteral">".gz"</span> ) <a name="l00571"></a>00571 _state |= KIcon::ZipOverlay; <a name="l00572"></a>00572 <span class="keywordflow">return</span> _state; <a name="l00573"></a>00573 } <a name="l00574"></a>00574 <a name="l00575"></a><a class="code" href="classKFileItem.html#af754b3c66bac1d1823fcaf224fc5f8aa">00575</a> <a class="codeRef" href="qpixmap.html">QPixmap</a> <a class="code" href="classKFileItem.html#af754b3c66bac1d1823fcaf224fc5f8aa" title="Returns a pixmap representing the file.">KFileItem::pixmap</a>( <span class="keywordtype">int</span> _size, <span class="keywordtype">int</span> _state )<span class="keyword"> const</span> <a name="l00576"></a>00576 <span class="keyword"></span>{ <a name="l00577"></a>00577 <span class="keywordflow">if</span> (d && (!d->iconName.isEmpty())) <a name="l00578"></a>00578 <span class="keywordflow">return</span> DesktopIcon(d->iconName,_size,_state); <a name="l00579"></a>00579 <a name="l00580"></a>00580 <span class="keywordflow">if</span> ( !m_pMimeType ) <a name="l00581"></a>00581 { <a name="l00582"></a>00582 <span class="keyword">static</span> <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & defaultFolderIcon = <a name="l00583"></a>00583 KGlobal::staticQString(<a class="code" href="classKMimeType.html#a1fd115a75a84e762e31d8424eee683c0" title="Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...">KMimeType::mimeType</a>( <span class="stringliteral">"inode/directory"</span> )-><a class="code" href="classKServiceType.html#ad101244161b3b2b66630a765a0c5e0a2" title="Returns the icon associated with this service type.">KServiceType::icon</a>()); <a name="l00584"></a>00584 <a name="l00585"></a>00585 <span class="keywordflow">if</span> ( S_ISDIR( m_fileMode ) ) <a name="l00586"></a>00586 <span class="keywordflow">return</span> DesktopIcon( defaultFolderIcon, _size, _state ); <a name="l00587"></a>00587 <a name="l00588"></a>00588 <span class="keywordflow">return</span> DesktopIcon( <span class="stringliteral">"unknown"</span>, _size, _state ); <a name="l00589"></a>00589 } <a name="l00590"></a>00590 <a name="l00591"></a>00591 _state |= <a class="code" href="classKFileItem.html#a7b52afe0fdea1b1c52a3a064bc43a6df" title="Returns the overlays (bitfield of KIcon::*Overlay flags) that are used for this item's pixmap...">overlays</a>(); <a name="l00592"></a>00592 <a name="l00593"></a>00593 KMimeType::Ptr mime; <a name="l00594"></a>00594 <span class="comment">// Use guessed mimetype if the main one hasn't been determined for sure</span> <a name="l00595"></a>00595 <span class="keywordflow">if</span> ( !m_bMimeTypeKnown && !m_guessedMimeType.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) <a name="l00596"></a>00596 mime = <a class="code" href="classKMimeType.html#a1fd115a75a84e762e31d8424eee683c0" title="Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...">KMimeType::mimeType</a>( m_guessedMimeType ); <a name="l00597"></a>00597 <span class="keywordflow">else</span> <a name="l00598"></a>00598 mime = m_pMimeType; <a name="l00599"></a>00599 <a name="l00600"></a>00600 <span class="comment">// Support for gzipped files: extract mimetype of contained file</span> <a name="l00601"></a>00601 <span class="comment">// See also the relevant code in overlays, which adds the zip overlay.</span> <a name="l00602"></a>00602 <span class="keywordflow">if</span> ( mime->name() == <span class="stringliteral">"application/x-gzip"</span> && m_url.fileName().right(3) == <span class="stringliteral">".gz"</span> ) <a name="l00603"></a>00603 { <a name="l00604"></a>00604 KURL sf; <a name="l00605"></a>00605 sf.setPath( m_url.path().left( m_url.path().length() - 3 ) ); <a name="l00606"></a>00606 <span class="comment">//kdDebug() << "KFileItem::pixmap subFileName=" << subFileName << endl;</span> <a name="l00607"></a>00607 mime = <a class="code" href="classKMimeType.html#a19c6563574d22a7395c4686c06e1dec9" title="Finds a KMimeType with the given _url.">KMimeType::findByURL</a>( sf, 0, m_bIsLocalURL ); <a name="l00608"></a>00608 } <a name="l00609"></a>00609 <a name="l00610"></a>00610 <span class="keywordtype">bool</span> isLocalURL; <a name="l00611"></a>00611 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l00612"></a>00612 <a name="l00613"></a>00613 <a class="codeRef" href="qpixmap.html">QPixmap</a> p = mime->pixmap( url, KIcon::Desktop, _size, _state ); <a name="l00614"></a>00614 <span class="comment">//kdDebug() << "finding pixmap for " << url.url() << " : " << mime->name() << endl;</span> <a name="l00615"></a>00615 <span class="keywordflow">if</span> (p.<a class="codeRef" href="qpixmap.html#isNull">isNull</a>()) <a name="l00616"></a>00616 kdWarning() << <span class="stringliteral">"Pixmap not found for mimetype "</span> << m_pMimeType->name() << endl; <a name="l00617"></a>00617 <a name="l00618"></a>00618 <span class="keywordflow">return</span> p; <a name="l00619"></a>00619 } <a name="l00620"></a>00620 <a name="l00621"></a><a class="code" href="classKFileItem.html#a4c5c7907daa4098876a1753f52023bdb">00621</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#a4c5c7907daa4098876a1753f52023bdb" title="Checks whether the file or directory is readable.">KFileItem::isReadable</a>()<span class="keyword"> const</span> <a name="l00622"></a>00622 <span class="keyword"></span>{ <a name="l00623"></a>00623 <span class="comment">/*</span> <a name="l00624"></a>00624 <span class="comment"> struct passwd * user = getpwuid( geteuid() );</span> <a name="l00625"></a>00625 <span class="comment"> bool isMyFile = (QString::fromLocal8Bit(user->pw_name) == m_user);</span> <a name="l00626"></a>00626 <span class="comment"> // This gets ugly for the group....</span> <a name="l00627"></a>00627 <span class="comment"> // Maybe we want a static QString for the user and a static QStringList</span> <a name="l00628"></a>00628 <span class="comment"> // for the groups... then we need to handle the deletion properly...</span> <a name="l00629"></a>00629 <span class="comment"> */</span> <a name="l00630"></a>00630 <a name="l00631"></a>00631 <span class="keywordflow">if</span> ( m_permissions != KFileItem::Unknown ) { <a name="l00632"></a>00632 <span class="comment">// No read permission at all</span> <a name="l00633"></a>00633 <span class="keywordflow">if</span> ( !(S_IRUSR & m_permissions) && !(S_IRGRP & m_permissions) && !(S_IROTH & m_permissions) ) <a name="l00634"></a>00634 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00635"></a>00635 <a name="l00636"></a>00636 <span class="comment">// Read permissions for all: save a stat call</span> <a name="l00637"></a>00637 <span class="keywordflow">if</span> ( (S_IRUSR|S_IRGRP|S_IROTH) & m_permissions ) <a name="l00638"></a>00638 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00639"></a>00639 } <a name="l00640"></a>00640 <a name="l00641"></a>00641 <span class="comment">// Or if we can't read it [using ::access()] - not network transparent</span> <a name="l00642"></a>00642 <span class="keywordflow">if</span> ( m_bIsLocalURL && ::access( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path()), R_OK ) == -1 ) <a name="l00643"></a>00643 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00644"></a>00644 <a name="l00645"></a>00645 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00646"></a>00646 } <a name="l00647"></a>00647 <a name="l00648"></a><a class="code" href="classKFileItem.html#a1bce6507895e40bbffaaa2d108f8188c">00648</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#a1bce6507895e40bbffaaa2d108f8188c" title="Checks whether the file or directory is writable.">KFileItem::isWritable</a>()<span class="keyword"> const</span> <a name="l00649"></a>00649 <span class="keyword"></span>{ <a name="l00650"></a>00650 <span class="comment">/*</span> <a name="l00651"></a>00651 <span class="comment"> struct passwd * user = getpwuid( geteuid() );</span> <a name="l00652"></a>00652 <span class="comment"> bool isMyFile = (QString::fromLocal8Bit(user->pw_name) == m_user);</span> <a name="l00653"></a>00653 <span class="comment"> // This gets ugly for the group....</span> <a name="l00654"></a>00654 <span class="comment"> // Maybe we want a static QString for the user and a static QStringList</span> <a name="l00655"></a>00655 <span class="comment"> // for the groups... then we need to handle the deletion properly...</span> <a name="l00656"></a>00656 <span class="comment"> */</span> <a name="l00657"></a>00657 <a name="l00658"></a>00658 <span class="keywordflow">if</span> ( m_permissions != KFileItem::Unknown ) { <a name="l00659"></a>00659 <span class="comment">// No write permission at all</span> <a name="l00660"></a>00660 <span class="keywordflow">if</span> ( !(S_IWUSR & m_permissions) && !(S_IWGRP & m_permissions) && !(S_IWOTH & m_permissions) ) <a name="l00661"></a>00661 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00662"></a>00662 } <a name="l00663"></a>00663 <a name="l00664"></a>00664 <span class="comment">// Or if we can't read it [using ::access()] - not network transparent</span> <a name="l00665"></a>00665 <span class="keywordflow">if</span> ( m_bIsLocalURL && ::access( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path()), W_OK ) == -1 ) <a name="l00666"></a>00666 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00667"></a>00667 <a name="l00668"></a>00668 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00669"></a>00669 } <a name="l00670"></a>00670 <a name="l00671"></a><a class="code" href="classKFileItem.html#a634254ded940b344506a79093459ac8c">00671</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#a634254ded940b344506a79093459ac8c" title="Checks whether the file is hidden.">KFileItem::isHidden</a>()<span class="keyword"> const</span> <a name="l00672"></a>00672 <span class="keyword"></span>{ <a name="l00673"></a>00673 <span class="keywordflow">if</span> ( m_hidden != Auto ) <a name="l00674"></a>00674 <span class="keywordflow">return</span> m_hidden == Hidden; <a name="l00675"></a>00675 <a name="l00676"></a>00676 <span class="keywordflow">if</span> ( !m_url.isEmpty() ) <a name="l00677"></a>00677 <span class="keywordflow">return</span> m_url.fileName()[0] == <span class="charliteral">'.'</span>; <a name="l00678"></a>00678 <span class="keywordflow">else</span> <span class="comment">// should never happen</span> <a name="l00679"></a>00679 <span class="keywordflow">return</span> m_strName[0] == <span class="charliteral">'.'</span>; <a name="l00680"></a>00680 } <a name="l00681"></a>00681 <a name="l00682"></a><a class="code" href="classKFileItem.html#a4a42f3c3babb4ecb19c3c1c330b3c1bc">00682</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#a4a42f3c3babb4ecb19c3c1c330b3c1bc" title="Returns true if this item represents a directory.">KFileItem::isDir</a>()<span class="keyword"> const</span> <a name="l00683"></a>00683 <span class="keyword"></span>{ <a name="l00684"></a>00684 <span class="keywordflow">if</span> ( m_fileMode == KFileItem::Unknown ) <a name="l00685"></a>00685 { <a name="l00686"></a>00686 kdDebug() << <span class="stringliteral">" KFileItem::isDir can't say -> false "</span> << endl; <a name="l00687"></a>00687 <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// can't say for sure, so no</span> <a name="l00688"></a>00688 } <a name="l00689"></a>00689 <span class="keywordflow">return</span> (S_ISDIR(m_fileMode)); <a name="l00690"></a>00690 <span class="comment">/*</span> <a name="l00691"></a>00691 <span class="comment"> if (!S_ISDIR(m_fileMode)) {</span> <a name="l00692"></a>00692 <span class="comment"> if (m_url.isLocalFile()) {</span> <a name="l00693"></a>00693 <span class="comment"> KMimeType::Ptr ptr=KMimeType::findByURL(m_url,0,true,true);</span> <a name="l00694"></a>00694 <span class="comment"> if ((ptr!=0) && (ptr->is("directory/inode"))) return true;</span> <a name="l00695"></a>00695 <span class="comment"> }</span> <a name="l00696"></a>00696 <span class="comment"> return false</span> <a name="l00697"></a>00697 <span class="comment"> } else return true;*/</span> <a name="l00698"></a>00698 } <a name="l00699"></a>00699 <a name="l00700"></a><a class="code" href="classKFileItem.html#aa96a44aec31f0e7261d9e268c001521b">00700</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#aa96a44aec31f0e7261d9e268c001521b" title="Returns true if files can be dropped over this item.">KFileItem::acceptsDrops</a>() <a name="l00701"></a>00701 { <a name="l00702"></a>00702 <span class="comment">// A directory ?</span> <a name="l00703"></a>00703 <span class="keywordflow">if</span> ( S_ISDIR( <a class="code" href="classKFileItem.html#af506df34a95e060e42e792321e8babc3" title="Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).">mode</a>() ) ) { <a name="l00704"></a>00704 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#a1bce6507895e40bbffaaa2d108f8188c" title="Checks whether the file or directory is writable.">isWritable</a>(); <a name="l00705"></a>00705 } <a name="l00706"></a>00706 <a name="l00707"></a>00707 <span class="comment">// But only local .desktop files and executables</span> <a name="l00708"></a>00708 <span class="keywordflow">if</span> ( !m_bIsLocalURL ) <a name="l00709"></a>00709 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00710"></a>00710 <a name="l00711"></a>00711 <span class="keywordflow">if</span> ( <a class="code" href="classKFileItem.html#af0dff9baf66407473b41d63065a93567" title="Returns the mimetype of the file item.">mimetype</a>() == <span class="stringliteral">"application/x-desktop"</span>) <a name="l00712"></a>00712 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00713"></a>00713 <a name="l00714"></a>00714 <span class="comment">// Executable, shell script ... ?</span> <a name="l00715"></a>00715 <span class="keywordflow">if</span> ( ::access( <a class="codeRef" href="qfile.html#encodeName">QFile::encodeName</a>(m_url.path()), X_OK ) == 0 ) <a name="l00716"></a>00716 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00717"></a>00717 <a name="l00718"></a>00718 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00719"></a>00719 } <a name="l00720"></a>00720 <a name="l00721"></a><a class="code" href="classKFileItem.html#a2745b8fb8fc08e8f5e5d2f4be74992fd">00721</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a2745b8fb8fc08e8f5e5d2f4be74992fd" title="Returns the string to be displayed in the statusbar, e.g.">KFileItem::getStatusBarInfo</a>() <a name="l00722"></a>00722 { <a name="l00723"></a>00723 <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a81c3ba0690812cb8eae807de50470a00" title="Returns the text of the file item.">text</a> = m_strText; <a name="l00724"></a>00724 <a name="l00725"></a>00725 <span class="keywordflow">if</span> ( m_bLink ) <a name="l00726"></a>00726 { <a name="l00727"></a>00727 <a class="codeRef" href="qstring.html">QString</a> comment = <a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">determineMimeType</a>()->comment( m_url, m_bIsLocalURL ); <a name="l00728"></a>00728 <a class="codeRef" href="qstring.html">QString</a> tmp; <a name="l00729"></a>00729 <span class="keywordflow">if</span> ( comment.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) <a name="l00730"></a>00730 tmp = i18n ( <span class="stringliteral">"Symbolic Link"</span> ); <a name="l00731"></a>00731 <span class="keywordflow">else</span> <a name="l00732"></a>00732 tmp = i18n(<span class="stringliteral">"%1 (Link)"</span>).<a class="codeRef" href="qstring.html#arg">arg</a>(comment); <a name="l00733"></a>00733 text += <span class="stringliteral">"->"</span>; <a name="l00734"></a>00734 text += <a class="code" href="classKFileItem.html#a297821bebb5d81dfe379553277be512d" title="Returns the link destination if isLink() == true.">linkDest</a>(); <a name="l00735"></a>00735 text += <span class="stringliteral">" "</span>; <a name="l00736"></a>00736 text += tmp; <a name="l00737"></a>00737 } <a name="l00738"></a>00738 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( S_ISREG( m_fileMode ) ) <a name="l00739"></a>00739 { <a name="l00740"></a>00740 <span class="keywordtype">bool</span> hasSize; <a name="l00741"></a>00741 <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> sizeValue = <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">size</a>(hasSize); <a name="l00742"></a>00742 <span class="keywordflow">if</span>(hasSize) <a name="l00743"></a>00743 text += <a class="codeRef" href="qstring.html">QString</a>(<span class="stringliteral">" (%1) "</span>).<a class="codeRef" href="qstring.html#arg">arg</a>( <a class="code" href="namespaceKIO.html#a350bd897f2425789f4fbd250882700f9" title="Converts size from bytes to the string representation.">KIO::convertSize</a>( sizeValue ) ); <a name="l00744"></a>00744 text += <a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6" title="Returns the descriptive comment for this mime type, or the mime type itself if none is present...">mimeComment</a>(); <a name="l00745"></a>00745 } <a name="l00746"></a>00746 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( S_ISDIR ( m_fileMode ) ) <a name="l00747"></a>00747 { <a name="l00748"></a>00748 text += <span class="stringliteral">"/ "</span>; <a name="l00749"></a>00749 text += <a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6" title="Returns the descriptive comment for this mime type, or the mime type itself if none is present...">mimeComment</a>(); <a name="l00750"></a>00750 } <a name="l00751"></a>00751 <span class="keywordflow">else</span> <a name="l00752"></a>00752 { <a name="l00753"></a>00753 text += <span class="stringliteral">" "</span>; <a name="l00754"></a>00754 text += <a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6" title="Returns the descriptive comment for this mime type, or the mime type itself if none is present...">mimeComment</a>(); <a name="l00755"></a>00755 } <a name="l00756"></a>00756 text.<a class="codeRef" href="qstring.html#replace">replace</a>(<span class="charliteral">'\n'</span>, <span class="stringliteral">" "</span>); <span class="comment">// replace any newlines with a space, so the statusbar doesn't get a two-line string which messes the display up, Alex</span> <a name="l00757"></a>00757 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#a81c3ba0690812cb8eae807de50470a00" title="Returns the text of the file item.">text</a>; <a name="l00758"></a>00758 } <a name="l00759"></a>00759 <a name="l00760"></a><a class="code" href="classKFileItem.html#a0294aef2840c0642304eec9547a43171">00760</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a0294aef2840c0642304eec9547a43171" title="Returns the string to be displayed in the tool tip when the mouse is over this item.">KFileItem::getToolTipText</a>(<span class="keywordtype">int</span> maxcount) <a name="l00761"></a>00761 { <a name="l00762"></a>00762 <span class="comment">// we can return QString::null if no tool tip should be shown</span> <a name="l00763"></a>00763 <a class="codeRef" href="qstring.html">QString</a> tip; <a name="l00764"></a>00764 <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a> info = <a class="code" href="classKFileItem.html#a1f4678617c71875593ce78bc20fb6734" title="Returns the metainfo of this item.">metaInfo</a>(); <a name="l00765"></a>00765 <a name="l00766"></a>00766 <span class="comment">// the font tags are a workaround for the fact that the tool tip gets</span> <a name="l00767"></a>00767 <span class="comment">// screwed if the color scheme uses white as default text color</span> <a name="l00768"></a>00768 <span class="keyword">const</span> <span class="keywordtype">char</span>* start = <span class="stringliteral">"<tr><td><nobr><font color=\"black\">"</span>; <a name="l00769"></a>00769 <span class="keyword">const</span> <span class="keywordtype">char</span>* mid = <span class="stringliteral">"</font></nobr></td><td><nobr><font color=\"black\">"</span>; <a name="l00770"></a>00770 <span class="keyword">const</span> <span class="keywordtype">char</span>* end = <span class="stringliteral">"</font></nobr></td></tr>"</span>; <a name="l00771"></a>00771 <a name="l00772"></a>00772 tip = <span class="stringliteral">"<table cellspacing=0 cellpadding=0>"</span>; <a name="l00773"></a>00773 <a name="l00774"></a>00774 tip += start + i18n(<span class="stringliteral">"Name:"</span>) + mid + <a class="code" href="classKFileItem.html#a81c3ba0690812cb8eae807de50470a00" title="Returns the text of the file item.">text</a>() + end; <a name="l00775"></a>00775 tip += start + i18n(<span class="stringliteral">"Type:"</span>) + mid; <a name="l00776"></a>00776 <a name="l00777"></a>00777 <a class="codeRef" href="qstring.html">QString</a> type = <a class="codeRef" href="qstylesheet.html#escape">QStyleSheet::escape</a>(<a class="code" href="classKFileItem.html#ab8dafbaf6e09c6c34bac7c5aa8537eb6" title="Returns the descriptive comment for this mime type, or the mime type itself if none is present...">mimeComment</a>()); <a name="l00778"></a>00778 <span class="keywordflow">if</span> ( m_bLink ) { <a name="l00779"></a>00779 tip += i18n(<span class="stringliteral">"Link to %1 (%2)"</span>).<a class="codeRef" href="qstring.html#arg">arg</a>(<a class="code" href="classKFileItem.html#a297821bebb5d81dfe379553277be512d" title="Returns the link destination if isLink() == true.">linkDest</a>(), type) + end; <a name="l00780"></a>00780 } <span class="keywordflow">else</span> <a name="l00781"></a>00781 tip += type + end; <a name="l00782"></a>00782 <a name="l00783"></a>00783 <span class="keywordflow">if</span> ( !S_ISDIR ( m_fileMode ) ) { <a name="l00784"></a>00784 <span class="keywordtype">bool</span> hasSize; <a name="l00785"></a>00785 <a class="code" href="namespaceKIO.html#a90b418366ba9052c97d4dca845026f43" title="64-bit file size">KIO::filesize_t</a> sizeValue = <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">size</a>(hasSize); <a name="l00786"></a>00786 <span class="keywordflow">if</span>(hasSize) <a name="l00787"></a>00787 tip += start + i18n(<span class="stringliteral">"Size:"</span>) + mid + <a name="l00788"></a>00788 <a class="code" href="namespaceKIO.html#a91a01d5b66fbfb35ca7d207750d6483d" title="Converts size from bytes to a string representation with includes the size in bytes.">KIO::convertSizeWithBytes</a>(sizeValue) + end; <a name="l00789"></a>00789 } <a name="l00790"></a>00790 <a class="codeRef" href="qstring.html">QString</a> timeStr = <a class="code" href="classKFileItem.html#a96b0adc58a0ac2a4f76fbe0762d4420e" title="Requests the modification, access or creation time as a string, depending on which.">timeString</a>( <a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa2870258f5a68f7dd13a18703c7144d10" title="The last time the file was modified.">KIO::UDS_MODIFICATION_TIME</a>); <a name="l00791"></a>00791 <span class="keywordflow">if</span>(!timeStr.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l00792"></a>00792 tip += start + i18n(<span class="stringliteral">"Modified:"</span>) + mid + <a name="l00793"></a>00793 timeStr + end; <a name="l00794"></a>00794 <span class="preprocessor">#ifndef Q_WS_WIN //TODO: show win32-specific permissions</span> <a name="l00795"></a>00795 <span class="preprocessor"></span> <a class="codeRef" href="qstring.html">QString</a> userStr = <a class="code" href="classKFileItem.html#a4aea36ab5a5b94d1582c10eaf2a2f3c6" title="Returns the owner of the file.">user</a>(); <a name="l00796"></a>00796 <a class="codeRef" href="qstring.html">QString</a> groupStr = <a class="code" href="classKFileItem.html#a740d81934f194d2154e239f7f0cfff9a" title="Returns the group of the file.">group</a>(); <a name="l00797"></a>00797 <span class="keywordflow">if</span>(!userStr.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() || !groupStr.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l00798"></a>00798 tip += start + i18n(<span class="stringliteral">"Owner:"</span>) + mid + userStr + <span class="stringliteral">" - "</span> + groupStr + end + <a name="l00799"></a>00799 start + i18n(<span class="stringliteral">"Permissions:"</span>) + mid + <a name="l00800"></a>00800 <a class="code" href="classKFileItem.html#aa0c52ae585bef69d441f2d2f7770420d" title="Parses the given permission set and provides it for access()">parsePermissions</a>(m_permissions) + end; <a name="l00801"></a>00801 <span class="preprocessor">#endif</span> <a name="l00802"></a>00802 <span class="preprocessor"></span> <a name="l00803"></a>00803 <span class="keywordflow">if</span> (info.<a class="code" href="classKFileMetaInfo.html#a7fbb3ea4fc85133d4bd0534f7c684b1e" title="Returns true if the item is valid, i.e.">isValid</a>() && !info.<a class="code" href="classKFileMetaInfo.html#a8ac447c44bbe39bba51362428006aa74" title="Returns false if the object contains data, true if it's empty.">isEmpty</a>() ) <a name="l00804"></a>00804 { <a name="l00805"></a>00805 tip += <span class="stringliteral">"<tr><td colspan=2><center><s>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</s></center></td></tr>"</span>; <a name="l00806"></a>00806 <a class="codeRef" href="qstringlist.html">QStringList</a> keys = info.<a class="code" href="classKFileMetaInfo.html#ae8a67e83cb2452b97bd877daf113e948" title="Returns a list of all preferred keys.">preferredKeys</a>(); <a name="l00807"></a>00807 <a name="l00808"></a>00808 <span class="comment">// now the rest</span> <a name="l00809"></a>00809 QStringList::Iterator it = keys.begin(); <a name="l00810"></a>00810 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> count = 0; count<maxcount && it!=keys.end() ; ++it) <a name="l00811"></a>00811 { <a name="l00812"></a>00812 <a class="code" href="classKFileMetaInfoItem.html" title="A meta information item about a file.">KFileMetaInfoItem</a> item = info.<a class="code" href="classKFileMetaInfo.html#a49e8498204ac9b16d489a53a3d12e783" title="Returns the KFileMetaInfoItem with the given key.">item</a>( *it ); <a name="l00813"></a>00813 <span class="keywordflow">if</span> ( item.<a class="code" href="classKFileMetaInfoItem.html#a94bef8631db1e076ffc0b7c943efb5b7" title="Return true if the item is valid, i.e.">isValid</a>() ) <a name="l00814"></a>00814 { <a name="l00815"></a>00815 <a class="codeRef" href="qstring.html">QString</a> s = item.<a class="code" href="classKFileMetaInfoItem.html#ae83e40929b05a2e8d67720bca9b514ff" title="Returns a string containing the value, if possible.">string</a>(); <a name="l00816"></a>00816 <span class="keywordflow">if</span> ( ( item.<a class="code" href="classKFileMetaInfoItem.html#aa9b47e34db25fea770c19338f251ab0c" title="Returns the attributes for this item.">attributes</a>() & <a class="code" href="classKFileMimeTypeInfo.html#a5d4779692b425b43302a9a113f91d59aab6d2bce64978d2736618a10076bdad95" title="If the text for this item is very long, it should be squeezed to the size of the widget where it's di...">KFileMimeTypeInfo::SqueezeText</a> ) <a name="l00817"></a>00817 && s.<a class="codeRef" href="qstring.html#length">length</a>() > 50) { <a name="l00818"></a>00818 s.<a class="codeRef" href="qstring.html#truncate">truncate</a>(47); <a name="l00819"></a>00819 s.<a class="codeRef" href="qstring.html#append">append</a>(<span class="stringliteral">"..."</span>); <a name="l00820"></a>00820 } <a name="l00821"></a>00821 <span class="keywordflow">if</span> ( !s.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) <a name="l00822"></a>00822 { <a name="l00823"></a>00823 count++; <a name="l00824"></a>00824 tip += start + <a name="l00825"></a>00825 <a class="codeRef" href="qstylesheet.html#escape">QStyleSheet::escape</a>( item.<a class="code" href="classKFileMetaInfoItem.html#aa3f27f5127b4105905f54842bea3f8b6" title="Returns a translation of the key for displaying to the user.">translatedKey</a>() ) + <span class="stringliteral">":"</span> + <a name="l00826"></a>00826 mid + <a name="l00827"></a>00827 <a class="codeRef" href="qstylesheet.html#escape">QStyleSheet::escape</a>( s ) + <a name="l00828"></a>00828 end; <a name="l00829"></a>00829 } <a name="l00830"></a>00830 <a name="l00831"></a>00831 } <a name="l00832"></a>00832 } <a name="l00833"></a>00833 } <a name="l00834"></a>00834 tip += <span class="stringliteral">"</table>"</span>; <a name="l00835"></a>00835 <a name="l00836"></a>00836 <span class="comment">//kdDebug() << "making this the tool tip rich text:\n";</span> <a name="l00837"></a>00837 <span class="comment">//kdDebug() << tip << endl;</span> <a name="l00838"></a>00838 <a name="l00839"></a>00839 <span class="keywordflow">return</span> tip; <a name="l00840"></a>00840 } <a name="l00841"></a>00841 <a name="l00842"></a><a class="code" href="classKFileItem.html#a78529e83540c44492e4ceaa4db32bbb2">00842</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a78529e83540c44492e4ceaa4db32bbb2" title="Let's "KRun" this file ! (e.g.">KFileItem::run</a>() <a name="l00843"></a>00843 { <a name="l00844"></a>00844 <span class="comment">// It might be faster to pass skip that when we know the mimetype,</span> <a name="l00845"></a>00845 <span class="comment">// and just call KRun::runURL. But then we need to use mostLocalURL()</span> <a name="l00846"></a>00846 <span class="comment">// for application/x-desktop files, to be able to execute them.</span> <a name="l00847"></a>00847 (void) <span class="keyword">new</span> <a class="code" href="classKRun.html" title="To open files with their associated applications in KDE, use KRun.">KRun</a>( m_url, m_fileMode, m_bIsLocalURL ); <a name="l00848"></a>00848 } <a name="l00849"></a>00849 <a name="l00850"></a><a class="code" href="classKFileItem.html#ac022d0f7e92ff4932064674d45299bb5">00850</a> <span class="keywordtype">bool</span> <a class="code" href="classKFileItem.html#ac022d0f7e92ff4932064674d45299bb5" title="Somewhat like a comparison operator, but more explicit.">KFileItem::cmp</a>( <span class="keyword">const</span> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & item ) <a name="l00851"></a>00851 { <a name="l00852"></a>00852 <span class="keywordtype">bool</span> hasSize1,hasSize2,hasTime1,hasTime2; <a name="l00853"></a>00853 hasSize1 = hasSize2 = hasTime1 = hasTime2 = <span class="keyword">false</span>; <a name="l00854"></a>00854 <span class="keywordflow">return</span> ( m_strName == item.m_strName <a name="l00855"></a>00855 && m_bIsLocalURL == item.m_bIsLocalURL <a name="l00856"></a>00856 && m_fileMode == item.m_fileMode <a name="l00857"></a>00857 && m_permissions == item.m_permissions <a name="l00858"></a>00858 && m_user == item.m_user <a name="l00859"></a>00859 && m_group == item.m_group <a name="l00860"></a>00860 && m_bLink == item.m_bLink <a name="l00861"></a>00861 && m_hidden == item.m_hidden <a name="l00862"></a>00862 && <a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">size</a>(hasSize1) == item.<a class="code" href="classKFileItem.html#a46f839aae7de57343cc6718763e13f8e" title="Returns the size of the file, if known.">size</a>(hasSize2) <a name="l00863"></a>00863 && hasSize1 == hasSize2 <a name="l00864"></a>00864 && <a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">time</a>(<a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa2870258f5a68f7dd13a18703c7144d10" title="The last time the file was modified.">KIO::UDS_MODIFICATION_TIME</a>, hasTime1) == item.<a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">time</a>(<a class="code" href="namespaceKIO.html#ab329df4f691911c03bce444a035fd31fa2870258f5a68f7dd13a18703c7144d10" title="The last time the file was modified.">KIO::UDS_MODIFICATION_TIME</a>, hasTime2) <a name="l00865"></a>00865 && hasTime1 == hasTime2 <a name="l00866"></a>00866 && (!d || !item.d || d->iconName == item.d->iconName) ); <a name="l00867"></a>00867 <a name="l00868"></a>00868 <span class="comment">// Don't compare the mimetypes here. They might not be known, and we don't want to</span> <a name="l00869"></a>00869 <span class="comment">// do the slow operation of determining them here.</span> <a name="l00870"></a>00870 } <a name="l00871"></a>00871 <a name="l00872"></a><a class="code" href="classKFileItem.html#a6adc540938a5c4d2851a8adf05b56b91">00872</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a6adc540938a5c4d2851a8adf05b56b91" title="Somewhat like an assignment operator, but more explicit.">KFileItem::assign</a>( <span class="keyword">const</span> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & item ) <a name="l00873"></a>00873 { <a name="l00874"></a>00874 <span class="keywordflow">if</span> ( <span class="keyword">this</span> == &item ) <a name="l00875"></a>00875 <span class="keywordflow">return</span>; <a name="l00876"></a>00876 m_entry = item.m_entry; <a name="l00877"></a>00877 m_url = item.m_url; <a name="l00878"></a>00878 m_bIsLocalURL = item.m_bIsLocalURL; <a name="l00879"></a>00879 m_strName = item.m_strName; <a name="l00880"></a>00880 m_strText = item.m_strText; <a name="l00881"></a>00881 m_fileMode = item.m_fileMode; <a name="l00882"></a>00882 m_permissions = item.m_permissions; <a name="l00883"></a>00883 m_user = item.m_user; <a name="l00884"></a>00884 m_group = item.m_group; <a name="l00885"></a>00885 m_bLink = item.m_bLink; <a name="l00886"></a>00886 m_pMimeType = item.m_pMimeType; <a name="l00887"></a>00887 m_strLowerCaseName = item.m_strLowerCaseName; <a name="l00888"></a>00888 m_bMimeTypeKnown = item.m_bMimeTypeKnown; <a name="l00889"></a>00889 m_hidden = item.m_hidden; <a name="l00890"></a>00890 m_guessedMimeType = item.m_guessedMimeType; <a name="l00891"></a>00891 m_access = item.m_access; <a name="l00892"></a>00892 m_metaInfo = item.m_metaInfo; <a name="l00893"></a>00893 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < NumFlags; i++ ) <a name="l00894"></a>00894 m_time[i] = item.m_time[i]; <a name="l00895"></a>00895 m_size = item.m_size; <a name="l00896"></a>00896 <span class="comment">// note: m_extra is NOT copied, as we'd have no control over who is</span> <a name="l00897"></a>00897 <span class="comment">// deleting the data or not.</span> <a name="l00898"></a>00898 <a name="l00899"></a>00899 <span class="comment">// We had a mimetype previously (probably), so we need to re-determine it</span> <a name="l00900"></a>00900 <a class="code" href="classKFileItem.html#a9056645c465d70969814e755794a4432" title="Returns the mimetype of the file item.">determineMimeType</a>(); <a name="l00901"></a>00901 <a name="l00902"></a>00902 <span class="keywordflow">if</span> ( item.d ) { <a name="l00903"></a>00903 <span class="keywordflow">if</span> ( !d ) <a name="l00904"></a>00904 d = <span class="keyword">new</span> KFileItemPrivate; <a name="l00905"></a>00905 d->iconName = item.d->iconName; <a name="l00906"></a>00906 } <span class="keywordflow">else</span> { <a name="l00907"></a>00907 <span class="keyword">delete</span> d; <a name="l00908"></a>00908 d = 0; <a name="l00909"></a>00909 } <a name="l00910"></a>00910 } <a name="l00911"></a>00911 <a name="l00912"></a><a class="code" href="classKFileItem.html#a5f1e3795584052dc537a91645f88005b">00912</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a5f1e3795584052dc537a91645f88005b" title="Reinitialize KFileItem with a new UDSEntry.">KFileItem::setUDSEntry</a>( <span class="keyword">const</span> <a class="codeRef" href="qvaluelist.html">KIO::UDSEntry</a>& _entry, <span class="keyword">const</span> KURL& _url, <a name="l00913"></a>00913 <span class="keywordtype">bool</span> _determineMimeTypeOnDemand, <span class="keywordtype">bool</span> _urlIsDirectory ) <a name="l00914"></a>00914 { <a name="l00915"></a>00915 m_entry = _entry; <a name="l00916"></a>00916 m_url = _url; <a name="l00917"></a>00917 m_strName = QString::null; <a name="l00918"></a>00918 m_strText = QString::null; <a name="l00919"></a>00919 m_user = QString::null; <a name="l00920"></a>00920 m_group = QString::null; <a name="l00921"></a>00921 m_strLowerCaseName = QString::null; <a name="l00922"></a>00922 m_pMimeType = 0; <a name="l00923"></a>00923 m_fileMode = KFileItem::Unknown; <a name="l00924"></a>00924 m_permissions = KFileItem::Unknown; <a name="l00925"></a>00925 m_bMarked = <span class="keyword">false</span>; <a name="l00926"></a>00926 m_bLink = <span class="keyword">false</span>; <a name="l00927"></a>00927 m_bIsLocalURL = _url.isLocalFile(); <a name="l00928"></a>00928 m_bMimeTypeKnown = <span class="keyword">false</span>; <a name="l00929"></a>00929 m_hidden = Auto; <a name="l00930"></a>00930 m_guessedMimeType = QString::null; <a name="l00931"></a>00931 m_metaInfo = <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a>(); <a name="l00932"></a>00932 <a name="l00933"></a>00933 <span class="keywordflow">if</span> ( d ) <a name="l00934"></a>00934 d->iconName = QString::null; <a name="l00935"></a>00935 <a name="l00936"></a>00936 <a class="code" href="classKFileItem.html#aeabdbd8b43ef82f91903f28496b143b5" title="Extracts the data from the UDSEntry member and updates the KFileItem accordingly.">readUDSEntry</a>( _urlIsDirectory ); <a name="l00937"></a>00937 <a class="code" href="classKFileItem.html#ae1bc218528f8f7e9f7108ecc11ae9f2f" title="Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called agai...">init</a>( _determineMimeTypeOnDemand ); <a name="l00938"></a>00938 } <a name="l00939"></a>00939 <a name="l00940"></a><a class="code" href="classKFileItem.html#aa8c939fa906aee2e1211d33794ea273c">00940</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#aa8c939fa906aee2e1211d33794ea273c" title="Sets the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).">KFileItem::setFileMode</a>( mode_t m ) <a name="l00941"></a>00941 { <a name="l00942"></a>00942 m_fileMode = m; <a name="l00943"></a>00943 } <a name="l00944"></a>00944 <a name="l00945"></a><a class="code" href="classKFileItem.html#af9e9276497057b04da0c6c65cb31a790">00945</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#af9e9276497057b04da0c6c65cb31a790" title="Sets new mimetype for item.">KFileItem::setMimeType</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a>& mimetype ) <a name="l00946"></a>00946 { <a name="l00947"></a>00947 m_pMimeType = <a class="code" href="classKMimeType.html#a1fd115a75a84e762e31d8424eee683c0" title="Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...">KMimeType::mimeType</a>( mimetype ); <a name="l00948"></a>00948 } <a name="l00949"></a>00949 <a name="l00950"></a><a class="code" href="classKFileItem.html#a42007c59b49d91f034737db562b27a8e">00950</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a42007c59b49d91f034737db562b27a8e" title="This allows to associate some "extra" data to a KFileItem.">KFileItem::setExtraData</a>( <span class="keyword">const</span> <span class="keywordtype">void</span> *key, <span class="keywordtype">void</span> *value ) <a name="l00951"></a>00951 { <a name="l00952"></a>00952 <span class="keywordflow">if</span> ( !key ) <a name="l00953"></a>00953 <span class="keywordflow">return</span>; <a name="l00954"></a>00954 <a name="l00955"></a>00955 m_extra.<a class="codeRef" href="qmap.html#replace">replace</a>( key, value ); <a name="l00956"></a>00956 } <a name="l00957"></a>00957 <a name="l00958"></a><a class="code" href="classKFileItem.html#a815bb31dc2bca41f2ce6843423e3f185">00958</a> <span class="keyword">const</span> <span class="keywordtype">void</span> * <a class="code" href="classKFileItem.html#a815bb31dc2bca41f2ce6843423e3f185" title="Retrieves the extra data with the given key.">KFileItem::extraData</a>( <span class="keyword">const</span> <span class="keywordtype">void</span> *key )<span class="keyword"> const</span> <a name="l00959"></a>00959 <span class="keyword"></span>{ <a name="l00960"></a>00960 <a class="codeRef" href="qmapconstiterator.html">QMapConstIterator<const void*,void*></a> it = m_extra.<a class="codeRef" href="qmap.html#find">find</a>( key ); <a name="l00961"></a>00961 <span class="keywordflow">if</span> ( it != m_extra.<a class="codeRef" href="qmap.html#end">end</a>() ) <a name="l00962"></a>00962 <span class="keywordflow">return</span> it.<a class="codeRef" href="qmapconstiterator.html#data">data</a>(); <a name="l00963"></a>00963 <span class="keywordflow">return</span> 0L; <a name="l00964"></a>00964 } <a name="l00965"></a>00965 <a name="l00966"></a><a class="code" href="classKFileItem.html#a6e3c414b7b9a5217d8a40466712c8872">00966</a> <span class="keywordtype">void</span> * <a class="code" href="classKFileItem.html#a815bb31dc2bca41f2ce6843423e3f185" title="Retrieves the extra data with the given key.">KFileItem::extraData</a>( <span class="keyword">const</span> <span class="keywordtype">void</span> *key ) <a name="l00967"></a>00967 { <a name="l00968"></a>00968 <a class="codeRef" href="qmapiterator.html">QMapIterator<const void*,void*></a> it = m_extra.<a class="codeRef" href="qmap.html#find">find</a>( key ); <a name="l00969"></a>00969 <span class="keywordflow">if</span> ( it != m_extra.<a class="codeRef" href="qmap.html#end">end</a>() ) <a name="l00970"></a>00970 <span class="keywordflow">return</span> it.<a class="codeRef" href="qmapiterator.html#data">data</a>(); <a name="l00971"></a>00971 <span class="keywordflow">return</span> 0L; <a name="l00972"></a>00972 } <a name="l00973"></a>00973 <a name="l00974"></a><a class="code" href="classKFileItem.html#a7d1752bff43ff941ae71e6a93ce446d8">00974</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#a7d1752bff43ff941ae71e6a93ce446d8" title="Removes the extra data associated with an item via key.">KFileItem::removeExtraData</a>( <span class="keyword">const</span> <span class="keywordtype">void</span> *key ) <a name="l00975"></a>00975 { <a name="l00976"></a>00976 m_extra.<a class="codeRef" href="qmap.html#remove">remove</a>( key ); <a name="l00977"></a>00977 } <a name="l00978"></a>00978 <a name="l00979"></a><a class="code" href="classKFileItem.html#a1f9b474339d38a1c96424ed9f4c9bc39">00979</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a1f9b474339d38a1c96424ed9f4c9bc39" title="Returns the access permissions for the file as a string.">KFileItem::permissionsString</a>()<span class="keyword"> const</span> <a name="l00980"></a>00980 <span class="keyword"></span>{ <a name="l00981"></a>00981 <span class="keywordflow">if</span> (m_access.<a class="codeRef" href="qstring.html#isNull">isNull</a>()) <a name="l00982"></a>00982 m_access = <a class="code" href="classKFileItem.html#aa0c52ae585bef69d441f2d2f7770420d" title="Parses the given permission set and provides it for access()">parsePermissions</a>( m_permissions ); <a name="l00983"></a>00983 <a name="l00984"></a>00984 <span class="keywordflow">return</span> m_access; <a name="l00985"></a>00985 } <a name="l00986"></a>00986 <a name="l00987"></a><a class="code" href="classKFileItem.html#aa0c52ae585bef69d441f2d2f7770420d">00987</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#aa0c52ae585bef69d441f2d2f7770420d" title="Parses the given permission set and provides it for access()">KFileItem::parsePermissions</a>(mode_t perm)<span class="keyword"> const</span> <a name="l00988"></a>00988 <span class="keyword"></span>{ <a name="l00989"></a>00989 <span class="keywordtype">char</span> p[] = <span class="stringliteral">"---------- "</span>; <a name="l00990"></a>00990 <a name="l00991"></a>00991 <span class="keywordflow">if</span> (<a class="code" href="classKFileItem.html#a4a42f3c3babb4ecb19c3c1c330b3c1bc" title="Returns true if this item represents a directory.">isDir</a>()) <a name="l00992"></a>00992 p[0]=<span class="charliteral">'d'</span>; <a name="l00993"></a>00993 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classKFileItem.html#afe8c8d470b642f9b2a754279c634adcf" title="Returns true if this item represents a link in the UNIX sense of a link.">isLink</a>()) <a name="l00994"></a>00994 p[0]=<span class="charliteral">'l'</span>; <a name="l00995"></a>00995 <a name="l00996"></a>00996 <span class="keywordflow">if</span> (perm & QFileInfo::ReadUser) <a name="l00997"></a>00997 p[1]=<span class="charliteral">'r'</span>; <a name="l00998"></a>00998 <span class="keywordflow">if</span> (perm & QFileInfo::WriteUser) <a name="l00999"></a>00999 p[2]=<span class="charliteral">'w'</span>; <a name="l01000"></a>01000 <span class="keywordflow">if</span> ((perm & QFileInfo::ExeUser) && !(perm & S_ISUID)) p[3]=<span class="charliteral">'x'</span>; <a name="l01001"></a>01001 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((perm & QFileInfo::ExeUser) && (perm & S_ISUID)) p[3]=<span class="charliteral">'s'</span>; <a name="l01002"></a>01002 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!(perm & QFileInfo::ExeUser) && (perm & S_ISUID)) p[3]=<span class="charliteral">'S'</span>; <a name="l01003"></a>01003 <a name="l01004"></a>01004 <span class="keywordflow">if</span> (perm & QFileInfo::ReadGroup) <a name="l01005"></a>01005 p[4]=<span class="charliteral">'r'</span>; <a name="l01006"></a>01006 <span class="keywordflow">if</span> (perm & QFileInfo::WriteGroup) <a name="l01007"></a>01007 p[5]=<span class="charliteral">'w'</span>; <a name="l01008"></a>01008 <span class="keywordflow">if</span> ((perm & QFileInfo::ExeGroup) && !(perm & S_ISGID)) p[6]=<span class="charliteral">'x'</span>; <a name="l01009"></a>01009 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((perm & QFileInfo::ExeGroup) && (perm & S_ISGID)) p[6]=<span class="charliteral">'s'</span>; <a name="l01010"></a>01010 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!(perm & QFileInfo::ExeGroup) && (perm & S_ISGID)) p[6]=<span class="charliteral">'S'</span>; <a name="l01011"></a>01011 <a name="l01012"></a>01012 <span class="keywordflow">if</span> (perm & QFileInfo::ReadOther) <a name="l01013"></a>01013 p[7]=<span class="charliteral">'r'</span>; <a name="l01014"></a>01014 <span class="keywordflow">if</span> (perm & QFileInfo::WriteOther) <a name="l01015"></a>01015 p[8]=<span class="charliteral">'w'</span>; <a name="l01016"></a>01016 <span class="keywordflow">if</span> ((perm & QFileInfo::ExeOther) && !(perm & S_ISVTX)) p[9]=<span class="charliteral">'x'</span>; <a name="l01017"></a>01017 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((perm & QFileInfo::ExeOther) && (perm & S_ISVTX)) p[9]=<span class="charliteral">'t'</span>; <a name="l01018"></a>01018 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!(perm & QFileInfo::ExeOther) && (perm & S_ISVTX)) p[9]=<span class="charliteral">'T'</span>; <a name="l01019"></a>01019 <a name="l01020"></a>01020 <span class="keywordflow">if</span> (<a class="code" href="classKFileItem.html#a7b7aa7baf5c1b4b4e4fd1716709bc489" title="Tells if the file has extended access level information ( Posix ACL )">hasExtendedACL</a>()) <a name="l01021"></a>01021 p[10]=<span class="charliteral">'+'</span>; <a name="l01022"></a>01022 <a name="l01023"></a>01023 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(p); <a name="l01024"></a>01024 } <a name="l01025"></a>01025 <a name="l01026"></a>01026 <span class="comment">// check if we need to cache this</span> <a name="l01027"></a><a class="code" href="classKFileItem.html#a96b0adc58a0ac2a4f76fbe0762d4420e">01027</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKFileItem.html#a96b0adc58a0ac2a4f76fbe0762d4420e" title="Requests the modification, access or creation time as a string, depending on which.">KFileItem::timeString</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> which )<span class="keyword"> const</span> <a name="l01028"></a>01028 <span class="keyword"></span>{ <a name="l01029"></a>01029 <span class="keywordtype">bool</span> hasTime; <a name="l01030"></a>01030 time_t time_ = <a class="code" href="classKFileItem.html#aef9ef4084472ac89dd1317f6b7f81936" title="Requests the modification, access or creation time, depending on which.">time</a>(which, hasTime); <a name="l01031"></a>01031 <span class="keywordflow">if</span>(!hasTime) <span class="keywordflow">return</span> QString::null; <a name="l01032"></a>01032 <a name="l01033"></a>01033 <a class="codeRef" href="qdatetime.html">QDateTime</a> t; <a name="l01034"></a>01034 t.<a class="codeRef" href="qdatetime.html#setTime_t">setTime_t</a>( time_); <a name="l01035"></a>01035 <span class="keywordflow">return</span> KGlobal::locale()->formatDateTime( t ); <a name="l01036"></a>01036 } <a name="l01037"></a>01037 <a name="l01038"></a><a class="code" href="classKFileItem.html#aa369114fce4b365d7b227fe89fb3ef77">01038</a> <span class="keywordtype">void</span> <a class="code" href="classKFileItem.html#aa369114fce4b365d7b227fe89fb3ef77" title="Sets the metainfo of this item to info.">KFileItem::setMetaInfo</a>( <span class="keyword">const</span> <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a> & info ) <a name="l01039"></a>01039 { <a name="l01040"></a>01040 m_metaInfo = info; <a name="l01041"></a>01041 } <a name="l01042"></a>01042 <a name="l01043"></a><a class="code" href="classKFileItem.html#a1f4678617c71875593ce78bc20fb6734">01043</a> <span class="keyword">const</span> <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a> & <a class="code" href="classKFileItem.html#a1f4678617c71875593ce78bc20fb6734" title="Returns the metainfo of this item.">KFileItem::metaInfo</a>(<span class="keywordtype">bool</span> autoget, <span class="keywordtype">int</span>)<span class="keyword"> const</span> <a name="l01044"></a>01044 <span class="keyword"></span>{ <a name="l01045"></a>01045 <span class="keywordtype">bool</span> isLocalURL; <a name="l01046"></a>01046 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a> = <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">mostLocalURL</a>(isLocalURL); <a name="l01047"></a>01047 <a name="l01048"></a>01048 <span class="keywordflow">if</span> ( autoget && !m_metaInfo.<a class="code" href="classKFileMetaInfo.html#a7fbb3ea4fc85133d4bd0534f7c684b1e" title="Returns true if the item is valid, i.e.">isValid</a>() && <a name="l01049"></a>01049 KGlobalSettings::showFilePreview(url) ) <a name="l01050"></a>01050 { <a name="l01051"></a>01051 m_metaInfo = <a class="code" href="classKFileMetaInfo.html" title="Meta Information about a file.">KFileMetaInfo</a>( url, <a class="code" href="classKFileItem.html#af0dff9baf66407473b41d63065a93567" title="Returns the mimetype of the file item.">mimetype</a>() ); <a name="l01052"></a>01052 } <a name="l01053"></a>01053 <a name="l01054"></a>01054 <span class="keywordflow">return</span> m_metaInfo; <a name="l01055"></a>01055 } <a name="l01056"></a>01056 <a name="l01057"></a><a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048">01057</a> KURL <a class="code" href="classKFileItem.html#a2535aa6403077ab064566d60aa6b4048" title="Tries to give a local URL for this file item if possible.">KFileItem::mostLocalURL</a>(<span class="keywordtype">bool</span> &local)<span class="keyword"> const</span> <a name="l01058"></a>01058 <span class="keyword"></span>{ <a name="l01059"></a>01059 <a class="codeRef" href="qstring.html">QString</a> local_path = <a class="code" href="classKFileItem.html#aa0ea703232934902e9132073da38037e" title="Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...">localPath</a>(); <a name="l01060"></a>01060 <a name="l01061"></a>01061 <span class="keywordflow">if</span> ( !local_path.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) <a name="l01062"></a>01062 { <a name="l01063"></a>01063 local = <span class="keyword">true</span>; <a name="l01064"></a>01064 KURL <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a>; <a name="l01065"></a>01065 url.setPath(local_path); <a name="l01066"></a>01066 <span class="keywordflow">return</span> <a class="code" href="classKFileItem.html#a04813dcf686795b8854034b0165ccdc0" title="Returns the url of the file.">url</a>; <a name="l01067"></a>01067 } <a name="l01068"></a>01068 <span class="keywordflow">else</span> <a name="l01069"></a>01069 { <a name="l01070"></a>01070 local = m_bIsLocalURL; <a name="l01071"></a>01071 <span class="keywordflow">return</span> m_url; <a name="l01072"></a>01072 } <a name="l01073"></a>01073 } <a name="l01074"></a>01074 <a name="l01075"></a>01075 <span class="keywordtype">void</span> KFileItem::virtual_hook( <span class="keywordtype">int</span>, <span class="keywordtype">void</span>* ) <a name="l01076"></a>01076 { <span class="comment">/*BASE::virtual_hook( id, data );*/</span> } <a name="l01077"></a>01077 <a name="l01078"></a>01078 <a class="codeRef" href="qdatastream.html">QDataStream</a> & operator<< ( <a class="codeRef" href="qdatastream.html">QDataStream</a> & s, <span class="keyword">const</span> <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & a ) <a name="l01079"></a>01079 { <a name="l01080"></a>01080 <span class="comment">// We don't need to save/restore anything that refresh() invalidates,</span> <a name="l01081"></a>01081 <span class="comment">// since that means we can re-determine those by ourselves.</span> <a name="l01082"></a>01082 s << a.m_url; <a name="l01083"></a>01083 s << a.m_strName; <a name="l01084"></a>01084 s << a.m_strText; <a name="l01085"></a>01085 <span class="keywordflow">return</span> s; <a name="l01086"></a>01086 } <a name="l01087"></a>01087 <a name="l01088"></a>01088 <a class="codeRef" href="qdatastream.html">QDataStream</a> & operator>> ( <a class="codeRef" href="qdatastream.html">QDataStream</a> & s, <a class="code" href="classKFileItem.html" title="A KFileItem is a generic class to handle a file, local or remote.">KFileItem</a> & a ) <a name="l01089"></a>01089 { <a name="l01090"></a>01090 s >> a.m_url; <a name="l01091"></a>01091 s >> a.m_strName; <a name="l01092"></a>01092 s >> a.m_strText; <a name="l01093"></a>01093 a.m_bIsLocalURL = a.m_url.isLocalFile(); <a name="l01094"></a>01094 a.m_bMimeTypeKnown = <span class="keyword">false</span>; <a name="l01095"></a>01095 a.<a class="code" href="classKFileItem.html#afcd50458f3068076a1101c5b6a3b140a" title="Throw away and re-read (for local files) all information about the file.">refresh</a>(); <a name="l01096"></a>01096 <span class="keywordflow">return</span> s; <a name="l01097"></a>01097 } </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> <a href="../../../interfaces/kimproxy/interface/html/index.html">interface</a></li><li> <a href="../../../interfaces/kimproxy/library/html/index.html">library</a></li><li> <a href="../../../interfaces/kspeech/html/index.html">kspeech</a></li><li> <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> <a href="../../../kio/bookmarks/html/index.html">bookmarks</a></li><li> <a href="../../../kio/httpfilter/html/index.html">httpfilter</a></li><li> <a href="../../../kio/kfile/html/index.html">kfile</a></li><li> <a href="../../../kio/kio/html/index.html">kio</a></li><li> <a href="../../../kio/kioexec/html/index.html">kioexec</a></li><li> <a href="../../../kio/kpasswdserver/html/index.html">kpasswdserver</a></li><li> <a href="../../../kio/kssl/html/index.html">kssl</a></li><li><a href="../../../kioslave/html/index.html">kioslave</a></li><li> <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> <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="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">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>