bool KNfoViewerPart::openFile()
{
// m_file is always local so we can use QFile on it
if( !file.open( IO_ReadOnly ) )
return false;
CP437Codec codec;
stream.setCodec( &codec );
while( !stream.atEnd() ){
int pos = 0;
while( ( pos = s.find( exp, pos ) ) > -1 ){
int end = pos + 7;
while( !c.
isSpace() && c.
category() != QChar::Separator_Line && end
!= s.
length() ){ end++;
c = s.at( end );
}
QString l
= s.
mid( pos, end
- pos
);
QString link
( "<a href=\"" + l
+ "\">" + l
+ "</a>" );
s.replace( pos, l );
pos += link.length();
}
str += s + "<br>";
}
file.close();
// now that we have the entire file, display it
m_widget->setText( str );
// just for fun, set the status bar
emit setStatusBarText( m_url.prettyURL() );
return true;
}