summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishesh Handa <me@vhanda.in>2014-08-13 09:24:15 (GMT)
committerVishesh Handa <me@vhanda.in>2014-08-13 09:24:15 (GMT)
commit2bfa3ccff000b945818182a4e962ba77323441bb (patch)
treeb6bfd4978e9c8c406d3bfa1a0600ffbafbd2201a
parente4a4d400c35b3e41a60d490a7f56cd43c8707372 (diff)
Port the CHM generator
Would be nice if I had some CHM files to test this on.
-rw-r--r--CMakeLists.txt1
-rw-r--r--generators/CMakeLists.txt6
-rw-r--r--generators/chm/CMakeLists.txt6
-rw-r--r--generators/chm/generator_chm.cpp10
-rw-r--r--generators/chm/lib/libchmfile_search.cpp2
-rw-r--r--generators/chm/lib/libchmfileimpl.cpp6
-rw-r--r--generators/spectre/CMakeLists.txt2
7 files changed, 17 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f05170..05386d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ find_package(KF5 REQUIRED COMPONENTS
Parts
ThreadWeaver
Wallet
+ KHtml
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
diff --git a/generators/CMakeLists.txt b/generators/CMakeLists.txt
index 7c6c8e3..c53de50 100644
--- a/generators/CMakeLists.txt
+++ b/generators/CMakeLists.txt
@@ -92,9 +92,9 @@ endif(POPPLER_FOUND)
# add_subdirectory( kimgio )
#endif(KEXIV2_FOUND)
-#if(CHM_FOUND)
-# add_subdirectory( chm )
-#endif(CHM_FOUND)
+if(CHM_FOUND)
+ add_subdirectory( chm )
+endif(CHM_FOUND)
#if(DJVULIBRE_FOUND)
# add_subdirectory(djvu)
diff --git a/generators/chm/CMakeLists.txt b/generators/chm/CMakeLists.txt
index e54affc..6cfcd99 100644
--- a/generators/chm/CMakeLists.txt
+++ b/generators/chm/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_subdirectory( kio-msits )
+#add_subdirectory( kio-msits )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../..
@@ -19,9 +19,9 @@ set(okularGenerator_chmlib_SRCS
generator_chm.cpp
)
-kde4_add_plugin(okularGenerator_chmlib ${okularGenerator_chmlib_SRCS})
+add_library(okularGenerator_chmlib MODULE ${okularGenerator_chmlib_SRCS})
-target_link_libraries(okularGenerator_chmlib okularcore ${CHM_LIBRARY} ${KDE4_KHTML_LIBS} )
+target_link_libraries(okularGenerator_chmlib okularcore ${CHM_LIBRARY} KF5::KHtml)
install(TARGETS okularGenerator_chmlib DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/generators/chm/generator_chm.cpp b/generators/chm/generator_chm.cpp
index 84b9dde..1cdc877 100644
--- a/generators/chm/generator_chm.cpp
+++ b/generators/chm/generator_chm.cpp
@@ -15,7 +15,7 @@
#include <QtGui/QPainter>
#include <QtXml/QDomElement>
-#include <kaboutdata.h>
+#include <k4aboutdata.h>
#include <khtml_part.h>
#include <khtmlview.h>
#include <klocale.h>
@@ -29,15 +29,15 @@
#include <core/textpage.h>
#include <core/utils.h>
-static KAboutData createAboutData()
+static K4AboutData createAboutData()
{
- KAboutData aboutData(
+ K4AboutData aboutData(
"okular_chm",
"okular_chm",
ki18n( "CHM Backend" ),
"0.1.4",
ki18n( "A Microsoft Windows help file renderer" ),
- KAboutData::License_GPL,
+ K4AboutData::License_GPL,
ki18n( "© 2005-2007 Piotr Szymański\n© 2008 Albert Astals Cid" )
);
aboutData.addAuthor( ki18n( "Piotr Szymański" ), KLocalizedString(), "niedakh@gmail.com" );
@@ -383,7 +383,7 @@ void CHMGenerator::additionalRequestData()
new Okular::ObjectRect ( Okular::NormalizedRect(r,xScale,yScale),
false,
Okular::ObjectRect::Action,
- new Okular::BrowseAction ( url )));
+ new Okular::BrowseAction ( QUrl(url) )));
}
else
{
diff --git a/generators/chm/lib/libchmfile_search.cpp b/generators/chm/lib/libchmfile_search.cpp
index 1172346..5e6d67f 100644
--- a/generators/chm/lib/libchmfile_search.cpp
+++ b/generators/chm/lib/libchmfile_search.cpp
@@ -198,7 +198,7 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
QRegExp rxphrase( "\"(.*)\"" );
QRegExp rxword( "([^\\s]+)" );
- rxphrase.setMinimal( TRUE );
+ rxphrase.setMinimal( true );
// First, get the phrase queries
while ( (pos = rxphrase.indexIn (query, 0)) != -1 )
diff --git a/generators/chm/lib/libchmfileimpl.cpp b/generators/chm/lib/libchmfileimpl.cpp
index 929fb19..76e81b5 100644
--- a/generators/chm/lib/libchmfileimpl.cpp
+++ b/generators/chm/lib/libchmfileimpl.cpp
@@ -85,7 +85,7 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
if( m_chmFile )
closeAll();
- m_chmFile = chm_open( QFile::encodeName(filename) );
+ m_chmFile = chm_open( QFile::encodeName(filename).constData() );
if ( m_chmFile == NULL )
return false;
@@ -1054,14 +1054,14 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no name=\n", qPrintable( tag ));
// offset+5 skips 'name='
- offset = findStringInQuotes (tag, offset + name_pattern.length(), pname, TRUE, FALSE);
+ offset = findStringInQuotes (tag, offset + name_pattern.length(), pname, true, false);
pname = pname.toLower();
if ( (offset = tag.indexOf(value_pattern, offset, Qt::CaseInsensitive )) == -1 )
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no value=\n", qPrintable( tag ));
// offset+6 skips 'value='
- findStringInQuotes (tag, offset + value_pattern.length(), pvalue, FALSE, TRUE);
+ findStringInQuotes (tag, offset + value_pattern.length(), pvalue, false, true);
//qDebug ("<param>: name '%s', value '%s'", qPrintable( pname ), qPrintable( pvalue ));
diff --git a/generators/spectre/CMakeLists.txt b/generators/spectre/CMakeLists.txt
index be77d65..6711971 100644
--- a/generators/spectre/CMakeLists.txt
+++ b/generators/spectre/CMakeLists.txt
@@ -13,7 +13,7 @@ set(okularGenerator_ghostview_SRCS
rendererthread.cpp
)
-kde4_add_ui_files(okularGenerator_ghostview_SRCS
+ki18n_wrap_ui(okularGenerator_ghostview_SRCS
conf/gssettingswidget.ui
)