Commit fd6a3548 authored by Lukáš Tinkl's avatar Lukáš Tinkl
Browse files

port KUrl -> QUrl

parent ec8c2900
project(okular)
cmake_minimum_required(VERSION 2.8.12)
set(QT_MIN_VERSION "5.2.0")
......@@ -194,7 +192,7 @@ target_link_libraries(okularcore
)
if(LibKScreen_FOUND)
# target_link_libraries(okularcore KF5::LibKScreen)
target_link_libraries(okularcore KF5::LibKScreen)
endif(LibKScreen_FOUND)
set_target_properties(okularcore PROPERTIES VERSION 6.0.0 SOVERSION 6 )
......
......@@ -41,9 +41,9 @@ DocumentItem::DocumentItem(QObject *parent)
connect(m_document, SIGNAL(searchFinished(int,Okular::Document::SearchStatus)),
this, SLOT(searchFinished(int,Okular::Document::SearchStatus)));
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
this, SIGNAL(bookmarkedPagesChanged()));
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
this, SIGNAL(bookmarksChanged()));
}
......@@ -58,7 +58,7 @@ void DocumentItem::setPath(const QString &path)
//TODO: remote urls
//TODO: password
QMimeDatabase db;
m_document->openDocument(path, KUrl(path), db.mimeTypeForUrl(QUrl(path)));
m_document->openDocument(path, QUrl::fromLocalFile(path), db.mimeTypeForUrl(QUrl::fromLocalFile(path)));
m_tocModel->fill(m_document->documentSynopsis());
m_tocModel->setCurrentViewport(m_document->viewport());
......@@ -79,7 +79,8 @@ QString DocumentItem::windowTitleForDocument() const
{
// If 'DocumentTitle' should be used, check if the document has one. If
// either case is false, use the file name.
QString title = Okular::Settings::displayDocumentNameOrPath() == Okular::Settings::EnumDisplayDocumentNameOrPath::Path ? m_document->currentDocument().pathOrUrl() : m_document->currentDocument().fileName();
QString title = Okular::Settings::displayDocumentNameOrPath() == Okular::Settings::EnumDisplayDocumentNameOrPath::Path ?
m_document->currentDocument().toDisplayString(QUrl::PreferLocalFile) : m_document->currentDocument().fileName();
if (Okular::Settings::displayDocumentTitle()) {
const QString docTitle = m_document->metaData( "DocumentTitle" ).toString();
......@@ -94,7 +95,7 @@ QString DocumentItem::windowTitleForDocument() const
QString DocumentItem::path() const
{
return m_document->currentDocument().prettyUrl();
return m_document->currentDocument().toDisplayString();
}
void DocumentItem::setCurrentPage(int page)
......
......@@ -113,7 +113,7 @@ void PageItem::setDocument(DocumentItem *doc)
m_documentItem = doc;
Observer *observer = m_isThumbnail ? m_documentItem.data()->thumbnailObserver() : m_documentItem.data()->pageviewObserver();
connect(observer, SIGNAL(pageChanged(int, int)), this, SLOT(pageHasChanged(int, int)));
connect(doc->document()->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
connect(doc->document()->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
this, SLOT(checkBookmarksChanged()));
setPageNumber(0);
emit documentChanged();
......@@ -212,7 +212,7 @@ QStringList PageItem::bookmarks() const
void PageItem::goToBookmark(const QString &bookmark)
{
Okular::DocumentViewport viewPort(KUrl(bookmark).htmlRef());
Okular::DocumentViewport viewPort(QUrl::fromUserInput(bookmark).fragment(QUrl::FullyDecoded));
setPageNumber(viewPort.pageNumber);
//Are we in a flickable?
......@@ -226,7 +226,7 @@ void PageItem::goToBookmark(const QString &bookmark)
QPointF PageItem::bookmarkPosition(const QString &bookmark) const
{
Okular::DocumentViewport viewPort(KUrl(bookmark).htmlRef());
Okular::DocumentViewport viewPort(QUrl::fromUserInput(bookmark).fragment(QUrl::FullyDecoded));
if (viewPort.pageNumber != m_viewPort.pageNumber) {
return QPointF(-1, -1);
......
......@@ -42,7 +42,7 @@ void AddRemoveAnnotationTest::init()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
}
void AddRemoveAnnotationTest::cleanup()
......
......@@ -43,7 +43,7 @@ void AnnotationTest::initTestCase()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
}
void AnnotationTest::cleanupTestCase()
......
......@@ -39,7 +39,7 @@ void DocumentTest::testCloseDuringRotationJob()
Okular::DocumentObserver *dummyDocumentObserver = new Okular::DocumentObserver();
m_document->addObserver( dummyDocumentObserver );
m_document->openDocument( testFile, KUrl(), mime );
m_document->openDocument( testFile, QUrl(), mime );
m_document->setRotation( 1 );
// Tell ThreadWeaver not to start any new job
......
......@@ -108,7 +108,7 @@ void EditAnnotationContentsTest::init()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
// Undo and Redo should be unavailable when docuemnt is first opened.
QVERIFY( !m_document->canUndo() );
......
......@@ -68,7 +68,7 @@ void EditFormsTest::init()
const QString testFile = KDESRCDIR "data/formSamples.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
// Undo and Redo should be unavailable when docuemnt is first opened.
QVERIFY( !m_document->canUndo() );
......
......@@ -117,12 +117,12 @@ void MainShellTest::init()
Okular::Settings::self()->setDefaults();
// Clean docdatas
QList<KUrl> urls;
urls << KUrl("file://" KDESRCDIR "data/file1.pdf");
urls << KUrl("file://" KDESRCDIR "data/tocreload.pdf");
urls << KUrl("file://" KDESRCDIR "data/contents.epub");
QList<QUrl> urls;
urls << QUrl::fromUserInput("file://" KDESRCDIR "data/file1.pdf");
urls << QUrl::fromUserInput("file://" KDESRCDIR "data/tocreload.pdf");
urls << QUrl::fromUserInput("file://" KDESRCDIR "data/contents.epub");
foreach (const KUrl &url, urls)
foreach (const QUrl &url, urls)
{
QFileInfo fileReadTest( url.toLocalFile() );
const QString docDataPath = Okular::DocumentPrivate::docDataFileName(url, fileReadTest.size());
......
......@@ -54,7 +54,7 @@ void ModifyAnnotationPropertiesTest::init()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
// Undo and Redo should be unavailable when docuemnt is first opened.
QVERIFY( !m_document->canUndo() );
......
......@@ -139,8 +139,8 @@ void PartTest::testFowardPDF()
QCOMPARE(part.m_document->currentPage(), 0u);
part.closeUrl();
KUrl u(pdfResult);
u.setHTMLRef("src:100" + texDestination);
QUrl u(QUrl::fromLocalFile(pdfResult));
u.setFragment("src:100" + texDestination);
part.openUrl(u);
QCOMPARE(part.m_document->currentPage(), 1u);
}
......@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
KAboutData aboutData( QByteArray("qttest"), i18n("KDE Test Program"), QByteArray("version") );
QApplication app( argc, argv );
app.setApplicationName( QLatin1String("qttest") );
qRegisterMetaType<KUrl>(); /*as done by kapplication*/
qRegisterMetaType<QUrl>(); /*as done by kapplication*/
qRegisterMetaType<QList<QUrl>>();
Okular::PartTest test;
KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */
......
......@@ -175,7 +175,7 @@ void SearchTest::test311232()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
d.openDocument(testFile, KUrl(), mime);
d.openDocument(testFile, QUrl(), mime);
const int searchId = 0;
d.searchText(searchId, " i ", true, Qt::CaseSensitive, Okular::Document::NextMatch, false, QColor());
......
......@@ -15,21 +15,12 @@
#include "../shell/shellutils.h"
namespace QTest
static const QUrl makeUrlFromCwd( const QString& u, const QString& ref = QString() )
{
template<>
char* toString( const KUrl& url )
{
return qstrdup( url.url().toLocal8Bit().constData() );
}
}
static const KUrl makeUrlFromCwd( const QString& u, const QString& ref = QString() )
{
KUrl url( KUrl( QDir::currentPath() + '/' ), u );
QUrl url( QUrl::fromLocalFile( QDir::currentPath() + '/' + u ));
if ( !ref.isEmpty() )
url.setRef( ref );
url.cleanPath();
url.setFragment( ref );
url.setPath(QDir::cleanPath(url.path()));
return url;
}
......@@ -56,7 +47,7 @@ class ShellTest
void ShellTest::initTestCase()
{
qRegisterMetaType<KUrl>();
qRegisterMetaType<QUrl>();
KCmdLineArgs::setCwd( QDir::currentPath().toLocal8Bit() );
}
......@@ -65,7 +56,7 @@ void ShellTest::testUrlArgs_data()
{
QTest::addColumn<QString>( "arg" );
QTest::addColumn<bool>( "exists" );
QTest::addColumn<KUrl>( "resUrl" );
QTest::addColumn<QUrl>( "resUrl" );
// local files
QTest::newRow( "foo.pdf, exist" )
......@@ -87,7 +78,7 @@ void ShellTest::testUrlArgs_data()
QTest::newRow( "#207461" )
<< "file:///tmp/file%20with%20spaces.pdf"
<< true
<< KUrl( "file:///tmp/file%20with%20spaces.pdf" );
<< QUrl( "file:///tmp/file%20with%20spaces.pdf" );
// non-local files
QTest::newRow( "http://kde.org/foo.pdf" )
......@@ -105,16 +96,16 @@ void ShellTest::testUrlArgs_data()
QTest::newRow( "#207461" )
<< "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf"
<< true
<< KUrl( "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf" );
<< QUrl( "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf" );
}
void ShellTest::testUrlArgs()
{
QFETCH( QString, arg );
QFETCH( bool, exists );
QFETCH( KUrl, resUrl );
QFETCH( QUrl, resUrl );
KUrl url = ShellUtils::urlFromArg( arg, exists ? fileExist_always_Func : fileExist_never_Func );
QUrl url = ShellUtils::urlFromArg( arg, exists ? fileExist_always_Func : fileExist_never_Func );
QCOMPARE( url, resUrl );
}
......
......@@ -110,7 +110,7 @@ void TranslateAnnotationTest::init()
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, KUrl(), mime), Okular::Document::OpenSuccess );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
// Undo and Redo should be unavailable when docuemnt is first opened.
QVERIFY( !m_document->canUndo() );
......
......@@ -129,15 +129,15 @@ bool AudioPlayerPrivate::play( const SoundInfo& si )
{
int newid = newId();
m_mapper.setMapping( data->m_mediaobject, newid );
KUrl newurl;
if ( KUrl::isRelativeUrl( url ) )
QUrl newurl;
if ( QUrl::fromUserInput(url).isRelative() )
{
newurl = m_currentDocument;
newurl.setFileName( url );
newurl = m_currentDocument.adjusted(QUrl::RemoveFilename);
newurl.setPath(newurl.path() + url );
}
else
{
newurl = url;
newurl = QUrl::fromLocalFile(url);
}
data->m_mediaobject->setCurrentSource( newurl );
m_playing.insert( newid, data );
......
......@@ -13,7 +13,7 @@
// qt/kde includes
#include <qhash.h>
#include <qsignalmapper.h>
#include <kurl.h>
#include <QUrl>
class QBuffer;
class PlayData;
......@@ -41,7 +41,7 @@ public:
QHash< int, PlayData * > m_playing;
QSignalMapper m_mapper;
KUrl m_currentDocument;
QUrl m_currentDocument;
AudioPlayer::State m_state;
};
......
......@@ -15,10 +15,9 @@
#include <kbookmarkaction.h>
#include <kbookmarkmanager.h>
#include <kbookmarkmenu.h>
#include <QtCore/QDebug>
#include <QDebug>
#include <QGuiApplication>
#include <kurl.h>
#include <QUrl>
#include <QStandardPaths>
// local includes
......@@ -112,24 +111,26 @@ class BookmarkManager::Private : public KBookmarkOwner
virtual bool enableOption(BookmarkOption option) const;
virtual void openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::KeyboardModifiers );
QHash<KUrl, QString>::iterator bookmarkFind( const KUrl& url, bool doCreate, KBookmarkGroup *result = 0);
QHash<QUrl, QString>::iterator bookmarkFind( const QUrl& url, bool doCreate, KBookmarkGroup *result = 0);
// slots
void _o_changed( const QString & groupAddress, const QString & caller );
BookmarkManager * q;
KUrl url;
QUrl url;
QHash<int,int> urlBookmarks;
DocumentPrivate * document;
QString file;
KBookmarkManager * manager;
QHash<KUrl, QString> knownFiles;
QHash<QUrl, QString> knownFiles;
};
static inline KUrl urlForGroup(const KBookmark &group)
static inline QUrl urlForGroup(const KBookmark &group)
{
if ( group.url().isValid() ) return group.url();
else return KUrl( group.fullText() );
if ( group.url().isValid() )
return group.url();
else
return QUrl::fromUserInput( group.fullText() );
}
BookmarkManager::BookmarkManager( DocumentPrivate * document )
......@@ -161,8 +162,7 @@ QUrl BookmarkManager::Private::currentUrl() const
QString BookmarkManager::Private::currentTitle() const
{
#pragma message("KF5 porting: check if QUrl usage is right")
return url.isLocalFile() ? url.toLocalFile() : url.prettyUrl();
return url.toDisplayString();
}
bool BookmarkManager::Private::enableOption(BookmarkOption option) const
......@@ -183,9 +183,9 @@ void BookmarkManager::Private::_o_changed( const QString & groupAddress, const Q
if ( groupAddress.isEmpty() )
return;
KUrl referurl;
QUrl referurl;
// first, try to find the bookmark group whom change notification was just received
QHash<KUrl, QString>::iterator it = knownFiles.begin(), itEnd = knownFiles.end();
QHash<QUrl, QString>::iterator it = knownFiles.begin(), itEnd = knownFiles.end();
for ( ; it != itEnd; ++it )
{
if ( it.value() == groupAddress )
......@@ -249,7 +249,7 @@ QList<QUrl> BookmarkManager::files() const
return ret;
}
KBookmark::List BookmarkManager::bookmarks( const KUrl& url ) const
KBookmark::List BookmarkManager::bookmarks(const QUrl &url ) const
{
KBookmark::List ret;
KBookmarkGroup group = d->manager->root();
......@@ -313,7 +313,7 @@ KBookmark BookmarkManager::bookmark( const DocumentViewport &viewport ) const
return KBookmark();
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
if ( it == d->knownFiles.end() )
return KBookmark();
......@@ -338,9 +338,9 @@ void BookmarkManager::save() const
emit const_cast<BookmarkManager*>( this )->saved();
}
QHash<KUrl, QString>::iterator BookmarkManager::Private::bookmarkFind( const KUrl& url, bool doCreate, KBookmarkGroup *result )
QHash<QUrl, QString>::iterator BookmarkManager::Private::bookmarkFind( const QUrl& url, bool doCreate, KBookmarkGroup *result )
{
QHash<KUrl, QString>::iterator it = knownFiles.find( url );
QHash<QUrl, QString>::iterator it = knownFiles.find( url );
if ( it == knownFiles.end() )
{
// if the url we want to add a new entry for is not in the hash of the
......@@ -353,7 +353,7 @@ QHash<KUrl, QString>::iterator BookmarkManager::Private::bookmarkFind( const KUr
if ( bm.isSeparator() || !bm.isGroup() )
continue;
KUrl tmpurl( urlForGroup( bm ) );
QUrl tmpurl( urlForGroup( bm ) );
if ( tmpurl == url )
{
// got it! place it the hash of known files
......@@ -369,7 +369,7 @@ QHash<KUrl, QString>::iterator BookmarkManager::Private::bookmarkFind( const KUr
{
// folder not found :(
// then, in a single step create a new folder and add it in our cache :)
QString purl = url.isLocalFile() ? url.toLocalFile() : url.prettyUrl();
QString purl = url.isLocalFile() ? url.toLocalFile() : url.toDisplayString();
KBookmarkGroup newbg = root.createNewFolder( purl );
newbg.setUrl( url );
it = knownFiles.insert( url, newbg.address() );
......@@ -400,7 +400,7 @@ void BookmarkManager::addBookmark( const DocumentViewport &vp )
addBookmark( d->url, vp );
}
bool BookmarkManager::addBookmark( const KUrl& referurl, const Okular::DocumentViewport& vp, const QString& title )
bool BookmarkManager::addBookmark(const QUrl &referurl, const Okular::DocumentViewport& vp, const QString& title )
{
if ( !referurl.isValid() || !vp.isValid() )
return false;
......@@ -409,7 +409,7 @@ bool BookmarkManager::addBookmark( const KUrl& referurl, const Okular::DocumentV
return false;
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, true, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( referurl, true, &thebg );
Q_ASSERT( it != d->knownFiles.end() );
int count = 0; // Number of bookmarks in the current page
......@@ -448,8 +448,8 @@ bool BookmarkManager::addBookmark( const KUrl& referurl, const Okular::DocumentV
else
newtitle = title;
KUrl newurl = referurl;
newurl.setHTMLRef( vp.toString() );
QUrl newurl = referurl;
newurl.setFragment(vp.toString(), QUrl::DecodedMode);
thebg.addBookmark( newtitle, newurl, QString() );
if ( referurl == d->document->m_url )
{
......@@ -481,7 +481,7 @@ void BookmarkManager::removeBookmark( const DocumentViewport &vp )
void BookmarkManager::renameBookmark( KBookmark* bm, const QString& newName)
{
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
Q_ASSERT ( it != d->knownFiles.end() );
if ( it == d->knownFiles.end() )
return;
......@@ -490,13 +490,13 @@ void BookmarkManager::renameBookmark( KBookmark* bm, const QString& newName)
d->manager->emitChanged( thebg );
}
void BookmarkManager::renameBookmark( const KUrl& referurl, const QString& newName )
void BookmarkManager::renameBookmark(const QUrl &referurl, const QString& newName )
{
if ( !referurl.isValid() )
return;
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
Q_ASSERT ( it != d->knownFiles.end() );
if ( it == d->knownFiles.end() )
return;
......@@ -505,16 +505,16 @@ void BookmarkManager::renameBookmark( const KUrl& referurl, const QString& newNa
d->manager->emitChanged( thebg );
}
QString BookmarkManager::titleForUrl( const KUrl& referurl ) const
QString BookmarkManager::titleForUrl(const QUrl &referurl ) const
{
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
Q_ASSERT( it != d->knownFiles.end() );
return thebg.fullText();
}
int BookmarkManager::removeBookmark( const KUrl& referurl, const KBookmark& bm )
int BookmarkManager::removeBookmark(const QUrl &referurl, const KBookmark& bm )
{
if ( !referurl.isValid() || bm.isNull() || bm.isGroup() || bm.isSeparator() )
return -1;
......@@ -524,7 +524,7 @@ int BookmarkManager::removeBookmark( const KUrl& referurl, const KBookmark& bm )
return -1;
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
if ( it == d->knownFiles.end() )
return -1;
......@@ -540,13 +540,13 @@ int BookmarkManager::removeBookmark( const KUrl& referurl, const KBookmark& bm )
return vp.pageNumber;
}
void BookmarkManager::removeBookmarks( const KUrl& referurl, const KBookmark::List& list )
void BookmarkManager::removeBookmarks(const QUrl &referurl, const KBookmark::List& list )
{
if ( !referurl.isValid() || list.isEmpty() )
return;
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
if ( it == d->knownFiles.end() )
return;
......@@ -588,7 +588,7 @@ void BookmarkManager::removeBookmarks( const KUrl& referurl, const KBookmark::Li
d->manager->emitChanged( thebg );
}
QList< QAction * > BookmarkManager::actionsForUrl( const KUrl& url ) const
QList< QAction * > BookmarkManager::actionsForUrl(const QUrl &url ) const
{
QList< QAction * > ret;
KBookmarkGroup group = d->manager->root();
......@@ -611,12 +611,12 @@ QList< QAction * > BookmarkManager::actionsForUrl( const KUrl& url ) const
return ret;
}
void BookmarkManager::setUrl( const KUrl& url )
void BookmarkManager::setUrl(const QUrl &url )
{
d->url = url;
d->urlBookmarks.clear();
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( url, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( url, false, &thebg );
if ( it != d->knownFiles.end() )
{
for ( KBookmark bm = thebg.first(); !bm.isNull(); bm = thebg.next( bm ) )
......@@ -636,7 +636,7 @@ void BookmarkManager::setUrl( const KUrl& url )
bool BookmarkManager::setPageBookmark( int page )
{
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( d->url, true, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( d->url, true, &thebg );
Q_ASSERT( it != d->knownFiles.end() );
bool found = false;
......@@ -656,8 +656,8 @@ bool BookmarkManager::setPageBookmark( int page )
d->urlBookmarks[ page ]++;
DocumentViewport vp;
vp.pageNumber = page;
KUrl newurl = d->url;
newurl.setHTMLRef( vp.toString() );
QUrl newurl = d->url;
newurl.setFragment(vp.toString(), QUrl::DecodedMode);
thebg.addBookmark( QString::fromLatin1( "#" ) + QString::number( vp.pageNumber + 1 ), newurl, QString() );
added = true;
d->manager->emitChanged( thebg );
......@@ -668,7 +668,7 @@ bool BookmarkManager::setPageBookmark( int page )
bool BookmarkManager::removePageBookmark( int page )
{
KBookmarkGroup thebg;
QHash<KUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
QHash<QUrl, QString>::iterator it = d->bookmarkFind( d->url, false, &thebg );
if ( it == d->knownFiles.end() )
return false;
......
......@@ -13,7 +13,7 @@
#include <kbookmark.h>
#include "okularcore_export.h"
#include <kurl.h>
#include <QUrl>
class QAction;
......@@ -44,7 +44,7 @@ class OKULARCORE_EXPORT BookmarkManager : public QObject
/**
* Returns the list of bookmarks for the specified @p url.
*/
KBookmark::List bookmarks( const KUrl& url ) const;
KBookmark::List bookmarks( const QUrl& url ) const;
/**
* Returns the list of bookmarks for document
......@@ -92,7 +92,7 @@ class OKULARCORE_EXPORT BookmarkManager : public QObject
*
* If no @p title is specified, then \em #n will be used.
*/
bool addBookmark( const