Fix internal links conversion for saving mode "html only"

This commit is contained in:
Abs62 2015-07-03 17:40:28 +03:00
parent 5b666afe36
commit 1387a8b5bd

View file

@ -3279,6 +3279,19 @@ void MainWindow::on_saveArticle_triggered()
QFileInfo fi( fileName ); QFileInfo fi( fileName );
cfg.articleSavePath = QDir::toNativeSeparators( fi.absoluteDir().absolutePath() ); cfg.articleSavePath = QDir::toNativeSeparators( fi.absoluteDir().absolutePath() );
// Convert internal links
QRegExp rx3( "href=\"(bword:|gdlookup://localhost/)([^\"]+)\"" );
int pos = 0;
while ( ( pos = rx3.indexIn( html, pos ) ) != -1 )
{
QString name = QUrl::fromPercentEncoding( rx3.cap( 2 ).simplified().toLatin1() );
name.replace( rxName, "_" );
name = QString( "href=\"" ) + QUrl::toPercentEncoding( name ) + ".html\"";
html.replace( pos, rx3.cap().length(), name );
pos += name.length();
}
if ( complete ) if ( complete )
{ {
QString folder = fi.absoluteDir().absolutePath() + "/" + fi.baseName() + "_files"; QString folder = fi.absoluteDir().absolutePath() + "/" + fi.baseName() + "_files";
@ -3308,19 +3321,6 @@ void MainWindow::on_saveArticle_triggered()
} }
} }
// Convert internal links
QRegExp rx3( "href=\"(bword:|gdlookup://localhost/)([^\"]+)\"" );
int pos = 0;
while ( ( pos = rx3.indexIn( html, pos ) ) != -1 )
{
QString name = QUrl::fromPercentEncoding( rx3.cap( 2 ).simplified().toLatin1() );
name.replace( rxName, "_" );
name = QString( "href=\"" ) + QUrl::toPercentEncoding( name ) + ".html\"";
html.replace( pos, rx3.cap().length(), name );
pos += name.length();
}
progressDialog->setLabelText( tr("Saving article...") ); progressDialog->setLabelText( tr("Saving article...") );
progressDialog->setRange( 0, maxVal ); progressDialog->setRange( 0, maxVal );
progressDialog->setValue( 0 ); progressDialog->setValue( 0 );