@ -0,0 +1,12 @@
|
||||
Luke Plant <L.Plant.98@cantab.net>
|
||||
|
||||
Some code was taken from the following GPL projects, and noted
|
||||
in the relevant files:
|
||||
o The SWORD Project, CrossWire Bible Society 2003
|
||||
o BibleTime, the BibleTime team
|
||||
|
||||
Inspiration from kio-apt, by Sylvain Joyeux <sylvain.joyeux@m4x.org>
|
||||
|
||||
Thanks go to the following people for bug reports and patches:
|
||||
David Anderson
|
||||
Thomas Bettler
|
@ -0,0 +1,22 @@
|
||||
2004-06-05 Version 0.1
|
||||
|
||||
o removed nulls in HTML output
|
||||
o make umlauts display properly in GerSch (for example)
|
||||
o removed some debug code
|
||||
o HTML/CSS changes:
|
||||
o if you've made a customised version of the
|
||||
kio_sword.css file, you'll need to remove
|
||||
it or merge changes in by hand for things
|
||||
to look right
|
||||
o added <div class='sword_text'> around
|
||||
all the main body of text returned from
|
||||
a module
|
||||
o navigation links formatted as inline list
|
||||
o changed class names sword_xxx to swordxxx
|
||||
for CSS2 correctness
|
||||
|
||||
|
||||
2004-06-01 Version 0.0.1
|
||||
|
||||
o First release (test before the first real release, 0.1)
|
||||
|
@ -0,0 +1,215 @@
|
||||
Kio-Sword installation
|
||||
======================
|
||||
|
||||
In brief
|
||||
========
|
||||
|
||||
./configure --prefix=`kde-config --prefix` && make && sudo make install
|
||||
|
||||
(but see note about version compatibility below)
|
||||
|
||||
Details
|
||||
=======
|
||||
|
||||
To compile, you will need header files for the following
|
||||
libraries, as well as the libraries themselves:
|
||||
- kdelibs >= 3
|
||||
- sword >= 1.5.7
|
||||
|
||||
|
||||
After unpacking the source, change to the base directory of the
|
||||
kio-sword distribution. You will then need to find you KDE directory
|
||||
using this command if you don't know it already:
|
||||
kde-config --prefix
|
||||
|
||||
Then type:
|
||||
export KDEDIR=<your KDE dir>
|
||||
./configure --prefix=<your KDE DIR>
|
||||
make
|
||||
|
||||
Then as root (using su or sudo)
|
||||
|
||||
make install
|
||||
|
||||
Version Compatibility
|
||||
=====================
|
||||
|
||||
If you have sword 1.5.8 or later, you will need to patch the source
|
||||
due to a change in an API. The patch is provided, so you just have
|
||||
to run this command before running configure etc.
|
||||
|
||||
patch -p0 < sword_1_5_8_fix.patch
|
||||
|
||||
|
||||
|
||||
|
||||
Below are the generic installation instructions:
|
||||
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
4. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
@ -0,0 +1,24 @@
|
||||
SUBDIRS = $(TOPSUBDIRS)
|
||||
|
||||
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
|
||||
|
||||
$(top_srcdir)/subdirs:
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
|
||||
|
||||
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in $(top_srcdir)/admin/localm4/*.m4
|
||||
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in admin/localm4/*.m4 > acinclude.m4
|
||||
|
||||
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
|
||||
|
||||
package-messages:
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
|
||||
$(MAKE) -C po merge
|
||||
|
||||
EXTRA_DIST = admin COPYING configure.in.in debian sword_1_5_8_fix.patch
|
||||
|
||||
dist-hook:
|
||||
cd $(top_distdir) && perl admin/am_edit -padmin
|
||||
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
|
||||
-rm -rf `find $(top_distdir)/admin -name .svn`
|
||||
-rm -rf `find $(top_distdir)/debian -name .svn`
|
@ -0,0 +1,10 @@
|
||||
all:
|
||||
@echo "This Makefile is only for the CVS repository"
|
||||
@echo "This will be deleted before making the distribution"
|
||||
@echo ""
|
||||
$(MAKE) -f admin/Makefile.common cvs
|
||||
|
||||
dist:
|
||||
$(MAKE) -f admin/Makefile.common dist
|
||||
|
||||
.SILENT:
|
@ -0,0 +1,46 @@
|
||||
Kio-Sword - a lightweight frontend for the
|
||||
Sword Bible project for KDE
|
||||
|
||||
|
||||
Copyright (C) 2004-2006 Luke Plant <L.Plant.98@cantab.net>
|
||||
|
||||
Installation
|
||||
============
|
||||
See file INSTALL.
|
||||
|
||||
Using kio-sword
|
||||
===============
|
||||
Type 'sword:/' in a Konqueror window location bar, and
|
||||
browse. Help files can be found at sword:/?help (currently
|
||||
quite incomplete).
|
||||
|
||||
Requirements
|
||||
============
|
||||
o KDE 3
|
||||
o Sword 1.5.7
|
||||
o for compiling from source, the header files for the above
|
||||
libraries are also needed.
|
||||
o Sword modules installed (kio-sword isn't very useful
|
||||
without them)
|
||||
|
||||
License
|
||||
=======
|
||||
GNU General Public License v2 or later. See file COPYING
|
||||
for details.
|
||||
|
||||
Feedback
|
||||
========
|
||||
Comments, feature requests, bug reports are all welcome - please
|
||||
e-mail the author (e-mail above). For bug reports,
|
||||
please include:
|
||||
o version of KDE
|
||||
o version of Sword
|
||||
o operating system
|
||||
o locale information (the output of 'locale' if
|
||||
available, or the contents of LANG, LC_ALL etc)
|
||||
o the full error message if one was printed.
|
||||
|
||||
Website
|
||||
=======
|
||||
http://lukeplant.me.uk/kio-sword/
|
||||
|
@ -0,0 +1,75 @@
|
||||
Feedback/votes for any of these are appreciated - e-mail the author.
|
||||
|
||||
KNOWN BUGS/ISSUES
|
||||
=================
|
||||
o The fact that you can replace the CSS file easily needs documenting
|
||||
|
||||
o Background image is annoying
|
||||
|
||||
o Lots of the filters are incomplete, and don't render everything
|
||||
correctly, especially:
|
||||
o footnotes
|
||||
o cross references
|
||||
o lemmas
|
||||
|
||||
o i18n: Support for RTL text in the main page
|
||||
|
||||
o Support for RTL modules that aren't Bibles
|
||||
|
||||
o footnotes - not implemented at all yet
|
||||
|
||||
o ThML cross refs - partic MHC - have tags that just specify a verse number or
|
||||
verse and chapter, the rest of the reference should be inferred by the context
|
||||
(e.g. in commentary on John 5, '2' means John 5:2). We need to get these to
|
||||
produce correct hrefs
|
||||
|
||||
o Strongs and morph tags:
|
||||
o these won't work properly in all modules yet. In GBF, all
|
||||
strongs hrefs go to greekstrongs - I need to look up some docs to
|
||||
about the markup.
|
||||
|
||||
|
||||
o Lots of i18n issues:
|
||||
o Support for non-English names for Bible books
|
||||
o in terms of querying e.g. sword:/KJV/Genèse ??
|
||||
o and for displaying the book name
|
||||
(not sure how this will work)
|
||||
o Ability to choose different fonts for diferent lanugages somehow
|
||||
o probably by adding <span class='sword_hebrew'> </span>
|
||||
and using CSS, if possible
|
||||
o Need to investigate these issues:
|
||||
o reading of supplied URL - what encoding is it in?
|
||||
o DEFINITE bug here -- in e-mail
|
||||
o construction of URL for redirection, or going back
|
||||
to previous page - encoding issues?
|
||||
o add dir=RTL|LTR and lang attributes according to the user's chosen
|
||||
language
|
||||
|
||||
|
||||
o Bibles that don't have e.g. OT should produce an error if you request
|
||||
an OT verse
|
||||
|
||||
o Luther's commentary on Galatians lists everything from Galatians -
|
||||
Rev in the index. Probably others similarly
|
||||
|
||||
POSSIBLE FEATURES/CHANGES
|
||||
=========================
|
||||
|
||||
o Make modules names case insensitive
|
||||
|
||||
o HTML
|
||||
- move to XHTML strict
|
||||
|
||||
o Style sheet
|
||||
- get someone to do a better design for the page
|
||||
|
||||
o Read some config defaults from the BibleTime settings
|
||||
|
||||
o Headings in Lexicons - use the proper name, not the user's query text
|
||||
|
||||
o clean up/optimise lots of code according to the 'KDE mistakes' tutorial
|
||||
|
||||
o improve docbook documentation
|
||||
|
||||
o 'Bookmark' icon to make kio-sword pages appear with their own bookmark
|
||||
|
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# First create all the .html files from our
|
||||
# .docbook file. The KDE build process will
|
||||
# then create makefiles that install these docs
|
||||
cd doc/en
|
||||
meinproc index.docbook
|
||||
cd ../..
|
||||
WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" make -f Makefile.cvs
|
@ -0,0 +1,244 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
|
||||
#undef HAVE_CARBON_CARBON_H
|
||||
|
||||
/* Define if you have the CoreAudio API */
|
||||
#undef HAVE_COREAUDIO
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#undef HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Defines if your system has the crypt function */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have libjpeg */
|
||||
#undef HAVE_LIBJPEG
|
||||
|
||||
/* Define if you have libpng */
|
||||
#undef HAVE_LIBPNG
|
||||
|
||||
/* Define if you have a working libpthread (will enable threaded code) */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define if you have libz */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if your system needs _NSGetEnviron to set up the environment */
|
||||
#undef HAVE_NSGETENVIRON
|
||||
|
||||
/* Define if you have res_init */
|
||||
#undef HAVE_RES_INIT
|
||||
|
||||
/* Define if you have the res_init prototype */
|
||||
#undef HAVE_RES_INIT_PROTO
|
||||
|
||||
/* Define if you have a STL implementation by SGI */
|
||||
#undef HAVE_SGI_STL
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have strlcat */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcat prototype */
|
||||
#undef HAVE_STRLCAT_PROTO
|
||||
|
||||
/* Define if you have strlcpy */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strlcpy prototype */
|
||||
#undef HAVE_STRLCPY_PROTO
|
||||
|
||||
/* Define to 1 if you have the <sys/bitypes.h> header file. */
|
||||
#undef HAVE_SYS_BITYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Suffix for lib directories */
|
||||
#undef KDELIBSUFF
|
||||
|
||||
/* Define a safe value for MAXPATHLEN */
|
||||
#undef KDEMAXPATHLEN
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of a `char *', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR_P
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of a `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of a `unsigned long', as computed by sizeof. */
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Defined if compiling without arts */
|
||||
#undef WITHOUT_ARTS
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/*
|
||||
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
|
||||
* headers and I'm too lazy to write a configure test as long as only
|
||||
* unixware is related
|
||||
*/
|
||||
#ifdef _UNIXWARE
|
||||
#define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
|
||||
* that defines bzero.
|
||||
*/
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
|
||||
# include <sys/time.h>
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_RES_INIT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int res_init(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCAT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcat(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCPY_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcpy(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* On HP-UX, the declaration of vsnprintf() is needed every time !
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int snprintf(char *str, size_t n, char const *fmt, ...);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__SVR4) && !defined(__svr4__)
|
||||
#define __svr4__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
#undef kde_socklen_t
|
||||
|
||||
/* type to use in place of socklen_t if not defined (deprecated, use
|
||||
kde_socklen_t) */
|
||||
#undef ksize_t
|
@ -0,0 +1,2 @@
|
||||
./admin/configure.in.min
|
||||
configure.in.in
|
@ -0,0 +1,128 @@
|
||||
dnl =======================================================
|
||||
dnl FILE: ./admin/configure.in.min
|
||||
dnl =======================================================
|
||||
|
||||
dnl This file is part of the KDE libraries/packages
|
||||
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
|
||||
|
||||
dnl This file is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Library General Public License
|
||||
dnl along with this library; see the file COPYING.LIB. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
# Original Author was Kalle@kde.org
|
||||
# I lifted it in some mater. (Stephan Kulow)
|
||||
# I used much code from Janos Farkas
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(acinclude.m4) dnl a source file from your sub dir
|
||||
|
||||
dnl This is so we can use kde-common
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
|
||||
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
|
||||
unset CDPATH
|
||||
|
||||
dnl Checking host/target/build systems, for make, install etc.
|
||||
AC_CANONICAL_SYSTEM
|
||||
dnl Perform program name transformation
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
dnl Automake doc recommends to do this only here. (Janos)
|
||||
AM_INIT_AUTOMAKE(kio_sword, 0.3) dnl searches for some needed programs
|
||||
|
||||
KDE_SET_PREFIX
|
||||
|
||||
dnl generate the config header
|
||||
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_CHECK_COMPILERS
|
||||
AC_ENABLE_SHARED(yes)
|
||||
AC_ENABLE_STATIC(no)
|
||||
KDE_PROG_LIBTOOL
|
||||
|
||||
dnl for NLS support. Call them in this order!
|
||||
dnl WITH_NLS is for the po files
|
||||
AM_KDE_WITH_NLS
|
||||
|
||||
KDE_USE_QT(3.0.0)
|
||||
AC_PATH_KDE
|
||||
dnl =======================================================
|
||||
dnl FILE: configure.in.in
|
||||
dnl =======================================================
|
||||
|
||||
#MIN_CONFIG(3.0.0)
|
||||
|
||||
dnl PACKAGE set before
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
||||
AC_CHECK_SWORD(1.5.7, [$ac_use_static])
|
||||
|
||||
AC_CONFIG_FILES([ src/data/kio_sword.css ])
|
||||
KDE_CREATE_SUBDIRSLIST
|
||||
AC_CONFIG_FILES([ Makefile ])
|
||||
AC_CONFIG_FILES([ doc/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/en/Makefile ])
|
||||
AC_CONFIG_FILES([ po/Makefile ])
|
||||
AC_CONFIG_FILES([ src/Makefile ])
|
||||
AC_CONFIG_FILES([ src/data/Makefile ])
|
||||
AC_CONFIG_FILES([ src/pics/Makefile ])
|
||||
AC_OUTPUT
|
||||
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
|
||||
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
|
||||
# And if so, warn when they don't match
|
||||
if test "$kde_libs_prefix" != "$given_prefix"; then
|
||||
# And if kde doesn't know about the prefix yet
|
||||
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
|
||||
if test $? -ne 0; then
|
||||
echo ""
|
||||
echo "Warning: you chose to install this package in $given_prefix,"
|
||||
echo "but KDE was found in $kde_libs_prefix."
|
||||
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
|
||||
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
|
||||
echo "Then restart KDE."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
|
||||
echo ""
|
||||
echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
|
||||
echo "was not included. Therefore, GCC symbol visibility support remains disabled."
|
||||
echo ""
|
||||
echo "For better performance, consider including the Qt visibility supporting patch"
|
||||
echo "located at:"
|
||||
echo ""
|
||||
echo "http://bugs.kde.org/show_bug.cgi?id=109386"
|
||||
echo ""
|
||||
echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
|
||||
echo "everything will continue to work just fine without it."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test "$all_tests" = "bad"; then
|
||||
if test ! "$cache_file" = "/dev/null"; then
|
||||
echo ""
|
||||
echo "Please remove the file $cache_file after changing your setup"
|
||||
echo "so that configure will find the changes next time."
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Good - your configure finished. Start make now"
|
||||
echo ""
|
||||
fi
|
@ -0,0 +1,9 @@
|
||||
#MIN_CONFIG(3.0.0)
|
||||
|
||||
AM_INIT_AUTOMAKE(kio_sword, 0.3)
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
||||
AC_CHECK_SWORD(1.5.7, [$ac_use_static])
|
||||
|
||||
AC_CONFIG_FILES([ src/data/kio_sword.css ])
|
@ -0,0 +1,6 @@
|
||||
# the SUBDIRS is filled automatically by am_edit. If files are
|
||||
# in this directory they are installed into the english dir
|
||||
|
||||
KDE_LANG = en
|
||||
KDE_DOCS = kio_sword
|
||||
SUBDIRS = $(AUTODIRS)
|
@ -0,0 +1,2 @@
|
||||
KDE_DOCS = kio_sword
|
||||
KDE_LANG = en
|
@ -0,0 +1,285 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
|
||||
<!ENTITY kio_sword "<application>Kio-Sword</application>">
|
||||
<!ENTITY kappname "&kio_sword;"><!-- Do *not* replace kappname-->
|
||||
<!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
|
||||
<!ENTITY % addindex "IGNORE">
|
||||
<!ENTITY % English "INCLUDE"><!-- change language only here -->
|
||||
|
||||
|
||||
]>
|
||||
|
||||
<!-- ................................................................ -->
|
||||
|
||||
<!-- The language must NOT be changed here. -->
|
||||
|
||||
<book lang="&language;">
|
||||
|
||||
<bookinfo>
|
||||
<title>The &kio_sword; Handbook</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname></firstname>
|
||||
<othername></othername>
|
||||
<surname>Luke Plant</surname>
|
||||
<affiliation>
|
||||
<address><email>L.Plant.98@cantab.net</email></address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<!-- TRANS:ROLES_OF_TRANSLATORS -->
|
||||
|
||||
<copyright>
|
||||
<year>2004-2006</year>
|
||||
<holder>Luke Plant</holder>
|
||||
</copyright>
|
||||
<!-- Translators: put here the copyright notice of the translation -->
|
||||
<!-- legalnotice
|
||||
|
||||
For some reason, meinproc replaces my legal notice with a
|
||||
link to help:/common/fdl-notice, so I've put legal information
|
||||
in the relevant section.
|
||||
-->
|
||||
|
||||
|
||||
<!-- Date and version information of the documentation
|
||||
Don't forget to include this last date and this last revision number, we
|
||||
need them for translation coordination !
|
||||
Please respect the format of the date (YYYY-MM-DD) and of the version
|
||||
(V.MM.LL), it could be used by automation scripts.
|
||||
Do NOT change these in the translation. -->
|
||||
|
||||
<date>2006-12-16</date>
|
||||
<releaseinfo>0.3.0</releaseinfo>
|
||||
|
||||
<!-- Abstract about this handbook -->
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
&kio_sword; is a Bible reading tool written for the &kde; environment. It is a
|
||||
front-end for the SWORD Bible system, and enables you to view, browse and search
|
||||
your SWORD modules from the web browser (Konqueror).
|
||||
</para>
|
||||
</abstract>
|
||||
|
||||
<keywordset>
|
||||
<keyword>KDE</keyword>
|
||||
<keyword>kio_sword</keyword>
|
||||
<keyword>kio-sword</keyword>
|
||||
<keyword>Kio-Sword</keyword>
|
||||
<keyword>kiosword</keyword>
|
||||
<keyword>sword</keyword>
|
||||
<keyword>SWORD</keyword>
|
||||
<keyword>Bible</keyword>
|
||||
<keyword>kio</keyword>
|
||||
</keywordset>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
<chapter id="introduction">
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>
|
||||
&kio_sword; is a Bible reading tool written for the &kde; environment. It is a
|
||||
front-end for the SWORD Bible system, and enables you to view, browse and search
|
||||
your SWORD modules from the web browser (Konqueror). It is intended to
|
||||
be a lightweight companion to programs like BibleTime (for the KDE environment)
|
||||
and other SWORD programs.
|
||||
</para>
|
||||
|
||||
<para> Please report any problems or feature requests to the author.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="using-kio_sword">
|
||||
<title>Using &kio_sword;</title>
|
||||
|
||||
<para>To start using &kio_sword; simply type <ulink url="sword:/">sword:/</ulink>
|
||||
in the location bar in Konqueror, and start browsing your SWORD modules.
|
||||
To go directly to a section of a module, use a URL like this:
|
||||
<userinput>sword:/[modulename]/[reference]</userinput>
|
||||
<variablelist>
|
||||
<title>Examples</title>
|
||||
<varlistentry>
|
||||
<term><userinput>sword:/KJV/Hebrews 1:3</userinput></term>
|
||||
<listitem>
|
||||
<para>Takes you straight to Hebrews 1:3 in the King James Version</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>sword:/StrongsGreek/01234</userinput></term>
|
||||
<listitem>
|
||||
<para>Returns the information about the Strongs Number 01234 (Greek)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>sword:John 3:16</userinput></term>
|
||||
<listitem>
|
||||
<para>Redirects to John 3:16 in your default Bible</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
<para>You can specify other options in the URL. See <ulink url="sword:/?settings">sword:/?settings</ulink>.</para>
|
||||
|
||||
</chapter>
|
||||
<chapter id="faq">
|
||||
<title>Questions and Answers</title>
|
||||
|
||||
<!-- (OPTIONAL but recommended) This chapter should include all of the silly
|
||||
(and not-so-silly) newbie questions that fill up your mailbox. This chapter
|
||||
should be reserved for BRIEF questions and answers! If one question uses more
|
||||
than a page or so then it should probably be part of the
|
||||
"Using this Application" chapter instead. You should use links to
|
||||
cross-reference questions to the parts of your documentation that answer them.
|
||||
This is also a great place to provide pointers to other FAQ's if your users
|
||||
must do some complicated configuration on other programs in order for your
|
||||
application work. -->
|
||||
|
||||
&reporting.bugs;
|
||||
&updating.documentation;
|
||||
|
||||
<qandaset id="faqlist">
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>I get the message 'No modules installed!'</para>
|
||||
</question>
|
||||
<answer>
|
||||
<para>&kio_sword; uses the SWORD modules already installed on your system.
|
||||
You need to install some modules from <ulink url="http://www.crosswire.org">Crosswire.org</ulink>
|
||||
or use a SWORD frontend such as <ulink url="http://www.bibletime.info">BibleTime</ulink> to install the
|
||||
modules you want. You may need to edit your sword configuration in ~/.sword/ or /etc/sword as per
|
||||
the instructions on crosswire.org</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
</qandaset>
|
||||
</chapter>
|
||||
|
||||
<chapter id="credits">
|
||||
|
||||
<!-- Include credits for the programmers, documentation writers, and
|
||||
contributors here. The license for your software should then be included below
|
||||
the credits with a reference to the appropriate license file included in the KDE
|
||||
distribution. -->
|
||||
|
||||
<title>Credits and License</title>
|
||||
|
||||
<para>
|
||||
Program and documentation copyright 2004-2006 Luke Plant <email>L.Plant.98@cantab.net</email>
|
||||
</para>
|
||||
|
||||
&underGPL; <!-- GPL License -->
|
||||
|
||||
<para>The code also draws ideas, methods and some code from <ulink url="http://www.bibletime.info">BibleTime</ulink>
|
||||
Diatheke (included in the SWORD source distribution) and the SWORD libraries themselves (all of which are GPL software). See also the AUTHORS file distributed with &kio_sword; for other contributions.</para>
|
||||
|
||||
<para>This &kio_sword; handbook is part of &kio_sword; and is licensed under the same terms.
|
||||
</para>
|
||||
|
||||
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
|
||||
|
||||
<!-- Determine which license your application is licensed under,
|
||||
and delete all the remaining licenses below:
|
||||
|
||||
(NOTE: All documentation are licensed under the FDL,
|
||||
regardless of what license the application uses) -->
|
||||
|
||||
|
||||
</chapter>
|
||||
|
||||
<appendix id="installation">
|
||||
<title>Installation</title>
|
||||
|
||||
<sect1 id="getting-kio_sword">
|
||||
<title>How to obtain &kio_sword;</title>
|
||||
|
||||
<para>Download from <ulink url="http://lukeplant.me.uk/kio-sword/">The &kio_sword; home page</ulink> </para>
|
||||
<!-- This first entity contains boiler plate for applications that are
|
||||
part of KDE CVS. You should remove it if you are releasing your
|
||||
application -->
|
||||
<!--
|
||||
&install.intro.documentation;
|
||||
-->
|
||||
</sect1>
|
||||
|
||||
<sect1 id="requirements">
|
||||
<title>Requirements</title>
|
||||
<!--
|
||||
List any special requirements for your application here. This should include:
|
||||
.Libraries or other software that is not included in kdesupport,
|
||||
kdelibs, or kdebase.
|
||||
.Hardware requirements like amount of RAM, disk space, graphics card
|
||||
capabilities, screen resolution, special expansion cards, etc.
|
||||
.Operating systems the app will run on. If your app is designed only for a
|
||||
specific OS, (you wrote a graphical LILO configurator for example) put this
|
||||
information here.
|
||||
-->
|
||||
|
||||
<para>The following libraries are required:</para>
|
||||
<para>SWORD 1.5.8 or greater</para>
|
||||
<para>KDE 3 or greater</para>
|
||||
|
||||
<!-- FIXME link to getting SWORD -->
|
||||
|
||||
<!-- For a list of updates, you may refer to the application web site
|
||||
or the ChangeLog file, or ... -->
|
||||
<para>
|
||||
You can find a list of changes at <ulink
|
||||
url="http://apps.kde.org/kio_sword">http://apps.kde.org/kio_sword</ulink>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="compilation">
|
||||
<title>Compilation and Installation</title>
|
||||
|
||||
<!-- copied from install-compile.docbook then modified -->
|
||||
<para>In order to compile and install &kappname; on your system, first
|
||||
unpack the source code. Then type the following in the base directory
|
||||
of the &kappname; distribution:</para>
|
||||
|
||||
<screen><prompt>%</prompt> <userinput><command>./configure</command></userinput>
|
||||
<prompt>%</prompt> <userinput><command>make</command></userinput>
|
||||
<prompt>%</prompt> <userinput><command>make</command> install</userinput>
|
||||
</screen>
|
||||
|
||||
<para>You will need the header files for kdelibs4 and SWORD installed on your system.</para>
|
||||
|
||||
<para>You will need to be root before doing the 'make install' step.</para>
|
||||
|
||||
<para>Since &kappname; uses <command>autoconf</command> and
|
||||
<command>automake</command> you should have no trouble compiling it. Should you
|
||||
run into problems please report them to the author.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="configuration">
|
||||
<title>Configuration</title>
|
||||
|
||||
<para>You will need to install SWORD modules before using &kio_sword;.</para>
|
||||
<para>User settings can be saved via the 'Settings' page.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
</appendix>
|
||||
|
||||
&documentation.index;
|
||||
</book>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-general-insert-case:lower
|
||||
sgml-indent-step:0
|
||||
sgml-indent-data:nil
|
||||
End:
|
||||
|
||||
vim:tabstop=2:shiftwidth=2:expandtab
|
||||
-->
|
||||
|
@ -0,0 +1,214 @@
|
||||
<?xml version = '1.0'?>
|
||||
<kdevelop>
|
||||
<general>
|
||||
<author>Luke Plant</author>
|
||||
<email>L.Plant.98@cantab.net</email>
|
||||
<version>0.1</version>
|
||||
<projectmanagement>KDevKDEAutoProject</projectmanagement>
|
||||
<primarylanguage>C++</primarylanguage>
|
||||
<keywords>
|
||||
<keyword>C++</keyword>
|
||||
<keyword>Code</keyword>
|
||||
<keyword>Qt</keyword>
|
||||
<keyword>KDE</keyword>
|
||||
<keyword>kioslave</keyword>
|
||||
</keywords>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description/>
|
||||
<ignoreparts>
|
||||
<part>kdevdebugger</part>
|
||||
<part>kdevkonsoleview</part>
|
||||
<part>kdevrbdebugger</part>
|
||||
</ignoreparts>
|
||||
<secondaryLanguages/>
|
||||
<versioncontrol>kdevsubversion</versioncontrol>
|
||||
</general>
|
||||
<kdevautoproject>
|
||||
<general>
|
||||
<activetarget>src/kio_sword.la</activetarget>
|
||||
<useconfiguration>default</useconfiguration>
|
||||
</general>
|
||||
<configurations>
|
||||
<optimized>
|
||||
<builddir>optimized</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<cxxflags>-O2 -g0</cxxflags>
|
||||
</optimized>
|
||||
<debug>
|
||||
<configargs>--enable-debug=full</configargs>
|
||||
<builddir>debug</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<cxxflags>-O0 -g3</cxxflags>
|
||||
</debug>
|
||||
<default>
|
||||
<configargs>--enable-debug=full</configargs>
|
||||
<builddir/>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
<ldflags/>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary/>
|
||||
<cxxcompilerbinary/>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags>-O0 -g3</cxxflags>
|
||||
<f77flags/>
|
||||
<envvars/>
|
||||
</default>
|
||||
</configurations>
|
||||
<make>
|
||||
<envvars>
|
||||
<envvar value="1" name="WANT_AUTOCONF_2_5" />
|
||||
<envvar value="1" name="WANT_AUTOMAKE_1_6" />
|
||||
</envvars>
|
||||
<abortonerror>false</abortonerror>
|
||||
<numberofjobs>1</numberofjobs>
|
||||
<dontact>false</dontact>
|
||||
<makebin/>
|
||||
<prio>0</prio>
|
||||
</make>
|
||||
<run>
|
||||
<directoryradio>executable</directoryradio>
|
||||
<customdirectory>/</customdirectory>
|
||||
<mainprogram/>
|
||||
<programargs/>
|
||||
<terminal>false</terminal>
|
||||
<autocompile>true</autocompile>
|
||||
<envvars/>
|
||||
</run>
|
||||
</kdevautoproject>
|
||||
<kdevfileview>
|
||||
<groups>
|
||||
<group pattern="*.cpp;*.cxx;*.h" name="Sources" />
|
||||
<group pattern="*.po;*.ts" name="Translations" />
|
||||
<group pattern="*" name="Others" />
|
||||
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||
<hidenonlocation>false</hidenonlocation>
|
||||
</groups>
|
||||
<tree>
|
||||
<hidepatterns>*.o,*.lo,CVS</hidepatterns>
|
||||
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||
<showvcsfields>false</showvcsfields>
|
||||
</tree>
|
||||
</kdevfileview>
|
||||
<kdevdoctreeview>
|
||||
<ignoretocs>
|
||||
<toc>bash</toc>
|
||||
<toc>bash_bugs</toc>
|
||||
<toc>clanlib</toc>
|
||||
<toc>fortran_bugs_gcc</toc>
|
||||
<toc>gnome1</toc>
|
||||
<toc>gnustep</toc>
|
||||
<toc>gtk</toc>
|
||||
<toc>gtk_bugs</toc>
|
||||
<toc>haskell</toc>
|
||||
<toc>haskell_bugs_ghc</toc>
|
||||
<toc>java_bugs_gcc</toc>
|
||||
<toc>java_bugs_sun</toc>
|
||||
<toc>opengl</toc>
|
||||
<toc>pascal_bugs_fp</toc>
|
||||
<toc>php</toc>
|
||||
<toc>php_bugs</toc>
|
||||
<toc>perl</toc>
|
||||
<toc>perl_bugs</toc>
|
||||
<toc>python</toc>
|
||||
<toc>python_bugs</toc>
|
||||
<toc>ruby</toc>
|
||||
<toc>ruby_bugs</toc>
|
||||
<toc>sdl</toc>
|
||||
<toc>stl</toc>
|
||||
<toc>sw</toc>
|
||||
<toc>w3c-dom-level2-html</toc>
|
||||
<toc>w3c-svg</toc>
|
||||
<toc>w3c-uaag10</toc>
|
||||
<toc>wxwindows_bugs</toc>
|
||||
</ignoretocs>
|
||||
<ignoreqt_xml>
|
||||
<toc>Guide to the Qt Translation Tools</toc>
|
||||
<toc>Qt Assistant Manual</toc>
|
||||
<toc>Qt Designer Manual</toc>
|
||||
<toc>Qt Reference Documentation</toc>
|
||||
</ignoreqt_xml>
|
||||
</kdevdoctreeview>
|
||||
<kdevdebugger>
|
||||
<general>
|
||||
<dbgshell>libtool</dbgshell>
|
||||
<programargs/>
|
||||
<gdbpath/>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>false</floatingtoolbar>
|
||||
</general>
|
||||
<display>
|
||||
<staticmembers>false</staticmembers>
|
||||
<demanglenames>true</demanglenames>
|
||||
<outputradix>10</outputradix>
|
||||
</display>
|
||||
</kdevdebugger>
|
||||
<kdevfilecreate>
|
||||
<filetypes/>
|
||||
<useglobaltypes>
|
||||
<type ext="cpp" />
|
||||
<type ext="h" />
|
||||
</useglobaltypes>
|
||||
</kdevfilecreate>
|
||||
<cppsupportpart>
|
||||
<filetemplates>
|
||||
<interfacesuffix>.h</interfacesuffix>
|
||||
<implementationsuffix>.cpp</implementationsuffix>
|
||||
</filetemplates>
|
||||
</cppsupportpart>
|
||||
<kdevcppsupport>
|
||||
<codecompletion>
|
||||
<includeGlobalFunctions>true</includeGlobalFunctions>
|
||||
<includeTypes>true</includeTypes>
|
||||
<includeEnums>true</includeEnums>
|
||||
<includeTypedefs>false</includeTypedefs>
|
||||
<automaticCodeCompletion>true</automaticCodeCompletion>
|
||||
<automaticArgumentsHint>true</automaticArgumentsHint>
|
||||
<automaticHeaderCompletion>true</automaticHeaderCompletion>
|
||||
<codeCompletionDelay>250</codeCompletionDelay>
|
||||
<argumentsHintDelay>400</argumentsHintDelay>
|
||||
<headerCompletionDelay>250</headerCompletionDelay>
|
||||
</codecompletion>
|
||||
<references/>
|
||||
<creategettersetter>
|
||||
<prefixGet/>
|
||||
<prefixSet>set</prefixSet>
|
||||
<prefixVariable>m_,_</prefixVariable>
|
||||
<parameterName>theValue</parameterName>
|
||||
<inlineGet>true</inlineGet>
|
||||
<inlineSet>true</inlineSet>
|
||||
</creategettersetter>
|
||||
</kdevcppsupport>
|
||||
<kdevdocumentation>
|
||||
<projectdoc>
|
||||
<docsystem/>
|
||||
<docurl/>
|
||||
<usermanualurl/>
|
||||
</projectdoc>
|
||||
</kdevdocumentation>
|
||||
<ctagspart>
|
||||
<customArguments/>
|
||||
<customTagfilePath/>
|
||||
</ctagspart>
|
||||
<kdevvisualadvance>
|
||||
<emulator>VisualBoyAdvance</emulator>
|
||||
<binary/>
|
||||
<addOptions/>
|
||||
<terminal>false</terminal>
|
||||
<fullscreen>false</fullscreen>
|
||||
<graphicFilter>-f0</graphicFilter>
|
||||
<scaling>-1</scaling>
|
||||
</kdevvisualadvance>
|
||||
</kdevelop>
|
@ -0,0 +1 @@
|
||||
POFILES = AUTO
|
@ -0,0 +1,21 @@
|
||||
SUBDIRS = data pics
|
||||
|
||||
INCLUDES = -I/usr/include/qt3 $(all_includes)
|
||||
|
||||
kde_module_LTLIBRARIES = kio_sword.la
|
||||
|
||||
kio_sword_la_SOURCES = kio_sword.cpp renderer.cpp ks_osishtml.cpp ks_gbfhtml.cpp \
|
||||
ks_thmlhtml.cpp utils.cpp swordutils.cpp swordoptions.cpp filter.cpp template.cpp
|
||||
|
||||
kio_sword_la_LIBADD = -lqt-mt -lkio $(LIB_SWORD)
|
||||
|
||||
kio_sword_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_PLUGIN)
|
||||
|
||||
protocol_DATA = sword.protocol
|
||||
protocoldir = $(kde_servicesdir)
|
||||
|
||||
messages: rc.cpp
|
||||
$(XGETTEXT) *.cpp -o $(podir)/kio_sword.pot
|
||||
|
||||
noinst_HEADERS = kio_sword.h renderer.h swordoptions.h ks_osishtml.h \
|
||||
ks_gbfhtml.h ks_thmlhtml.h utils.h swordutils.h option.h filter.h template.h
|
@ -0,0 +1,4 @@
|
||||
kiosworddatadir = $(kde_datadir)/kio_sword
|
||||
kiosworddata_DATA = kio_sword.css swordvertical.png
|
||||
|
||||
EXTRA_DIST = $(kiosworddata_DATA)
|
@ -0,0 +1,273 @@
|
||||
body {
|
||||
background-color: #d0d0d0;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
div.page
|
||||
{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
div.content
|
||||
{
|
||||
padding: 5px 5px 5px 25px;
|
||||
margin: 0px;
|
||||
background: #ffffff;
|
||||
border: solid #808080 1px;
|
||||
/* background-image: url('file:///usr/share/apps/kio_sword/swordvertical.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%; */
|
||||
}
|
||||
|
||||
|
||||
h1, h2, h3 {
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 135%;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-size: 120%;
|
||||
margin-left: -10px;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
font-size: 110%;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
h4, h5, h6 { font-size: 100%; }
|
||||
|
||||
|
||||
hr {
|
||||
text-align: center ;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #4000ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none ;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.text {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
td.page {
|
||||
background-color: #ffffff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jesusquote {
|
||||
color: red ;
|
||||
}
|
||||
|
||||
.versenumber {
|
||||
vertical-align: super;
|
||||
font-size: 0.7em ;
|
||||
}
|
||||
|
||||
.biblename {
|
||||
text-align: right ;
|
||||
color: #202020 ;
|
||||
font-style: italic;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
img.tableimg {
|
||||
display: block;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.error {
|
||||
font-size: 1.2em ;
|
||||
color: red ;
|
||||
}
|
||||
|
||||
.fixme {
|
||||
font-size: 1.2em ;
|
||||
color: red ;
|
||||
}
|
||||
|
||||
h1.moduletitle, h2.moduletitle, h1.bibleref, h2.biblref {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1.moduleslist {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Page links */
|
||||
div.links {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
div.links ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.links li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.links li:before {
|
||||
display: inline;
|
||||
content: " | ";
|
||||
}
|
||||
div.links li:first-child:before {
|
||||
display: inline;
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Page toggles */
|
||||
div.toggles {
|
||||
font-size: 90%;
|
||||
text-align: right;
|
||||
border-bottom: 1px solid #808080;
|
||||
border-left: 1px solid #808080;
|
||||
border-right: 1px solid #808080;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
background: #e0e0e0;
|
||||
}
|
||||
|
||||
div.toggles ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.toggles li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.toggles li:before {
|
||||
display: inline;
|
||||
content: " | ";
|
||||
}
|
||||
div.toggles li:first-child:before {
|
||||
display: inline;
|
||||
content: "Toggles: ";
|
||||
}
|
||||
|
||||
/* Settings page */
|
||||
|
||||
table.settings {
|
||||
border-top: 1px solid black;
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
table.settings td,
|
||||
table.settings th {
|
||||
border-right: 1px solid black;
|
||||
border-bottom: 1px solid black;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
table.settings th {
|
||||
padding: 3pt 5pt 3pt 5pt ;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
background-color: #c0c0c0;
|
||||
}
|
||||
|
||||
table.settings td {
|
||||
padding: 2pt 5pt 2pt 5pt;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
table.settings td.settingscategory {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-weight: bold ;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
/* Search form */
|
||||
|
||||
h1.searchform {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.searchform {
|
||||
text-align: center;
|
||||
}
|
||||
div.searchform table {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Nav links */
|
||||
div.navbottom,
|
||||
div.navtop {
|
||||
font-size: 0.9em;
|
||||
text-align: right;
|
||||
margin-top: 1em;
|
||||
}
|
||||
div.navbottom {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
div.navtop {
|
||||
padding-bottom: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
div.navtop li,
|
||||
div.navbottom li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
div.navtop li:before,
|
||||
div.navbottom li:before {
|
||||
content: "| ";
|
||||
}
|
||||
|
||||
div.navtop li.first:before,
|
||||
div.navbottom li.first:before {
|
||||
content: ""
|
||||
}
|
||||
|
||||
div.navtop ul,
|
||||
div.navbottom ul {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px
|
||||
}
|
||||
|
||||
|
||||
/* Misc */
|
||||
|
||||
|
||||
.strongs, .morph {
|
||||
font-size: small;
|
||||
font-style: italic;
|
||||
}
|
||||
|
@ -0,0 +1,273 @@
|
||||
body {
|
||||
background-color: #d0d0d0;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
div.page
|
||||
{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
div.content
|
||||
{
|
||||
padding: 5px 5px 5px 25px;
|
||||
margin: 0px;
|
||||
background: #ffffff;
|
||||
border: solid #808080 1px;
|
||||
/* background-image: url('file://@prefix@/share/apps/kio_sword/swordvertical.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%; */
|
||||
}
|
||||
|
||||
|
||||
h1, h2, h3 {
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 135%;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-size: 120%;
|
||||
margin-left: -10px;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
font-size: 110%;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
h4, h5, h6 { font-size: 100%; }
|
||||
|
||||
|
||||
hr {
|
||||
text-align: center ;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #4000ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none ;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.text {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
td.page {
|
||||
background-color: #ffffff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jesusquote {
|
||||
color: red ;
|
||||
}
|
||||
|
||||
.versenumber {
|
||||
vertical-align: super;
|
||||
font-size: 0.7em ;
|
||||
}
|
||||
|
||||
.biblename {
|
||||
text-align: right ;
|
||||
color: #202020 ;
|
||||
font-style: italic;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
img.tableimg {
|
||||
display: block;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.error {
|
||||
font-size: 1.2em ;
|
||||
color: red ;
|
||||
}
|
||||
|
||||
.fixme {
|
||||
font-size: 1.2em ;
|
||||
color: red ;
|
||||
}
|
||||
|
||||
h1.moduletitle, h2.moduletitle, h1.bibleref, h2.biblref {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1.moduleslist {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Page links */
|
||||
div.links {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
div.links ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.links li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.links li:before {
|
||||
display: inline;
|
||||
content: " | ";
|
||||
}
|
||||
div.links li:first-child:before {
|
||||
display: inline;
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Page toggles */
|
||||
div.toggles {
|
||||
font-size: 90%;
|
||||
text-align: right;
|
||||
border-bottom: 1px solid #808080;
|
||||
border-left: 1px solid #808080;
|
||||
border-right: 1px solid #808080;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
background: #e0e0e0;
|
||||
}
|
||||
|
||||
div.toggles ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
div.toggles li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.toggles li:before {
|
||||
display: inline;
|
||||
content: " | ";
|
||||
}
|
||||
div.toggles li:first-child:before {
|
||||
display: inline;
|
||||
content: "Toggles: ";
|
||||
}
|
||||
|
||||
/* Settings page */
|
||||
|
||||
table.settings {
|
||||
border-top: 1px solid black;
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
table.settings td,
|
||||
table.settings th {
|
||||
border-right: 1px solid black;
|
||||
border-bottom: 1px solid black;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
table.settings th {
|
||||
padding: 3pt 5pt 3pt 5pt ;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
background-color: #c0c0c0;
|
||||
}
|
||||
|
||||
table.settings td {
|
||||
padding: 2pt 5pt 2pt 5pt;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
table.settings td.settingscategory {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-weight: bold ;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
/* Search form */
|
||||
|
||||
h1.searchform {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.searchform {
|
||||
text-align: center;
|
||||
}
|
||||
div.searchform table {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Nav links */
|
||||
div.navbottom,
|
||||
div.navtop {
|
||||
font-size: 0.9em;
|
||||
text-align: right;
|
||||
margin-top: 1em;
|
||||
}
|
||||
div.navbottom {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
div.navtop {
|
||||
padding-bottom: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
div.navtop li,
|
||||
div.navbottom li {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
div.navtop li:before,
|
||||
div.navbottom li:before {
|
||||
content: "| ";
|
||||
}
|
||||
|
||||
div.navtop li.first:before,
|
||||
div.navbottom li.first:before {
|
||||
content: ""
|
||||
}
|
||||
|
||||
div.navtop ul,
|
||||
div.navbottom ul {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px
|
||||
}
|
||||
|
||||
|
||||
/* Misc */
|
||||
|
||||
|
||||
.strongs, .morph {
|
||||
font-size: small;
|
||||
font-style: italic;
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
File: filter.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
using namespace sword;
|
||||
|
||||
namespace KioSword {
|
||||
class SwordOptions;
|
||||
|
||||
void FilterBase::setSwordOptions(const SwordOptions* options)
|
||||
{
|
||||
m_swordoptions = options;
|
||||
};
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/***************************************************************************
|
||||
File: filter.h
|
||||
Project: kio-sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef KS_FILTER_H
|
||||
#define KS_FILTER_H
|
||||
|
||||
#include <swbasicfilter.h>
|
||||
|
||||
namespace KioSword {
|
||||
class SwordOptions;
|
||||
|
||||
class FilterBase : public sword::SWBasicFilter {
|
||||
protected:
|
||||
const SwordOptions* m_swordoptions;
|
||||
public:
|
||||
void setSwordOptions(const SwordOptions* options);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,676 @@
|
||||
/***************************************************************************
|
||||
File: kio_sword.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
|
||||
File info:
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
// Mine
|
||||
#include "renderer.h"
|
||||
#include "kio_sword.h"
|
||||
#include "utils.h"
|
||||
#include "template.h"
|
||||
#include "option.h"
|
||||
|
||||
// KDE
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kurl.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
// Qt
|
||||
#include <qcstring.h>
|
||||
#include <qmap.h>
|
||||
|
||||
// Standard C++ /C
|
||||
#include <list>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace KIO;
|
||||
using std::list;
|
||||
using std::vector;
|
||||
|
||||
|
||||
// main --------------------------------------------------------------------------------------------------------
|
||||
extern "C" {
|
||||
int kdemain(int argc, char **argv) {
|
||||
KInstance instance("kio_sword");
|
||||
|
||||
kdDebug(7101) << "*** Starting kio_sword " << endl;
|
||||
|
||||
if (argc != 4) {
|
||||
kdDebug(7101) <<
|
||||
"Usage: kio_sword protocol domain-socket1 domain-socket2"
|
||||
<< endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
KioSword::SwordProtocol slave(argv[2], argv[3]);
|
||||
slave.dispatchLoop();
|
||||
|
||||
kdDebug(7101) << "*** kio_sword Done" << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
namespace KioSword
|
||||
{
|
||||
class SwordOptions;
|
||||
|
||||
// HTML fragments that will be initialised at run time -------------------------------------------------------------------------
|
||||
static QString search_form;
|
||||
static QString help_page;
|
||||
|
||||
|
||||
|
||||
SwordProtocol::SwordProtocol(const QCString & pool_socket,
|
||||
const QCString & app_socket)
|
||||
: SlaveBase("kio_sword", pool_socket, app_socket)
|
||||
{
|
||||
kdDebug() << "SwordProtocol::SwordProtocol()" << endl;
|
||||
m_config = KGlobal::config();
|
||||
}
|
||||
|
||||
|
||||
SwordProtocol::~SwordProtocol()
|
||||
{
|
||||
kdDebug() << "SwordProtocol::~SwordProtocol()" << endl;
|
||||
}
|
||||
|
||||
void SwordProtocol::get(const KURL & url)
|
||||
{
|
||||
QString modname;
|
||||
QString query;
|
||||
QString error;
|
||||
|
||||
kdDebug() << "SwordProtocol::get(const KURL& url)" << endl;
|
||||
|
||||
/* kdDebug() << "Seconds: " << url.query() << endl;
|
||||
QString remoteServer = url.host();
|
||||
int remotePort = url.port();
|
||||
kdDebug() << "myURL: " << url.prettyURL() << endl; */
|
||||
|
||||
// Send the mimeType as soon as it is known
|
||||
mimeType("text/html");
|
||||
|
||||
// Set user defaults from user config file
|
||||
// (with internal defaults supplied if any options
|
||||
// are missing from users config file)
|
||||
readUserConfig();
|
||||
|
||||
// Get options/actions from URL
|
||||
parseURL(url);
|
||||
|
||||
if (!m_path.isEmpty() && m_path != "/") {
|
||||
if (!m_path.startsWith("/")) {
|
||||
// sword:xxx is a shortcut for bible verses
|
||||
modname = m_options.defaultBible();
|
||||
if (modname.isEmpty())
|
||||
{
|
||||
error = i18n("No default Bible has been specified.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// do redirection
|
||||
query = m_path;
|
||||
KURL newurl(url);
|
||||
newurl.setPath('/' + modname + '/' + query);
|
||||
redirection(newurl);
|
||||
finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
modname = m_path.section('/', 0, 0, QString::SectionSkipEmpty);
|
||||
query = m_path.section('/', 1, -1, QString::SectionSkipEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
// handle redirections first
|
||||
if (m_action == REDIRECT_QUERY) {
|
||||
if (!m_redirect.module.isEmpty())
|
||||
modname = m_redirect.module;
|
||||
if (!m_redirect.query.isEmpty())
|
||||
query = m_redirect.query;
|
||||
|
||||
if (modname.isEmpty()) {
|
||||
switch (m_moduletype) {
|
||||
case DEFBIBLE:
|
||||
modname = m_options.defaultBible();
|
||||
error = i18n("No default Bible has been specified.");
|
||||
break;
|
||||
case GREEKSTRONGS:
|
||||
modname = m_options.defaultGreekStrongs();
|
||||
error = i18n("No default Greek Strongs module has been specified.");
|
||||
break;
|
||||
case HEBREWSTRONGS:
|
||||
modname = m_options.defaultHebrewStrongs();
|
||||
error = i18n("No default Hebrew Strongs module has been specified.");
|
||||
break;
|
||||
case GREEKMORPH:
|
||||
modname = m_options.defaultGreekMorph();
|
||||
error = i18n("No default Greek morphological module has been specified.");
|
||||
break;
|
||||
case HEBREWMORPH:
|
||||
modname = m_options.defaultHebrewMorph();
|
||||
error = i18n("No default Hebrew morphological module has been specified.");
|
||||
break;
|
||||
case DEFMODULETYPE_NONE:
|
||||
error = i18n("No module specified.");
|
||||
}
|
||||
}
|
||||
|
||||
if (modname.isEmpty()) {
|
||||
error = "<p class='usererror'>" + error + "</p><hr />";
|
||||
m_action = QUERY; // revert back to displaying list of modules
|
||||
} else {
|
||||
KURL newurl(url);
|
||||
// Remove anything that will trigger a redirection
|
||||
newurl.removeQueryItem("module");
|
||||
newurl.removeQueryItem("query");
|
||||
newurl.removeQueryItem("testsettings");
|
||||
newurl.removeQueryItem("modtype");
|
||||
newurl.setPath('/' + modname + '/' + query);
|
||||
redirection(newurl);
|
||||
finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the data
|
||||
Template* tmplt = new Template();
|
||||
tmplt->setCurrentPath(m_path);
|
||||
|
||||
switch (m_action) {
|
||||
case QUERY:
|
||||
if (!modname.isEmpty()) {
|
||||
m_renderer.moduleQuery(modname, query, m_options, tmplt);
|
||||
} else {
|
||||
QString body;
|
||||
tmplt->setTitle(i18n("Modules - Kio-Sword"));
|
||||
if (!error.isEmpty()) {
|
||||
body = error;
|
||||
}
|
||||
body += m_renderer.listModules(m_options);
|
||||
tmplt->setContent(body);
|
||||
}
|
||||
break;
|
||||
|
||||
case SEARCH_FORM:
|
||||
tmplt->setTitle(i18n("Search - Kio-Sword"));
|
||||
tmplt->setContent(searchForm(m_options));
|
||||
break;
|
||||
|
||||
case SEARCH_QUERY:
|
||||
tmplt->setTitle(i18n("Search Results - Kio-Sword"));
|
||||
tmplt->setContent(m_renderer.search(m_redirect.module, m_redirect.query, m_stype, m_options));
|
||||
break;
|
||||
|
||||
case SETTINGS_FORM:
|
||||
tmplt->setTitle(i18n("Settings - Kio-Sword"));
|
||||
tmplt->setContent(settingsForm());
|
||||
break;
|
||||
|
||||
case SETTINGS_SAVE:
|
||||
tmplt->setTitle(i18n("Settings saved - Kio-Sword"));
|
||||
tmplt->setContent(saveUserConfig());
|
||||
break;
|
||||
|
||||
case HELP:
|
||||
tmplt->setTitle(i18n("Kio-Sword Help"));
|
||||
tmplt->setContent(helpPage());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sendPage(tmplt);
|
||||
delete tmplt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SwordProtocol::mimetype(const KURL& url) {
|
||||
mimeType("text/html");
|
||||
finished();
|
||||
}
|
||||
|
||||
/* redefine data for QCStrings so we don't send the trailing
|
||||
null */
|
||||
void SwordProtocol::data(const QCString& text) {
|
||||
QByteArray nonull;
|
||||
nonull.setRawData(text.data(), text.size()-1);
|
||||
SlaveBase::data(nonull);
|
||||
nonull.resetRawData(text.data(), text.size()-1);
|
||||
}
|
||||
|
||||
void SwordProtocol::data(const QByteArray& array) {
|
||||
SlaveBase::data(array);
|
||||
}
|
||||
|
||||
void SwordProtocol::readUserConfig()
|
||||
{
|
||||
m_options.readFromConfig(m_config);
|
||||
}
|
||||
|
||||
QString SwordProtocol::saveUserConfig()
|
||||
{
|
||||
QString message;
|
||||
m_options.saveToConfig(m_config);
|
||||
m_config->sync();
|
||||
// search form depends on settings, so force it to be recreated
|
||||
search_form.truncate(0);
|
||||
message = "<p>" + i18n("Settings saved.") + "</p>";
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
#define ENUM_OPTION(option, tag, v) \
|
||||
if (!strcasecmp(key, tag)) { \
|
||||
option = v; \
|
||||
}
|
||||
|
||||
void SwordProtocol::parseURL(const KURL& url)
|
||||
{
|
||||
// Reset data members that should always be
|
||||
// retrieved from URL
|
||||
m_action = QUERY;
|
||||
m_path = QString::null;
|
||||
m_redirect.module = QString::null;
|
||||
m_redirect.query = QString::null;
|
||||
m_previous.module = QString::null;
|
||||
m_previous.query = QString::null;
|
||||
m_moduletype = DEFMODULETYPE_NONE;
|
||||
|
||||
if (url.hasPath())
|
||||
m_path = url.path();
|
||||
|
||||
m_options.readFromQueryString(url.queryItems(KURL::CaseInsensitiveKeys));
|
||||
|
||||
// URLs will be encoded in UTF-8 since they are sometimes
|
||||
// generated from the search form, and the browser will
|
||||
// encode in UTF-8 since the whole page has UTF-8 charset
|
||||
QMap<QString, QString> items = url.queryItems(KURL::CaseInsensitiveKeys, 106);
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
QMap<QString, QString>::const_iterator it_end = items.end();
|
||||
QString val;
|
||||
|
||||
const char *key;
|
||||
for(it = items.begin(); it != it_end; it++) {
|
||||
key = it.key().latin1();
|
||||
val = it.data();
|
||||
|
||||
if (!strcasecmp(key, "query")) {
|
||||
m_redirect.query = val;
|
||||
}
|
||||
else if (!strcasecmp(key, "module")) {
|
||||
m_redirect.module = val;
|
||||
}
|
||||
else if (!strcasecmp(key, "modtype")) {
|
||||
if (!strcasecmp(val, "bible")) {
|
||||
m_moduletype = DEFBIBLE;
|
||||
m_action = REDIRECT_QUERY;
|
||||
} else if (!strcasecmp(val, "greekstrongs")) {
|
||||
m_moduletype = GREEKSTRONGS;
|
||||
m_action = REDIRECT_QUERY;
|
||||
} else if (!strcasecmp(val, "hebrewstrongs")) {
|
||||
m_moduletype = HEBREWSTRONGS;
|
||||
m_action = REDIRECT_QUERY;
|
||||
} else if (!strcasecmp(val, "greekmorph")) {
|
||||
m_moduletype = GREEKMORPH;
|
||||
m_action = REDIRECT_QUERY;
|
||||
} else if (!strcasecmp(val, "hebrewmorph")) {
|
||||
m_moduletype = HEBREWMORPH;
|
||||
m_action = REDIRECT_QUERY;
|
||||
}
|
||||
}
|
||||
// search
|
||||
else if (!strcasecmp(key, "stype")) {
|
||||
if (!strcasecmp(val, "words")) {
|
||||
m_stype = Renderer::SEARCH_WORDS;
|
||||
} else if (!strcasecmp(val, "phrase")) {
|
||||
m_stype = Renderer::SEARCH_PHRASE;
|
||||
} else if (!strcasecmp(val, "regex")) {
|
||||
m_stype = Renderer::SEARCH_REGEX;
|
||||
} else {
|
||||
m_stype = Renderer::SEARCH_WORDS;
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
else ENUM_OPTION(m_action, "help", HELP)
|
||||
else ENUM_OPTION(m_action, "search", SEARCH_FORM)
|
||||
else ENUM_OPTION(m_action, "searchq", SEARCH_QUERY)
|
||||
else ENUM_OPTION(m_action, "settings", SETTINGS_FORM)
|
||||
else ENUM_OPTION(m_action, "savesettings", SETTINGS_SAVE)
|
||||
else ENUM_OPTION(m_action, "testsettings", REDIRECT_QUERY)
|
||||
|
||||
else if (!strcasecmp(key, "previouspath")) {
|
||||
m_previous.module = val.section('/', 0, 0, QString::SectionSkipEmpty);
|
||||
m_previous.query = val.section('/', 1, -1, QString::SectionSkipEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
// Once all the URL is parsed:
|
||||
if ((m_action == QUERY) && (
|
||||
!m_redirect.query.isEmpty() || !m_redirect.module.isEmpty()))
|
||||
m_action = REDIRECT_QUERY;
|
||||
}
|
||||
|
||||
#undef ENUM_OPTION
|
||||
|
||||
|
||||
void SwordProtocol::sendPage(const Template* tplt) {
|
||||
data(tplt->render(m_options));
|
||||
data(QByteArray()); // empty array means we're done sending the data
|
||||
finished();
|
||||
}
|
||||
|
||||
/** Returns a string representing notes about an option for the settings page
|
||||
*/
|
||||
template <class T>
|
||||
QString optionNotes(const Option<T>& option)
|
||||
{
|
||||
QString output;
|
||||
if (!option.m_propagate)
|
||||
{
|
||||
output += "<sup>1</sup>";
|
||||
}
|
||||
if (option.m_configName.isNull())
|
||||
{
|
||||
if (output.length() > 0)
|
||||
{
|
||||
output += "<sup>,</sup>";
|
||||
}
|
||||
output += "<sup>2</sup>";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/** HTML for a boolean option */
|
||||
QString settingsBooleanOptionRow(const QString& description, const Option<bool>& option) {
|
||||
static const QString boolean_option_row(
|
||||
"<tr><td>%1</td><td><nobr><input type='radio' name='%2' value='1' %3>%4 <input type='radio' name='%2' value='0' %5>%6</nobr></td><td>%2, %7</td></tr>");
|
||||
return boolean_option_row
|
||||
.arg(description + optionNotes(option))
|
||||
.arg(option.m_qsShortName)
|
||||
.arg(option.m_qsShortName)
|
||||
.arg(option.m_qsShortName)
|
||||
.arg(option() ? "checked" : "")
|
||||
.arg(i18n("On"))
|
||||
.arg(option() ? "" : "checked")
|
||||
.arg(i18n("Off"))
|
||||
.arg(option.m_qsLongName);
|
||||
}
|
||||
/** */
|
||||
|
||||
/** HTML for a general option row
|
||||
*
|
||||
* @param description User visible description of option
|
||||
* @param option option metadata
|
||||
* @param optionList HTML containing the <option>s
|
||||
* @return
|
||||
*/
|
||||
QString settingsGeneralOptionRow(const QString& description, const Option<QString>& option,
|
||||
const QString& optionList)
|
||||
{
|
||||
static const QString general_option_row(
|
||||
"<tr><td>%1</td><td><select name='%2'>%3</select></td><td>%4, %5</td></tr>");
|
||||
return general_option_row
|
||||
.arg(description + optionNotes(option))
|
||||
.arg(option.m_qsLongName)
|
||||
.arg(optionList)
|
||||
.arg(option.m_qsShortName)
|
||||
.arg(option.m_qsLongName);
|
||||
}
|
||||
|
||||
QString SwordProtocol::settingsForm() {
|
||||
QString output;
|
||||
QStringList modules;
|
||||
QStringList::Iterator it;
|
||||
QString temp;
|
||||
|
||||
static const QString separator_row(
|
||||
"<tr><td class='settingscategory' colspan='3'>%1</td></tr>");
|
||||
|
||||
|
||||
// Start output
|
||||
output += i18n("<h1>Settings</h1>"
|
||||
"<p>Select the settings using the form below. Use the 'Save settings' button to "
|
||||
" save these settings to your own configuration file. 'Test settings' will return "
|
||||
" you to the previous page with the options you have specified. <br>");
|
||||
|
||||
output += QString(
|
||||
"<form action='sword:/' method='GET'>"
|
||||
"<table class='settings' border=0 cellspacing=0>"
|
||||
" <tr><th>%1</th><th>%2</th><th>%4</th></tr>")
|
||||
.arg(i18n("Description"))
|
||||
.arg(i18n("Value"))
|
||||
.arg(i18n("URL parameter"));
|
||||
|
||||
output += separator_row.arg(i18n("Formatting options"));
|
||||
output += settingsBooleanOptionRow(i18n("Display verse numbers for Bible modules"), m_options.verseNumbers);
|
||||
output += settingsBooleanOptionRow(i18n("Insert line breaks between Bible verses"), m_options.verseLineBreaks);
|
||||
output += settingsBooleanOptionRow(i18n("Include footnotes."), m_options.footnotes);
|
||||
output += settingsBooleanOptionRow(i18n("Words of Christ in red."), m_options.redWords);
|
||||
output += settingsBooleanOptionRow(i18n("Display strongs numbers (for Bibles that include them)."), m_options.strongs);
|
||||
output += settingsBooleanOptionRow(i18n("Display morphological tags (for Bibles that include them)."), m_options.morph);
|
||||
|
||||
output += separator_row.arg(i18n("Language"));
|
||||
|
||||
// Locale
|
||||
QStringList locales = m_renderer.availableLocales();
|
||||
temp = "";
|
||||
for (int i = 0; i < locales.size(); i++)
|
||||
{
|
||||
temp += QString("<option value='%1' %3>%2</option>")
|
||||
.arg(locales[i])
|
||||
.arg(locales[i])
|
||||
.arg((m_options.locale() == locales[i]) ? "selected" : "");
|
||||
}
|
||||
output += settingsGeneralOptionRow(i18n("Locale"), m_options.locale, temp);
|
||||
|
||||
// Formatting options
|
||||
output += settingsBooleanOptionRow(i18n("Use Hebrew cantillation."), m_options.cantillation);
|
||||
output += settingsBooleanOptionRow(i18n("Show Hebrew vowel points."), m_options.hebrewVowelPoints);
|
||||
output += settingsBooleanOptionRow(i18n("Show Greek accents."), m_options.greekAccents);
|
||||
|
||||
output += separator_row.arg(i18n("Navigation options"));
|
||||
output += settingsBooleanOptionRow(i18n("Display the whole book when a Bible book is selected, instead of an index of the chapters"),
|
||||
m_options.wholeBook);
|
||||
output += settingsBooleanOptionRow(i18n("Display the booklist for bibles if no book is requested"),
|
||||
m_options.doBibleIndex);
|
||||
output += settingsBooleanOptionRow(i18n("Display an index for dictionaries if no entry is requested"),
|
||||
m_options.doDictIndex);
|
||||
output += settingsBooleanOptionRow(i18n("Display an index for other books if no entry is request"),
|
||||
m_options.doOtherIndex);
|
||||
output += settingsBooleanOptionRow(i18n("Display a full index for books that have a multiple level index, instead of just the first level"),
|
||||
m_options.doFullTreeIndex);
|
||||
|
||||
|
||||
// Default modules
|
||||
output += separator_row.arg(i18n("Default modules"));
|
||||
modules = m_renderer.moduleList();
|
||||
|
||||
vector<QString> dm_desc;
|
||||
vector<Option<QString> > dm_options;
|
||||
vector<QString>::size_type i;
|
||||
dm_desc.push_back(i18n("Default Bible"));
|
||||
dm_options.push_back(m_options.defaultBible);
|
||||
|
||||
dm_desc.push_back(i18n("Default Greek Strong's Lexicon"));
|
||||
dm_options.push_back(m_options.defaultGreekStrongs);
|
||||
|
||||
dm_desc.push_back(i18n("Default Hebrew Strong's Lexicon"));
|
||||
dm_options.push_back(m_options.defaultHebrewStrongs);
|
||||
|
||||
dm_desc.push_back(i18n("Default Greek Morphological Lexicon"));
|
||||
dm_options.push_back(m_options.defaultGreekMorph);
|
||||
|
||||
dm_desc.push_back(i18n("Default Hebrew Morphological Lexicon"));
|
||||
dm_options.push_back(m_options.defaultHebrewMorph);
|
||||
|
||||
for (i = 0; i < dm_options.size(); i++) {
|
||||
temp = QString("<option value='' %1> </option>")
|
||||
.arg(dm_options[i]().stripWhiteSpace().isEmpty() ? "selected" : "");
|
||||
|
||||
for (it = modules.begin(); it != modules.end(); ++it ) {
|
||||
temp += QString("<option value='%1' %3>%2</option>")
|
||||
.arg(*it)
|
||||
.arg(*it)
|
||||
.arg(((*it) == dm_options[i]() ? "selected" : ""));
|
||||
}
|
||||
output += settingsGeneralOptionRow(dm_desc[i], dm_options[i], temp);
|
||||
}
|
||||
|
||||
// Misc options
|
||||
output += separator_row.arg(i18n("Other options"));
|
||||
output += settingsBooleanOptionRow(i18n("Make formatting options propagate. This makes Kio-Sword remember formatting settings that you have set, by propagating them in the links. (Some navigation options are always excluded from this behaviour)."),
|
||||
m_options.propagate);
|
||||
|
||||
output += QString("</table>");
|
||||
|
||||
output += i18n("<p>Notes:<br/>"
|
||||
"1) These options never propagate<br/>"
|
||||
"2) These options are never saved<br/></p>");
|
||||
|
||||
output += QString(
|
||||
"<br><input type='hidden' name='module' value='%1'>" // redirection path
|
||||
"<input type='hidden' name='query' value='%2'>" // redirection path
|
||||
"<input type='submit' name='testsettings' value='%3'> " // "Test settings"
|
||||
"<input type='submit' name='savesettings' value='%4''>" // "Save settings"
|
||||
"</form>")
|
||||
.arg(m_previous.module)
|
||||
.arg(m_previous.query)
|
||||
.arg(i18n("Test settings"))
|
||||
.arg(i18n("Save settings"));
|
||||
|
||||
output += i18n("<hr><h1>Stylesheet</h1>"
|
||||
"<p>To further customise the appearance of the Kio-Sword page, you can make your own modified "
|
||||
"version of the style sheet. "
|
||||
"Simply copy the file '%1kio_sword/kio_sword.css' to $HOME/.kde/share/apps/kio_sword/ and modify it as desired. You may want to use the 'simplepage' option above to make the most of this.</p>")
|
||||
.arg(KGlobal::dirs()->findResourceDir("data", "kio_sword/kio_sword.css")); // FIXME - this must always return the system dir, not users dir.
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
QString SwordProtocol::helpPage() {
|
||||
if (help_page.isEmpty()) {
|
||||
help_page += i18n("<h1>Help</h1>"
|
||||
"<p>For full documentation, see <a href=\"help:/kio_sword\">installed help files</a>.</p>"
|
||||
"<p>Kio-Sword allows you to view SWORD modules (such as Bibles and commentaries) from Konqueror.\n"
|
||||
" These modules must already be installed - you can download them from <a href=\"http://www.crosswire.org/\">"
|
||||
"crosswire.org</a> or you can use a program such as <a href=\"http:/www.bibletime.info\">BibleTime</a> to help"
|
||||
" install them."
|
||||
"<h3>Quick help</h3>\n"
|
||||
"<ul>\n"
|
||||
" <li>To start, simply type <b><a href=\"sword:/\">sword:/</a></b> in the location bar, and follow the links like any normal web page<br /><br />\n"
|
||||
" <li>You can type the exact reference in the Location bar, instead of browsing to it, e.g.<br />\n"
|
||||
" <b>sword:/KJV/Hebrews 1:3-5</b> will look up Hebrews chapter 1 verses 3 to 5 in the King James Bible.<br /><br /></li>\n"
|
||||
" <li>You can specify various formatting options in the URL - see <a href=\"sword:/?settings\">Settings</a> for more info.<br /><br /></li>\n"
|
||||
" <li>To use your default Bible, just omit the first forward slash: <b>sword:Hebs 1:3-5</b> <br /><br /></li>\n"
|
||||
" <li>You can bookmark Kio-Sword pages just like any other web page.<br /><br /></li>\n"
|
||||
" <li>You can use keyboards shortcuts - press 'Ctrl' to activate 'Acess Keys' in Konqueror, \n"
|
||||
" and the following shortcuts are then available:"
|
||||
" <ul><li>'u' to go up</li>\n"
|
||||
" <li>'n' for next section/chapter</li>\n"
|
||||
" <li>'p' for previous section/chapter</li>\n"
|
||||
" <li>'t' for the module list</li>\n"
|
||||
" <li>'v' to toggle verse numbers</li>\n"
|
||||
" <li>'l' to toggle line breaks between verses</li>\n"
|
||||
" <li>'s' to toggle Strongs numbers</li>\n"
|
||||
" <li>'m' to toggle morphological tags</li>\n"
|
||||
" </ul>\n"
|
||||
" (Depending on the context, some of these will either not be available or won't be much use).<br/><br/>"
|
||||
" Also, remember the following Konqueror shortcuts to make keyboard navigation even better:<br/>"
|
||||
" <b>/</b> starts find-as-you-type<br/>"
|
||||
" <b>'</b> starts find-as-you-type for link text<br/>"
|
||||
" </li>\n"
|
||||
"</ul>\n"
|
||||
"<p>Problems, comments, feature requests? Email the author. "
|
||||
"<p>Author: <a href=\"mailto:L.Plant.98@cantab.net\">L.Plant.98@cantab.net</a>"
|
||||
"<p>Website: <a href=\"http://lukeplant.me.uk/kio-sword/\">http://lukeplant.me.uk/kio-sword/</a>.");
|
||||
}
|
||||
return help_page;
|
||||
}
|
||||
|
||||
QString SwordProtocol::searchForm(const SwordOptions& options) {
|
||||
static const QString search_form_tmpl(
|
||||
"<h1 class='searchform'>%1</h1>" // title
|
||||
"<div class='searchform'>"
|
||||
"<form action='sword:/' method='GET'>"
|
||||
" <table class='searchform'>"
|
||||
" <tr>"
|
||||
" <td><label for='query'>%2</label></td>" // Search terms
|
||||
" <td><input type='text' name='query'></td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td><label for='module'>%3</label></td>" // Module
|
||||
" <td><select name='module'>"
|
||||
" %4</select></td>" // (list of modules)
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td valign='top'><label for='stype'>%5</label></td>" // Search type
|
||||
" <td><input type='radio' name='stype' value='words' checked>%6<br>" // words
|
||||
" <input type='radio' name='stype' value='phrase'>%7<br>" // phrase
|
||||
" <input type='radio' name='stype' value='regex'>%8" // regex
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td colspan='2' align='center'><input type='submit' name='searchq' value='%9'></td>" // Search
|
||||
" </tr>"
|
||||
" </table>"
|
||||
"</form>"
|
||||
"</div>");
|
||||
|
||||
if (search_form.isEmpty()) { // avoid calculating this twice
|
||||
QStringList modules = m_renderer.moduleList();
|
||||
QString temp;
|
||||
QStringList::Iterator it;
|
||||
|
||||
temp = "<option value=''></option>";
|
||||
for (it = modules.begin(); it != modules.end(); ++it ) {
|
||||
temp += QString("<option value='%1' %3>%2</option>")
|
||||
.arg(*it)
|
||||
.arg(*it)
|
||||
.arg((*it == m_options.defaultBible()) ? "selected='selected'" : "");
|
||||
}
|
||||
search_form = search_form_tmpl
|
||||
.arg(i18n("Search"))
|
||||
.arg(i18n("Search terms"))
|
||||
.arg(i18n("Module"))
|
||||
.arg(temp)
|
||||
.arg(i18n("Search type"))
|
||||
.arg(i18n("Words"))
|
||||
.arg(i18n("Phrase"))
|
||||
.arg(i18n("Regular expression"))
|
||||
.arg(i18n("Search"));
|
||||
}
|
||||
// search_form is generated once, but we need to modify
|
||||
// form each time to include propagated values
|
||||
QString output(search_form);
|
||||
return output.replace("</form>", optionsAsHiddenFields(options) + "</form>");
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2004-2005 by Luke Plant *
|
||||
* L.Plant.98@cantab.net *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KIOSWORD_H
|
||||
#define KIOSWORD_H
|
||||
|
||||
#include "utils.h"
|
||||
#include "swordoptions.h"
|
||||
#include "renderer.h"
|
||||
|
||||
#include <kurl.h>
|
||||
#include <kconfig.h>
|
||||
#include <kio/slavebase.h>
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qcstring.h>
|
||||
|
||||
namespace KioSword {
|
||||
class Template;
|
||||
|
||||
class SwordProtocol : public KIO::SlaveBase {
|
||||
|
||||
public:
|
||||
SwordProtocol(const QCString & pool_socket,
|
||||
const QCString & app_socket);
|
||||
virtual ~SwordProtocol();
|
||||
virtual void mimetype(const KURL & url);
|
||||
virtual void get(const KURL & url);
|
||||
|
||||
protected:
|
||||
void data(const QCString& text);
|
||||
void data(const QByteArray& text);
|
||||
|
||||
void parseURL(const KURL & url);
|
||||
void readUserConfig();
|
||||
QString saveUserConfig();
|
||||
|
||||
void sendPage(const Template* tmplt);
|
||||
|
||||
QString helpPage();
|
||||
QString pageLinks(const SwordOptions& options);
|
||||
QString searchForm(const SwordOptions& options);
|
||||
QString settingsForm();
|
||||
|
||||
typedef enum { QUERY,
|
||||
REDIRECT_QUERY,
|
||||
SEARCH_FORM,
|
||||
SEARCH_QUERY,
|
||||
SETTINGS_FORM,
|
||||
SETTINGS_SAVE,
|
||||
HELP } ActionType;
|
||||
|
||||
Renderer m_renderer;
|
||||
SwordOptions m_options;
|
||||
ActionType m_action;
|
||||
DefModuleType m_moduletype;
|
||||
QString m_path;
|
||||
Renderer::SearchType m_stype;
|
||||
KURL m_baseurl;
|
||||
|
||||
struct {
|
||||
QString query;
|
||||
QString module;
|
||||
} m_previous;
|
||||
|
||||
struct {
|
||||
QString query;
|
||||
QString module;
|
||||
} m_redirect;
|
||||
|
||||
KConfig *m_config;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,16 @@
|
||||
Begin3
|
||||
Title: kio_sword -- Some description
|
||||
Version: 0.1
|
||||
Entered-date:
|
||||
Description:
|
||||
Keywords: KDE Qt
|
||||
Author: Luke Plant <L.Plant.98@cantab.net>
|
||||
Maintained-by: Luke Plant <L.Plant.98@cantab.net>
|
||||
Home-page:
|
||||
Alternate-site:
|
||||
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
|
||||
xxxxxx kio_sword-0.1.tar.gz
|
||||
xxx kio_sword-0.1.lsm
|
||||
Platform: Linux. Needs KDE
|
||||
Copying-policy: GPL
|
||||
End
|
@ -0,0 +1,236 @@
|
||||
/***************************************************************************
|
||||
File: ks_gbfhtml.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2003
|
||||
(file based on gbfhtmlhref.cpp and osiscgi.cpp)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "ks_gbfhtml.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <swmodule.h>
|
||||
#include <utilxml.h>
|
||||
#include <versekey.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace sword;
|
||||
|
||||
namespace KioSword {
|
||||
GBFHTML::GBFHTML() {
|
||||
setTokenStart("<");
|
||||
setTokenEnd(">");
|
||||
|
||||
setTokenCaseSensitive(true);
|
||||
|
||||
//addTokenSubstitute("Rf", ")</small></font>");
|
||||
addTokenSubstitute("FA", "<font color=\"#800000\">"); // for ASV footnotes to mark text
|
||||
addTokenSubstitute("Rx", "</a>");
|
||||
addTokenSubstitute("FI", "<i>"); // italics begin
|
||||
addTokenSubstitute("Fi", "</i>");
|
||||
addTokenSubstitute("FB", "<b>"); // bold begin
|
||||
addTokenSubstitute("Fb", "</b>");
|
||||
addTokenSubstitute("FR", "<span class='jesusquote'>"); // words of Jesus begin
|
||||
addTokenSubstitute("Fr", "</span>");
|
||||
addTokenSubstitute("FU", "<u>"); // underline begin
|
||||
addTokenSubstitute("Fu", "</u>");
|
||||
addTokenSubstitute("FO", "<cite>"); // Old Testament quote begin
|
||||
addTokenSubstitute("Fo", "</cite>");
|
||||
addTokenSubstitute("FS", "<sup>"); // Superscript begin// Subscript begin
|
||||
addTokenSubstitute("Fs", "</sup>");
|
||||
addTokenSubstitute("FV", "<sub>"); // Subscript begin
|
||||
addTokenSubstitute("Fv", "</sub>");
|
||||
addTokenSubstitute("TT", "<span class='title'>"); // Book title begin
|
||||
addTokenSubstitute("Tt", "</span>");
|
||||
addTokenSubstitute("PP", "<cite>"); // poetry begin
|
||||
addTokenSubstitute("Pp", "</cite>");
|
||||
addTokenSubstitute("Fn", "</font>"); // font end
|
||||
addTokenSubstitute("CL", "<br />"); // new line
|
||||
addTokenSubstitute("CM", "<br />"); // non showing comment
|
||||
addTokenSubstitute("CG", ""); // ???
|
||||
addTokenSubstitute("CT", ""); // ???
|
||||
addTokenSubstitute("JR", "<div align=\"right\">"); // right align begin
|
||||
addTokenSubstitute("JC", "<div align=\"center\">"); // center align begin
|
||||
addTokenSubstitute("JL", "</div>"); // align end
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool GBFHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
|
||||
const char *tok;
|
||||
char val[128];
|
||||
char *valto;
|
||||
const char *num;
|
||||
MyUserData *u = (MyUserData *)userData;
|
||||
|
||||
if (!substituteToken(buf, token)) {
|
||||
XMLTag tag(token);
|
||||
if (!strncmp(token, "w", 1)) {
|
||||
// OSIS Word (temporary until OSISRTF is done)
|
||||
valto = val;
|
||||
num = strstr(token, "lemma=\"x-Strongs:");
|
||||
if (num) {
|
||||
for (num+=17; ((*num) && (*num != '\"')); num++)
|
||||
*valto++ = *num;
|
||||
*valto = 0;
|
||||
if (atoi((!isdigit(*val))?val+1:val) < 5627) {
|
||||
buf += " <span class='strongs'><<a href=\"";
|
||||
buf += swordUrlForSearch(GREEKSTRONGS, val, m_swordoptions).utf8();
|
||||
buf += "\">";
|
||||
for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
|
||||
buf += *tok;
|
||||
buf += "</a>></span> ";
|
||||
//cout << buf;
|
||||
|
||||
}
|
||||
/* forget these for now
|
||||
else {
|
||||
// verb morph
|
||||
sprintf(wordstr, "%03d", word-1);
|
||||
module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
|
||||
}
|
||||
*/
|
||||
}
|
||||
valto = val;
|
||||
num = strstr(token, "morph=\"x-Robinson:");
|
||||
if (num) {
|
||||
for (num+=18; ((*num) && (*num != '\"')); num++)
|
||||
*valto++ = *num;
|
||||
*valto = 0;
|
||||
buf += " <span class='morph'>(<a href=\"";
|
||||
buf += swordUrlForSearch(GREEKMORPH, val, m_swordoptions).utf8();
|
||||
buf += "\">";
|
||||
for (tok = val; *tok; tok++)
|
||||
//if(*tok != '\"')
|
||||
buf += *tok;
|
||||
buf += "</a>)</span> ";
|
||||
}
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
|
||||
buf += " <span class='strongs'><<a href=\"";
|
||||
buf += swordUrlForSearch(GREEKSTRONGS, token + 2, m_swordoptions).utf8();
|
||||
buf += "\">";
|
||||
for (tok = token + 2; *tok; tok++)
|
||||
//if(token[i] != '\"')
|
||||
buf += *tok;
|
||||
buf += "</a>></span> ";
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
|
||||
buf += " <span class='morph'>(<a href=\"";
|
||||
buf += swordUrlForSearch(GREEKMORPH, token + 3, m_swordoptions).utf8();
|
||||
buf += "\">";
|
||||
for (tok = token + 3; *tok; tok++)
|
||||
if(*tok != '\"')
|
||||
buf += *tok;
|
||||
buf += "</a>)</span> ";
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
|
||||
buf += " <span class='morph'>(<a href=\"";
|
||||
buf += swordUrlForSearch(GREEKMORPH, token + 2, m_swordoptions).utf8();
|
||||
buf += "\">";
|
||||
for (tok = token + 2; *tok; tok++)
|
||||
if(*tok != '\"')
|
||||
buf += *tok;
|
||||
buf += "</a>)</span>";
|
||||
}
|
||||
|
||||
else if (!strcmp(tag.getName(), "RX")) {
|
||||
buf += "<a href=\"";
|
||||
buf += swordUrlForSearch(DEFBIBLE, token + 3, m_swordoptions);
|
||||
|
||||
/* FIXME - restore this, work out what it does
|
||||
for (tok = token + 3; *tok; tok++) {
|
||||
if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
|
||||
buf += *tok;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
buf += "\">";
|
||||
}
|
||||
|
||||
// FIXME - modify for Kio-Sword
|
||||
else if (!strcmp(tag.getName(), "RF")) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
|
||||
VerseKey *vkey;
|
||||
// see if we have a VerseKey * or descendant
|
||||
try {
|
||||
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
|
||||
}
|
||||
catch ( ... ) { }
|
||||
if (vkey) {
|
||||
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
|
||||
//char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
|
||||
buf.appendFormatted("<a href=\"noteID=%s.%c.%s\"><small><sup>*%c</sup></small></a> ", vkey->getText(), 'n', footnoteNumber.c_str(), 'n');
|
||||
}
|
||||
u->suspendTextPassThru = true;
|
||||
}
|
||||
else if (!strcmp(tag.getName(), "Rf")) {
|
||||
u->suspendTextPassThru = false;
|
||||
}
|
||||
/*
|
||||
else if (!strncmp(token, "RB", 2)) {
|
||||
buf += "<i> ";
|
||||
u->hasFootnotePreTag = true;
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "Rf", 2)) {
|
||||
buf += " <a href=\"note=";
|
||||
buf += u->lastTextNode.c_str();
|
||||
buf += "\">";
|
||||
buf += "<small><sup>*n</sup></small></a> ";
|
||||
// let's let text resume to output again
|
||||
u->suspendTextPassThru = false;
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "RF", 2)) {
|
||||
if (u->hasFootnotePreTag) {
|
||||
u->hasFootnotePreTag = false;
|
||||
buf += "</i> ";
|
||||
}
|
||||
u->suspendTextPassThru = true;
|
||||
}
|
||||
*/
|
||||
else if (!strncmp(token, "FN", 2)) {
|
||||
buf += "<font face=\"";
|
||||
for (tok = token + 2; *tok; tok++)
|
||||
if(*tok != '\"')
|
||||
buf += *tok;
|
||||
buf += "\">";
|
||||
}
|
||||
|
||||
else if (!strncmp(token, "CA", 2)) { // ASCII value
|
||||
buf += (char)atoi(&token[2]);
|
||||
}
|
||||
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
File: ks_gbfhtml.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2003
|
||||
(file based on gbfhtmlhref.h)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef KS_GBFHTML_H
|
||||
#define KS_GBFHTML_H
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
#include <swbasicfilter.h>
|
||||
#include <swkey.h>
|
||||
#include <swmodule.h>
|
||||
|
||||
namespace KioSword {
|
||||
/** this filter converts GBF text to HTML text with hrefs
|
||||
*/
|
||||
class GBFHTML : public FilterBase {
|
||||
protected:
|
||||
class MyUserData : public sword::BasicFilterUserData {
|
||||
public:
|
||||
MyUserData(const sword::SWModule *module, const sword::SWKey *key) : BasicFilterUserData(module, key) {}
|
||||
bool hasFootnotePreTag;
|
||||
};
|
||||
virtual sword::BasicFilterUserData *createUserData(const sword::SWModule *module, const sword::SWKey *key) {
|
||||
return new MyUserData(module, key);
|
||||
}
|
||||
virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData);
|
||||
public:
|
||||
GBFHTML();
|
||||
};
|
||||
}
|
||||
#endif
|
@ -0,0 +1,358 @@
|
||||
/***************************************************************************
|
||||
File: ks_osishtml.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2003
|
||||
(file based on osishtmlhref.cpp and osiscgi.cpp)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "ks_osishtml.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <utilxml.h>
|
||||
#include <versekey.h>
|
||||
#include <swmodule.h>
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace sword;
|
||||
|
||||
namespace KioSword {
|
||||
OSISHTML::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
|
||||
osisQToTick = ((!module->getConfigEntry("OSISqToTick")) || (strcmp(module->getConfigEntry("OSISqToTick"), "false")));
|
||||
}
|
||||
|
||||
|
||||
OSISHTML::OSISHTML() {
|
||||
setTokenStart("<");
|
||||
setTokenEnd(">");
|
||||
|
||||
setEscapeStart("&");
|
||||
setEscapeEnd(";");
|
||||
|
||||
setEscapeStringCaseSensitive(true);
|
||||
|
||||
addEscapeStringSubstitute("amp", "&");
|
||||
addEscapeStringSubstitute("apos", "'");
|
||||
addEscapeStringSubstitute("lt", "<");
|
||||
addEscapeStringSubstitute("gt", ">");
|
||||
addEscapeStringSubstitute("quot", "\"");
|
||||
addTokenSubstitute("lg", "<br />");
|
||||
addTokenSubstitute("/lg", "<br />");
|
||||
|
||||
setTokenCaseSensitive(true);
|
||||
}
|
||||
|
||||
|
||||
bool OSISHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
|
||||
// manually process if it wasn't a simple substitution
|
||||
if (!substituteToken(buf, token)) {
|
||||
MyUserData *u = (MyUserData *)userData;
|
||||
XMLTag tag(token);
|
||||
|
||||
// <w> tag
|
||||
if (!strcmp(tag.getName(), "w")) {
|
||||
if ((!tag.isEmpty()) && (!tag.isEndTag())) {
|
||||
// start <w> tag
|
||||
u->w = token;
|
||||
} else {
|
||||
// end <w> tag
|
||||
const char *attrib;
|
||||
const char *val;
|
||||
if (tag.isEndTag())
|
||||
tag = u->w.c_str();
|
||||
|
||||
if ((attrib = tag.getAttribute("xlit"))) {
|
||||
val = strchr(attrib, ':');
|
||||
val = (val) ? (val + 1) : attrib;
|
||||
buf.appendFormatted(" %s", val);
|
||||
}
|
||||
if ((attrib = tag.getAttribute("gloss"))) {
|
||||
val = strchr(attrib, ':');
|
||||
val = (val) ? (val + 1) : attrib;
|
||||
buf.appendFormatted(" %s", val);
|
||||
}
|
||||
if ((attrib = tag.getAttribute("lemma"))) {
|
||||
int count = tag.getAttributePartCount("lemma");
|
||||
int i = (count > 1) ? 0 : -1; // -1 for whole value cuz it's faster, but does the same thing as 0
|
||||
do {
|
||||
attrib = tag.getAttribute("lemma", i);
|
||||
if (i < 0) i = 0; // to handle our -1 condition
|
||||
val = strchr(attrib, ':');
|
||||
val = (val) ? (val + 1) : attrib;
|
||||
if (*val == 'G') {
|
||||
buf.append(QString(" <span class='strongs'><<a href=\"%2\">%1</a>></span> ")
|
||||
.arg(val+1)
|
||||
.arg(swordUrlForSearch(GREEKSTRONGS, val+1, m_swordoptions))
|
||||
.utf8());
|
||||
} else if (*val == 'H') {
|
||||
buf.append(QString(" <span class='strongs'><<a href=\"%2\">%1</a>></span> ")
|
||||
.arg(val+1)
|
||||
.arg(swordUrlForSearch(HEBREWSTRONGS, val+1, m_swordoptions))
|
||||
.utf8());
|
||||
}
|
||||
} while (++i < count);
|
||||
}
|
||||
if ((attrib = tag.getAttribute("morph"))) {
|
||||
int count = tag.getAttributePartCount("morph");
|
||||
int i = (count > 1) ? 0 : -1; // -1 for whole value cuz it's faster, but does the same thing as 0
|
||||
do {
|
||||
attrib = tag.getAttribute("morph", i);
|
||||
if (i < 0) i = 0; // to handle our -1 condition
|
||||
val = strchr(attrib, ':');
|
||||
val = (val) ? (val + 1) : attrib;
|
||||
if (!strncmp(attrib, "x-Robinson",10)) { //robinson codes
|
||||
buf.append(QString(" <span class='morph'>(<a href=\"%2\">%1</a>)</span> ")
|
||||
.arg(val)
|
||||
.arg(swordUrlForSearch(GREEKMORPH, val, m_swordoptions))
|
||||
.utf8());
|
||||
} else if ((*val == 'T')) {
|
||||
if (val[1] == 'G') {
|
||||
buf.append(QString(" <span class='morph'>(<a href=\"%2\">%1</a>)</span> ")
|
||||
.arg(val+1)
|
||||
.arg(swordUrlForSearch(GREEKMORPH, val+1, m_swordoptions))
|
||||
.utf8());
|
||||
} else if (val[1] == 'H') {
|
||||
buf.append(QString(" <span class='morph'>(<a href=\"%2\">%1</a>)</span> ")
|
||||
.arg(val+1)
|
||||
.arg(swordUrlForSearch(HEBREWMORPH, val+1, m_swordoptions))
|
||||
.utf8());
|
||||
}
|
||||
}
|
||||
} while (++i < count);
|
||||
}
|
||||
if ((attrib = tag.getAttribute("POS"))) {
|
||||
val = strchr(attrib, ':');
|
||||
val = (val) ? (val + 1) : attrib;
|
||||
buf.appendFormatted(" %s", val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <note> tag
|
||||
// FIXME - needs to be modified for Kio-Sword
|
||||
else if (!strcmp(tag.getName(), "note")) {
|
||||
if (!tag.isEndTag()) {
|
||||
if (!tag.isEmpty()) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
|
||||
if (type != "strongsMarkup") { // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
|
||||
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
|
||||
VerseKey *vkey;
|
||||
// see if we have a VerseKey * or descendant
|
||||
try {
|
||||
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
|
||||
}
|
||||
catch ( ... ) { }
|
||||
if (vkey) {
|
||||
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
|
||||
buf.appendFormatted("<a href=\"noteID=%s.%c.%s\"><small><sup>*%c</sup></small></a> ", vkey->getText(), ch, footnoteNumber.c_str(), ch);
|
||||
}
|
||||
}
|
||||
u->suspendTextPassThru = true;
|
||||
}
|
||||
}
|
||||
if (tag.isEndTag()) {
|
||||
u->suspendTextPassThru = false;
|
||||
}
|
||||
}
|
||||
|
||||
// <p> paragraph tag
|
||||
else if (!strcmp(tag.getName(), "p")) {
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) { // non-empty start tag
|
||||
buf += "<p>";
|
||||
}
|
||||
else if (tag.isEndTag()) { // end tag
|
||||
buf += "</P>";
|
||||
userData->supressAdjacentWhitespace = true;
|
||||
}
|
||||
else { // empty paragraph break marker
|
||||
buf += "<br />";
|
||||
userData->supressAdjacentWhitespace = true;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME - needs to be modified for Kio-Sword
|
||||
// <reference> tag
|
||||
else if (!strcmp(tag.getName(), "reference")) {
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
|
||||
buf += "<a href=\"\">";
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
buf += "</a>";
|
||||
}
|
||||
}
|
||||
|
||||
// <l> poetry, etc
|
||||
else if (!strcmp(tag.getName(), "l")) {
|
||||
if (tag.isEmpty()) {
|
||||
buf += "<br />";
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
buf += "<br />";
|
||||
}
|
||||
else if (tag.getAttribute("sID")) { // empty line marker
|
||||
buf += "<br />";
|
||||
}
|
||||
}
|
||||
|
||||
// <milestone type="line"/>
|
||||
else if ((!strcmp(tag.getName(), "milestone")) && (tag.getAttribute("type")) && (!strcmp(tag.getAttribute("type"), "line"))) {
|
||||
buf += "<br />";
|
||||
userData->supressAdjacentWhitespace = true;
|
||||
}
|
||||
|
||||
// <title>
|
||||
else if (!strcmp(tag.getName(), "title")) {
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
|
||||
buf += "<div class='title'>";
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
buf += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
// <hi> hi? hi contrast?
|
||||
else if (!strcmp(tag.getName(), "hi")) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
|
||||
if (type == "b" || type == "x-b") {
|
||||
buf += "<b>";
|
||||
u->inBold = true;
|
||||
}
|
||||
else { // all other types
|
||||
buf += "<i>";
|
||||
u->inBold = false;
|
||||
}
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
if(u->inBold) {
|
||||
buf += "</b>";
|
||||
u->inBold = false;
|
||||
}
|
||||
else
|
||||
buf += "</i>";
|
||||
}
|
||||
else { // empty hi marker
|
||||
// what to do? is this even valid?
|
||||
}
|
||||
}
|
||||
|
||||
// <q> quote
|
||||
else if (!strcmp(tag.getName(), "q")) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
SWBuf who = tag.getAttribute("who");
|
||||
const char *lev = tag.getAttribute("level");
|
||||
int level = (lev) ? atoi(lev) : 1;
|
||||
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
|
||||
/*buf += "{";*/
|
||||
|
||||
//alternate " and '
|
||||
if (u->osisQToTick)
|
||||
buf += (level % 2) ? '\"' : '\'';
|
||||
|
||||
if (who == "Jesus")
|
||||
buf += "<span class='jesusquote'>";
|
||||
else
|
||||
buf += "<span class='quote'>";
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
buf += "</span>";
|
||||
|
||||
//alternate " and '
|
||||
if (u->osisQToTick)
|
||||
buf += (level % 2) ? '\"' : '\'';
|
||||
|
||||
}
|
||||
else { // empty quote marker
|
||||
//alternate " and '
|
||||
if (u->osisQToTick)
|
||||
buf += (level % 2) ? '\"' : '\'';
|
||||
}
|
||||
}
|
||||
|
||||
// <transChange>
|
||||
else if (!strcmp(tag.getName(), "transChange")) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
|
||||
|
||||
// just do all transChange tags this way for now
|
||||
// if (type == "supplied")
|
||||
buf += "<i>";
|
||||
}
|
||||
else if (tag.isEndTag()) {
|
||||
buf += "</i>";
|
||||
}
|
||||
else { // empty transChange marker?
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME - remove for Kio-Sword?
|
||||
// image
|
||||
else if (!strcmp(tag.getName(), "figure")) {
|
||||
const char *src = tag.getAttribute("src");
|
||||
if (!src) // assert we have a src attribute
|
||||
return false;
|
||||
|
||||
char* filepath = new char[strlen(u->module->getConfigEntry("AbsoluteDataPath")) + strlen(token)];
|
||||
*filepath = 0;
|
||||
strcpy(filepath, userData->module->getConfigEntry("AbsoluteDataPath"));
|
||||
strcat(filepath, src);
|
||||
|
||||
// we do this because BibleCS looks for this EXACT format for an image tag
|
||||
buf+="<image src=\"";
|
||||
buf+=filepath;
|
||||
buf+="\" />";
|
||||
/*
|
||||
char imgc;
|
||||
for (c = filepath + strlen(filepath); c > filepath && *c != '.'; c--);
|
||||
c++;
|
||||
FILE* imgfile;
|
||||
if (strcasecmp(c, "jpg") || stricmp(c, "jpeg")) {
|
||||
imgfile = fopen(filepath, "r");
|
||||
if (imgfile != NULL) {
|
||||
buf += "{\\nonshppict {\\pict\\jpegblip ";
|
||||
while (feof(imgfile) != EOF) {
|
||||
buf.appendFormatted("%2x", fgetc(imgfile));
|
||||
}
|
||||
fclose(imgfile);
|
||||
buf += "}}";
|
||||
}
|
||||
}
|
||||
else if (strcasecmp(c, "png")) {
|
||||
buf += "{\\*\\shppict {\\pict\\pngblip ";
|
||||
|
||||
buf += "}}";
|
||||
}
|
||||
*/
|
||||
delete [] filepath;
|
||||
}
|
||||
|
||||
else {
|
||||
return false; // we still didn't handle token
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/***************************************************************************
|
||||
File: ks_osishtml.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2003
|
||||
(file based on osishtmlhref.h)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KS_OSISHTML_H
|
||||
#define KS_OSISHTML_H
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
#include <swbasicfilter.h>
|
||||
#include <swkey.h>
|
||||
#include <swmodule.h>
|
||||
|
||||
using namespace sword;
|
||||
|
||||
namespace KioSword {
|
||||
/** this filter converts OSIS text to HTML text with hrefs */
|
||||
class OSISHTML : public FilterBase {
|
||||
private:
|
||||
protected:
|
||||
class MyUserData : public sword::BasicFilterUserData {
|
||||
public:
|
||||
bool osisQToTick;
|
||||
bool inBold;
|
||||
sword::SWBuf lastTransChange;
|
||||
sword::SWBuf w;
|
||||
sword::SWBuf fn;
|
||||
MyUserData(const sword::SWModule *module, const sword::SWKey *key);
|
||||
};
|
||||
virtual BasicFilterUserData* createUserData(const sword::SWModule *module, const sword::SWKey *key) {
|
||||
return new MyUserData(module, key);
|
||||
}
|
||||
virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData);
|
||||
public:
|
||||
OSISHTML();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,222 @@
|
||||
/***************************************************************************
|
||||
File: ks_thmlhtml.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2001
|
||||
(file based on thmlhtmlhref.cpp)
|
||||
and the BibleTime team (bits taken from bt_thmlhtml.cpp)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "ks_thmlhtml.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <swmodule.h>
|
||||
#include <utilxml.h>
|
||||
#include <versekey.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace sword;
|
||||
|
||||
namespace KioSword {
|
||||
ThMLHTML::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
|
||||
if (module) {
|
||||
version = module->Name();
|
||||
BiblicalText = (!strcmp(module->Type(), "Biblical Texts"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ThMLHTML::ThMLHTML() {
|
||||
setTokenStart("<");
|
||||
setTokenEnd(">");
|
||||
|
||||
setTokenCaseSensitive(true);
|
||||
addTokenSubstitute("scripture", "<i> ");
|
||||
addTokenSubstitute("/scripture", "</i> ");
|
||||
}
|
||||
|
||||
|
||||
bool ThMLHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
|
||||
const char *tok;
|
||||
if (!substituteToken(buf, token)) { // manually process if it wasn't a simple substitution
|
||||
MyUserData *u = (MyUserData *)userData;
|
||||
|
||||
XMLTag tag(token);
|
||||
if ((!tag.isEndTag()) && (!tag.isEmpty()))
|
||||
u->startTag = tag;
|
||||
|
||||
if (tag.getName() && !strcasecmp(tag.getName(), "sync")) { //lemmas, morph codes or strongs
|
||||
if (tag.getAttribute("type") && !strcasecmp(tag.getAttribute("type"), "lemma")) { // Lemma
|
||||
const char *value = tag.getAttribute("value");
|
||||
if (strlen(value)) {
|
||||
buf.appendFormatted
|
||||
(" <span class='lemma'><%s></span>", value);
|
||||
}
|
||||
} else if (tag.getAttribute("type") && !strcasecmp(tag.getAttribute("type"), "morph")) { // Morph
|
||||
const char *value = tag.getAttribute("value");
|
||||
if (value) {
|
||||
buf.append(QString(" <span class='morph'>(<a href=\"%2\">%1</a>)</span>")
|
||||
.arg(value)
|
||||
.arg(swordUrlForSearch(GREEKMORPH, value, m_swordoptions))
|
||||
.utf8());
|
||||
}
|
||||
} else if (tag.getAttribute("type") && !strcasecmp(tag.getAttribute("type"), "Strongs")) { // Strongs
|
||||
const char *value =
|
||||
tag.getAttribute("value");
|
||||
if (value && value[0] == 'H') { // hewbrew strongs number
|
||||
// value + 1 => skip the H
|
||||
buf.append(QString(" <span class='strongs'><<a href=\"%2\">%1</a>></span>")
|
||||
.arg(value + 1)
|
||||
.arg(swordUrlForSearch(HEBREWSTRONGS, value + 1, m_swordoptions))
|
||||
.utf8());
|
||||
} else if (value && value[0] == 'G') { //greek strongs number
|
||||
// value + 1 => skip the G
|
||||
buf.append(QString(" <span class='strongs'><<a href=\"%2\">%1</a>></span>")
|
||||
.arg(value + 1)
|
||||
.arg(swordUrlForSearch(GREEKSTRONGS, value + 1, m_swordoptions))
|
||||
.utf8());
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME - modify for Kio-Sword
|
||||
// <note> tag
|
||||
else if (!strcmp(tag.getName(), "note")) {
|
||||
if (!tag.isEndTag()) {
|
||||
if (!tag.isEmpty()) {
|
||||
SWBuf type = tag.getAttribute("type");
|
||||
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
|
||||
VerseKey *vkey;
|
||||
// see if we have a VerseKey * or descendant
|
||||
try {
|
||||
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
|
||||
}
|
||||
catch ( ... ) { }
|
||||
if (vkey) {
|
||||
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
|
||||
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
|
||||
buf.appendFormatted("<a href=\"noteID=%s.%c.%s\"><small><sup>*%c</sup></small></a> ", vkey->getText(), ch, footnoteNumber.c_str(), ch);
|
||||
}
|
||||
u->suspendTextPassThru = true;
|
||||
}
|
||||
}
|
||||
if (tag.isEndTag()) {
|
||||
u->suspendTextPassThru = false;
|
||||
}
|
||||
}
|
||||
// <scripRef> tag
|
||||
else if (!strcmp(tag.getName(), "scripRef")) {
|
||||
if (!tag.isEndTag()) {
|
||||
if (!tag.isEmpty()) {
|
||||
u->suspendTextPassThru = true;
|
||||
}
|
||||
}
|
||||
if (tag.isEndTag()) { // </scripRef>
|
||||
if (!u->BiblicalText) {
|
||||
SWBuf refList = u->startTag.getAttribute("passage");
|
||||
if (!refList.length())
|
||||
refList = u->lastTextNode;
|
||||
SWBuf version = tag.getAttribute("version");
|
||||
buf += "<a href=\"";
|
||||
buf += swordUrlForSearch(DEFBIBLE, refList.c_str(), m_swordoptions).utf8();
|
||||
/* TODO - can we do with in KioSword?
|
||||
if (version.length()) {
|
||||
buf += "&version=";
|
||||
buf += version;
|
||||
buf += " ";
|
||||
}*/
|
||||
buf += "\">";
|
||||
buf += u->lastTextNode.c_str();
|
||||
buf += "</a>";
|
||||
}
|
||||
// FIXME for Kio-Sword
|
||||
else {
|
||||
SWBuf footnoteNumber = u->startTag.getAttribute("swordFootnote");
|
||||
VerseKey *vkey;
|
||||
// see if we have a VerseKey * or descendant
|
||||
try {
|
||||
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
|
||||
}
|
||||
catch ( ... ) {}
|
||||
if (vkey) {
|
||||
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
|
||||
buf.appendFormatted("<a href=\"noteID=%s.x.%s\"><small><sup>*x</sup></small></a> ", vkey->getText(), footnoteNumber.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// let's let text resume to output again
|
||||
u->suspendTextPassThru = false;
|
||||
}
|
||||
}
|
||||
else if (tag.getName() && !strcasecmp(tag.getName(), "div")) {
|
||||
if (tag.isEndTag() && u->SecHead) {
|
||||
buf += "</i></b><br />";
|
||||
u->SecHead = false;
|
||||
}
|
||||
else if (tag.getAttribute("class")) {
|
||||
if (!strcasecmp(tag.getAttribute("class"), "sechead")) {
|
||||
u->SecHead = true;
|
||||
buf += "<br /><b><i>";
|
||||
}
|
||||
else if (!strcasecmp(tag.getAttribute("class"), "title")) {
|
||||
u->SecHead = true;
|
||||
buf += "<br /><b><i>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag.getName() && (!strcasecmp(tag.getName(), "img") || !strcasecmp(tag.getName(), "image"))) {
|
||||
const char *src = strstr(token, "src");
|
||||
if (!src) // assert we have a src attribute
|
||||
return false;
|
||||
|
||||
buf += '<';
|
||||
for (const char *c = token; *c; c++) {
|
||||
if (c == src) {
|
||||
for (;((*c) && (*c != '"')); c++)
|
||||
buf += *c;
|
||||
|
||||
if (!*c) { c--; continue; }
|
||||
|
||||
buf += '"';
|
||||
if (*(c+1) == '/') {
|
||||
buf += "file:";
|
||||
buf += userData->module->getConfigEntry("AbsoluteDataPath");
|
||||
if (buf[buf.length()-2] == '/')
|
||||
c++; // skip '/'
|
||||
}
|
||||
continue;
|
||||
}
|
||||
buf += *c;
|
||||
}
|
||||
buf += '>';
|
||||
}
|
||||
else {
|
||||
buf += '<';
|
||||
/*for (const char *tok = token; *tok; tok++)
|
||||
buf += *tok;*/
|
||||
buf += token;
|
||||
buf += '>';
|
||||
//return false; // we still didn't handle token
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
File: ks_thmlhtml.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
and CrossWire Bible Society 2001
|
||||
(file based on thmlhtmlhref.cpp)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KS_THMLHTML_H
|
||||
#define KS_THMLHTML_H
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
#include <swbasicfilter.h>
|
||||
#include <utilxml.h>
|
||||
#include <swkey.h>
|
||||
#include <swmodule.h>
|
||||
|
||||
namespace KioSword {
|
||||
/** this filter converts ThML text to HTML text with hrefs
|
||||
*/
|
||||
class ThMLHTML : public FilterBase {
|
||||
protected:
|
||||
class MyUserData : public sword::BasicFilterUserData {
|
||||
public:
|
||||
MyUserData(const sword::SWModule *module, const sword::SWKey *key);
|
||||
sword::SWBuf inscriptRef;
|
||||
bool SecHead;
|
||||
bool BiblicalText;
|
||||
sword::SWBuf version;
|
||||
sword::XMLTag startTag;
|
||||
};
|
||||
virtual sword::BasicFilterUserData* createUserData(const sword::SWModule *module, const sword::SWKey *key) {
|
||||
return new MyUserData(module, key);
|
||||
}
|
||||
virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData);
|
||||
public:
|
||||
ThMLHTML();
|
||||
};
|
||||
}
|
||||
#endif /* KS_THMLHTML_H */
|
@ -0,0 +1,300 @@
|
||||
/***************************************************************************
|
||||
File: option.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef option_h
|
||||
#define option_h
|
||||
|
||||
#include <kconfig.h>
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qmap.h>
|
||||
|
||||
namespace KioSword
|
||||
{
|
||||
class OptionBase
|
||||
{
|
||||
public:
|
||||
virtual void readFromQueryString(QMap<QString, QString> params, bool allowPropagating) = 0;
|
||||
virtual void getQueryStringPair(QString& name, QString& val) = 0;
|
||||
virtual void readFromConfig(const KConfig* config) = 0;
|
||||
virtual void saveToConfig(KConfig* config) = 0;
|
||||
virtual void copy(const OptionBase* other) = 0;
|
||||
|
||||
virtual ~OptionBase() {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Template class for options that can be read/saved to a query string
|
||||
* or config file and are used at run time to determine various things
|
||||
*
|
||||
*/
|
||||
template <class T>
|
||||
class Option : public OptionBase
|
||||
{
|
||||
protected:
|
||||
T m_value; // current value
|
||||
T m_propagate_value; // value we are going to propagate when creating URLs
|
||||
T m_default_value; // KioSWord internal default
|
||||
T m_config_value; // User's default
|
||||
|
||||
/** Convert a value from a string to the option's type */
|
||||
static const T fromString(const QString& val)
|
||||
{
|
||||
// We will specialise this function later
|
||||
// to work correctly
|
||||
T result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Convert the option to a string for use in query strings */
|
||||
QString toString(T val)
|
||||
{
|
||||
// Will specialise this later
|
||||
QString result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/** return the config setting */
|
||||
T readConfigSetting(const KConfig* config)
|
||||
{
|
||||
// We will specialise this later
|
||||
T result;
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
QString m_qsShortName; // short name in querystring
|
||||
QString m_qsLongName; // long name in querystring
|
||||
bool m_propagate; // true if this option can be propagated
|
||||
QString m_configName; // name of config setting in config file
|
||||
|
||||
Option()
|
||||
{
|
||||
};
|
||||
|
||||
virtual ~Option()
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets up the names and default value of the option
|
||||
*
|
||||
* Setting configName to "" means the option is never put into the config file
|
||||
* Setting both qsShortName and qsLongName to "" means the option is never put
|
||||
* in the query string.
|
||||
*
|
||||
* @param default_value the value the option if not set from anywhere else
|
||||
* @param configName the name the option has in the config file, or "" to never save or read from config
|
||||
* @param qsShortName the short name for the option when used in a query string
|
||||
* @param qsLongName the long name for the option when use in a query string
|
||||
* @param propagate true if this parameter can be propagated in generated query strings
|
||||
*/
|
||||
void setup(const T& default_value, const QString& configName, const QString& qsShortName, const QString& qsLongName, bool propagate)
|
||||
{
|
||||
m_value = default_value;
|
||||
m_default_value = default_value;
|
||||
m_config_value = default_value; // assume this for now
|
||||
m_propagate_value = m_value;
|
||||
m_configName = configName;
|
||||
m_qsShortName = qsShortName;
|
||||
m_qsLongName = qsLongName;
|
||||
m_propagate = propagate;
|
||||
}
|
||||
|
||||
/** Get the value of the option */
|
||||
const T& operator() () const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
/** Set the value of the option (including the value to propagate) */
|
||||
void set(const T& value)
|
||||
{
|
||||
m_value = value;
|
||||
m_propagate_value = value;
|
||||
}
|
||||
|
||||
/** read and set the option from the querystring */
|
||||
virtual void readFromQueryString(QMap<QString, QString> params, bool allowPropagating)
|
||||
{
|
||||
T newval;
|
||||
bool found = false;
|
||||
|
||||
/* // Start with defaults. We have to do this
|
||||
// because these objects are re-used from one request to the next
|
||||
m_value = m_config_value;
|
||||
m_propagate_value = m_config_value;*/
|
||||
|
||||
// Search for short name
|
||||
QMap<QString, QString>::const_iterator it = params.find(m_qsShortName);
|
||||
if (it != params.end())
|
||||
{
|
||||
newval = fromString(it.data());
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
// Search for long name
|
||||
it = params.find(m_qsLongName);
|
||||
if (it != params.end())
|
||||
{
|
||||
newval = fromString(it.data());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
m_value = newval;
|
||||
if (m_propagate && allowPropagating) {
|
||||
m_propagate_value = newval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** set the name and value of a query string pair */
|
||||
virtual void getQueryStringPair(QString& name, QString& val)
|
||||
{
|
||||
// To keep things tidy, we don't propagate in the
|
||||
// query string values that wouldn't make a difference
|
||||
// i.e. if current value is the same as config,
|
||||
// don't propagate
|
||||
if (m_propagate_value != m_config_value) {
|
||||
if (m_qsShortName.isEmpty())
|
||||
name.append(m_qsLongName);
|
||||
else
|
||||
name.append(m_qsShortName.copy());
|
||||
val.append(toString(m_propagate_value));
|
||||
}
|
||||
}
|
||||
|
||||
/** read and set the value from the config file, or set to default if no config setting */
|
||||
virtual void readFromConfig(const KConfig* config)
|
||||
{
|
||||
if (!m_configName.isEmpty())
|
||||
{
|
||||
set(readConfigSetting(config));
|
||||
}
|
||||
else
|
||||
{
|
||||
set(m_default_value);
|
||||
}
|
||||
m_config_value = m_value;
|
||||
}
|
||||
|
||||
/** save the value to the config file */
|
||||
virtual void saveToConfig(KConfig* config)
|
||||
{
|
||||
if (!m_configName.isEmpty())
|
||||
{
|
||||
// overloads for KConfig::writeEntry cater
|
||||
// for everything we need so far
|
||||
if (m_value != m_default_value) // keep settings file tidy
|
||||
{
|
||||
config->writeEntry(m_configName, m_value);
|
||||
m_config_value = m_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
config->deleteEntry(m_configName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** copy value from another */
|
||||
virtual void copy(const OptionBase* other)
|
||||
{
|
||||
// we must ensure that we only copy from an object
|
||||
// of the same type.
|
||||
const Option<T>* other2 = (Option<T>*)other;
|
||||
|
||||
// m_configName, m_default_value, m_qsShortName and m_qsLongName, and m_propagate
|
||||
// have already been set up correctly (those don't change fromString
|
||||
// the values given in the setup() method)
|
||||
m_value = other2->m_value;
|
||||
m_config_value = other2->m_config_value;
|
||||
m_propagate_value = other2->m_propagate_value;
|
||||
}
|
||||
};
|
||||
|
||||
// Specialisations
|
||||
|
||||
// fromString specialisations
|
||||
template<>
|
||||
inline const bool Option<bool>::fromString(const QString& val)
|
||||
{
|
||||
if (val == "0")
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline const QString Option<QString>::fromString(const QString& val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline const int Option<int>::fromString(const QString& val)
|
||||
{
|
||||
return val.toInt();
|
||||
}
|
||||
|
||||
// toString specialisations
|
||||
template<>
|
||||
inline QString Option<bool>::toString(bool val)
|
||||
{
|
||||
return val ? QString("1"): QString("0");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline QString Option<QString>::toString(QString val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline QString Option<int>::toString(int val)
|
||||
{
|
||||
return QString::number(val);
|
||||
}
|
||||
|
||||
// readConfigSetting specialisations
|
||||
template<>
|
||||
inline bool Option<bool>::readConfigSetting(const KConfig* config)
|
||||
{
|
||||
return config->readBoolEntry(m_configName, m_default_value);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline QString Option<QString>::readConfigSetting(const KConfig* config)
|
||||
{
|
||||
return config->readEntry(m_configName, m_default_value);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline int Option<int>::readConfigSetting(const KConfig* config)
|
||||
{
|
||||
return config->readNumEntry(m_configName, m_default_value);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
KDE_ICON = kio_sword
|
||||
|
||||
EXTRA_DIST = kio_sword_everything.svg \
|
||||
kio_sword_borders.xcf \
|
||||
hisc-app-kio_sword.svgz \
|
||||
hi128-app-kio_sword.png \
|
||||
hi64-app-kio_sword.png \
|
||||
hi48-app-kio_sword.png \
|
||||
hi32-app-kio_sword.png \
|
||||
hi22-app-kio_sword.png \
|
||||
hi16-app-kio_sword.png
|
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 679 B |
After Width: | Height: | Size: 1011 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 56 KiB |
@ -0,0 +1,131 @@
|
||||
/***************************************************************************
|
||||
File: renderer.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef KS_RENDERER_H
|
||||
#define KS_RENDERER_H
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
#include <swmgr.h>
|
||||
#include <swmodule.h>
|
||||
#include <versekey.h>
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
|
||||
/** Handles sword backend and prints modules
|
||||
*
|
||||
* Renderer inherits from sword::SWMgr and handles the majority of
|
||||
* the sword stuff. It also adds functions to 'print' text from
|
||||
* a specified module and to list available modules.
|
||||
*
|
||||
* All output is in HTML, and unicode characters are not converted
|
||||
* to HTML entities (this allows the calling function to decide
|
||||
* what encoding to use in the web page e.g. utf 8 could be used
|
||||
* and no transformation would need to be done).
|
||||
*
|
||||
*/
|
||||
|
||||
namespace KioSword {
|
||||
class SwordOptions;
|
||||
class Template;
|
||||
|
||||
class Renderer : public sword::SWMgr {
|
||||
|
||||
public:
|
||||
Renderer();
|
||||
virtual ~Renderer();
|
||||
|
||||
typedef enum { SEARCH_WORDS,
|
||||
SEARCH_PHRASE,
|
||||
SEARCH_REGEX } SearchType;
|
||||
|
||||
/** Return an HTML snippet of specified key from module
|
||||
*
|
||||
* @param module The sword module to print from
|
||||
* @param key The text description of the key from the users URL
|
||||
* @param options Options for rendering text
|
||||
* @param tmplt Output parameter that should be filled with title and content
|
||||
*/
|
||||
void moduleQuery(const QString &module, const QString &ref, const SwordOptions &options, Template* tmplt);
|
||||
|
||||
QString search(const QString &module, const QString &query, SearchType stype, const SwordOptions &options);
|
||||
|
||||
/** Return an HTML snippet containing a hyperlinked table of modules
|
||||
*/
|
||||
QString listModules(const SwordOptions &options);
|
||||
void setOptions(const SwordOptions &options);
|
||||
QStringList moduleList();
|
||||
QStringList availableLocales();
|
||||
|
||||
|
||||
protected:
|
||||
typedef enum { BIBLE, COMMENTARY, LEXDICT, GENERIC, NUM_MODULE_TYPES } ModuleType ;
|
||||
enum KeyType { SWKEY, VERSEKEY, TREEKEY } ;
|
||||
void setModuleFilter(sword::SWModule *module, const SwordOptions* options);
|
||||
|
||||
ModuleType getModuleType(sword::SWModule *module);
|
||||
QString indexBible(sword::SWModule *module, const SwordOptions& options);
|
||||
QString indexBook(sword::SWModule *module, const SwordOptions& options);
|
||||
QString indexTree(sword::SWModule *module, const SwordOptions& options, bool fromTop, const int depth = -1);
|
||||
|
||||
void verseQuery(sword::SWModule *module, const QString &query, const SwordOptions &options,
|
||||
ModuleType modtype, Template* tmplt, QString &navlinks);
|
||||
void treeQuery(sword::SWModule *module, const QString &query, const SwordOptions &options,
|
||||
ModuleType modtype, Template* tmplt, QString &navlinks);
|
||||
void normalQuery(sword::SWModule *module, const QString &query, const SwordOptions &options,
|
||||
ModuleType modtype, Template* tmplt, QString &navlinks);
|
||||
|
||||
static QString renderText(sword::SWModule *module);
|
||||
static QString chapterList(const QString &modname, const sword::VerseKey *vk, const SwordOptions& options);
|
||||
|
||||
static QString chapterLink(const QString &modname, const sword::VerseKey *vk, const SwordOptions& options);
|
||||
static QString chapterLink(const QString &modname, const sword::SWKey *sk, const SwordOptions& options);
|
||||
|
||||
static QString bookLink(const QString &modname, const sword::VerseKey *vk, const SwordOptions& options);
|
||||
static QString bookLink(const QString &modname, const sword::SWKey *sk, const SwordOptions& options);
|
||||
|
||||
static QString bookChapter(const sword::SWKey *sk);
|
||||
static QString bookChapter(const sword::VerseKey *vk);
|
||||
|
||||
static QString bookName(const sword::SWKey *sk);
|
||||
static QString bookName(const sword::VerseKey *vk);
|
||||
|
||||
FilterBase *m_osisfilter;
|
||||
FilterBase *m_gbffilter;
|
||||
FilterBase *m_thmlfilter;
|
||||
sword::SWFilter *m_plainfilter;
|
||||
sword::SWFilter *m_rtffilter;
|
||||
|
||||
std::set<sword::SWModule *, std::less<sword::SWModule *> > m_modset;
|
||||
std::vector<const char *> m_moduleTypes;
|
||||
std::vector<QString> m_moduleTypeNames;
|
||||
|
||||
};
|
||||
}
|
||||
#endif // KS_RENDERER_H
|
||||
|
@ -0,0 +1,13 @@
|
||||
[Protocol]
|
||||
exec=kio_sword
|
||||
protocol=sword
|
||||
input=none
|
||||
output=filesystem
|
||||
reading=true
|
||||
defaultMimetype=text/html
|
||||
Icon=kio_sword
|
||||
Description=A kioslave for quick access to Bible texts within Konqueror
|
||||
DocPath=kio_sword/index.html
|
||||
determineMimetypeFromExtension=false
|
||||
Class=:local
|
||||
URIMode=uri
|
@ -0,0 +1,174 @@
|
||||
/***************************************************************************
|
||||
File: swordoptions.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
// Internal
|
||||
#include "swordoptions.h"
|
||||
#include "option.h"
|
||||
|
||||
|
||||
// Std C/C++
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
|
||||
using std::vector;
|
||||
|
||||
namespace KioSword
|
||||
{
|
||||
SwordOptions::SwordOptions()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void SwordOptions::init()
|
||||
{
|
||||
// Setup all the options
|
||||
propagate.setup (true, "PropagateOptions", "p", "propagate", true);
|
||||
verseNumbers.setup (true, "VerseNumbers", "vn", "versenumbers", true);
|
||||
verseLineBreaks.setup (true, "VerseLineBreaks", "lb", "linebreaks", true);
|
||||
redWords.setup (true, "RedWords", "rw", "redwords", true);
|
||||
footnotes.setup (false, "Footnotes", "fn", "footnotes", true);
|
||||
headings.setup (true, "Headings", "hd", "headings", true);
|
||||
strongs.setup (false, "StrongsNumbers", "st", "strongs", true);
|
||||
morph.setup (false, "MorphologicalTags", "mt", "morph", true);
|
||||
cantillation.setup (true, "Cantillation", "hc", "cantillation", true);
|
||||
hebrewVowelPoints.setup (true, "HebrewVowelPoints", "hvp", "vowelpoints", true);
|
||||
greekAccents.setup (true, "GreekAccents", "ga", "accents", true);
|
||||
styleSheet.setup ("default.css", "StyleSheet", "ss", "stylesheet", true);
|
||||
variants.setup (0, "Variants", "vr", "variants", true);
|
||||
wholeBook.setup (false, "WholeBook", "wb", "wholebook", false);
|
||||
doBibleIndex.setup (true, "BibleIndex", "bi", "bibleindex", false);
|
||||
doDictIndex.setup (false, QString::null, "di", "dictindex", false);
|
||||
doFullTreeIndex.setup (false, "FullTreeIndex", "fi", "fullindex", false);
|
||||
doOtherIndex.setup (false, QString::null, "oi", "otherindex", false);
|
||||
defaultBible.setup ("", "DefaultBible", "dfb", "defaultbible", true);
|
||||
defaultGreekStrongs.setup ("", "DefaultGreekStrongs", "dfgs", "defaultgreekstrongs", true);
|
||||
defaultHebrewStrongs.setup ("", "DefaultHebrewStrongs", "dfhs", "defaulthebrewstrongs", true);
|
||||
defaultGreekMorph.setup ("", "DefaultGreekMorph", "dfgm", "defaultgreekmorph", true);
|
||||
defaultHebrewMorph.setup ("", "DefaultHebrewMorph", "dfhm", "defaulthebrewmorph", true);
|
||||
locale.setup ("", "Locale", "l", "locale", true);
|
||||
|
||||
m_optionList.push_back(&propagate);
|
||||
m_optionList.push_back(&verseNumbers);
|
||||
m_optionList.push_back(&verseLineBreaks);
|
||||
m_optionList.push_back(&redWords);
|
||||
m_optionList.push_back(&footnotes);
|
||||
m_optionList.push_back(&headings);
|
||||
m_optionList.push_back(&strongs);
|
||||
m_optionList.push_back(&morph);
|
||||
m_optionList.push_back(&cantillation);
|
||||
m_optionList.push_back(&hebrewVowelPoints);
|
||||
m_optionList.push_back(&greekAccents);
|
||||
m_optionList.push_back(&styleSheet);
|
||||
m_optionList.push_back(&variants);
|
||||
m_optionList.push_back(&wholeBook);
|
||||
m_optionList.push_back(&doBibleIndex);
|
||||
m_optionList.push_back(&doDictIndex);
|
||||
m_optionList.push_back(&doFullTreeIndex);
|
||||
m_optionList.push_back(&doOtherIndex);
|
||||
m_optionList.push_back(&defaultBible);
|
||||
m_optionList.push_back(&defaultGreekStrongs);
|
||||
m_optionList.push_back(&defaultHebrewStrongs);
|
||||
m_optionList.push_back(&defaultGreekMorph);
|
||||
m_optionList.push_back(&defaultHebrewMorph);
|
||||
m_optionList.push_back(&locale);
|
||||
}
|
||||
|
||||
/** Copy constuctor */
|
||||
SwordOptions::SwordOptions(const SwordOptions& other)
|
||||
{
|
||||
init();
|
||||
vector<OptionBase*>::const_iterator it_other;
|
||||
vector<OptionBase*>::const_iterator it_end = other.m_optionList.end();
|
||||
|
||||
vector<OptionBase*>::const_iterator it_this = m_optionList.begin();
|
||||
for(it_other = other.m_optionList.begin(); it_other != it_end; )
|
||||
{
|
||||
(*it_this)->copy((*it_other));
|
||||
++it_this;
|
||||
++it_other;
|
||||
}
|
||||
}
|
||||
|
||||
SwordOptions::~SwordOptions()
|
||||
{
|
||||
}
|
||||
|
||||
/** Set all (appropriate) options from the query string */
|
||||
void SwordOptions::readFromQueryString(QMap<QString, QString> items)
|
||||
{
|
||||
vector<OptionBase*>::const_iterator it;
|
||||
vector<OptionBase*>::const_iterator it_end = m_optionList.end();
|
||||
|
||||
for(it = m_optionList.begin(); it != it_end; ++it)
|
||||
{
|
||||
(*it)->readFromQueryString(items, propagate());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Read all options in from the config file/defaults */
|
||||
void SwordOptions::readFromConfig(const KConfig* config)
|
||||
{
|
||||
vector<OptionBase*>::const_iterator it;
|
||||
vector<OptionBase*>::const_iterator it_end = m_optionList.end();
|
||||
|
||||
for(it = m_optionList.begin(); it != it_end; ++it)
|
||||
{
|
||||
(*it)->readFromConfig(config);
|
||||
}
|
||||
}
|
||||
|
||||
/** Save all options to the config file */
|
||||
void SwordOptions::saveToConfig(KConfig* config)
|
||||
{
|
||||
vector<OptionBase*>::const_iterator it;
|
||||
vector<OptionBase*>::const_iterator it_end = m_optionList.end();
|
||||
|
||||
for(it = m_optionList.begin(); it != it_end; ++it)
|
||||
{
|
||||
(*it)->saveToConfig(config);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the values that should be used for building a query string */
|
||||
QMap<QString, QString> SwordOptions::getQueryStringParams() const
|
||||
{
|
||||
QMap<QString, QString> result;
|
||||
|
||||
|
||||
vector<OptionBase*>::const_iterator it;
|
||||
vector<OptionBase*>::const_iterator it_end = m_optionList.end();
|
||||
|
||||
for(it = m_optionList.begin(); it != it_end; ++it)
|
||||
{
|
||||
QString name = QString::null;
|
||||
QString value = QString::null;
|
||||
(*it)->getQueryStringPair(name, value);
|
||||
if (!name.isNull() && !name.isEmpty())
|
||||
{
|
||||
result[name] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/***************************************************************************
|
||||
File: swordoptions.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SWORDOPTIONS_H
|
||||
#define SWORDOPTIONS_H
|
||||
|
||||
// Internal
|
||||
#include "option.h"
|
||||
|
||||
// KDE
|
||||
#include <kglobal.h>
|
||||
|
||||
// Qt
|
||||
#include <qstring.h>
|
||||
|
||||
|
||||
// Std C/C++
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
|
||||
using std::vector;
|
||||
|
||||
namespace KioSword {
|
||||
class SwordOptions {
|
||||
|
||||
// There are 3 lists of options:
|
||||
// - Here
|
||||
// - 2* in SwordOptions::init()
|
||||
// Also, they usually need to be added to the settings form
|
||||
public:
|
||||
// Need to duplicate
|
||||
Option<bool> propagate; // Allow options set in one 'get' command to persist to later 'get' commands
|
||||
Option<bool> redWords;
|
||||
Option<bool> verseNumbers;
|
||||
Option<bool> verseLineBreaks;
|
||||
Option<QString> styleSheet; // FIXME IMPLEMENT
|
||||
|
||||
Option<bool> footnotes; // FIXME IMPLEMENT
|
||||
Option<bool> headings; // FIXME IMPLEMENT
|
||||
Option<bool> strongs;
|
||||
Option<bool> morph;
|
||||
Option<bool> cantillation;
|
||||
Option<bool> hebrewVowelPoints;
|
||||
Option<bool> greekAccents;
|
||||
Option<bool> lemmas; // FIXME IMPLEMENT
|
||||
Option<bool> crossRefs; // FIXME IMPLEMENT
|
||||
Option<int> variants;
|
||||
|
||||
Option<bool> wholeBook; // Allows whole book to be printed - otherwise 'Genesis' will give an index of chapters
|
||||
Option<bool> doBibleIndex; // Create an index for for Bibles/Commentaries
|
||||
Option<bool> doFullTreeIndex; // Create a full index for 'tree' books, not just first level
|
||||
Option<bool> doDictIndex; // Create an index for all items in a Lexicon/Dictionary
|
||||
Option<bool> doOtherIndex; // Create an index for other books
|
||||
|
||||
Option<QString> defaultBible;
|
||||
Option<QString> defaultGreekStrongs;
|
||||
Option<QString> defaultHebrewStrongs;
|
||||
Option<QString> defaultGreekMorph;
|
||||
Option<QString> defaultHebrewMorph;
|
||||
|
||||
Option<QString> locale;
|
||||
|
||||
SwordOptions();
|
||||
SwordOptions(const SwordOptions& copyFrom);
|
||||
virtual ~SwordOptions();
|
||||
|
||||
void readFromConfig(const KConfig* config);
|
||||
void saveToConfig(KConfig* config);
|
||||
|
||||
QMap<QString, QString> getQueryStringParams() const;
|
||||
void readFromQueryString(QMap<QString, QString> params);
|
||||
|
||||
private:
|
||||
/** options that are read/saved in the config or propagated */
|
||||
vector<OptionBase*> m_optionList;
|
||||
void init();
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
@ -0,0 +1,86 @@
|
||||
/***************************************************************************
|
||||
File: swordutils-.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "swordutils.h"
|
||||
#include <versekey.h>
|
||||
|
||||
using namespace sword;
|
||||
using sword::VerseKey;
|
||||
using sword::SWModule;
|
||||
|
||||
namespace KioSword {
|
||||
|
||||
/** \brief Return true if the verse key specifies an entire book of the Bible
|
||||
*
|
||||
*/
|
||||
bool isEntireBook(const VerseKey *vk) {
|
||||
if (vk->LowerBound().Chapter() == 1 &&
|
||||
vk->LowerBound().Verse() == 1) {
|
||||
// lower bound is first verse in book
|
||||
VerseKey cp(vk->UpperBound());
|
||||
cp++;
|
||||
if (cp._compare(vk->UpperBound()) == 0 ||
|
||||
cp.Error() ||
|
||||
cp.Book() != vk->UpperBound().Book()) {
|
||||
// reached end of module, or
|
||||
// another book
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Checks if the VerseKey represents a single chapter
|
||||
*
|
||||
*/
|
||||
bool isSingleChapter(const VerseKey *vk) {
|
||||
if (!vk) return false;
|
||||
|
||||
if (vk->LowerBound().Verse() == 1 &&
|
||||
vk->LowerBound().Chapter() == vk->UpperBound().Chapter()) {
|
||||
VerseKey cp(vk->UpperBound());
|
||||
cp++;
|
||||
if (cp._compare(vk->UpperBound()) == 0 ||
|
||||
cp.Error() ||
|
||||
cp.Chapter() != vk->UpperBound().Chapter()) {
|
||||
// either reached end of module, or
|
||||
// another chapter
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Gets the text direction of the given module, used for
|
||||
* inserting into HTML
|
||||
*
|
||||
* @param module Module to test
|
||||
* @return "ltr" or "rtl"
|
||||
*/
|
||||
const char* textDirection(SWModule* module)
|
||||
{
|
||||
return (module->Direction(-1) == (int)sword::DIRECTION_LTR ? "ltr" : "rtl");
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
File: swordutils.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SWORDUTILS_H
|
||||
#define SWORDUTILS_H
|
||||
|
||||
#include <versekey.h>
|
||||
#include <swmodule.h>
|
||||
|
||||
namespace KioSword {
|
||||
bool isEntireBook(const sword::VerseKey *vk);
|
||||
bool isSingleChapter(const sword::VerseKey *vk);
|
||||
const char* textDirection(sword::SWModule* module);
|
||||
}
|
||||
#endif
|
@ -0,0 +1,175 @@
|
||||
/***************************************************************************
|
||||
File: template.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "template.h"
|
||||
#include "utils.h"
|
||||
#include "swordoptions.h"
|
||||
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
namespace KioSword {
|
||||
|
||||
|
||||
// placeholders
|
||||
static const char* PAGETITLE = "{$pagetitle}";
|
||||
static const char* BASECSS = "{$basecss}";
|
||||
static const char* CONTENT = "{$content}";
|
||||
static const char* HOMELINK = "{$homelink}";
|
||||
static const char* HOMELINKCAPTION = "{$homelinkcaption}";
|
||||
static const char* SEARCHLINK = "{$searchlink}";
|
||||
static const char* SEARCHLINKCAPTION = "{$searchlinkcaption}";
|
||||
static const char* SETTINGSLINK = "{$settingslink}";
|
||||
static const char* SETTINGSLINKCAPTION = "{$settingslinkcaption}";
|
||||
static const char* HELPLINK = "{$helplink}";
|
||||
static const char* HELPLINKCAPTION = "{$helplinkcaption}";
|
||||
static const char* TOPNAV = "{$topnav}";
|
||||
static const char* BOTTOMNAV = "{$bottomnav}";
|
||||
static const char* TOGGLES = "{$toggles}";
|
||||
|
||||
// static HTML fragments -------------------------------------------------------------------------------------------------------
|
||||
static const QString &html_page(QString("") +
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" " // make W3C valid
|
||||
"\"http://www.w3.org/TR/html4/strict.dtd\">\n"
|
||||
"<html><head>\n"
|
||||
"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\n"
|
||||
"<title>" + PAGETITLE + "</title>\n"
|
||||
"<link rel=\"StyleSheet\" href=\"file:" + BASECSS + "\" TYPE=\"text/css\">\n"
|
||||
"</head>\n"
|
||||
"<body class=\"kiosword\">"
|
||||
"<div class=\"page\"><div class='inner'>"
|
||||
" " + TOPNAV + "\n"
|
||||
" <div class=\"content\"><div class='inner'>" + CONTENT + "</div></div>\n"
|
||||
" " + TOGGLES + "\n"
|
||||
" " + BOTTOMNAV + "\n"
|
||||
" <div class=\"links\"><div class='inner'>\n"
|
||||
" <ul>\n"
|
||||
" <li><a accesskey=\"t\" href=\"" + HOMELINK + "\">" + HOMELINKCAPTION + "</a></li>\n"
|
||||
" <li><a href=\"" + SEARCHLINK + "\">" + SEARCHLINKCAPTION + "</a></li>\n"
|
||||
" <li><a href=\"" + SETTINGSLINK + "\">" + SETTINGSLINKCAPTION + "</a></li>\n"
|
||||
" <li><a href=\"" + HELPLINK + "\">" + HELPLINKCAPTION + "</a></li>\n"
|
||||
" </ul>\n"
|
||||
" </div></div>\n"
|
||||
"</div></div>\n"
|
||||
"</body>\n"
|
||||
"</html>\n");
|
||||
|
||||
Template::Template()
|
||||
{
|
||||
m_showToggles = false;
|
||||
}
|
||||
|
||||
QCString Template::render(const SwordOptions& options) const
|
||||
{
|
||||
|
||||
QString cssdir = KGlobal::dirs()->findResourceDir("data", "kio_sword/kio_sword.css") + "kio_sword/";
|
||||
|
||||
QString output = html_page;
|
||||
output = output
|
||||
.replace(HOMELINK, swordUrl("", options))
|
||||
.replace(HOMELINKCAPTION, i18n("Module list"))
|
||||
.replace(SEARCHLINK, swordUrlForPage("search", options))
|
||||
.replace(SEARCHLINKCAPTION, i18n("Search"))
|
||||
.replace(SETTINGSLINK, swordUrlForSettings(m_currentPath, options))
|
||||
.replace(SETTINGSLINKCAPTION, i18n("Settings"))
|
||||
.replace(HELPLINK, swordUrlForPage("help", options))
|
||||
.replace(HELPLINKCAPTION, i18n("Help"))
|
||||
.replace(BASECSS, cssdir + "kio_sword.css")
|
||||
.replace(PAGETITLE, m_title)
|
||||
.replace(CONTENT, m_content);
|
||||
if (!m_nav.isEmpty())
|
||||
{
|
||||
output = output
|
||||
.replace(TOPNAV, "<div class='navtop'><div class='inner'>" + m_nav + "</div></div>")
|
||||
.replace(BOTTOMNAV, "<div class='navbottom'><div class='inner'>" + m_nav + "</div></div>");
|
||||
}
|
||||
else
|
||||
{
|
||||
output = output
|
||||
.replace(TOPNAV, "")
|
||||
.replace(BOTTOMNAV, "");
|
||||
}
|
||||
if (m_showToggles)
|
||||
{
|
||||
QString toggles;
|
||||
SwordOptions toggledOptions(options);
|
||||
|
||||
toggledOptions.verseNumbers.set(!toggledOptions.verseNumbers());
|
||||
toggles += "<li><a href=\"" + swordUrl(m_currentPath, toggledOptions) + "\" accesskey='v'>"
|
||||
+ i18n("Verse Numbers") + "</a></li>";
|
||||
toggledOptions.verseNumbers.set(!toggledOptions.verseNumbers());
|
||||
|
||||
toggledOptions.verseLineBreaks.set(!toggledOptions.verseLineBreaks());
|
||||
toggles += "<li><a href=\"" + swordUrl(m_currentPath, toggledOptions) + "\" accesskey='l'>"
|
||||
+ i18n("Verse Line Breaks") + "</a></li>";
|
||||
toggledOptions.verseLineBreaks.set(!toggledOptions.verseLineBreaks());
|
||||
|
||||
toggledOptions.strongs.set(!toggledOptions.strongs());
|
||||
toggles += "<li><a href=\"" + swordUrl(m_currentPath, toggledOptions) + "\" accesskey='s'>"
|
||||
+ i18n("Strongs") + "</a></li>";
|
||||
toggledOptions.strongs.set(!toggledOptions.strongs());
|
||||
|
||||
toggledOptions.morph.set(!toggledOptions.morph());
|
||||
toggles += "<li><a href=\"" + swordUrl(m_currentPath, toggledOptions) + "\" accesskey='m'>"
|
||||
+ i18n("Morphological tags") + "</a></li>";
|
||||
toggledOptions.morph.set(!toggledOptions.morph());
|
||||
|
||||
output = output.replace(TOGGLES, "<div class='toggles'><div class='inner'><ul>" + toggles + "</ul></div></div>");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
output = output.replace(TOGGLES, "");
|
||||
}
|
||||
return output.utf8();
|
||||
}
|
||||
|
||||
void Template::setTitle(const QString& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void Template::setContent(const QString& content)
|
||||
{
|
||||
m_content = content;
|
||||
}
|
||||
|
||||
void Template::setNav(const QString& nav)
|
||||
{
|
||||
m_nav = nav;
|
||||
}
|
||||
|
||||
void Template::setCurrentPath(const QString& currentPath)
|
||||
{
|
||||
m_currentPath = currentPath;
|
||||
}
|
||||
|
||||
void Template::setShowToggles(bool showToggles)
|
||||
{
|
||||
m_showToggles = showToggles;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
File: template.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KS_TEMPLATE_H
|
||||
#define KS_TEMPLATE_H
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qcstring.h>
|
||||
|
||||
|
||||
namespace KioSword {
|
||||
|
||||
class SwordOptions;
|
||||
|
||||
/** Template used to generate page to be returned */
|
||||
class Template {
|
||||
private:
|
||||
QString m_title;
|
||||
QString m_content;
|
||||
QString m_nav;
|
||||
QString m_currentPath;
|
||||
bool m_showToggles;
|
||||
public:
|
||||
Template();
|
||||
void setContent(const QString& content);
|
||||
void setNav(const QString& nav);
|
||||
void setTitle(const QString& title);
|
||||
void setCurrentPath(const QString& currentPath);
|
||||
void setShowToggles(bool showToggles);
|
||||
QCString render(const SwordOptions& options) const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,212 @@
|
||||
/***************************************************************************
|
||||
File: utils.cpp
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
Description: Misc utility functions that don't belong anywhere else
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "utils.h"
|
||||
#include "swordoptions.h"
|
||||
|
||||
#include <kurl.h>
|
||||
#include <qstring.h>
|
||||
|
||||
namespace KioSword {
|
||||
|
||||
const char* DEFBIBLE_STR = "bible";
|
||||
const char* GREEKSTRONGS_STR = "greekstrongs";
|
||||
const char* HEBREWSTRONGS_STR = "hebrewstrongs";
|
||||
const char* GREEKMORPH_STR = "greekmorph";
|
||||
const char* HEBREWMORPH_STR = "hebrewmorph";
|
||||
|
||||
const char* SWORD_PROTOCOL = "sword";
|
||||
|
||||
static void mergeOptionsToURL(KURL& url, const SwordOptions* options)
|
||||
{
|
||||
QMap<QString, QString> items = options->getQueryStringParams();
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
QMap<QString, QString>::const_iterator it_end = items.end();
|
||||
for(it = items.begin(); it != it_end; ++it) {
|
||||
url.addQueryItem(it.key(), it.data());
|
||||
}
|
||||
}
|
||||
|
||||
static void mergeOptionsToURL(KURL& url, const SwordOptions& options)
|
||||
{
|
||||
return mergeOptionsToURL(url, &options);
|
||||
}
|
||||
|
||||
static QString htmlEncode(const QString& text)
|
||||
{
|
||||
QString output = text;
|
||||
return output
|
||||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\"", """);
|
||||
}
|
||||
|
||||
/** Returns options that need to be propagated as HTML for a form */
|
||||
QString optionsAsHiddenFields(const SwordOptions& options)
|
||||
{
|
||||
QString output;
|
||||
QMap<QString, QString> items = options.getQueryStringParams();
|
||||
QMap<QString, QString>::const_iterator it;
|
||||
QMap<QString, QString>::const_iterator it_end = items.end();
|
||||
for(it = items.begin(); it != it_end; ++it) {
|
||||
output += QString("<input type=\"hidden\" name=\"%1\" value=\"%2\">")
|
||||
.arg(it.key())
|
||||
.arg(htmlEncode(it.data()));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* return a valid sword URL to be used in anchors
|
||||
*
|
||||
* Many key names have spaces in them, and even trailing spaces
|
||||
* which are stripped by Konqueror. We must encode them to
|
||||
* ensure we can access them.
|
||||
*
|
||||
* @param path path to be encode
|
||||
*/
|
||||
QString swordUrl(const QString& path, const SwordOptions& options, bool htmlEncodeOutput) {
|
||||
QString output;
|
||||
KURL url;
|
||||
url.setProtocol(SWORD_PROTOCOL);
|
||||
if (path.at(0) != '/')
|
||||
url.addPath("/");
|
||||
url.addPath(path);
|
||||
mergeOptionsToURL(url, options);
|
||||
if (htmlEncodeOutput)
|
||||
return htmlEncode(url.url(0, 106)); // return as utf-8
|
||||
else
|
||||
return url.url(0, 106); // return as utf-8
|
||||
}
|
||||
|
||||
/**
|
||||
* return a valid sword URL to be used in anchors
|
||||
*
|
||||
* @param module name of module
|
||||
* @param reference within module
|
||||
*/
|
||||
QString swordUrl(const QString& module, const QString& ref, const SwordOptions& options, bool htmlEncodeOutput) {
|
||||
if (ref.at(0) == '/')
|
||||
return swordUrl(module + ref, options, htmlEncodeOutput);
|
||||
else
|
||||
return swordUrl(module + "/" + ref, options, htmlEncodeOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* return a valid sword URL for 'pages' such as 'help', 'settings' etc,
|
||||
* which are defined using a query parameter
|
||||
*/
|
||||
QString swordUrlForPage(const QString& page, const SwordOptions& options, bool htmlEncodeOutput)
|
||||
{
|
||||
QString output;
|
||||
KURL url;
|
||||
url.setProtocol(SWORD_PROTOCOL);
|
||||
url.addPath("/");
|
||||
url.addQueryItem(page, "");
|
||||
mergeOptionsToURL(url, options);
|
||||
if (htmlEncodeOutput)
|
||||
return htmlEncode(url.url(0, 106)); // return as utf-8
|
||||
else
|
||||
return url.url(0, 106); // return as utf-8
|
||||
}
|
||||
|
||||
QString swordUrlForSettings(const QString& path, const SwordOptions& options, bool htmlEncodeOutput)
|
||||
{
|
||||
QString output;
|
||||
KURL url;
|
||||
url.setProtocol(SWORD_PROTOCOL);
|
||||
url.addPath("/");
|
||||
url.addQueryItem("settings", "");
|
||||
|
||||
// Up to KDE 3.5.2 at least, there is a bug in KURL::url which
|
||||
// doesn't take into account the encoding_hint for the query items,
|
||||
// so we can't use addQueryItem for anything which has non-ascii chars
|
||||
// url.addQueryItem("previouspath", path);
|
||||
mergeOptionsToURL(url, options);
|
||||
output = url.url(0, 106); // return as utf-8
|
||||
|
||||
// Add 'previouspath' manually
|
||||
output += ( (url.queryItems().count() > 0) ? "&" : "?");
|
||||
output += "previouspath=" + KURL::encode_string(path, 106);
|
||||
|
||||
if (htmlEncodeOutput)
|
||||
return htmlEncode(output);
|
||||
else
|
||||
return output;
|
||||
}
|
||||
|
||||
/** Get a URL for doing a search */
|
||||
QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions& options, bool htmlEncodeOutput)
|
||||
{
|
||||
return swordUrlForSearch(modType, searchQuery, &options, htmlEncodeOutput);
|
||||
}
|
||||
|
||||
/** Get a URL for doing a search */
|
||||
QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions* options, bool htmlEncodeOutput)
|
||||
{
|
||||
QString modTypeStr;
|
||||
QString output;
|
||||
KURL url;
|
||||
// FIXME - make this into a dictionary or something better?
|
||||
switch (modType)
|
||||
{
|
||||
case DEFBIBLE:
|
||||
modTypeStr = DEFBIBLE_STR;
|
||||
break;
|
||||
case GREEKSTRONGS:
|
||||
modTypeStr = GREEKSTRONGS_STR;
|
||||
break;
|
||||
case HEBREWSTRONGS:
|
||||
modTypeStr = HEBREWSTRONGS_STR;
|
||||
break;
|
||||
case GREEKMORPH:
|
||||
modTypeStr = GREEKMORPH_STR;
|
||||
break;
|
||||
case HEBREWMORPH:
|
||||
modTypeStr = HEBREWMORPH_STR;
|
||||
break;
|
||||
default:
|
||||
return output;
|
||||
}
|
||||
url.setProtocol(SWORD_PROTOCOL);
|
||||
url.addPath("/");
|
||||
url.addQueryItem("modtype", modTypeStr);
|
||||
url.addQueryItem("query", searchQuery);
|
||||
mergeOptionsToURL(url, options);
|
||||
if (htmlEncodeOutput)
|
||||
return htmlEncode(url.url(0, 106)); // return as utf-8
|
||||
else
|
||||
return url.url(0, 106); // return as utf-8
|
||||
}
|
||||
|
||||
/** truncate a string to len chars, adding an ellipsis if necessary */
|
||||
QString shorten(const QString &ref, uint len) {
|
||||
QString output = ref.stripWhiteSpace();
|
||||
if (output.length() > len)
|
||||
output = output.left(len-2) + "...";
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
File: utils.h
|
||||
Project: Kio-Sword -- An ioslave for SWORD and KDE
|
||||
Copyright: Copyright (C) 2004-2005 Luke Plant
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <qstring.h>
|
||||
namespace KioSword {
|
||||
|
||||
class SwordOptions;
|
||||
|
||||
typedef enum { DEFMODULETYPE_NONE,
|
||||
DEFBIBLE,
|
||||
GREEKSTRONGS,
|
||||
HEBREWSTRONGS,
|
||||
GREEKMORPH,
|
||||
HEBREWMORPH } DefModuleType;
|
||||
|
||||
extern const char* DEFBIBLE_STR;
|
||||
extern const char* GREEKSTRONGS_STR;
|
||||
extern const char* HEBREWSTRONGS_STR;
|
||||
extern const char* GREEKMORPH_STR;
|
||||
extern const char* HEBREWMORPH_STR;
|
||||
|
||||
QString optionsAsHiddenFields(const SwordOptions& options);
|
||||
QString swordUrl(const QString& path, const SwordOptions& options, bool htmlEncodeOutput = true);
|
||||
QString swordUrl(const QString& module, const QString& ref, const SwordOptions& options, bool htmlEncodeOutput = true);
|
||||
QString swordUrlForPage(const QString& page, const SwordOptions& options, bool htmlEncodeOutput = true);
|
||||
QString swordUrlForSettings(const QString& path, const SwordOptions& options, bool htmlEncodeOutput = true);
|
||||
QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions& options, bool htmlEncodeOutput = true);
|
||||
QString swordUrlForSearch(DefModuleType modType, const QString& searchQuery, const SwordOptions* options, bool htmlEncodeOutput = true);
|
||||
QString shorten(const QString& ref, uint len);
|
||||
|
||||
}
|
||||
#endif
|