24 #include <tqfileinfo.h> 27 UrlInfo::UrlInfo( const KURL& url, const UrlType type ) 29 m_filename( new TQString ), 32 calculateInfo( url, type ); 41 TQString UrlInfo::mimetype() const 46 return "message/rfc822"; 48 return "inode/directory"; 55 TQString UrlInfo::filename() const 60 TQString UrlInfo::id() const 65 TQString UrlInfo::url() const 67 return *m_filename + "/" + *m_id; 71 void UrlInfo::calculateInfo( const KURL& url, const UrlType type ) 75 if( !found && type & UrlInfo::message ) 76 found = isMessage( url ); 77 if( !found && type & UrlInfo::directory ) 78 found = isDirectory( url ); 87 bool UrlInfo::isDirectory( const KURL& url ) 90 TQString filename = url.path(); 94 while( filename.length() > 1 && filename.right( 1 ) == "/" ) 95 filename.remove( filename.length()-2, 1 ); 98 info.setFile( filename ); 103 *m_filename = filename; 106 kdDebug() << "urlInfo::isDirectory( " << url << " )" << endl; 110 bool UrlInfo::isMessage( const KURL& url ) 112 TQString path = url.path(); 114 int cutindex = path.findRev( '/' ); 121 info.setFile( path.left( cutindex ) ); 126 kdDebug() << "urlInfo::isMessage( " << url << " )" << endl; 128 *m_id = path.right( path.length() - cutindex - 1 ); 129 *m_filename = path.left( cutindex );
|