summaryrefslogtreecommitdiffstats
path: root/tdeio/tdeio/tdefileitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdeio/tdeio/tdefileitem.cpp')
-rw-r--r--tdeio/tdeio/tdefileitem.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/tdeio/tdeio/tdefileitem.cpp b/tdeio/tdeio/tdefileitem.cpp
index aa4d1f873..213e9368f 100644
--- a/tdeio/tdeio/tdefileitem.cpp
+++ b/tdeio/tdeio/tdefileitem.cpp
@@ -36,6 +36,7 @@
#include <tqmap.h>
#include <tqstylesheet.h>
#include <tqimage.h>
+#include <tqregexp.h>
#include <kdebug.h>
#include <tdefilemetainfo.h>
@@ -272,6 +273,21 @@ void KFileItem::readUDSEntry( bool _urlIsDirectory )
else
m_hidden = Shown;
break;
+
+ case TDEIO::UDS_ATTRIBUTES:
+ {
+ m_attrs.clear();
+ TQString serialized = (*it).m_str;
+ TQStringList pairs = TQStringList::split(TQChar((char)30), serialized);
+ for (TQStringList::Iterator it = pairs.begin(); it != pairs.end(); ++it)
+ {
+ TQStringList pair = TQStringList::split(TQChar((char)31), (*it));
+ TQString key = pair[0];
+ TQString value = pair[1];
+ m_attrs[key] = value;
+ }
+ break;
+ }
}
}
@@ -291,6 +307,7 @@ void KFileItem::refresh()
m_group = TQString::null;
m_metaInfo = KFileMetaInfo();
m_hidden = Auto;
+ m_attrs.clear();
// Basically, we can't trust any information we got while listing.
// Everything could have changed...
@@ -597,10 +614,10 @@ TQString KFileItem::mimeComment()
if (d && (d->commentCached)) return d->comment;
KMimeType::Ptr mType = determineMimeType();
-
+
bool isLocalURL;
KURL url = mostLocalURL(isLocalURL);
-
+
TQString comment = mType->comment( url, isLocalURL );
//kdDebug() << "finding comment for " << url.url() << " : " << m_pMimeType->name() << endl;
if ( !d ) {
@@ -718,7 +735,7 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const
kdWarning() << "failed to open file" << url.path() << endl;
return p;
}
-
+
icon_size = _size;
icon = libr_icon_geticon_bysize(handle, icon_size);
@@ -937,6 +954,9 @@ TQString KFileItem::getToolTipText(int maxcount)
TQString tip;
KFileMetaInfo info = metaInfo();
+#define TIP_SEPARATOR "<tr><td colspan=2></td></tr>"
+ // TODO find better style (e.g. colored headings)
+
// the font tags are a workaround for the fact that the tool tip gets
// screwed if the color scheme uses white as default text color
const char* start = "<tr><td><nobr><font color=\"black\">";
@@ -976,7 +996,7 @@ TQString KFileItem::getToolTipText(int maxcount)
if (info.isValid() && !info.isEmpty() )
{
- tip += "<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>";
+ tip += TIP_SEPARATOR;
TQStringList keys = info.preferredKeys();
// now the rest
@@ -1005,8 +1025,22 @@ TQString KFileItem::getToolTipText(int maxcount)
}
}
}
+
+ if (m_attrs.count() > 0)
+ {
+ tip += TIP_SEPARATOR;
+ tip += "<tr><td colspan=2><nobr><center><b>" + i18n("Attributes") + "</td></tr>";
+ TQMap<TQString, TQString>::Iterator it;
+ for (it = m_attrs.begin(); it != m_attrs.end(); ++it)
+ {
+ tip += start + it.key() + mid + it.data() + end;
+ }
+ }
+
tip += "</table>";
+#undef TIP_SEPARATOR
+
//kdDebug() << "making this the tool tip rich text:\n";
//kdDebug() << tip << endl;
@@ -1107,6 +1141,7 @@ void KFileItem::setUDSEntry( const TDEIO::UDSEntry& _entry, const KURL& _url,
m_hidden = Auto;
m_guessedMimeType = TQString::null;
m_metaInfo = KFileMetaInfo();
+ m_attrs.clear();
if ( d ) {
d->iconName = TQString::null;