[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KFileItem Modification Time
From: Szombathelyi =?iso-8859-1?q?Gy=F6rgy?= <gyurco () freemail ! hu>
Date: 2003-04-25 22:14:51
[Download RAW message or body]
2003. április 24. 16.13 dátummal Stephan Kulow ezt írta:
> On Thursday 24 April 2003 15:14, reply@eninteractive.com wrote:
> > Hi All
> >
> > This is my first mail to this list.I have started developement in kde
> > some time before.
> >
> > I am facing a very strange problem with KFileItem.I am trying to get the
> > modification of a file which is somewhere on network.
> >
> > My code for that is following.
> >
> > KFileItem
> > item1(KURL("smb:/MAIN/EN3/En/LINDOWS/source.txt"),"text/plain",KFileItem:
> >:Unknown); KFileItem
> > item2(KFileItem::Unknown,KFileItem::Unknown,KURL("smb:/MAIN/EN3/En/LINDOW
> >S/source.txt"),true);
> >
> > cout<<"time ="<<item1.timeString(KIO::UDS_CREATION_TIME);
> > cout<<"time ="<<item2.timeString(KIO::UDS_CREATION_TIME);
> >
> > I should get correct time of file source.txt But my time string that i am
> > getting is
> >
> > "time =12/31/69 4:00 pm"
> >
> > in both cases and for every file.
> >
> > I have tried one more thing to get mimetype dynamically, i used function
> > KIO::NetAccess::mimetype(KURL &)but it is giving error "undefined
> > reference to mimetype..." at linking time while all other functions of
> > KIO::NetAccess are working fine.
> >
> > Please suggest me where i am doing wrong.
>
> a) if MAIN is the server, the URL needs to look as smb://MAIN/...
> b) did you look at the docu of KFileItem? KFileItem is a container returned
> from KIO::listDir
> c) you want KIO::NetAccess::stat
>
> Greetings, Stephan
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<
Hi!
I've got a KFileItem related question:
Why KIO::NetAccess::stat() freezes the application when I try to put in
KFileItem::init() (It would be good to use this for ACL support)(Plese try
the attached patch)
Regards, György
P.S.: I asked this question two weeks ago, but nobody answered, maybe someone
has some time to investigate this.
["kfileitem.prob.diff" (text/x-diff)]
Index: kfileitem.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kfileitem.cpp,v
retrieving revision 1.140
diff -u -r1.140 kfileitem.cpp
--- kfileitem.cpp 19 Nov 2002 00:11:43 -0000 1.140
+++ kfileitem.cpp 13 Apr 2003 20:35:12 -0000
@@ -43,6 +43,7 @@
#include <krun.h>
#include <kfilemetainfo.h>
#include <kfileshare.h>
+#include <netaccess.h>
KFileItem::KFileItem( const KIO::UDSEntry& _entry, const KURL& _url,
bool _determineMimeTypeOnDemand, bool _urlIsDirectory ) :
@@ -174,6 +175,18 @@
* stat("/is/unaccessible/") -> EPERM H.Z.
* This is the reason for the -1
*/
+ KIO::NetAccess::stat( m_url, m_entry );
+ KIO::UDSEntry::ConstIterator it = m_entry.begin();
+ for( ; it != m_entry.end(); it++ ) {
+ switch ((*it).m_uds) {
+
+ case KIO::UDS_ACCESS:
+ mode = (mode_t)((*it).m_long);
+ break;
+
+ }
+ }
+/*
KDE_struct_stat buf;
QCString path = QFile::encodeName(m_url.path( -1 ));
if ( KDE_lstat( path.data(), &buf ) == 0 )
@@ -188,11 +201,13 @@
mode = (S_IFMT-1) | S_IRWXU | S_IRWXG | S_IRWXO;
}
}
+*/
}
if ( m_fileMode == KFileItem::Unknown )
m_fileMode = mode & S_IFMT; // extract file type
if ( m_permissions == KFileItem::Unknown )
m_permissions = mode & 07777; // extract permissions
+
}
// determine the mimetype
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic