diff --git a/core/document.cpp b/core/document.cpp index 2233cd008..3274392d6 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1171,13 +1171,16 @@ bool Document::openDocument( const QString & docFile, const KUrl& url, const KMi fileReadTest.close(); 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 ) ) + if ( !QFile::exists( newokularfile ) ) { - // ### copy or move? - if ( !QFile::copy( oldkpdffile, newokularfile ) ) - return false; + QString oldkpdf = "kpdf/" + fn; + QString oldkpdffile = KStandardDirs::locateLocal( "data", oldkpdf ); + if ( QFile::exists( oldkpdffile ) ) + { + // ### copy or move? + if ( !QFile::copy( oldkpdffile, newokularfile ) ) + return false; + } } d->m_xmlFileName = newokularfile; } diff --git a/part.cpp b/part.cpp index 266a96d3a..a5e38a3d1 100644 --- a/part.cpp +++ b/part.cpp @@ -121,10 +121,11 @@ m_cliPresentation(false), m_generatorGuiClient(0) { // first necessary step: copy the configuration from kpdf, if available QString newokularconffile = KStandardDirs::locateLocal( "config", "okularpartrc" ); - QString oldkpdfconffile = KStandardDirs::locateLocal( "config", "kpdfpartrc" ); - if ( !QFile::exists( newokularconffile ) && QFile::exists( oldkpdfconffile ) ) + if ( !QFile::exists( newokularconffile ) ) { - QFile::copy( oldkpdfconffile, newokularconffile ); + QString oldkpdfconffile = KStandardDirs::locateLocal( "config", "kpdfpartrc" ); + if ( QFile::exists( oldkpdfconffile ) ) + QFile::copy( oldkpdfconffile, newokularconffile ); } QDBusConnection::sessionBus().registerObject("/okular", this, QDBusConnection::ExportScriptableSlots);