From 13d14942e6b919f7f65f02b064af6e4663e5b5ef Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 21 Apr 2007 23:07:44 +0000 Subject: [PATCH] first step of a KPDF -> okular conversion: copy the data file for the document to be opened to the new place svn path=/trunk/KDE/kdegraphics/okular/; revision=656648 --- TODO | 1 + core/document.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 598a0d05a..d5cd866a1 100644 --- a/TODO +++ b/TODO @@ -28,6 +28,7 @@ Bugs and wishes to close when moving okular to kdegraphics: In progress [working on]: -> core: forms support (mainly for pdf) (BR91809) -> bookmarks: improved interface, with easy handling of the bookmarks of all the documents (BR99787,BR136113) +-> KPDF -> okular conversion of datafiles {document data(in progress), kwallet passwords(missing)} -> inverse search (BR113191) find with an usability expert the "best" way to activate such a link provide a configuration widget to choose the editor and configure a custom one diff --git a/core/document.cpp b/core/document.cpp index 3a788167f..8dbebcd8b 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -745,9 +745,19 @@ bool Document::openDocument( const QString & docFile, const KUrl& url, const KMi d->m_url = url; d->m_docFileName = docFile; QString fn = docFile.contains('/') ? docFile.section('/', -1, -1) : docFile; - fn = "kpdf/" + QString::number(fileReadTest.size()) + '.' + fn + ".xml"; + fn = QString::number(fileReadTest.size()) + '.' + fn + ".xml"; fileReadTest.close(); - d->m_xmlFileName = KStandardDirs::locateLocal( "data", fn ); + QString newokular = "okular/docdata/" + fn; + QString newokularfile = KStandardDirs::locateLocal( "data", newokular ); + QString oldkpdf = "kpdf/" + fn; + QString oldkpdffile = KStandardDirs::locateLocal( "data", oldkpdf ); + if ( QFile::exists( oldkpdffile ) && !QFile::exists( newokularfile ) ) + { + // ### copy or move? + if ( !QFile::copy( oldkpdffile, newokularfile ) ) + return false; + } + d->m_xmlFileName = newokularfile; } else {