KJS and KWallet are indeed optional, that's what the ${optionalComponents} variable does
remotes/origin/work/aacid/shorcutslost_2008
Albert Astals Cid 6 years ago
parent 4e0c1690d2
commit 2697105462
  1. 7
      CMakeLists.txt
  2. 4
      core/generator.cpp
  3. 6
      core/scripter.cpp
  4. 4
      generators/ooo/generator_ooo.cpp
  5. 8
      part.cpp

@ -112,6 +112,13 @@ find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Wallet
)
if(KF5Wallet_FOUND)
add_definitions(-DWITH_KWALLET=1)
endif()
if(KF5JS_FOUND)
add_definitions(-DWITH_KJS=1)
endif()
if(NOT WIN32 AND NOT ANDROID)
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Activities

@ -25,7 +25,9 @@
#include <QMimeDatabase>
#include <QTimer>
#ifdef WITH_KWALLET
#include <KWallet>
#endif
#include "document.h"
#include "document_p.h"
@ -396,9 +398,11 @@ bool Generator::exportTo(const QString &, const ExportFormat &)
void Generator::walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
{
#ifdef WITH_KWALLET
*walletKey = fileName.section(QLatin1Char('/'), -1, -1);
*walletName = KWallet::Wallet::NetworkWallet();
*walletFolder = QStringLiteral("KPdf");
#endif
}
bool Generator::hasFeature(GeneratorFeature feature) const

@ -22,13 +22,17 @@ class Okular::ScripterPrivate
public:
ScripterPrivate(DocumentPrivate *doc)
: m_doc(doc)
#ifdef WITH_KJS
, m_kjs(nullptr)
#endif
, m_event(nullptr)
{
}
DocumentPrivate *m_doc;
#ifdef WITH_KJS
QScopedPointer<ExecutorKJS> m_kjs;
#endif
Event *m_event;
};
@ -45,6 +49,7 @@ Scripter::~Scripter()
void Scripter::execute(ScriptType type, const QString &script)
{
qCDebug(OkularCoreDebug) << "executing the script:";
#ifdef WITH_KJS
#if 0
if ( script.length() < 1000 )
qDebug() << script;
@ -69,6 +74,7 @@ void Scripter::execute(ScriptType type, const QString &script)
}
d->m_kjs->execute(builtInScript + script, d->m_event);
}
#endif
}
void Scripter::setEvent(Event *event)

@ -14,7 +14,9 @@
#include <KAboutData>
#include <KConfigDialog>
#include <KLocalizedString>
#ifdef WITH_KWALLET
#include <kwallet.h>
#endif
OKULAR_EXPORT_PLUGIN(KOOOGenerator, "libokularGenerator_ooo.json")
@ -33,7 +35,9 @@ void KOOOGenerator::addPages(KConfigDialog *dlg)
void KOOOGenerator::walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
{
*walletKey = fileName + QStringLiteral("/opendocument");
#ifdef WITH_KWALLET
*walletName = KWallet::Wallet::LocalWallet();
*walletFolder = KWallet::Wallet::PasswordFolder();
#endif
}
#include "generator_ooo.moc"

@ -67,11 +67,13 @@
#include <KStandardShortcut>
#include <KToggleAction>
#include <KToggleFullScreenAction>
#include <Kdelibs4ConfigMigrator>
#include <Kdelibs4Migration>
#ifdef WITH_KWALLET
#include <KWallet>
#endif
#include <KXMLGUIClient>
#include <KXMLGUIFactory>
#include <Kdelibs4ConfigMigrator>
#include <Kdelibs4Migration>
#if PURPOSE_FOUND
#include <Purpose/AlternativesModel>
@ -1372,6 +1374,7 @@ Document::OpenResult Part::doOpenFile(const QMimeType &mimeA, const QString &fil
}
m_documentOpenWithPassword = false;
#ifdef WITH_KWALLET
// if the file didn't open correctly it might be encrypted, so ask for a pass
QString walletName, walletFolder, walletKey;
m_document->walletDataForFile(fileNameToOpen, &walletName, &walletFolder, &walletKey);
@ -1437,6 +1440,7 @@ Document::OpenResult Part::doOpenFile(const QMimeType &mimeA, const QString &fil
}
}
}
#endif
}
if (openResult == Document::OpenSuccess) {

Loading…
Cancel
Save