[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [Patch] Usage of URL's filename to detect hidden files
From: "Craig Drummond" <Craig.Drummond () gmx ! net>
Date: 2004-03-17 15:30:16
Message-ID: 17475.1079537416 () www8 ! gmx ! net
[Download RAW message or body]
This is a MIME encapsulated multipart message -
please use a MIME-compliant e-mail program to open it.
Dies ist eine mehrteilige Nachricht im MIME-Format -
bitte verwenden Sie zum Lesen ein MIME-konformes Mailprogramm.
Hi,
Currently it seems as if KDE just uses a KFileItem's "name" field to
determine if a file is hidden or not. However, a KFileItem can also have a URL,
whose filename part may differ. The following patches add a "isHidden()" function
to KFileItem - this function then uses the url.filename() (if one has been
specified) to look for a leading '.'
Is this OK to apply?
Craig.
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
["kdirlister.cpp.diff" (application/octet-stream)]
--- kdirlister.cpp.orig 2004-03-17 14:06:40.000000000 +0000
+++ kdirlister.cpp 2004-03-17 14:07:02.000000000 +0000
@@ -1702,7 +1702,7 @@
continue;
}
- if ( (*kit)->text()[0] == dot )
+ if ( (*kit)->isHidden() )
{
if ( d->changes & DOT_FILES )
{
["kfileitem.cpp.diff" (application/octet-stream)]
--- kfileitem.cpp.orig 2004-03-17 14:01:56.000000000 +0000
+++ kfileitem.cpp 2004-03-17 14:06:32.000000000 +0000
@@ -437,7 +437,7 @@
&& !isReadable())
_state |= KIcon::LockOverlay;
- if ( m_strName[0] == '.' )
+ if ( isHidden() )
_state |= KIcon::HiddenOverlay;
if( S_ISDIR( m_fileMode ) && m_bIsLocalURL)
@@ -517,6 +517,14 @@
return true;
}
+bool KFileItem::isHidden() const
+{
+ if ( !m_url.isEmpty() )
+ return m_url.filename()[0] == '.';
+ else
+ return m_strName[0] == '.';
+}
+
bool KFileItem::isDir() const
{
if ( m_fileMode == KFileItem::Unknown )
["kfileitem.h.diff" (application/octet-stream)]
--- kfileitem.h.orig 2004-03-17 14:01:48.000000000 +0000
+++ kfileitem.h 2004-03-17 14:03:04.000000000 +0000
@@ -183,6 +183,12 @@
bool isReadable() const;
/**
+ * Checks whether the file is hidden.
+ * @return true if the file is hidden.
+ */
+ bool isHidden() const;
+
+ /**
* Returns the link destination if isLink() == true.
* @return the link destination. QString::null if the item is not a link
*/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic