kioslave/mbox
27UrlInfo::UrlInfo(
const KUrl& url,
const UrlType type )
29 m_filename( new QString ),
32 calculateInfo( url, type );
41QString UrlInfo::mimetype()
const
45 return "message/rfc822";
47 return "inode/directory";
54QString UrlInfo::filename()
const
59QString UrlInfo::id()
const
64QString UrlInfo::url()
const
66 return *m_filename +
'/' + *m_id;
70void UrlInfo::calculateInfo(
const KUrl& url,
const UrlType type )
74 if( !found && type & UrlInfo::message ) {
75 found = isMessage( url );
77 if( !found && type & UrlInfo::directory ) {
78 found = isDirectory( url );
87bool UrlInfo::isDirectory(
const KUrl& url )
90 QString filename = url.path();
94 while( filename.length() > 1 && filename.right( 1 ) ==
"/" ) {
95 filename.remove( filename.length()-2, 1 );
99 info.setFile( filename );
100 if( !info.isFile() ) {
105 *m_filename = filename;
108 kDebug() <<
"urlInfo::isDirectory(" << url <<
" )";
112bool UrlInfo::isMessage(
const KUrl& url )
114 QString path = url.path();
116 int cutindex = path.lastIndexOf(
'/' );
124 info.setFile( path.left( cutindex ) );
125 if( !info.isFile() ) {
130 kDebug() <<
"urlInfo::isMessage(" << url <<
" )";
132 *m_id = path.right( path.length() - cutindex - 1 );
133 *m_filename = path.left( cutindex );
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by
doxygen 1.9.5 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.