Commit 2bfa3ccf authored by Vishesh Handa's avatar Vishesh Handa
Browse files

Port the CHM generator

Would be nice if I had some CHM files to test this on.
parent e4a4d400
......@@ -33,6 +33,7 @@ find_package(KF5 REQUIRED COMPONENTS
Parts
ThreadWeaver
Wallet
KHtml
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
......
......@@ -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)
......
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})
......
......@@ -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
{
......
......@@ -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 )
......
......@@ -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 ));
......
......@@ -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
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment