------=_Part_2744_6891014.1123269508316
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

I've created the attached *untested* patch which adds UDS_HIDDEN to
the UDSAtomTypes. With UDS_HIDDEN it is possible to override the
default behaviour of treating only dotfiles (leading dot) as hidden
files.

One use would be hiding of URLs containing "/." (dotfiles actually,
but not recognised as such) in the results of kio-locate. Another use
would be actual hiding of supposed-to-be-hidden FAT files.

It would be great if it could be included in next minor release (it
should be ABI compatible: I only added enumeration values and a
bitfield to the header).

Comments&thoughts are welcome of course. Also it would be cool if
someone could test it if it is agreed that it is accepted.

thanks,

Tobi Vollebregt

------=_Part_2744_6891014.1123269508316
Content-Type: text/plain; name=uds_hidden.diff; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="uds_hidden.diff"

diff -u -r -x .svn kdelibs/kio/kio/global.h kdelibs-tvo/kio/kio/global.h
--- kdelibs/kio/kio/global.h 2005-08-05 17:52:33.000000000 +0200
+++ kdelibs-tvo/kio/kio/global.h 2005-08-05 20:54:18.000000000 +0200
@@ -325,8 +325,11 @@
/// A local file path if the ioslave display files sitting
/// on the local filesystem (but in another hierarchy, e.g. media:/)
UDS_LOCAL_PATH = 72 | UDS_STRING,
+ /// Treat the file as a hidden file or as a normal file,
+ /// regardless of (the absence of) a leading dot in the filename.
+ UDS_HIDDEN = 80 | UDS_LONG,

- // available: 80, 88, 92, 100, 108 etc.
+ // available: 88, 92, 100, 108 etc.

/// Access permissions (part of the mode returned by stat)
UDS_ACCESS = 128 | UDS_LONG,
diff -u -r -x .svn kdelibs/kio/kio/kfileitem.cpp kdelibs-tvo/kio/kio/kfileitem.cpp
--- kdelibs/kio/kio/kfileitem.cpp 2005-08-05 17:52:33.000000000 +0200
+++ kdelibs-tvo/kio/kio/kfileitem.cpp 2005-08-05 20:30:11.000000000 +0200
@@ -62,6 +62,7 @@
m_bLink( false ),
m_bIsLocalURL( _url.isLocalFile() ),
m_bMimeTypeKnown( false ),
+ m_hidden( Auto ),
d(0)
{
readUDSEntry( _urlIsDirectory );
@@ -80,6 +81,7 @@
m_bLink( false ),
m_bIsLocalURL( _url.isLocalFile() ),
m_bMimeTypeKnown( false ),
+ m_hidden( Auto ),
d(0)
{
init( _determineMimeTypeOnDemand );
@@ -96,6 +98,7 @@
m_bLink( false ),
m_bIsLocalURL( url.isLocalFile() ),
m_bMimeTypeKnown( !mimeType.isEmpty() ),
+ m_hidden( Auto ),
d(0)
{
if (m_bMimeTypeKnown)
@@ -238,6 +241,13 @@
d = new KFileItemPrivate();
d->iconName = (*it).m_str;
break;
+
+ case KIO::UDS_HIDDEN:
+ if ( (*it).m_long )
+ m_hidden = Hide;
+ else
+ m_hidden = Show;
+ break;
}
}

@@ -255,6 +265,7 @@
m_user = QString::null;
m_group = QString::null;
m_metaInfo = KFileMetaInfo();
+ m_hidden = Auto;

// Basically, we can't trust any information we got while listing.
// Everything could have changed...
@@ -597,6 +608,9 @@

bool KFileItem::isHidden() const
{
+ if ( m_hidden != Auto )
+ return m_hidden == Hide;
+
if ( !m_url.isEmpty() )
return m_url.fileName()[0] == '.';
else // should never happen
@@ -779,6 +793,7 @@
&& m_user == item.m_user
&& m_group == item.m_group
&& m_bLink == item.m_bLink
+ && m_hidden == m_hidden
&& size() == item.size()
&& time(KIO::UDS_MODIFICATION_TIME) == item.time(KIO::UDS_MODIFICATION_TIME)
&& mimetype() == item.mimetype()
@@ -802,6 +817,7 @@
m_pMimeType = item.m_pMimeType;
m_strLowerCaseName = item.m_strLowerCaseName;
m_bMimeTypeKnown = item.m_bMimeTypeKnown;
+ m_hidden = item.m_hidden;
m_guessedMimeType = item.m_guessedMimeType;
m_access = item.m_access;
m_metaInfo = item.m_metaInfo;
@@ -841,6 +857,7 @@
m_bLink = false;
m_bIsLocalURL = _url.isLocalFile();
m_bMimeTypeKnown = false;
+ m_hidden = Auto;
m_guessedMimeType = QString::null;
m_metaInfo = KFileMetaInfo();

diff -u -r -x .svn kdelibs/kio/kio/kfileitem.h kdelibs-tvo/kio/kio/kfileitem.h
--- kdelibs/kio/kio/kfileitem.h 2005-08-05 17:52:33.000000000 +0200
+++ kdelibs-tvo/kio/kio/kfileitem.h 2005-08-05 20:03:15.000000000 +0200
@@ -458,20 +458,20 @@
* Somewhat like an assignment operator, but more explicit.
* Note: extra-data set with setExtraData() is not copied, so be careful
* what you do!
- *
+ *
* @param item the item to copy
*/
void assign( const KFileItem & item );

/**
* Reinitialize KFileItem with a new UDSEntry.
- *
+ *
* Note: extra-data set with setExtraData() is not changed or deleted, so
* be careful what you do!
*
* KDirListerCache uses it to save new/delete calls by updating existing
* items that are otherwise not needed anymore.
- *
+ *
* @param entry the UDSEntry to assign to this KFileItem
* @param url the file url
* @param determineMimeTypeOnDemand specifies if the mimetype of the given
@@ -576,6 +576,10 @@

bool m_bMimeTypeKnown:1;

+ enum { Auto = 0, Hide = 1, Show = 2 };
+ // One of Auto, Hide, Show. Auto: check leading dot.
+ unsigned char m_hidden:2;
+
// For special case like link to dirs over FTP
QString m_guessedMimeType;
mutable QString m_access;

------=_Part_2744_6891014.1123269508316
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

=

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<

------=_Part_2744_6891014.1123269508316--