summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishesh Handa <me@vhanda.in>2014-08-13 09:42:09 (GMT)
committerVishesh Handa <me@vhanda.in>2014-08-13 09:42:09 (GMT)
commitfb330dd45c0af77510e38a0f8e385c1ab68a1978 (patch)
tree198b11ea1c90ea4270db74f848be46c8294f647d
parenteee26dd72f40953d45f41e421e4b7bfba30925f6 (diff)
Port the EPubGenerator
-rw-r--r--core/textdocumentgenerator.cpp2
-rw-r--r--generators/CMakeLists.txt6
-rw-r--r--generators/epub/CMakeLists.txt4
-rw-r--r--generators/epub/converter.cpp2
-rw-r--r--generators/epub/epubdocument.cpp2
-rw-r--r--generators/epub/generator_epub.cpp16
-rw-r--r--generators/epub/generator_epub.h3
7 files changed, 21 insertions, 14 deletions
diff --git a/core/textdocumentgenerator.cpp b/core/textdocumentgenerator.cpp
index bcfa609..c2d7d72 100644
--- a/core/textdocumentgenerator.cpp
+++ b/core/textdocumentgenerator.cpp
@@ -273,7 +273,7 @@ void TextDocumentGeneratorPrivate::initializeGenerator()
}
TextDocumentGenerator::TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName )
- : Okular::Generator( *new TextDocumentGeneratorPrivate( converter ) )
+ : Okular::Generator( *new TextDocumentGeneratorPrivate( converter ) )
{
Q_D( TextDocumentGenerator );
d->mGeneralSettings = new TextDocumentSettings( configName, this );
diff --git a/generators/CMakeLists.txt b/generators/CMakeLists.txt
index 055a49e..5f8f29f 100644
--- a/generators/CMakeLists.txt
+++ b/generators/CMakeLists.txt
@@ -120,9 +120,9 @@ add_subdirectory(comicbook)
# add_subdirectory(plucker)
#endif(JPEG_FOUND AND ZLIB_FOUND)
-#if(EPUB_FOUND)
-# add_subdirectory(epub)
-#endif(EPUB_FOUND)
+if(EPUB_FOUND)
+ add_subdirectory(epub)
+endif(EPUB_FOUND)
#add_subdirectory(txt)
diff --git a/generators/epub/CMakeLists.txt b/generators/epub/CMakeLists.txt
index fa989ad..a7ef774 100644
--- a/generators/epub/CMakeLists.txt
+++ b/generators/epub/CMakeLists.txt
@@ -14,9 +14,9 @@ set(okularGenerator_epub_PART_SRCS
generator_epub.cpp
)
-kde4_add_plugin(okularGenerator_epub ${okularGenerator_epub_PART_SRCS})
+add_library(okularGenerator_epub MODULE ${okularGenerator_epub_PART_SRCS})
-target_link_libraries(okularGenerator_epub okularcore ${EPUB_LIBRARIES} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
+target_link_libraries(okularGenerator_epub okularcore ${EPUB_LIBRARIES} KF5::KDELibs4Support Qt5::Widgets Qt5::Xml)
install(TARGETS okularGenerator_epub DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/generators/epub/converter.cpp b/generators/epub/converter.cpp
index 392947e..b30cb41 100644
--- a/generators/epub/converter.cpp
+++ b/generators/epub/converter.cpp
@@ -110,7 +110,7 @@ void Converter::_handle_anchors(const QTextBlock &start, const QString &name) {
frag.position()+fragLen));
} else { // Outside document link
Okular::BrowseAction *action =
- new Okular::BrowseAction(href.toString());
+ new Okular::BrowseAction(QUrl(href.toString()));
emit addAction(action, frag.position(),
frag.position() + frag.length());
diff --git a/generators/epub/epubdocument.cpp b/generators/epub/epubdocument.cpp
index 92fafbb..02c59f0 100644
--- a/generators/epub/epubdocument.cpp
+++ b/generators/epub/epubdocument.cpp
@@ -82,7 +82,7 @@ QVariant EpubDocument::loadResource(int type, const QUrl &name)
char *data;
// Get the data from the epub file
- size = epub_get_data(mEpub, resourceUrl(mCurrentSubDocument, name.toString()).toUtf8(), &data);
+ size = epub_get_data(mEpub, resourceUrl(mCurrentSubDocument, name.toString()).toUtf8().constData(), &data);
QVariant resource;
diff --git a/generators/epub/generator_epub.cpp b/generators/epub/generator_epub.cpp
index 48e7314..b2ad5b4 100644
--- a/generators/epub/generator_epub.cpp
+++ b/generators/epub/generator_epub.cpp
@@ -11,18 +11,18 @@
#include "converter.h"
-#include <kaboutdata.h>
+#include <k4aboutdata.h>
#include <kconfigdialog.h>
-static KAboutData createAboutData()
+static K4AboutData createAboutData()
{
- KAboutData aboutData(
+ K4AboutData aboutData(
"okular_epub",
"okular_epub",
ki18n("EPub Backend"),
"0.2.3",
ki18n("An EPub backend"),
- KAboutData::License_GPL,
+ K4AboutData::License_GPL,
ki18n("© 2008 Ely Levy")
);
aboutData.addAuthor(ki18n("Ely Levy"), KLocalizedString(),
@@ -34,7 +34,11 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN( EPubGenerator, createAboutData() )
EPubGenerator::EPubGenerator( QObject *parent, const QVariantList &args )
-: Okular::TextDocumentGenerator( new Epub::Converter, "okular_epub_generator_settings", parent, args )
+: Okular::TextDocumentGenerator( new Epub::Converter, "okular_epub_generator_settings" )
+{
+}
+
+EPubGenerator::~EPubGenerator()
{
}
@@ -44,3 +48,5 @@ void EPubGenerator::addPages( KConfigDialog* dlg )
dlg->addPage( widget, generalSettings(), i18n("EPub"), "application-epub+zip", i18n("EPub Backend Configuration") );
}
+
+#include "generator_epub.moc"
diff --git a/generators/epub/generator_epub.h b/generators/epub/generator_epub.h
index 02cecb2..3da0191 100644
--- a/generators/epub/generator_epub.h
+++ b/generators/epub/generator_epub.h
@@ -13,9 +13,10 @@
class EPubGenerator : public Okular::TextDocumentGenerator
{
+ Q_OBJECT
public:
EPubGenerator( QObject *parent, const QVariantList &args );
- ~EPubGenerator() {}
+ ~EPubGenerator();
// [INHERITED] reparse configuration
void addPages( KConfigDialog* dlg );