From 1387a8b5bdc49cb6a7570734e4c4b8a20a82a1a4 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Fri, 3 Jul 2015 17:40:28 +0300 Subject: [PATCH] Fix internal links conversion for saving mode "html only" --- mainwindow.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 6f6f5470..3f6a98b8 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -3279,6 +3279,19 @@ void MainWindow::on_saveArticle_triggered() QFileInfo fi( fileName ); 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 ) { 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->setRange( 0, maxVal ); progressDialog->setValue( 0 );