Commit 411bdee0 authored by Olivier Churlaud's avatar Olivier Churlaud
Browse files

Open relative path again

REVIEW: 128507
parent 09a99ba9
......@@ -310,6 +310,10 @@ target_link_libraries(okularpart okularcore
KF5::IconThemes
KF5::ItemViews
KF5::KDELibs4Support
KF5::KIOCore
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::KIONTLM
KF5::Parts
KF5::Solid
KF5::Wallet
......
......@@ -48,7 +48,7 @@
#include <kmessagebox.h>
#include <kmimetypetrader.h>
#include <kprocess.h>
#include <krun.h>
#include <KRun>
#include <kshell.h>
#include <kzip.h>
#include <KIO/Global>
......@@ -3999,8 +3999,10 @@ void Document::processAction( const Action * action )
QString lilySource;
int lilyRow = 0, lilyCol = 0;
// if the url is a mailto one, invoke mailer
if ( browse->url().scheme().compare(QLatin1String("mailto")) )
if ( browse->url().scheme() == QLatin1String("mailto") )
{
QDesktopServices::openUrl( browse->url() );
}
else if ( extractLilyPondSourceReference( browse->url(), &lilySource, &lilyRow, &lilyCol ) )
{
const SourceReference ref( lilySource, lilyRow, lilyCol );
......@@ -4008,25 +4010,22 @@ void Document::processAction( const Action * action )
}
else
{
QUrl url = browse->url();
const QUrl url = browse->url();
#pragma message("KF5 fix this mess - relative urls should probably be resolved earlier")
// fix for #100366, documents with relative links that are the form of http:foo.pdf
// if (url.indexOf("http:") == 0 && url.indexOf("http://") == -1 && url.right(4) == ".pdf")
// {
// d->openRelativeFile(url.mid(5));
// return;
// }
// FIXME
// // handle documents with relative path
// if ( d->m_url.isValid() )
// {
// realUrl = KUrl( d->m_url.upUrl(), url );
// }
// // Albert: this is not a leak!
// new KRun( realUrl, d->m_widget );
if ((url.scheme() == "http") && url.host().isEmpty() && url.fileName().endsWith("pdf"))
{
d->openRelativeFile(url.fileName());
return;
}
// handle documents with relative path
if ( d->m_url.isValid() )
{
const QUrl realUrl = KIO::upUrl(d->m_url).resolved(url);
// KRun autodeletes
new KRun( realUrl, d->m_widget );
}
}
} break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment