mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
Port the CHM generator
Would be nice if I had some CHM files to test this on.
This commit is contained in:
parent
e4a4d400c3
commit
2bfa3ccff0
|
@ -33,6 +33,7 @@ find_package(KF5 REQUIRED COMPONENTS
|
||||||
Parts
|
Parts
|
||||||
ThreadWeaver
|
ThreadWeaver
|
||||||
Wallet
|
Wallet
|
||||||
|
KHtml
|
||||||
)
|
)
|
||||||
find_package(Phonon4Qt5 CONFIG REQUIRED)
|
find_package(Phonon4Qt5 CONFIG REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -92,9 +92,9 @@ endif(POPPLER_FOUND)
|
||||||
# add_subdirectory( kimgio )
|
# add_subdirectory( kimgio )
|
||||||
#endif(KEXIV2_FOUND)
|
#endif(KEXIV2_FOUND)
|
||||||
|
|
||||||
#if(CHM_FOUND)
|
if(CHM_FOUND)
|
||||||
# add_subdirectory( chm )
|
add_subdirectory( chm )
|
||||||
#endif(CHM_FOUND)
|
endif(CHM_FOUND)
|
||||||
|
|
||||||
#if(DJVULIBRE_FOUND)
|
#if(DJVULIBRE_FOUND)
|
||||||
# add_subdirectory(djvu)
|
# add_subdirectory(djvu)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
add_subdirectory( kio-msits )
|
#add_subdirectory( kio-msits )
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||||
|
@ -19,9 +19,9 @@ set(okularGenerator_chmlib_SRCS
|
||||||
generator_chm.cpp
|
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})
|
install(TARGETS okularGenerator_chmlib DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtXml/QDomElement>
|
#include <QtXml/QDomElement>
|
||||||
|
|
||||||
#include <kaboutdata.h>
|
#include <k4aboutdata.h>
|
||||||
#include <khtml_part.h>
|
#include <khtml_part.h>
|
||||||
#include <khtmlview.h>
|
#include <khtmlview.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
@ -29,15 +29,15 @@
|
||||||
#include <core/textpage.h>
|
#include <core/textpage.h>
|
||||||
#include <core/utils.h>
|
#include <core/utils.h>
|
||||||
|
|
||||||
static KAboutData createAboutData()
|
static K4AboutData createAboutData()
|
||||||
{
|
{
|
||||||
KAboutData aboutData(
|
K4AboutData aboutData(
|
||||||
"okular_chm",
|
"okular_chm",
|
||||||
"okular_chm",
|
"okular_chm",
|
||||||
ki18n( "CHM Backend" ),
|
ki18n( "CHM Backend" ),
|
||||||
"0.1.4",
|
"0.1.4",
|
||||||
ki18n( "A Microsoft Windows help file renderer" ),
|
ki18n( "A Microsoft Windows help file renderer" ),
|
||||||
KAboutData::License_GPL,
|
K4AboutData::License_GPL,
|
||||||
ki18n( "© 2005-2007 Piotr Szymański\n© 2008 Albert Astals Cid" )
|
ki18n( "© 2005-2007 Piotr Szymański\n© 2008 Albert Astals Cid" )
|
||||||
);
|
);
|
||||||
aboutData.addAuthor( ki18n( "Piotr Szymański" ), KLocalizedString(), "niedakh@gmail.com" );
|
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),
|
new Okular::ObjectRect ( Okular::NormalizedRect(r,xScale,yScale),
|
||||||
false,
|
false,
|
||||||
Okular::ObjectRect::Action,
|
Okular::ObjectRect::Action,
|
||||||
new Okular::BrowseAction ( url )));
|
new Okular::BrowseAction ( QUrl(url) )));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,7 +198,7 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
|
||||||
|
|
||||||
QRegExp rxphrase( "\"(.*)\"" );
|
QRegExp rxphrase( "\"(.*)\"" );
|
||||||
QRegExp rxword( "([^\\s]+)" );
|
QRegExp rxword( "([^\\s]+)" );
|
||||||
rxphrase.setMinimal( TRUE );
|
rxphrase.setMinimal( true );
|
||||||
|
|
||||||
// First, get the phrase queries
|
// First, get the phrase queries
|
||||||
while ( (pos = rxphrase.indexIn (query, 0)) != -1 )
|
while ( (pos = rxphrase.indexIn (query, 0)) != -1 )
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
|
||||||
if( m_chmFile )
|
if( m_chmFile )
|
||||||
closeAll();
|
closeAll();
|
||||||
|
|
||||||
m_chmFile = chm_open( QFile::encodeName(filename) );
|
m_chmFile = chm_open( QFile::encodeName(filename).constData() );
|
||||||
|
|
||||||
if ( m_chmFile == NULL )
|
if ( m_chmFile == NULL )
|
||||||
return false;
|
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 ));
|
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no name=\n", qPrintable( tag ));
|
||||||
|
|
||||||
// offset+5 skips 'name='
|
// 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();
|
pname = pname.toLower();
|
||||||
|
|
||||||
if ( (offset = tag.indexOf(value_pattern, offset, Qt::CaseInsensitive )) == -1 )
|
if ( (offset = tag.indexOf(value_pattern, offset, Qt::CaseInsensitive )) == -1 )
|
||||||
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no value=\n", qPrintable( tag ));
|
qFatal ("LCHMFileImpl::ParseAndFillTopicsTree: bad <param> tag '%s': no value=\n", qPrintable( tag ));
|
||||||
|
|
||||||
// offset+6 skips 'value='
|
// 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 ));
|
//qDebug ("<param>: name '%s', value '%s'", qPrintable( pname ), qPrintable( pvalue ));
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ set(okularGenerator_ghostview_SRCS
|
||||||
rendererthread.cpp
|
rendererthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_ui_files(okularGenerator_ghostview_SRCS
|
ki18n_wrap_ui(okularGenerator_ghostview_SRCS
|
||||||
conf/gssettingswidget.ui
|
conf/gssettingswidget.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue