From e3379a9953ab5532065dbe90bdb5a5fe14565641 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 14:20:53 -0600 Subject: Rename additional kioslave libraries --- kdoctools/CMakeLists.txt | 16 +- kdoctools/Makefile.am | 20 +- kdoctools/ghelp.protocol | 2 +- kdoctools/help.protocol | 2 +- kdoctools/kio_help.cpp | 404 ------------------------------------- kdoctools/kio_help.h | 47 ----- kdoctools/kio_help.upd | 3 - kdoctools/main.cpp | 6 +- kdoctools/main_ghelp.cpp | 6 +- kdoctools/meinproc.cpp | 2 +- kdoctools/move_kio_help_cache.sh | 6 - kdoctools/move_tdeio_help_cache.sh | 6 + kdoctools/tdeio_help.cpp | 404 +++++++++++++++++++++++++++++++++++++ kdoctools/tdeio_help.h | 47 +++++ kdoctools/tdeio_help.upd | 3 + kdoctools/xslt.cpp | 4 +- 16 files changed, 489 insertions(+), 489 deletions(-) delete mode 100644 kdoctools/kio_help.cpp delete mode 100644 kdoctools/kio_help.h delete mode 100644 kdoctools/kio_help.upd delete mode 100644 kdoctools/move_kio_help_cache.sh create mode 100644 kdoctools/move_tdeio_help_cache.sh create mode 100644 kdoctools/tdeio_help.cpp create mode 100644 kdoctools/tdeio_help.h create mode 100644 kdoctools/tdeio_help.upd (limited to 'kdoctools') diff --git a/kdoctools/CMakeLists.txt b/kdoctools/CMakeLists.txt index 09b04a8ea..8657e277e 100644 --- a/kdoctools/CMakeLists.txt +++ b/kdoctools/CMakeLists.txt @@ -33,8 +33,8 @@ link_directories( ##### other data ################################ install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/checkXML DESTINATION ${BIN_INSTALL_DIR} ) -install( PROGRAMS move_kio_help_cache.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( FILES kio_help.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( PROGRAMS move_tdeio_help_cache.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES tdeio_help.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES help.protocol ghelp.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) # FIXME why automake version is so complicated? @@ -58,12 +58,12 @@ tde_add_library( kbzipfilter_dummy STATIC_PIC ) -#### kio_help ################################### +#### tdeio_help ################################### -set( target kio_help ) +set( target tdeio_help ) set( ${target}_SRCS - kio_help.cpp main.cpp xslt.cpp + tdeio_help.cpp main.cpp xslt.cpp ) tde_add_kpart( ${target} SHARED @@ -73,12 +73,12 @@ tde_add_kpart( ${target} SHARED ) -#### kio_ghelp ################################### +#### tdeio_ghelp ################################### -set( target kio_ghelp ) +set( target tdeio_ghelp ) set( ${target}_SRCS - kio_help.cpp main_ghelp.cpp xslt.cpp + tdeio_help.cpp main_ghelp.cpp xslt.cpp ) tde_add_kpart( ${target} SHARED diff --git a/kdoctools/Makefile.am b/kdoctools/Makefile.am index 05c3487cd..c009fd19d 100644 --- a/kdoctools/Makefile.am +++ b/kdoctools/Makefile.am @@ -8,17 +8,17 @@ libkbzipfilter_dummy_la_SOURCES = kbzip2filter.cpp ####### Files -kde_module_LTLIBRARIES = kio_help.la kio_ghelp.la +kde_module_LTLIBRARIES = tdeio_help.la tdeio_ghelp.la -kio_help_la_SOURCES = kio_help.cpp main.cpp xslt.cpp -kio_help_la_LIBADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS) libkbzipfilter_dummy.la $(LIB_KIO) $(LIBBZ2) $(LIB_QT) $(LIB_TDECORE) -kio_help_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_help_la_SOURCES = tdeio_help.cpp main.cpp xslt.cpp +tdeio_help_la_LIBADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS) libkbzipfilter_dummy.la $(LIB_KIO) $(LIBBZ2) $(LIB_QT) $(LIB_TDECORE) +tdeio_help_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kio_ghelp_la_SOURCES = kio_help.cpp main_ghelp.cpp xslt.cpp -kio_ghelp_la_LIBADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS) libkbzipfilter_dummy.la $(LIB_KIO) $(LIBBZ2) $(LIB_QT) $(LIB_TDECORE) -kio_ghelp_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_ghelp_la_SOURCES = tdeio_help.cpp main_ghelp.cpp xslt.cpp +tdeio_ghelp_la_LIBADD = $(LIBXSLT_LIBS) $(LIBXML_LIBS) libkbzipfilter_dummy.la $(LIB_KIO) $(LIBBZ2) $(LIB_QT) $(LIB_TDECORE) +tdeio_ghelp_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -noinst_HEADERS = kio_help.h +noinst_HEADERS = tdeio_help.h kdelnk_DATA = help.protocol ghelp.protocol kdelnkdir = $(kde_servicesdir) @@ -36,8 +36,8 @@ bin_SCRIPTS = checkXML METASOURCES = AUTO -update_DATA = kio_help.upd -update_SCRIPTS = move_kio_help_cache.sh +update_DATA = tdeio_help.upd +update_SCRIPTS = move_tdeio_help_cache.sh updatedir = $(kde_datadir)/tdeconf_update messages: diff --git a/kdoctools/ghelp.protocol b/kdoctools/ghelp.protocol index ec5e50a34..f8dca77c2 100644 --- a/kdoctools/ghelp.protocol +++ b/kdoctools/ghelp.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_ghelp +exec=tdeio_ghelp protocol=ghelp input=none output=filesystem diff --git a/kdoctools/help.protocol b/kdoctools/help.protocol index b4ee178e6..dc7a25b16 100644 --- a/kdoctools/help.protocol +++ b/kdoctools/help.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_help +exec=tdeio_help protocol=help input=none output=filesystem diff --git a/kdoctools/kio_help.cpp b/kdoctools/kio_help.cpp deleted file mode 100644 index 19712f826..000000000 --- a/kdoctools/kio_help.cpp +++ /dev/null @@ -1,404 +0,0 @@ -#include - -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif - -#include -#include -#ifdef HAVE_STDIO_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "kio_help.h" -#include -#include -#include "xslt.h" - -using namespace TDEIO; - -TQString HelpProtocol::langLookup(const TQString& fname) -{ - TQStringList search; - - // assemble the local search paths - const TQStringList localDoc = TDEGlobal::dirs()->resourceDirs("html") + TDEGlobal::dirs()->resourceDirs("html-bundle"); - - TQStringList langs = TDEGlobal::locale()->languageList(); - langs.append( "en" ); - langs.remove( "C" ); - - // this is kind of compat hack as we install our docs in en/ but the - // default language is en_US - for (TQStringList::Iterator it = langs.begin(); it != langs.end(); ++it) - if ( *it == "en_US" ) - *it = "en"; - - // look up the different languages - int ldCount = localDoc.count(); - for (int id=0; id < ldCount; id++) - { - TQStringList::ConstIterator lang; - for (lang = langs.begin(); lang != langs.end(); ++lang) - search.append(TQString("%1%2/%3").arg(localDoc[id], *lang, fname)); - } - - // try to locate the file - TQStringList::Iterator it; - for (it = search.begin(); it != search.end(); ++it) - { - kdDebug( 7119 ) << "Looking for help in: " << *it << endl; - - TQFileInfo info(*it); - if (info.exists() && info.isFile() && info.isReadable()) - return *it; - - if ( ( *it ).right( 5 ) == ".html" ) - { - TQString file = (*it).left((*it).findRev('/')) + "/index.docbook"; - kdDebug( 7119 ) << "Looking for help in: " << file << endl; - info.setFile(file); - if (info.exists() && info.isFile() && info.isReadable()) - return *it; - } - } - - - return TQString::null; -} - - -TQString HelpProtocol::lookupFile(const TQString &fname, - const TQString &query, bool &redirect) -{ - redirect = false; - - TQString path, result; - - path = fname; - - result = langLookup(path); - if (result.isEmpty()) - { - result = langLookup(path+"/index.html"); - if (!result.isEmpty()) - { - KURL red( "help:/" ); - red.setPath( path + "/index.html" ); - red.setQuery( query ); - redirection(red); - kdDebug( 7119 ) << "redirect to " << red.url() << endl; - redirect = true; - } - else - { - unicodeError( i18n("There is no documentation available for %1." ).arg(path) ); - finished(); - return TQString::null; - } - } else - kdDebug( 7119 ) << "result " << result << endl; - - return result; -} - - -void HelpProtocol::unicodeError( const TQString &t ) -{ - data(fromUnicode( TQString( - "\n" - "%2" ).arg( TQTextCodec::codecForLocale()->name() ).arg( t ) ) ); -} - -HelpProtocol *slave = 0; - -HelpProtocol::HelpProtocol( bool ghelp, const TQCString &pool, const TQCString &app ) - : SlaveBase( ghelp ? "ghelp" : "help", pool, app ), mGhelp( ghelp ) -{ - slave = this; -} - -void HelpProtocol::get( const KURL& url ) -{ - kdDebug( 7119 ) << "get: path=" << url.path() - << " query=" << url.query() << endl; - - bool redirect; - TQString doc; - doc = url.path(); - - if ( !mGhelp ) { - if (doc.at(0) != '/') - doc = doc.prepend('/'); - - if (doc.at(doc.length() - 1) == '/') - doc += "index.html"; - } - - infoMessage(i18n("Looking up correct file")); - - if ( !mGhelp ) { - doc = lookupFile(doc, url.query(), redirect); - - if (redirect) - { - finished(); - return; - } - } - - if (doc.isEmpty()) - { - error( TDEIO::ERR_DOES_NOT_EXIST, url.url() ); - return; - } - - mimeType("text/html"); - KURL target; - target.setPath(doc); - if (url.hasHTMLRef()) - target.setHTMLRef(url.htmlRef()); - - kdDebug( 7119 ) << "target " << target.url() << endl; - - TQString file = target.path(); - - if ( mGhelp ) { - if ( file.right( 4 ) != ".xml" ) { - get_file( target ); - return; - } - } else { - TQString docbook_file = file.left(file.findRev('/')) + "/index.docbook"; - if (!KStandardDirs::exists(file)) { - file = docbook_file; - } else { - TQFileInfo fi(file); - if (fi.isDir()) { - file = file + "/index.docbook"; - } else { - if ( file.right( 5 ) != ".html" || !compareTimeStamps( file, docbook_file ) ) { - get_file( target ); - return; - } else - file = docbook_file; - } - } - } - - infoMessage(i18n("Preparing document")); - - if ( mGhelp ) { - TQString xsl = "customization/kde-nochunk.xsl"; - mParsed = transform(file, locate("dtd", xsl)); - - kdDebug( 7119 ) << "parsed " << mParsed.length() << endl; - - if (mParsed.isEmpty()) { - unicodeError( i18n( "The requested help file could not be parsed:
%1" ).arg( file ) ); - } else { - int pos1 = mParsed.find( "charset=" ); - if ( pos1 > 0 ) { - int pos2 = mParsed.find( '"', pos1 ); - if ( pos2 > 0 ) { - mParsed.replace( pos1, pos2 - pos1, "charset=UTF-8" ); - } - } - data( mParsed.utf8() ); - } - } else { - - kdDebug( 7119 ) << "look for cache for " << file << endl; - - mParsed = lookForCache( file ); - - kdDebug( 7119 ) << "cached parsed " << mParsed.length() << endl; - - if ( mParsed.isEmpty() ) { - mParsed = transform(file, locate("dtd", "customization/kde-chunk.xsl")); - if ( !mParsed.isEmpty() ) { - infoMessage( i18n( "Saving to cache" ) ); - TQString cache = file.left( file.length() - 7 ); - saveToCache( mParsed, locateLocal( "cache", - "kio_help" + cache + - "cache.bz2" ) ); - } - } else infoMessage( i18n( "Using cached version" ) ); - - kdDebug( 7119 ) << "parsed " << mParsed.length() << endl; - - if (mParsed.isEmpty()) { - unicodeError( i18n( "The requested help file could not be parsed:
%1" ).arg( file ) ); - } else { - TQString query = url.query(), anchor; - - // if we have a query, look if it contains an anchor - if (!query.isEmpty()) - if (query.left(8) == "?anchor=") { - anchor = query.mid(8).lower(); - - KURL redirURL(url); - - redirURL.setQuery(TQString::null); - redirURL.setHTMLRef(anchor); - redirection(redirURL); - finished(); - return; - } - if (anchor.isEmpty() && url.hasHTMLRef()) - anchor = url.htmlRef(); - - kdDebug( 7119 ) << "anchor: " << anchor << endl; - - if ( !anchor.isEmpty() ) - { - int index = 0; - while ( true ) { - index = mParsed.find( TQRegExp( "" ).arg( anchor ) ) - { - index = mParsed.findRev( " -#include - - -#include -#include - - -#include -#include -#include - - -#include -#include - -class HelpProtocol : public TDEIO::SlaveBase -{ -public: - - HelpProtocol( bool ghelp, const TQCString &pool, const TQCString &app); - virtual ~HelpProtocol() { } - - virtual void get( const KURL& url ); - - virtual void mimetype( const KURL& url ); - -private: - - TQString langLookup(const TQString& fname); - void emitFile( const KURL &url ); - void get_file( const KURL& url ); - TQString lookupFile(const TQString &fname, const TQString &query, - bool &redirect); - - void unicodeError( const TQString &t ); - - TQString mParsed; - bool mGhelp; -}; - - -#endif diff --git a/kdoctools/kio_help.upd b/kdoctools/kio_help.upd deleted file mode 100644 index cca96f64b..000000000 --- a/kdoctools/kio_help.upd +++ /dev/null @@ -1,3 +0,0 @@ -# Move kio_help cache from $TDEHOME/share/apps/tdeio_help/cache to $TDEHOME/cache-$HOST/tdeio_help -Id=trinity_2 -Script=move_kio_help_cache.sh,sh diff --git a/kdoctools/main.cpp b/kdoctools/main.cpp index 7ba294bfb..57a44156c 100644 --- a/kdoctools/main.cpp +++ b/kdoctools/main.cpp @@ -16,7 +16,7 @@ #include #include #include -#include "kio_help.h" +#include "tdeio_help.h" #include extern int xmlLoadExtDtdDefaultValue; @@ -25,7 +25,7 @@ extern "C" { KDE_EXPORT int kdemain( int argc, char **argv ) { - TDEInstance instance( "kio_help" ); + TDEInstance instance( "tdeio_help" ); fillInstance(instance); (void)instance.config(); // we need this one to make sure system globals are read @@ -33,7 +33,7 @@ extern "C" if (argc != 4) { - fprintf(stderr, "Usage: kio_help protocol domain-socket1 domain-socket2\n"); + fprintf(stderr, "Usage: tdeio_help protocol domain-socket1 domain-socket2\n"); exit(-1); } diff --git a/kdoctools/main_ghelp.cpp b/kdoctools/main_ghelp.cpp index bbdb5d7c0..94bcc60dd 100644 --- a/kdoctools/main_ghelp.cpp +++ b/kdoctools/main_ghelp.cpp @@ -16,7 +16,7 @@ #include #include #include -#include "kio_help.h" +#include "tdeio_help.h" #include extern int xmlLoadExtDtdDefaultValue; @@ -25,7 +25,7 @@ extern "C" { KDE_EXPORT int kdemain( int argc, char **argv ) { - TDEInstance instance( "kio_ghelp" ); + TDEInstance instance( "tdeio_ghelp" ); fillInstance(instance); (void)instance.config(); // we need this one to make sure system globals are read @@ -33,7 +33,7 @@ extern "C" if (argc != 4) { - fprintf(stderr, "Usage: kio_ghelp protocol domain-socket1 domain-socket2\n"); + fprintf(stderr, "Usage: tdeio_ghelp protocol domain-socket1 domain-socket2\n"); exit(-1); } diff --git a/kdoctools/meinproc.cpp b/kdoctools/meinproc.cpp index 1c47ec43f..034218546 100644 --- a/kdoctools/meinproc.cpp +++ b/kdoctools/meinproc.cpp @@ -98,7 +98,7 @@ int main(int argc, char **argv) { TDECmdLineArgs::init(argc, argv, &aboutData); TDECmdLineArgs::addCmdLineOptions( options ); - KLocale::setMainCatalogue("kio_help"); + KLocale::setMainCatalogue("tdeio_help"); TDEInstance ins("meinproc"); TDEGlobal::locale(); diff --git a/kdoctools/move_kio_help_cache.sh b/kdoctools/move_kio_help_cache.sh deleted file mode 100644 index f1342c5b4..000000000 --- a/kdoctools/move_kio_help_cache.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -bas=`tde-config --localprefix`share/apps/tdeio_help -mv "$bas/cache" "`tde-config --path cache`kio_help" -rmdir "$bas" -exit 0 diff --git a/kdoctools/move_tdeio_help_cache.sh b/kdoctools/move_tdeio_help_cache.sh new file mode 100644 index 000000000..33096e885 --- /dev/null +++ b/kdoctools/move_tdeio_help_cache.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +bas=`tde-config --localprefix`share/apps/tdeio_help +mv "$bas/cache" "`tde-config --path cache`tdeio_help" +rmdir "$bas" +exit 0 diff --git a/kdoctools/tdeio_help.cpp b/kdoctools/tdeio_help.cpp new file mode 100644 index 000000000..d6d5f285a --- /dev/null +++ b/kdoctools/tdeio_help.cpp @@ -0,0 +1,404 @@ +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif + +#include +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "tdeio_help.h" +#include +#include +#include "xslt.h" + +using namespace TDEIO; + +TQString HelpProtocol::langLookup(const TQString& fname) +{ + TQStringList search; + + // assemble the local search paths + const TQStringList localDoc = TDEGlobal::dirs()->resourceDirs("html") + TDEGlobal::dirs()->resourceDirs("html-bundle"); + + TQStringList langs = TDEGlobal::locale()->languageList(); + langs.append( "en" ); + langs.remove( "C" ); + + // this is kind of compat hack as we install our docs in en/ but the + // default language is en_US + for (TQStringList::Iterator it = langs.begin(); it != langs.end(); ++it) + if ( *it == "en_US" ) + *it = "en"; + + // look up the different languages + int ldCount = localDoc.count(); + for (int id=0; id < ldCount; id++) + { + TQStringList::ConstIterator lang; + for (lang = langs.begin(); lang != langs.end(); ++lang) + search.append(TQString("%1%2/%3").arg(localDoc[id], *lang, fname)); + } + + // try to locate the file + TQStringList::Iterator it; + for (it = search.begin(); it != search.end(); ++it) + { + kdDebug( 7119 ) << "Looking for help in: " << *it << endl; + + TQFileInfo info(*it); + if (info.exists() && info.isFile() && info.isReadable()) + return *it; + + if ( ( *it ).right( 5 ) == ".html" ) + { + TQString file = (*it).left((*it).findRev('/')) + "/index.docbook"; + kdDebug( 7119 ) << "Looking for help in: " << file << endl; + info.setFile(file); + if (info.exists() && info.isFile() && info.isReadable()) + return *it; + } + } + + + return TQString::null; +} + + +TQString HelpProtocol::lookupFile(const TQString &fname, + const TQString &query, bool &redirect) +{ + redirect = false; + + TQString path, result; + + path = fname; + + result = langLookup(path); + if (result.isEmpty()) + { + result = langLookup(path+"/index.html"); + if (!result.isEmpty()) + { + KURL red( "help:/" ); + red.setPath( path + "/index.html" ); + red.setQuery( query ); + redirection(red); + kdDebug( 7119 ) << "redirect to " << red.url() << endl; + redirect = true; + } + else + { + unicodeError( i18n("There is no documentation available for %1." ).arg(path) ); + finished(); + return TQString::null; + } + } else + kdDebug( 7119 ) << "result " << result << endl; + + return result; +} + + +void HelpProtocol::unicodeError( const TQString &t ) +{ + data(fromUnicode( TQString( + "\n" + "%2" ).arg( TQTextCodec::codecForLocale()->name() ).arg( t ) ) ); +} + +HelpProtocol *slave = 0; + +HelpProtocol::HelpProtocol( bool ghelp, const TQCString &pool, const TQCString &app ) + : SlaveBase( ghelp ? "ghelp" : "help", pool, app ), mGhelp( ghelp ) +{ + slave = this; +} + +void HelpProtocol::get( const KURL& url ) +{ + kdDebug( 7119 ) << "get: path=" << url.path() + << " query=" << url.query() << endl; + + bool redirect; + TQString doc; + doc = url.path(); + + if ( !mGhelp ) { + if (doc.at(0) != '/') + doc = doc.prepend('/'); + + if (doc.at(doc.length() - 1) == '/') + doc += "index.html"; + } + + infoMessage(i18n("Looking up correct file")); + + if ( !mGhelp ) { + doc = lookupFile(doc, url.query(), redirect); + + if (redirect) + { + finished(); + return; + } + } + + if (doc.isEmpty()) + { + error( TDEIO::ERR_DOES_NOT_EXIST, url.url() ); + return; + } + + mimeType("text/html"); + KURL target; + target.setPath(doc); + if (url.hasHTMLRef()) + target.setHTMLRef(url.htmlRef()); + + kdDebug( 7119 ) << "target " << target.url() << endl; + + TQString file = target.path(); + + if ( mGhelp ) { + if ( file.right( 4 ) != ".xml" ) { + get_file( target ); + return; + } + } else { + TQString docbook_file = file.left(file.findRev('/')) + "/index.docbook"; + if (!KStandardDirs::exists(file)) { + file = docbook_file; + } else { + TQFileInfo fi(file); + if (fi.isDir()) { + file = file + "/index.docbook"; + } else { + if ( file.right( 5 ) != ".html" || !compareTimeStamps( file, docbook_file ) ) { + get_file( target ); + return; + } else + file = docbook_file; + } + } + } + + infoMessage(i18n("Preparing document")); + + if ( mGhelp ) { + TQString xsl = "customization/kde-nochunk.xsl"; + mParsed = transform(file, locate("dtd", xsl)); + + kdDebug( 7119 ) << "parsed " << mParsed.length() << endl; + + if (mParsed.isEmpty()) { + unicodeError( i18n( "The requested help file could not be parsed:
%1" ).arg( file ) ); + } else { + int pos1 = mParsed.find( "charset=" ); + if ( pos1 > 0 ) { + int pos2 = mParsed.find( '"', pos1 ); + if ( pos2 > 0 ) { + mParsed.replace( pos1, pos2 - pos1, "charset=UTF-8" ); + } + } + data( mParsed.utf8() ); + } + } else { + + kdDebug( 7119 ) << "look for cache for " << file << endl; + + mParsed = lookForCache( file ); + + kdDebug( 7119 ) << "cached parsed " << mParsed.length() << endl; + + if ( mParsed.isEmpty() ) { + mParsed = transform(file, locate("dtd", "customization/kde-chunk.xsl")); + if ( !mParsed.isEmpty() ) { + infoMessage( i18n( "Saving to cache" ) ); + TQString cache = file.left( file.length() - 7 ); + saveToCache( mParsed, locateLocal( "cache", + "tdeio_help" + cache + + "cache.bz2" ) ); + } + } else infoMessage( i18n( "Using cached version" ) ); + + kdDebug( 7119 ) << "parsed " << mParsed.length() << endl; + + if (mParsed.isEmpty()) { + unicodeError( i18n( "The requested help file could not be parsed:
%1" ).arg( file ) ); + } else { + TQString query = url.query(), anchor; + + // if we have a query, look if it contains an anchor + if (!query.isEmpty()) + if (query.left(8) == "?anchor=") { + anchor = query.mid(8).lower(); + + KURL redirURL(url); + + redirURL.setQuery(TQString::null); + redirURL.setHTMLRef(anchor); + redirection(redirURL); + finished(); + return; + } + if (anchor.isEmpty() && url.hasHTMLRef()) + anchor = url.htmlRef(); + + kdDebug( 7119 ) << "anchor: " << anchor << endl; + + if ( !anchor.isEmpty() ) + { + int index = 0; + while ( true ) { + index = mParsed.find( TQRegExp( "
" ).arg( anchor ) ) + { + index = mParsed.findRev( " +#include + + +#include +#include + + +#include +#include +#include + + +#include +#include + +class HelpProtocol : public TDEIO::SlaveBase +{ +public: + + HelpProtocol( bool ghelp, const TQCString &pool, const TQCString &app); + virtual ~HelpProtocol() { } + + virtual void get( const KURL& url ); + + virtual void mimetype( const KURL& url ); + +private: + + TQString langLookup(const TQString& fname); + void emitFile( const KURL &url ); + void get_file( const KURL& url ); + TQString lookupFile(const TQString &fname, const TQString &query, + bool &redirect); + + void unicodeError( const TQString &t ); + + TQString mParsed; + bool mGhelp; +}; + + +#endif diff --git a/kdoctools/tdeio_help.upd b/kdoctools/tdeio_help.upd new file mode 100644 index 000000000..4be705f6e --- /dev/null +++ b/kdoctools/tdeio_help.upd @@ -0,0 +1,3 @@ +# Move tdeio_help cache from $TDEHOME/share/apps/tdeio_help/cache to $TDEHOME/cache-$HOST/tdeio_help +Id=trinity_2 +Script=move_tdeio_help_cache.sh,sh diff --git a/kdoctools/xslt.cpp b/kdoctools/xslt.cpp index 6653c7cd5..d143e0a06 100644 --- a/kdoctools/xslt.cpp +++ b/kdoctools/xslt.cpp @@ -11,7 +11,7 @@ #include #include #include -#include "kio_help.h" +#include "tdeio_help.h" #include #include #include @@ -287,7 +287,7 @@ TQString lookForCache( const TQString &filename ) return output; if ( readCache( filename, locateLocal( "cache", - "kio_help" + cache + + "tdeio_help" + cache + "cache.bz2" ), output ) ) return output; -- cgit v1.2.1