From kde-devel Fri Apr 25 22:14:51 2003 From: Szombathelyi =?iso-8859-1?q?Gy=F6rgy?= Date: Fri, 25 Apr 2003 22:14:51 +0000 To: kde-devel Subject: Re: KFileItem Modification Time X-MARC-Message: https://marc.info/?l=kde-devel&m=105130962708092 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_bNbq+AWZ0Lvqmsl" --Boundary-00=_bNbq+AWZ0Lvqmsl Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2003. =E1prilis 24. 16.13 d=E1tummal Stephan Kulow ezt =EDrta: > 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",KFileIte= m: > >:Unknown); KFileItem > > item2(KFileItem::Unknown,KFileItem::Unknown,KURL("smb:/MAIN/EN3/En/LIND= OW > >S/source.txt"),true); > > > > cout<<"time =3D"< > cout<<"time =3D"< > > > I should get correct time of file source.txt But my time string that i = am > > getting is > > > > "time =3D12/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 return= ed > 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=20 KFileItem::init() (It would be good to use this for ACL support)(Plese try= =20 the attached patch) Regards, Gy=F6rgy P.S.: I asked this question two weeks ago, but nobody answered, maybe someo= ne=20 has some time to investigate this. --Boundary-00=_bNbq+AWZ0Lvqmsl Content-Type: text/x-diff; charset="iso-8859-1"; name="kfileitem.prob.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kfileitem.prob.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 #include #include +#include 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 --Boundary-00=_bNbq+AWZ0Lvqmsl Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_bNbq+AWZ0Lvqmsl--