|
|
@ -47,8 +47,13 @@
|
|
|
|
#include <krun.h>
|
|
|
|
#include <krun.h>
|
|
|
|
|
|
|
|
|
|
|
|
class KFileItem::KFileItemPrivate {
|
|
|
|
class KFileItem::KFileItemPrivate {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
KFileItemPrivate() : commentCached(false) {}
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
TQString iconName;
|
|
|
|
TQString iconName;
|
|
|
|
|
|
|
|
TQString comment;
|
|
|
|
|
|
|
|
bool commentCached;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
KFileItem::KFileItem( const KIO::UDSEntry& _entry, const KURL& _url,
|
|
|
|
KFileItem::KFileItem( const KIO::UDSEntry& _entry, const KURL& _url,
|
|
|
@ -239,8 +244,9 @@ void KFileItem::readUDSEntry( bool _urlIsDirectory )
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KIO::UDS_ICON_NAME:
|
|
|
|
case KIO::UDS_ICON_NAME:
|
|
|
|
if ( !d )
|
|
|
|
if ( !d ) {
|
|
|
|
d = new KFileItemPrivate();
|
|
|
|
d = new KFileItemPrivate();
|
|
|
|
|
|
|
|
}
|
|
|
|
d->iconName = (*it).m_str;
|
|
|
|
d->iconName = (*it).m_str;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
@ -279,6 +285,11 @@ void KFileItem::refresh()
|
|
|
|
|
|
|
|
|
|
|
|
void KFileItem::refreshMimeType()
|
|
|
|
void KFileItem::refreshMimeType()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( d ) {
|
|
|
|
|
|
|
|
d->iconName = TQString::null;
|
|
|
|
|
|
|
|
d->comment = TQString::null;
|
|
|
|
|
|
|
|
d->commentCached = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
m_pMimeType = 0L;
|
|
|
|
m_pMimeType = 0L;
|
|
|
|
init( false ); // Will determine the mimetype
|
|
|
|
init( false ); // Will determine the mimetype
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -510,6 +521,16 @@ TQString KFileItem::mimetype() const
|
|
|
|
return that->determineMimeType()->name();
|
|
|
|
return that->determineMimeType()->name();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString KFileItem::mimetypeFast() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isMimeTypeKnown()) {
|
|
|
|
|
|
|
|
return mimetype();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
return m_pMimeType->name();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KMimeType::Ptr KFileItem::determineMimeType()
|
|
|
|
KMimeType::Ptr KFileItem::determineMimeType()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( !m_pMimeType || !m_bMimeTypeKnown )
|
|
|
|
if ( !m_pMimeType || !m_bMimeTypeKnown )
|
|
|
@ -535,6 +556,8 @@ bool KFileItem::isMimeTypeKnown() const
|
|
|
|
|
|
|
|
|
|
|
|
TQString KFileItem::mimeComment()
|
|
|
|
TQString KFileItem::mimeComment()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (d && (d->commentCached)) return d->comment;
|
|
|
|
|
|
|
|
|
|
|
|
KMimeType::Ptr mType = determineMimeType();
|
|
|
|
KMimeType::Ptr mType = determineMimeType();
|
|
|
|
|
|
|
|
|
|
|
|
bool isLocalURL;
|
|
|
|
bool isLocalURL;
|
|
|
@ -542,10 +565,19 @@ TQString KFileItem::mimeComment()
|
|
|
|
|
|
|
|
|
|
|
|
TQString comment = mType->comment( url, isLocalURL );
|
|
|
|
TQString comment = mType->comment( url, isLocalURL );
|
|
|
|
//kdDebug() << "finding comment for " << url.url() << " : " << m_pMimeType->name() << endl;
|
|
|
|
//kdDebug() << "finding comment for " << url.url() << " : " << m_pMimeType->name() << endl;
|
|
|
|
if (!comment.isEmpty())
|
|
|
|
if ( !d ) {
|
|
|
|
return comment;
|
|
|
|
d = new KFileItemPrivate();
|
|
|
|
else
|
|
|
|
}
|
|
|
|
return mType->name();
|
|
|
|
if (!comment.isEmpty()) {
|
|
|
|
|
|
|
|
d->comment = comment;
|
|
|
|
|
|
|
|
d->commentCached = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
d->comment = mType->name();
|
|
|
|
|
|
|
|
d->commentCached = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return d->comment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString KFileItem::iconName()
|
|
|
|
TQString KFileItem::iconName()
|
|
|
@ -556,7 +588,11 @@ TQString KFileItem::iconName()
|
|
|
|
KURL url = mostLocalURL(isLocalURL);
|
|
|
|
KURL url = mostLocalURL(isLocalURL);
|
|
|
|
|
|
|
|
|
|
|
|
//kdDebug() << "finding icon for " << url.url() << " : " << m_pMimeType->name() << endl;
|
|
|
|
//kdDebug() << "finding icon for " << url.url() << " : " << m_pMimeType->name() << endl;
|
|
|
|
return determineMimeType()->icon(url, isLocalURL);
|
|
|
|
if ( !d ) {
|
|
|
|
|
|
|
|
d = new KFileItemPrivate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
d->iconName = determineMimeType()->icon(url, isLocalURL);
|
|
|
|
|
|
|
|
return d->iconName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KFileItem::overlays() const
|
|
|
|
int KFileItem::overlays() const
|
|
|
@ -745,12 +781,18 @@ TQString KFileItem::getStatusBarInfo()
|
|
|
|
|
|
|
|
|
|
|
|
if ( m_bLink )
|
|
|
|
if ( m_bLink )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString comment = determineMimeType()->comment( m_url, m_bIsLocalURL );
|
|
|
|
if ( !d ) {
|
|
|
|
|
|
|
|
d = new KFileItemPrivate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!d->commentCached) {
|
|
|
|
|
|
|
|
d->comment = determineMimeType()->comment( m_url, m_bIsLocalURL );
|
|
|
|
|
|
|
|
d->commentCached = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
TQString tmp;
|
|
|
|
TQString tmp;
|
|
|
|
if ( comment.isEmpty() )
|
|
|
|
if ( d->comment.isEmpty() )
|
|
|
|
tmp = i18n ( "Symbolic Link" );
|
|
|
|
tmp = i18n ( "Symbolic Link" );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
tmp = i18n("%1 (Link)").arg(comment);
|
|
|
|
tmp = i18n("%1 (Link)").arg(d->comment);
|
|
|
|
text += "->";
|
|
|
|
text += "->";
|
|
|
|
text += linkDest();
|
|
|
|
text += linkDest();
|
|
|
|
text += " ";
|
|
|
|
text += " ";
|
|
|
@ -921,8 +963,9 @@ void KFileItem::assign( const KFileItem & item )
|
|
|
|
determineMimeType();
|
|
|
|
determineMimeType();
|
|
|
|
|
|
|
|
|
|
|
|
if ( item.d ) {
|
|
|
|
if ( item.d ) {
|
|
|
|
if ( !d )
|
|
|
|
if ( !d ) {
|
|
|
|
d = new KFileItemPrivate;
|
|
|
|
d = new KFileItemPrivate;
|
|
|
|
|
|
|
|
}
|
|
|
|
d->iconName = item.d->iconName;
|
|
|
|
d->iconName = item.d->iconName;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
@ -951,8 +994,11 @@ void KFileItem::setUDSEntry( const KIO::UDSEntry& _entry, const KURL& _url,
|
|
|
|
m_guessedMimeType = TQString::null;
|
|
|
|
m_guessedMimeType = TQString::null;
|
|
|
|
m_metaInfo = KFileMetaInfo();
|
|
|
|
m_metaInfo = KFileMetaInfo();
|
|
|
|
|
|
|
|
|
|
|
|
if ( d )
|
|
|
|
if ( d ) {
|
|
|
|
d->iconName = TQString::null;
|
|
|
|
d->iconName = TQString::null;
|
|
|
|
|
|
|
|
d->comment = TQString::null;
|
|
|
|
|
|
|
|
d->commentCached = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
readUDSEntry( _urlIsDirectory );
|
|
|
|
readUDSEntry( _urlIsDirectory );
|
|
|
|
init( _determineMimeTypeOnDemand );
|
|
|
|
init( _determineMimeTypeOnDemand );
|
|
|
|