diff options
Diffstat (limited to 'bibletime/frontend/searchdialog')
-rw-r--r-- | bibletime/frontend/searchdialog/Makefile.am | 16 | ||||
-rw-r--r-- | bibletime/frontend/searchdialog/Makefile.in | 696 | ||||
-rw-r--r-- | bibletime/frontend/searchdialog/csearchdialog.cpp | 1248 | ||||
-rw-r--r-- | bibletime/frontend/searchdialog/csearchdialog.h | 460 | ||||
-rw-r--r-- | bibletime/frontend/searchdialog/csearchdialogpages.cpp | 851 | ||||
-rw-r--r-- | bibletime/frontend/searchdialog/csearchdialogpages.h | 336 |
6 files changed, 0 insertions, 3607 deletions
diff --git a/bibletime/frontend/searchdialog/Makefile.am b/bibletime/frontend/searchdialog/Makefile.am deleted file mode 100644 index 24541be..0000000 --- a/bibletime/frontend/searchdialog/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = $(all_includes) - -libsearchdialog_a_METASOURCES = AUTO - -noinst_LIBRARIES = libsearchdialog.a - -libsearchdialog_a_SOURCES = \ -csearchdialog.cpp \ -csearchdialogpages.cpp - -all_headers = \ -csearchdialog.h \ -csearchdialogpages.h - -EXTRA_DIST = $(libsearchdialog_a_SOURCES) $(all_headers) - diff --git a/bibletime/frontend/searchdialog/Makefile.in b/bibletime/frontend/searchdialog/Makefile.in deleted file mode 100644 index 0def193..0000000 --- a/bibletime/frontend/searchdialog/Makefile.in +++ /dev/null @@ -1,696 +0,0 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. -# KDE tags expanded automatically by am_edit - $Revision: 1.22 $ -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -ARTSCCONFIG = @ARTSCCONFIG@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BT_LDFLAGS = @BT_LDFLAGS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONF_FILES = @CONF_FILES@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DCOPIDL = @DCOPIDL@ -DCOPIDL2CPP = @DCOPIDL2CPP@ -DCOPIDLNG = @DCOPIDLNG@ -DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIBUTION = @DISTRIBUTION@ -DISTRIBUTION_VERSION = @DISTRIBUTION_VERSION@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@ -GMSGFMT = @GMSGFMT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -KCFG_DEPENDENCIES = @KCFG_DEPENDENCIES@ -KCONFIG_COMPILER = @KCONFIG_COMPILER@ -KDECONFIG = @KDECONFIG@ -KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ -KDE_INCLUDES = @KDE_INCLUDES@ -KDE_LDFLAGS = @KDE_LDFLAGS@ -KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@ -KDE_MT_LIBS = @KDE_MT_LIBS@ -KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ -KDE_PLUGIN = @KDE_PLUGIN@ -KDE_RPATH = @KDE_RPATH@ -KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ -KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ -KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ -KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ -KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ -KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ -KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ -LDFLAGS = @LDFLAGS@ -LIBCOMPAT = @LIBCOMPAT@ -LIBCRYPT = @LIBCRYPT@ -LIBDL = @LIBDL@ -LIBJPEG = @LIBJPEG@ -LIBOBJS = @LIBOBJS@ -LIBPNG = @LIBPNG@ -LIBPTHREAD = @LIBPTHREAD@ -LIBRESOLV = @LIBRESOLV@ -LIBS = @LIBS@ -LIBSM = @LIBSM@ -LIBSOCKET = @LIBSOCKET@ -LIBTOOL = @LIBTOOL@ -LIBUCB = @LIBUCB@ -LIBUTIL = @LIBUTIL@ -LIBZ = @LIBZ@ -LIB_KAB = @LIB_KAB@ -LIB_KABC = @LIB_KABC@ -LIB_KDECORE = @LIB_KDECORE@ -LIB_KDEPIM = @LIB_KDEPIM@ -LIB_KDEPRINT = @LIB_KDEPRINT@ -LIB_KDEUI = @LIB_KDEUI@ -LIB_KFILE = @LIB_KFILE@ -LIB_KFM = @LIB_KFM@ -LIB_KHTML = @LIB_KHTML@ -LIB_KIO = @LIB_KIO@ -LIB_KPARTS = @LIB_KPARTS@ -LIB_KSPELL = @LIB_KSPELL@ -LIB_KSYCOCA = @LIB_KSYCOCA@ -LIB_KUTILS = @LIB_KUTILS@ -LIB_POLL = @LIB_POLL@ -LIB_QPE = @LIB_QPE@ -LIB_QT = @LIB_QT@ -LIB_SMB = @LIB_SMB@ -LIB_SWORD = @LIB_SWORD@ -LIB_X11 = @LIB_X11@ -LIB_XEXT = @LIB_XEXT@ -LIB_XRENDER = @LIB_XRENDER@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MCOPIDL = @MCOPIDL@ -MEINPROC = @MEINPROC@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -NOOPT_CFLAGS = @NOOPT_CFLAGS@ -NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -QTE_NORTTI = @QTE_NORTTI@ -QT_INCLUDES = @QT_INCLUDES@ -QT_LDFLAGS = @QT_LDFLAGS@ -RANLIB = @RANLIB@ -RPM_GROUP = @RPM_GROUP@ -RPM_PREFIX = @RPM_PREFIX@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SWORD_INCLUDES = @SWORD_INCLUDES@ -SWORD_LIBRARY_PATH = @SWORD_LIBRARY_PATH@ -TOPSUBDIRS = @TOPSUBDIRS@ -UIC = @UIC@ -UIC_TR = @UIC_TR@ -USER_INCLUDES = @USER_INCLUDES@ -USER_LDFLAGS = @USER_LDFLAGS@ -USE_EXCEPTIONS = @USE_EXCEPTIONS@ -USE_RTTI = @USE_RTTI@ -USE_THREADS = @USE_THREADS@ -VERSION = @VERSION@ -WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ -XGETTEXT = @XGETTEXT@ -XMLLINT = @XMLLINT@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_INCLUDES = @X_INCLUDES@ -X_LDFLAGS = @X_LDFLAGS@ -X_PRE_LIBS = @X_PRE_LIBS@ -X_RPATH = @X_RPATH@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -include_ARTS_FALSE = @include_ARTS_FALSE@ -include_ARTS_TRUE = @include_ARTS_TRUE@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -kde_appsdir = @kde_appsdir@ -kde_bindir = @kde_bindir@ -kde_confdir = @kde_confdir@ -kde_datadir = @kde_datadir@ -kde_htmldir = @kde_htmldir@ -kde_icondir = @kde_icondir@ -kde_includes = @kde_includes@ -kde_kcfgdir = @kde_kcfgdir@ -kde_libraries = @kde_libraries@ -kde_libs_htmldir = @kde_libs_htmldir@ -kde_libs_prefix = @kde_libs_prefix@ -kde_locale = @kde_locale@ -kde_mimedir = @kde_mimedir@ -kde_moduledir = @kde_moduledir@ -kde_qtver = @kde_qtver@ -kde_servicesdir = @kde_servicesdir@ -kde_servicetypesdir = @kde_servicetypesdir@ -kde_sounddir = @kde_sounddir@ -kde_styledir = @kde_styledir@ -kde_templatesdir = @kde_templatesdir@ -kde_wallpaperdir = @kde_wallpaperdir@ -kde_widgetdir = @kde_widgetdir@ -kdeinitdir = @kdeinitdir@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -qt_includes = @qt_includes@ -qt_libraries = @qt_libraries@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -x_includes = @x_includes@ -x_libraries = @x_libraries@ -xdg_appsdir = @xdg_appsdir@ -xdg_directorydir = @xdg_directorydir@ -xdg_menudir = @xdg_menudir@ -INCLUDES = $(all_includes) - -#>- libsearchdialog_a_METASOURCES = AUTO - -noinst_LIBRARIES = libsearchdialog.a - -libsearchdialog_a_SOURCES = \ -csearchdialog.cpp \ -csearchdialogpages.cpp - - -all_headers = \ -csearchdialog.h \ -csearchdialogpages.h - - -EXTRA_DIST = $(libsearchdialog_a_SOURCES) $(all_headers) -subdir = bibletime/frontend/searchdialog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - -libsearchdialog_a_AR = $(AR) cru -libsearchdialog_a_LIBADD = -am_libsearchdialog_a_OBJECTS = csearchdialog.$(OBJEXT) \ - csearchdialogpages.$(OBJEXT) -#>- libsearchdialog_a_OBJECTS = $(am_libsearchdialog_a_OBJECTS) -#>+ 6 -libsearchdialog_a_final_OBJECTS = libsearchdialog_a.all_cpp.o -libsearchdialog_a_nofinal_OBJECTS = csearchdialog.$(OBJEXT) \ - csearchdialogpages.$(OBJEXT)\ -csearchdialogpages.moc.o csearchdialog.moc.o -@KDE_USE_FINAL_FALSE@libsearchdialog_a_OBJECTS = $(libsearchdialog_a_nofinal_OBJECTS) -@KDE_USE_FINAL_TRUE@libsearchdialog_a_OBJECTS = $(libsearchdialog_a_final_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/admin/depcomp -am__depfiles_maybe = depfiles -#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/csearchdialog.Po \ -#>- @AMDEP_TRUE@ ./$(DEPDIR)/csearchdialogpages.Po -#>+ 4 -@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/csearchdialogpages.moc.P $(DEPDIR)/csearchdialog.moc.P $(DEPDIR)/libsearchdialog_a.all_cpp.P ./$(DEPDIR)/csearchdialog.Po \ -@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/csearchdialogpages.Po -@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = $(DEPDIR)/csearchdialogpages.moc.P $(DEPDIR)/csearchdialog.moc.P ./$(DEPDIR)/csearchdialog.Po \ -@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/csearchdialogpages.Po -#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ -#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -#>+ 2 -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) -#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ -#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ -#>- $(AM_CXXFLAGS) $(CXXFLAGS) -#>+ 3 -LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) -CXXLD = $(CXX) -#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ -#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ -#>+ 2 -CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libsearchdialog_a_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(libsearchdialog_a_SOURCES) - -#>- all: all-am -#>+ 1 -all: docs-am all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) -#>- cd $(top_srcdir) && \ -#>- $(AUTOMAKE) --gnu bibletime/frontend/searchdialog/Makefile -#>+ 3 - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu bibletime/frontend/searchdialog/Makefile - cd $(top_srcdir) && perl admin/am_edit bibletime/frontend/searchdialog/Makefile.in -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libsearchdialog.a: $(libsearchdialog_a_OBJECTS) $(libsearchdialog_a_DEPENDENCIES) - -rm -f libsearchdialog.a - $(libsearchdialog_a_AR) libsearchdialog.a $(libsearchdialog_a_OBJECTS) $(libsearchdialog_a_LIBADD) - $(RANLIB) libsearchdialog.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csearchdialog.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csearchdialogpages.Po@am__quote@ - -distclean-depend: - -rm -rf ./$(DEPDIR) - -.cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -.cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -#>+ 1 -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -#>- clean: clean-am -#>+ 1 -clean: kde-rpo-clean clean-am - -#>- clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ -#>- mostlyclean-am -#>+ 2 -clean-am: clean-metasources clean-bcheck clean-final clean-generic clean-libtool clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES ctags distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: - -#>+ 3 -csearchdialogpages.moc.cpp: $(srcdir)/csearchdialogpages.h - $(MOC) $(srcdir)/csearchdialogpages.h -o csearchdialogpages.moc.cpp - -#>+ 2 -mocs: csearchdialogpages.moc.cpp - -#>+ 3 -csearchdialog.moc.cpp: $(srcdir)/csearchdialog.h - $(MOC) $(srcdir)/csearchdialog.h -o csearchdialog.moc.cpp - -#>+ 2 -mocs: csearchdialog.moc.cpp - -#>+ 3 -clean-metasources: - -rm -f csearchdialogpages.moc.cpp csearchdialog.moc.cpp - -#>+ 2 -KDE_DIST=csearchdialog.h csearchdialogpages.h - -#>+ 2 -docs-am: - -#>+ 6 -force-reedit: - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu bibletime/frontend/searchdialog/Makefile - cd $(top_srcdir) && perl admin/am_edit bibletime/frontend/searchdialog/Makefile.in - - -#>+ 21 -clean-bcheck: - rm -f *.bchecktest.cc *.bchecktest.cc.class a.out - -bcheck: bcheck-am - -bcheck-am: - @for i in ; do \ - if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \ - echo "int main() {return 0;}" > $$i.bchecktest.cc ; \ - echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \ - echo "$$i"; \ - if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \ - rm -f $$i.bchecktest.cc; exit 1; \ - fi ; \ - echo "" >> $$i.bchecktest.cc.class; \ - perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \ - rm -f a.out; \ - fi ; \ - done - - -#>+ 11 -libsearchdialog_a.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/csearchdialog.cpp $(srcdir)/csearchdialogpages.cpp csearchdialogpages.moc.cpp csearchdialog.moc.cpp - @echo 'creating libsearchdialog_a.all_cpp.cpp ...'; \ - rm -f libsearchdialog_a.all_cpp.files libsearchdialog_a.all_cpp.final; \ - echo "#define KDE_USE_FINAL 1" >> libsearchdialog_a.all_cpp.final; \ - for file in csearchdialog.cpp csearchdialogpages.cpp csearchdialogpages.moc.cpp csearchdialog.moc.cpp ; do \ - echo "#include \"$$file\"" >> libsearchdialog_a.all_cpp.files; \ - test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libsearchdialog_a.all_cpp.final; \ - done; \ - cat libsearchdialog_a.all_cpp.final libsearchdialog_a.all_cpp.files > libsearchdialog_a.all_cpp.cpp; \ - rm -f libsearchdialog_a.all_cpp.final libsearchdialog_a.all_cpp.files - -#>+ 3 -clean-final: - -rm -f libsearchdialog_a.all_cpp.cpp - -#>+ 3 -final: - $(MAKE) libsearchdialog_a_OBJECTS="$(libsearchdialog_a_final_OBJECTS)" all-am - -#>+ 3 -final-install: - $(MAKE) libsearchdialog_a_OBJECTS="$(libsearchdialog_a_final_OBJECTS)" install-am - -#>+ 3 -no-final: - $(MAKE) libsearchdialog_a_OBJECTS="$(libsearchdialog_a_nofinal_OBJECTS)" all-am - -#>+ 3 -no-final-install: - $(MAKE) libsearchdialog_a_OBJECTS="$(libsearchdialog_a_nofinal_OBJECTS)" install-am - -#>+ 3 -cvs-clean: - $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean - -#>+ 3 -kde-rpo-clean: - -rm -f *.rpo - -#>+ 3 -nmcheck: -nmcheck-am: nmcheck diff --git a/bibletime/frontend/searchdialog/csearchdialog.cpp b/bibletime/frontend/searchdialog/csearchdialog.cpp deleted file mode 100644 index 7be6b1a..0000000 --- a/bibletime/frontend/searchdialog/csearchdialog.cpp +++ /dev/null @@ -1,1248 +0,0 @@ -/*************************************************************************** - csearchdialog.cpp - description - ------------------- - begin : Die Jul 30 2002 - copyright : (C) 2002 by The BibleTime team - email : info@bibletime.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include "csearchdialog.h" - -#include "backend/cswordkey.h" -#include "backend/cswordversekey.h" - -#include "frontend/cbtconfig.h" - -#include "util/cresmgr.h" -#include "util/ctoolclass.h" - -//Qt includes -#include <qhbox.h> -#include <qptrlist.h> -#include <qpainter.h> -#include <qwhatsthis.h> -#include <qlayout.h> -#include <qmap.h> -#include <qlineedit.h> -#include <qtextedit.h> -#include <qlabel.h> -#include <qsizepolicy.h> -#include <qpushbutton.h> -#include <qheader.h> -#include <qregexp.h> - -//KDE includes -#include <kapplication.h> -#include <kfiledialog.h> -#include <klocale.h> -#include <kiconloader.h> - -const int SPACE_BETWEEN_PARTS = 5; -const int RIGHT_BORDER = 15; -const int LEFT_BORDER = 15; -const int LOWER_BORDER = 10; -const int UPPER_BORDER = 10; - -const int ITEM_TEXT_SIZE = 8; -const int LABEL_TEXT_SIZE = 6; - -//used for the shift between the bars -const int BAR_DELTAX = 4; -const int BAR_DELTAY = 2; -const int BAR_WIDTH = 2 + (2*BAR_DELTAX); //should be equal or bigger than the label font size -// Used for the text below the bars -const int BAR_LOWER_BORDER = 100; - -const int LEGEND_INNER_BORDER = 5; -const int LEGEND_DELTAY = 4; -const int LEGEND_WIDTH = 85; - -static CSearchDialog* m_staticDialog = 0; - -void CSearchDialog::openDialog(const ListCSwordModuleInfo modules, const QString& searchText, QWidget* parentDialog) { - if (!m_staticDialog) { - m_staticDialog = new CSearchDialog(parentDialog); - }; - m_staticDialog->reset(); - - if (modules.count()) { - m_staticDialog->setModules(modules); - } else { - m_staticDialog->showModulesSelector(); - } - - m_staticDialog->setSearchText(searchText); - if (m_staticDialog->isHidden()) { - m_staticDialog->show(); - } - - m_staticDialog->raise(); - if (modules.count() && !searchText.isEmpty()) { - m_staticDialog->startSearch(); - } -}; - -CSearchDialog* const CSearchDialog::getSearchDialog() { - Q_ASSERT(m_staticDialog); - return m_staticDialog; -}; - -CSearchDialog::CSearchDialog(QWidget *parent) - : KDialogBase(Tabbed, i18n("Search dialog"), Close | User1 | User2, User1, parent, "CSearchDialog", false, true, i18n("Search"), i18n("Interrupt")) { - - setIcon(CResMgr::searchdialog::icon); - m_searcher.connectPercentUpdate(this, SLOT(percentUpdate())); - m_searcher.connectFinished(this, SLOT(searchFinished())); - - initView(); - initConnections(); -} - -CSearchDialog::~CSearchDialog(){ -} - -/** Reimplemented to show the First time searchdialog page. */ -void CSearchDialog::show(){ - KDialogBase::show(); - -// if (CBTConfig::get(CBTConfig::firstSearchDialog)) { //is this the first time we show the dialog? -// CHTMLDialog dlg(CResMgr::helpDialog::firstTimeSearchDialog); -// dlg.exec(); -// CBTConfig::set(CBTConfig::firstSearchDialog, false); -// }; -} - -/** Starts the search with the set modules and the set search text. */ -void CSearchDialog::startSearch(){ - QString searchText(m_searchOptionsPage->searchText()); - - if (searchText.isEmpty()) return; - - m_searchResultPage->reset(); - enableButton(User1,false); - enableButton(User2,true); - m_interruptedSearch = false; - - int searchFlags = m_searchOptionsPage->searchFlags(); - m_searchOptionsPage->prepareSearch(); - - const CSwordModuleSearch::scopeType scopeType = m_searchOptionsPage->scopeType(); - if (scopeType == CSwordModuleSearch::Scope_LastSearch) { - searchFlags |= CSwordModuleSearch::useLastResult; - } else if ( (scopeType == CSwordModuleSearch::Scope_Bounds) && strlen(m_searchOptionsPage->searchScope().getRangeText()) ) { - //we need the scope flag and a valid scope! - searchFlags |= CSwordModuleSearch::useScope; - m_searcher.setSearchScope( m_searchOptionsPage->searchScope() ); - } - - m_searcher.setModules( modules() ); - m_searcher.setSearchedText(searchText); - m_searcher.setSearchOptions(searchFlags); - -// qWarning("start the search"); - m_searcher.startSearchThread(); -} - -/** Starts the search with the given module list and given search text. */ -void CSearchDialog::startSearch( const ListCSwordModuleInfo modules, const QString& searchText){ - m_searchResultPage->reset(); - m_searchOptionsPage->reset(); - setModules(modules); - setSearchText(searchText); - - startSearch(); -} - -/** Returns the list of used modules. */ -const ListCSwordModuleInfo CSearchDialog::modules(){ - return m_searchOptionsPage->modules(); -} - -/** Sets the list of modules for the search. */ -void CSearchDialog::setModules( const ListCSwordModuleInfo modules ){ - m_searchOptionsPage->setModules(modules); - resize( sizeHint() ); -} - -/** Returns the search text which is set currently. */ -const QString CSearchDialog::searchText(){ - return m_searchOptionsPage->searchText(); -} - -sword::ListKey CSearchDialog::searchScope(){ - return m_searchOptionsPage->searchScope(); -}; - -/** Returns true if the search used a scope, otherwise false. */ -const CSwordModuleSearch::scopeType CSearchDialog::searchScopeType() const { - return m_searchOptionsPage->scopeType(); -} - -/** Returns true if the search used a scope, otherwise false. */ -const int CSearchDialog::searchFlags() const { - return m_searchOptionsPage->searchFlags(); -} - -/** Returns the search text which is used for the search. */ -void CSearchDialog::setSearchText( const QString searchText ){ - m_searchOptionsPage->setSearchText(searchText); -} - -/** Initializes this object. */ -void CSearchDialog::initView(){ - setButtonTip(User1, CResMgr::searchdialog::searchButton::tooltip); - setButtonWhatsThis(User1, CResMgr::searchdialog::searchButton::whatsthis); - - setButtonTip(User2, CResMgr::searchdialog::cancelSearchButton::tooltip); - setButtonWhatsThis(User2, CResMgr::searchdialog::cancelSearchButton::whatsthis); - - QHBox* box = addHBoxPage(i18n("Search options")); - m_index.optionsPage = pageIndex(box); - m_searchOptionsPage = new CSearchOptionsPage(box); - - box = addHBoxPage(i18n("Search result")); - m_index.resultPage = pageIndex(box); - m_searchResultPage = new CSearchResultPage(box); -} - -/** Updates the percentage bars. */ -void CSearchDialog::percentUpdate(){ - updateProgress(); -} - -/** Updates the percentage bars. */ -void CSearchDialog::searchFinished(){ -// qWarning("CSearchDialog::searchFinished()"); - m_searchOptionsPage->setOverallProgress(100); - m_searchOptionsPage->setCurrentModuleProgress(100); - - if ( !m_interruptedSearch && m_searcher.foundItems() ){ - m_searchResultPage->setSearchResult(modules()); - showPage(m_index.resultPage); - } - else - m_searchResultPage->reset(); - - enableButton(User2,false); - enableButton(User1,true); -} - -void CSearchDialog::showModulesSelector() { - m_searchOptionsPage->chooseModules(); -} - -/** Initializes the signal slot connections */ -void CSearchDialog::initConnections(){ - connect(this, SIGNAL(user1Clicked()), SLOT(startSearch())); - connect(this, SIGNAL(user2Clicked()), SLOT(interruptSearch())); - connect(this, SIGNAL(closeClicked()), SLOT(slotDelayedDestruct())); - connect(this, SIGNAL(aboutToShowPage(QWidget*)), SLOT(slotShowPage(QWidget*))); -} - -/** Updates the progress. */ -void CSearchDialog::updateProgress(){ - KApplication::kApplication()->processEvents(); - m_searchOptionsPage->setOverallProgress(m_searcher.getPercent(CSwordModuleSearch::allModules)); - m_searchOptionsPage->setCurrentModuleProgress(m_searcher.getPercent(CSwordModuleSearch::currentModule)); -} - -/** Interrupts the search. */ -void CSearchDialog::interruptSearch(){ - m_interruptedSearch = true; - m_searcher.interruptSearch(); - m_searchOptionsPage->prepareSearch(); -} - -/** Resets the parts to the default. */ -void CSearchDialog::reset(){ - m_searchOptionsPage->reset(); - m_searchResultPage->reset(); - showPage(m_index.optionsPage); -} - -/** Is the slot which is called when a page will be shown. */ -void CSearchDialog::slotShowPage(QWidget* page){ - if (pageIndex(page) == m_index.optionsPage) { - m_searchOptionsPage->aboutToShow(); - }; -} - -/** Reimplementation. */ -void CSearchDialog::slotClose(){ - //try to stop the search before we close the dialog which destroys the search object - m_interruptedSearch = true; - m_searcher.interruptSearch(); - - delayedDestruct(); - m_staticDialog = 0; -} - -/****************************/ -/****************************/ -/****************************/ - -CModuleChooser::ModuleCheckBoxItem::ModuleCheckBoxItem(QListViewItem* item, CSwordModuleInfo* module) : QCheckListItem(item, QString::null, QCheckListItem::CheckBox) { - m_module = module; - setText(0,m_module->name()); -}; - -CModuleChooser::ModuleCheckBoxItem::~ModuleCheckBoxItem() { - -}; - -/** Returns the used module. */ -CSwordModuleInfo* const CModuleChooser::ModuleCheckBoxItem::module() const{ - return m_module; -} - - -/****************************/ -/****************************/ -/****************************/ - -CModuleChooser::CModuleChooser(QWidget* parent) : KListView(parent) { - initView(); - initTree(); -}; - -CModuleChooser::~CModuleChooser() { - -}; - -void CModuleChooser::show() { - KListView::show(); - - //open module items - QListViewItemIterator it( this ); - for ( ; it.current(); ++it ) { - if ( ModuleCheckBoxItem* i = dynamic_cast<ModuleCheckBoxItem*>(it.current()) ) { - if (i->isOn()) { - ensureItemVisible(i); - }; - } - } -}; - -/** Initializes this widget and the childs of it. */ -void CModuleChooser::initView(){ - addColumn("Module Name"); - setRootIsDecorated(true); -// header()->hide(); - setFullWidth(true); -} - -/** Initializes the tree of this widget. */ -void CModuleChooser::initTree(){ - ListCSwordModuleInfo mods = backend()->moduleList(); - /** - * The next steps: - * 1. Sort by type - * 2. Sort the modules of this type by their language - * 3. Create the subfolders for this - */ - - QMap<CSwordModuleInfo::ModuleType, QString> typenameMap; - typenameMap.insert(CSwordModuleInfo::Bible, i18n("Bibles")); - typenameMap.insert(CSwordModuleInfo::Commentary, i18n("Commentaries")); - typenameMap.insert(CSwordModuleInfo::Lexicon, i18n("Lexicons")); - typenameMap.insert(CSwordModuleInfo::GenericBook, i18n("Books")); - - int type = CSwordModuleInfo::Bible; - bool ok = true; - bool addedDevotionals = false; - bool addedGlossaries = false; - bool addedLexs = false; - bool incType = false; - - while (ok) { - ListCSwordModuleInfo modsForType; - QString typeFolderCaption = QString::null; - incType = false; - if (static_cast<CSwordModuleInfo::ModuleType>(type) == CSwordModuleInfo::Lexicon) { - if (!addedLexs) { - for (mods.first(); mods.current(); mods.next()) { - if (mods.current()->type() == CSwordModuleInfo::Lexicon && (mods.current()->category() != CSwordModuleInfo::DailyDevotional) && (mods.current()->category() != CSwordModuleInfo::Glossary)) { - modsForType.append(mods.current()); - }; - }; - addedLexs = true; - typeFolderCaption = QString::null; - } - else if (!addedDevotionals) { - for (mods.first(); mods.current(); mods.next()) { - if (mods.current()->category() == CSwordModuleInfo::DailyDevotional) { - modsForType.append(mods.current()); - }; - }; - addedDevotionals = true; - typeFolderCaption = i18n("Daily Devotionals"); - } - else if (!addedGlossaries) { - for (mods.first(); mods.current(); mods.next()) { - if (mods.current()->category() == CSwordModuleInfo::Glossary) { - modsForType.append(mods.current()); - }; - }; - addedGlossaries = true; - typeFolderCaption = i18n("Glossaries"); - }; - - if (addedLexs && addedDevotionals && addedGlossaries) - incType = true; - } - else if (type == CSwordModuleInfo::Bible || type == CSwordModuleInfo::Commentary || type == CSwordModuleInfo::GenericBook){ - for (mods.first(); mods.current(); mods.next()) { - if (mods.current()->type() == type) { - modsForType.append(mods.current()); - }; - }; - incType = true; - } - else - ok = false; - - if (typeFolderCaption.isEmpty()) { - typeFolderCaption = typenameMap[static_cast<CSwordModuleInfo::ModuleType>(type)]; - } - - //get the available languages of the selected modules - QStringList langs; - for (modsForType.first(); modsForType.current(); modsForType.next()) { - if ( !langs.contains(QString::fromLatin1( modsForType.current()->module()->Lang() ))) { - langs.append(QString::fromLatin1( modsForType.current()->module()->Lang() )); - } - }; - langs.sort(); - - //go through the list of languages and create subfolders for each language and the modules of the language - QListViewItem* typeFolder = 0; - if (modsForType.count()) { - typeFolder = new QListViewItem(this, typeFolder, typeFolderCaption); - } - else { - if (incType) { - type++; - } - continue; - }; - - - QString language = QString::null; - CLanguageMgr* langMgr = languageMgr(); - for ( QStringList::Iterator it = langs.begin(); it != langs.end(); ++it ) { - language = langMgr->languageForAbbrev(*it).translatedName(); - if (language.isEmpty()) { - language = (*it); - } - - QListViewItem* langFolder = new QListViewItem(typeFolder,language); - langFolder->setPixmap(0, SmallIcon(CResMgr::mainIndex::closedFolder::icon, 16)); - - //create the module items of this lang folder - for (modsForType.first(); modsForType.current(); modsForType.next()) { - if (QString::fromLatin1( modsForType.current()->module()->Lang() ) == (*it) ) { //found correct language - ModuleCheckBoxItem* i = new ModuleCheckBoxItem(langFolder, modsForType.current()); - i->setPixmap(0, CToolClass::getIconForModule(modsForType.current())); - }; - }; - }; - typeFolder->setPixmap(0,SmallIcon(CResMgr::mainIndex::closedFolder::icon, 16)); - - if (incType) { - ++type; - } - }; -} - -/** Returns a list of selected modules. */ -ListCSwordModuleInfo CModuleChooser::modules(){ - ListCSwordModuleInfo mods; - QListViewItemIterator it( this ); - for ( ; it.current(); ++it ) { - if ( ModuleCheckBoxItem* i = dynamic_cast<ModuleCheckBoxItem*>(it.current()) ) { - //add the module if the box is checked - if (i->isOn()) { - mods.append(i->module()); - }; - }; - }; - - return mods; -} - -/** Sets the list of modules and updates the state of the checkbox items. */ -void CModuleChooser::setModules( ListCSwordModuleInfo modules ){ -// qWarning("CModuleChooser::setModules( ListCSwordModuleInfo modules )"); - QListViewItemIterator it( this ); - for ( ; it.current(); ++it ) { - if ( ModuleCheckBoxItem* i = dynamic_cast<ModuleCheckBoxItem*>(it.current()) ) { - i->setOn(modules.contains(i->module())); //set the status for the module checkbox item -// if (i->isOn()) { //if it's checked, show the item -// qWarning("show item!"); -// ensureItemVisible(i); -// } - } - }; -} - -/****************************/ - -CModuleChooserDialog::CModuleChooserDialog( QWidget* parentDialog, ListCSwordModuleInfo modules ) : KDialogBase(Plain, i18n("Choose modules"), Ok, Ok, parentDialog, "CModuleChooser", false, true) { - initView(); - initConnections(); - - m_moduleChooser->setModules(modules); -}; - -CModuleChooserDialog::~CModuleChooserDialog() { - -}; - -/** Initializes the view of this dialog */ -void CModuleChooserDialog::initView(){ - setButtonOKText(i18n("Use chosen modules")); - - QFrame* page = plainPage(); - QHBoxLayout* layout = new QHBoxLayout(page); - m_moduleChooser = new CModuleChooser(page); - m_moduleChooser->setMinimumSize(320,400); - layout->addWidget(m_moduleChooser); -} - -/** Initializes the connections of this dialog. */ -void CModuleChooserDialog::initConnections(){ - -} - -/** Reimplementation to handle the modules. */ -void CModuleChooserDialog::slotOk(){ - emit modulesChanged( m_moduleChooser->modules() ); - - KDialogBase::slotOk(); -} - -/****************************/ -CRangeChooserDialog::RangeItem::RangeItem(QListView* view, QListViewItem* afterThis, const QString caption, const QString range) : KListViewItem(view, afterThis) { - setCaption(caption); - setRange(range); -}; - -CRangeChooserDialog::RangeItem::~RangeItem() { - -}; - -const QString& CRangeChooserDialog::RangeItem::range() { -// qWarning("ange is %s", (const char*)m_range.utf8()); - return m_range; -}; - -void CRangeChooserDialog::RangeItem::setRange(QString newRange) { - m_range = newRange; -}; - -const QString CRangeChooserDialog::RangeItem::caption() { - return text(0); -}; - -void CRangeChooserDialog::RangeItem::setCaption(const QString newCaption) { - setText(0, newCaption); -}; - - -/**************************/ -CRangeChooserDialog::CRangeChooserDialog( QWidget* parentDialog ) : KDialogBase(Plain, i18n("Search range editor"), Default | Ok | Cancel, Ok, parentDialog, "CRangeChooserDialog", false, true) { - initView(); - initConnections(); - - //add the existing scopes - CBTConfig::StringMap map = CBTConfig::get(CBTConfig::searchScopes); - CBTConfig::StringMap::Iterator it; - for (it = map.begin(); it != map.end(); ++it) { - new RangeItem(m_rangeList, 0, it.key(), it.data()); - }; - - editRange(0); - if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())){ - nameChanged(i->caption()); - } -}; - -CRangeChooserDialog::~CRangeChooserDialog() { -}; - -/** Initializes the view of this object. */ -void CRangeChooserDialog::initView(){ -// setButtonOKText(i18n("")); - - QGridLayout* grid = new QGridLayout(plainPage(),6,5,0,3); - - m_rangeList = new KListView(plainPage()); - m_rangeList->addColumn(i18n("Search range")); - m_rangeList->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding)); - m_rangeList->setFullWidth(true); - m_rangeList->setSorting(0, true); - m_rangeList->header()->setClickEnabled(false); - m_rangeList->header()->setMovingEnabled(false); - grid->addMultiCellWidget(m_rangeList,0,4,0,1); - - m_newRangeButton = new QPushButton(i18n("Add new range"),plainPage()); - connect(m_newRangeButton, SIGNAL(clicked()), this, SLOT(addNewRange())); - grid->addWidget(m_newRangeButton,5,0); - - m_deleteRangeButton = new QPushButton(i18n("Delete current range"),plainPage()); - connect(m_deleteRangeButton, SIGNAL(clicked()), this, SLOT(deleteCurrentRange())); - grid->addWidget(m_deleteRangeButton,5,1); - - grid->addColSpacing(2, 5); - - QLabel* label = new QLabel(i18n("Name:"), plainPage()); - m_nameEdit = new QLineEdit(plainPage()); - grid->addWidget(label,0,3); - grid->addWidget(m_nameEdit,0,4); - - label = new QLabel(i18n("Edit current search range:"), plainPage()); - label->setFixedSize(label->sizeHint()); - m_rangeEdit = new QTextEdit(plainPage()); - m_rangeEdit->setTextFormat(Qt::PlainText); - grid->addMultiCellWidget(label,1,1,3,4); - grid->addMultiCellWidget(m_rangeEdit,2,2,3,4); - - grid->addRowSpacing(3, 10); - - m_resultList = new KListView(plainPage()); - m_resultList->addColumn(i18n("Parsed search range:")); - m_resultList->setFullWidth(true); - m_resultList->setSorting(-1); - m_resultList->setShowSortIndicator(false); - m_resultList->header()->setClickEnabled(false); - m_resultList->header()->setMovingEnabled(false); - m_resultList->setSelectionModeExt(KListView::NoSelection); - - grid->addMultiCellWidget(m_resultList, 4,5,3,4); - - grid->setRowStretch(4,5); -} - -/** Initializes the connections of this widget. */ -void CRangeChooserDialog::initConnections(){ - connect(m_rangeList, SIGNAL(selectionChanged(QListViewItem*)), - this, SLOT(editRange(QListViewItem*))); - - connect(m_rangeEdit, SIGNAL(textChanged()), - this, SLOT(parseRange())); - connect(m_rangeEdit, SIGNAL(textChanged()), - this, SLOT(rangeChanged())); - - connect(m_nameEdit, SIGNAL(textChanged(const QString&)), - this, SLOT(nameChanged(const QString&))); -} - -/** Adds a new range to the list. */ -void CRangeChooserDialog::addNewRange(){ - RangeItem* i = new RangeItem(m_rangeList, m_rangeList->lastItem(), i18n("New range")); - m_rangeList->setSelected(i, true); - m_rangeList->setCurrentItem(i); - editRange(i); - - m_nameEdit->setFocus(); -} - -/** No descriptions */ -void CRangeChooserDialog::editRange(QListViewItem* item){ - RangeItem* const range = dynamic_cast<RangeItem*>(item); - - m_nameEdit->setEnabled( range ); //only if an item is selected enable the edit part - m_rangeEdit->setEnabled( range ); - m_resultList->setEnabled( range ); - m_deleteRangeButton->setEnabled( range ); - - if (range) { - m_nameEdit->setText(range->caption()); -// qWarning("setting new range %s", (const char*)range->range().utf8()); - m_rangeEdit->setText(range->range()); -// qWarning("after setting new range is %s", (const char*)m_rangeEdit->text().utf8()); - } -} - -/** Parses the entered text and prints out the result in the list box below the edit area. */ -void CRangeChooserDialog::parseRange(){ - m_resultList->clear(); - - //hack: repair range to work with Sword 1.5.6 - QString range( m_rangeEdit->text() ); - range.replace(QRegExp("\\s{0,}-\\s{0,}"), "-" ); - - sword::VerseKey key; - sword::ListKey verses = key.ParseVerseList((const char*)range.local8Bit(), "Genesis 1:1", true); - for (int i = 0; i < verses.Count(); ++i) { - new KListViewItem(m_resultList, QString::fromLocal8Bit(verses.GetElement(i)->getRangeText())); -// qWarning("range=%s, text=%s",verses.GetElement(i)->getRangeText(), verses.GetElement(i)->getText() ); - } - -} - -/** No descriptions */ -void CRangeChooserDialog::rangeChanged(){ - if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())) { - QString range( m_rangeEdit->text() ); - //hack: repair range to work with Sword 1.5.6 - range.replace(QRegExp("\\s{0,}-\\s{0,}"), "-" ); - i->setRange(range); - }; -} - -/** No descriptions */ -void CRangeChooserDialog::nameChanged(const QString& newCaption){ - m_rangeEdit->setEnabled(!newCaption.isEmpty()); - m_resultList->setEnabled(!newCaption.isEmpty()); - m_resultList->header()->setEnabled(!newCaption.isEmpty()); - - if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())) { - if (!newCaption.isEmpty()) { - m_newRangeButton->setEnabled(true); - i->setCaption(newCaption); - m_rangeList->sort(); - } - else { //invalid name - i->setCaption(i18n("<invalid name of search range>")); - m_newRangeButton->setEnabled(false); - }; - }; -} - -/** Deletes the selected range. */ -void CRangeChooserDialog::deleteCurrentRange(){ - if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())) { - if (QListViewItem* selection = i->itemBelow() ? i->itemBelow() : i->itemAbove()) { - m_rangeList->setSelected(selection, true); - m_rangeList->setCurrentItem(selection); - } - else { - m_rangeList->setSelected(m_rangeList->firstChild(), true); - m_rangeList->setCurrentItem(m_rangeList->firstChild()); - } - delete i; - } - editRange(m_rangeList->currentItem()); -} - -void CRangeChooserDialog::slotOk(){ - //save the new map of search scopes - CBTConfig::StringMap map; - QListViewItemIterator it( m_rangeList ); - for (;it.current(); ++it) { - if ( RangeItem* i = dynamic_cast<RangeItem*>(it.current()) ){ - map[i->caption()] = i->range(); - }; - }; - CBTConfig::set(CBTConfig::searchScopes, map); - - KDialogBase::slotOk(); -} - -void CRangeChooserDialog::slotDefault(){ - m_rangeList->clear(); - CBTConfig::StringMap map = CBTConfig::getDefault(CBTConfig::searchScopes); - CBTConfig::StringMap::Iterator it; - for (it = map.begin(); it != map.end(); ++it) { - new RangeItem(m_rangeList, 0, it.key(), it.data()); - }; - m_rangeList->setSelected(m_rangeList->selectedItem(), false); - m_rangeList->setCurrentItem(0); - - editRange(0); - if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())) { - nameChanged(i->caption()); - } - - KDialogBase::slotDefault(); -} - -/****************************/ - -CSearchAnalysisDialog::CSearchAnalysisDialog( ListCSwordModuleInfo modules, QWidget* parentDialog ) : KDialogBase(Plain, i18n("Search analysis"), Close, Close, parentDialog, 0, true){ - initView(); - initConnections(); - m_analysis->reset(); - m_analysis->analyse(modules); - showMaximized(); -}; - -CSearchAnalysisDialog::~CSearchAnalysisDialog() { - -}; - -/** Initializes this dialog. */ -void CSearchAnalysisDialog::initView(){ - QVBoxLayout* layout = new QVBoxLayout(plainPage(),0); - - QPushButton* button = new QPushButton(plainPage(), "button"); - button->setIconSet(SmallIconSet("filesave")); - button->setText(i18n("Save search analysis as HTML")); - button->setFixedSize(button->sizeHint()); - layout->addWidget(button); - layout->addSpacing(10); - - m_analysis = new CSearchAnalysis(plainPage()); - m_analysisView = new CSearchAnalysisView(m_analysis, plainPage()); - m_analysisView->show(); - layout->addWidget(m_analysisView); - - connect(button, SIGNAL(clicked()), m_analysis, SLOT(saveAsHTML())); -} - -/** Initializes the widgets SIGNAL and SLOT connections,. */ -void CSearchAnalysisDialog::initConnections(){ -} - -/****************************/ -/* CSearchAnalysis */ -/****************************/ - -CSearchAnalysis::CSearchAnalysis(QObject *parent, const char *name ) - : QCanvas(parent,name) { - - m_scaleFactor = 0.0; - m_legend = 0; - setBackgroundColor(Qt::white); - m_canvasItemList.resize(67); - m_canvasItemList.setAutoDelete(true); - resize(1,1); - connect(this, SIGNAL(resized()), SLOT(slotResized())); -} - -CSearchAnalysis::~CSearchAnalysis(){ -} - -QDict<CSearchAnalysisItem>* CSearchAnalysis::getSearchAnalysisItemList(){ - // Returns pointer to the search analysis items - return &m_canvasItemList; -} - -/** Starts the analysis of the search result. This should be called only once because QCanvas handles the updates automatically. */ -void CSearchAnalysis::analyse(ListCSwordModuleInfo modules){ - /** - * Steps of analysing our search result; - * -Create the items for all available books ("Genesis" - "Revelation") - * -Iterate through all modules we analyse - * -Go through all books of this module - * -Find out how many times we found the book - * -Set the count to the items which belongs to the book - */ - setModules(modules); - - m_lastPosList.clear(); - const int numberOfModules = m_moduleList.count(); - if (!numberOfModules) - return; - m_legend = new CSearchAnalysisLegendItem(this, &m_moduleList); - m_legend->setX(LEFT_BORDER); - m_legend->setY(UPPER_BORDER); - m_legend->setSize(LEGEND_WIDTH, - LEGEND_INNER_BORDER*2 + ITEM_TEXT_SIZE*numberOfModules + LEGEND_DELTAY*(numberOfModules-1)); - m_legend->show(); - - int xPos = LEFT_BORDER + m_legend->width() + SPACE_BETWEEN_PARTS; - int moduleIndex = 0; - m_maxCount = 0; - int count = 0; - CSwordVerseKey key(0); - key.key("Genesis 1:1"); - - CSearchAnalysisItem* analysisItem = m_canvasItemList[key.book()]; - bool ok = true; - while (ok && analysisItem) { - for (moduleIndex = 0,m_moduleList.first(); m_moduleList.current(); m_moduleList.next(),++moduleIndex) { - KApplication::kApplication()->processEvents(10); - if (!m_lastPosList.contains(m_moduleList.current())) - m_lastPosList.insert(m_moduleList.current(),0); - analysisItem->setCountForModule(moduleIndex, (count = getCount(key.book(),m_moduleList.current()))); - m_maxCount = (count > m_maxCount) ? count : m_maxCount; - } - analysisItem->setX(xPos); - analysisItem->setY(UPPER_BORDER); - analysisItem->show(); - - xPos += (int)analysisItem->width() + SPACE_BETWEEN_PARTS; - ok = key.next(CSwordVerseKey::UseBook); - analysisItem = m_canvasItemList[key.book()]; - } - resize(xPos+BAR_WIDTH+(m_moduleList.count()-1)*BAR_DELTAX+RIGHT_BORDER, height() ); - slotResized(); -} - -/** Sets te module list used for the analysis. */ -void CSearchAnalysis::setModules(ListCSwordModuleInfo modules){ - m_moduleList.clear(); - for (modules.first(); modules.current(); modules.next()) { - if ( (modules.current()->type() == CSwordModuleInfo::Bible) || (modules.current()->type() == CSwordModuleInfo::Commentary) ) { //a Bible or an commentary - m_moduleList.append(modules.current()); - } - } - - m_canvasItemList.clear(); - CSearchAnalysisItem* analysisItem = 0; - CSwordVerseKey key(0); - key.key("Genesis 1:1"); - do { - analysisItem = new CSearchAnalysisItem(this, m_moduleList.count(), key.book(), &m_scaleFactor, &m_moduleList); - analysisItem->hide(); - m_canvasItemList.insert(key.book(), analysisItem); - } while (key.next(CSwordVerseKey::UseBook)); - update(); -} - -/** Sets back the items and deletes things to cleanup */ -void CSearchAnalysis::reset(){ - m_scaleFactor = 0.0; - QDictIterator<CSearchAnalysisItem> it( m_canvasItemList ); // iterator for items - while ( it.current() ) { - it.current()->hide(); - ++it; - } - m_lastPosList.clear(); - - if (m_legend) - m_legend->hide(); - delete m_legend; - m_legend = 0; - update(); -} - -/** No descriptions */ -void CSearchAnalysis::slotResized(){ - m_scaleFactor = (double)( (double)(height()-UPPER_BORDER-LOWER_BORDER-BAR_LOWER_BORDER-(m_moduleList.count()-1)*BAR_DELTAY) - /(double)m_maxCount); - QDictIterator<CSearchAnalysisItem> it( m_canvasItemList ); - while ( it.current() ) { - it.current()->setSize(BAR_WIDTH + (m_moduleList.count()-1)*BAR_DELTAX, height()-UPPER_BORDER-LOWER_BORDER); - it.current()->setY(UPPER_BORDER); - ++it; - } - update(); -} - -/** This function returns a color for each module */ -QColor CSearchAnalysis::getColor(int index){ - switch (index){ - case 0: return Qt::red; - case 1: return Qt::darkGreen; - case 2: return Qt::blue; - case 3: return Qt::cyan; - case 4: return Qt::magenta; - case 5: return Qt::darkRed; - case 6: return Qt::darkGray; - case 7: return Qt::black; - case 8: return Qt::darkCyan; - case 9: return Qt::darkMagenta; - default: return Qt::red; - } -} - -/** Returns the count of the book in the module */ -const unsigned int CSearchAnalysis::getCount( const QString book, CSwordModuleInfo* module ){ - sword::ListKey& result = module->searchResult(); - const int length = book.length(); - unsigned int i = m_lastPosList[module]; - unsigned int count = 0; - const unsigned int resultCount = result.Count(); - while (i < resultCount) { - if ( strncmp(book.local8Bit(), (const char*)*result.GetElement(i), length) ) - break; - i++; - ++count; - } - m_lastPosList.contains(module) ? m_lastPosList.replace(module,i) : m_lastPosList.insert(module,i); - - return count; -} - - -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -CSearchAnalysisItem::CSearchAnalysisItem(QCanvas *parent, const int moduleCount, const QString &bookname, double *scaleFactor, ListCSwordModuleInfo* modules) - : QCanvasRectangle(parent), - m_moduleList( modules ), - m_scaleFactor(scaleFactor), - m_bookName(bookname), - m_moduleCount(moduleCount), - m_bufferPixmap(0) -{ - m_resultCountArray.resize(m_moduleCount); - int index = 0; - for (index = 0; index < m_moduleCount; ++index) - m_resultCountArray[index] = 0; -} - -CSearchAnalysisItem::~CSearchAnalysisItem() { - delete m_bufferPixmap; -} - -/** Sets the resultcount of this item for the given module */ -void CSearchAnalysisItem::setCountForModule( const int moduleIndex, const int count) { - m_resultCountArray[moduleIndex] = count; -} - -/** Returns the resultcount of this item for the given module */ -int CSearchAnalysisItem::getCountForModule( const int moduleIndex) { - return m_resultCountArray[moduleIndex]; -} - -/** Reimplementation. Draws the content of this item. */ -void CSearchAnalysisItem::draw(QPainter& painter) { - QFont f = painter.font(); - f.setPointSize(ITEM_TEXT_SIZE); - painter.setFont(f); - - setPen(QPen(black,1)); - setBrush(Qt::red); - /** - * We have to paint so many bars as we have modules available (we use m_moduleCount) - * We paint inside the area which is given by height and width of this rectangle item - */ - int index = 0; - int drawn = 0; - int Value = 0; - - //find out the biggest value - for (index=0;index < m_moduleCount; index++) { - if (m_resultCountArray[index] > Value) { - Value = m_resultCountArray[index]; - } - }; - - while (drawn < m_moduleCount) { - for (index = 0; index < m_moduleCount; index++) { - if (m_resultCountArray[index] == Value) { - QPoint p1((int)x() + (m_moduleCount-drawn-1)*BAR_DELTAX, - (int)height() + (int)y() - BAR_LOWER_BORDER - (m_moduleCount-drawn)*BAR_DELTAY); - QPoint p2(p1.x() + BAR_WIDTH, - p1.y() - (int)( !m_resultCountArray[index] ? 0 : ((m_resultCountArray[index])*(*m_scaleFactor))) ); - QRect r(p1, p2); - painter.fillRect(r, QBrush(CSearchAnalysis::getColor(index)) ); - painter.drawRect(r); - drawn++; - } - } - //finds the next smaller value - int newValue = 0; - for (index=0;index < m_moduleCount; index++) - if (m_resultCountArray[index] < Value && m_resultCountArray[index] >= newValue) - newValue = m_resultCountArray[index]; - Value = newValue; - } - if (!m_bufferPixmap) { - m_bufferPixmap = new QPixmap(); - m_bufferPixmap->resize(width(),BAR_LOWER_BORDER); - m_bufferPixmap->fill(); - QPainter p(m_bufferPixmap); - f = p.font(); - f.setPointSize(ITEM_TEXT_SIZE); - p.setFont(f); - p.rotate(90); - p.drawText(QPoint(5,0), m_bookName); - } - painter.drawPixmap(QPoint(int(x()),int(height()+y()-BAR_LOWER_BORDER)), *m_bufferPixmap); -} - -/** Returns the width of this item. */ -int CSearchAnalysisItem::width(){ - return m_moduleCount*(m_moduleCount>1 ? BAR_DELTAX : 0) + BAR_WIDTH; -} - -/** Returns the tooltip for this item. */ -const QString CSearchAnalysisItem::getToolTip(){ - QString ret = QString::fromLatin1("<CENTER><B>%1</B></CENTER><HR>").arg(m_bookName); - ret += "<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" WIDTH=\"100%\" HEIGHT=\"100%\" ALIGN=\"center\">"; - for (int i = 0; i < m_moduleCount; ++i) { - CSwordModuleInfo* info = m_moduleList->at(i); - const QColor c = CSearchAnalysis::getColor(i); - ret.append( - QString::fromLatin1("<TR BGCOLOR=\"white\"><TD><B><FONT COLOR=\"#%1\">%2</FONT></B></TD><TD>%3 (%4%)</TD></TR>") - .arg(QString().sprintf("%02X%02X%02X",c.red(),c.green(),c.blue())) - .arg(info ? info->name() : QString::null) - .arg(m_resultCountArray[i]) - .arg((info && m_resultCountArray[i])? ((double)m_resultCountArray[i] / (double)info->searchResult().Count())*(double)100 : 0.0, 0, 'g', 2) - ); - } - ret += "</TABLE>"; - return ret; -} - -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -CSearchAnalysisView::CSearchAnalysisView(QCanvas* canvas, QWidget* parent) - : QCanvasView(canvas, parent) { -// QWhatsThis::add(this, WT_SD_ANALYSIS_VIEW); - setFocusPolicy(QWidget::WheelFocus); - m_toolTip = new ToolTip(this); - resize(sizeHint()); - -} - -/** Returns the sizeHint for this view */ -QSize CSearchAnalysisView::sizeHint(){ - if ( parentWidget() ) - return parentWidget()->sizeHint(); - return QCanvasView::sizeHint(); -} - -/** No descriptions */ -void CSearchAnalysisView::resizeEvent( QResizeEvent* e){ - QCanvasView::resizeEvent(e); - canvas()->resize( canvas()->width(), viewport()->height() ); -} - -CSearchAnalysisView::ToolTip::ToolTip(QWidget* parent) : QToolTip(parent) { -} - -void CSearchAnalysisView::ToolTip::maybeTip(const QPoint& p) { - CSearchAnalysisView* view = dynamic_cast<CSearchAnalysisView*>(parentWidget()); - if (!view) - return; - QPoint point(p); - point = view->viewport()->mapFrom(view, point); - CSearchAnalysisItem* i = view->itemAt( view->viewportToContents(point) ); - if (!i) - return; - - //get type of item and display correct text - QString text = i->getToolTip(); - if (text.isEmpty()) - return; - - QPoint p1 = view->viewport()->mapTo(view, view->contentsToViewport(i->rect().topLeft())); - p1.setY(0); - QPoint p2 = view->viewport()->mapTo(view, view->contentsToViewport(i->rect().bottomRight())); - p2.setY(view->height()); - QRect r = QRect( p1, p2 ); - if (r.contains(p)) - tip(r, text); -} - - -/** Returns the item at position p. If there no item at that point return 0. */ -CSearchAnalysisItem* CSearchAnalysisView::itemAt( const QPoint& p ){ - QCanvasItemList l = canvas()->collisions(p); - if (!l.count()) - return 0; - return dynamic_cast<CSearchAnalysisItem*>(l.first()); -} - -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -CSearchAnalysisLegendItem::CSearchAnalysisLegendItem(QCanvas *parent, ListCSwordModuleInfo *list ) - : QCanvasRectangle(parent) { - m_moduleList = list; -} - -/** Reimplementation. Draws the content of this item. */ -void CSearchAnalysisLegendItem::draw (QPainter& painter) { - painter.save(); - - setPen( QPen(black,2) ); - setBrush( Qt::white ); - //the outer rectangle - QPoint p1( (int)x(), (int)y() ); - QPoint p2( (int)x()+width(), (int)y() + height() ); - QRect r(p1, p2); - r.normalize(); - painter.drawRect(r); - - QFont f = painter.font(); - f.setPointSize(ITEM_TEXT_SIZE); - painter.setFont(f); - - for (unsigned int index=0; index < m_moduleList->count(); index++){ - // the module color indicators - QPoint p1( (int)x() + LEGEND_INNER_BORDER, (int)y() + LEGEND_INNER_BORDER + index*(LEGEND_DELTAY + ITEM_TEXT_SIZE) ); - QPoint p2(p1.x() + ITEM_TEXT_SIZE, p1.y() + ITEM_TEXT_SIZE); - QRect r(p1,p2); - painter.fillRect(r, QBrush(CSearchAnalysis::getColor(index)) ); - r.normalize(); - painter.drawRect(r); - - QPoint p3( p2.x() + LEGEND_INNER_BORDER, p2.y() ); - painter.drawText(p3, m_moduleList->at(index)->name() ); - } - painter.restore(); -} - -/** No descriptions */ -void CSearchAnalysis::saveAsHTML(){ - const QString file = KFileDialog::getSaveFileName(QString::null, QString::fromLatin1("*.html | %1").arg(i18n("HTML files")), 0, i18n("Save Search Analysis")); - if (file.isNull()) { - return; - } - - int moduleIndex = 0; - int count = 0; - QString countStr = ""; - QString m_searchAnalysisHTML = ""; - QString tableTitle = ""; - QString tableTotals = ""; - QString VerseRange = ""; - const QString txtCSS = QString::fromLatin1("<style type=\"text/css\">\ntd {border:1px solid black;}\nth {font-size: 130%; text-align:left; vertical-align:top;}\n</style>\n"); - const QString metaEncoding = QString::fromLatin1("<META http-equiv=Content-Type content=\"text/html; charset=utf-8\">"); - CSwordVerseKey key(0); - sword::ListKey searchResult; - - key.key("Genesis 1:1"); - - if (CSearchDialog::getSearchDialog()->searchScopeType() != CSwordModuleSearch::Scope_NoScope) { //a search scope was used - sword::ListKey verses = CSearchDialog::getSearchDialog()->searchScope(); - for (int i = 0; i < verses.Count(); ++i) { - VerseRange += QString::fromLocal8Bit(verses.GetElement(i)->getRangeText()) + "<BR>"; - } - } - - CSearchAnalysisItem* analysisItem = m_canvasItemList.find( key.book() ); - - QString text = "<html>\n<head>\n<title>" + i18n("BibleTime Search Analysis") + "</title>\n" + txtCSS + metaEncoding + "</head>\n<body>\n"; - text += "<table>\n<tr><th>" + i18n("Search text :") + "</th><th>" + CSearchDialog::getSearchDialog()->searchText() + "</th></tr>\n"; - text += QString::fromLatin1("<tr><th>") + i18n("Search type :") + QString::fromLatin1("</th><th>") + /*m_searchText->getSearchTypeString() +*/ "</th></tr>\n"; - text += QString::fromLatin1("<tr><th>") + i18n("Search scope:") + "</th><th>" + ((CSearchDialog::getSearchDialog()->searchScopeType() != CSwordModuleSearch::Scope_NoScope) ? VerseRange : i18n("No search scope")) + "</th></tr>\n</table>\n<br>\n"; - - - tableTitle = "<tr><th align=\"left\">" + i18n("Book") + "</th>"; - tableTotals = "<tr><td align=\"left\">" + i18n("Total hits") + "</td>"; - for (moduleIndex = 0,m_moduleList.first(); m_moduleList.current(); m_moduleList.next(),++moduleIndex) { - tableTitle += QString::fromLatin1("<th align=\"left\">") + m_moduleList.current()->name() + QString::fromLatin1("</th>"); - searchResult = m_moduleList.current()->searchResult(); - countStr.setNum(searchResult.Count()); - tableTotals += QString::fromLatin1("<td align=\"right\">") + countStr + QString::fromLatin1("</td>"); - } - tableTitle += QString::fromLatin1("</tr>\n"); - tableTotals += QString::fromLatin1("</tr>\n"); - - m_searchAnalysisHTML = ""; - bool ok = true; - while (ok) { - m_searchAnalysisHTML += QString::fromLatin1("<tr><td>") + key.book() + QString::fromLatin1("</td>"); - analysisItem = m_canvasItemList.find( key.book() ); - for (moduleIndex = 0, m_moduleList.first(); m_moduleList.current(); m_moduleList.next(), ++moduleIndex) { - count = analysisItem->getCountForModule(moduleIndex); - countStr.setNum(count); - m_searchAnalysisHTML += QString::fromLatin1("<td align=\"right\">") + countStr + QString::fromLatin1("</td>"); - } - m_searchAnalysisHTML += QString::fromLatin1("</tr>\n"); - ok = key.next(CSwordVerseKey::UseBook); - } - text += QString::fromLatin1("<table>\n") + tableTitle + tableTotals + m_searchAnalysisHTML + QString::fromLatin1("</table>\n"); - text += QString::fromLatin1("<center>") + i18n("Created by") + QString::fromLatin1(" <a href=\"http://www.bibletime.info/\">BibleTime</a></center>"); - text += QString::fromLatin1("</body></html>"); - - CToolClass::savePlainFile(file, text, false, QTextStream::UnicodeUTF8); -} diff --git a/bibletime/frontend/searchdialog/csearchdialog.h b/bibletime/frontend/searchdialog/csearchdialog.h deleted file mode 100644 index c54dae6..0000000 --- a/bibletime/frontend/searchdialog/csearchdialog.h +++ /dev/null @@ -1,460 +0,0 @@ -/*************************************************************************** - csearchdialog.h - description - ------------------- - begin : Die Jul 30 2002 - copyright : (C) 2002 by The BibleTime team - email : info@bibletime.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef CSEARCHDIALOG_H -#define CSEARCHDIALOG_H - -//BibleTime includes -#include "csearchdialogpages.h" - -#include "backend/cswordmoduleinfo.h" -#include "backend/cswordbackend.h" -#include "backend/cswordmodulesearch.h" - -#include "util/cpointers.h" - -//Sword includes - - -//Qt includes -#include <qwidget.h> -#include <qstring.h> -#include <qcanvas.h> -#include <qdict.h> -#include <qtooltip.h> - -//KDE includes -#include <kdialog.h> -#include <kdialogbase.h> - -//forward declarations -class CSearchAnalysisItem; -class CSearchAnalysisLegendItem; -class CSearchAnalysis; -class CSearchAnalysisView; - -class QLineEdit; -class QTextEdit; - -/** - *@author The BibleTime team - */ - -class CSearchDialog : public KDialogBase { - Q_OBJECT - -public: - static void openDialog(const ListCSwordModuleInfo modules, const QString& searchText = QString::null, QWidget* parentDialog = 0); - -public slots: // Public slots - /** - * Reimplemented to show the First time searchdialog page. - */ - virtual void show(); - -protected: - friend class CSearchAnalysis; - friend class CSearchResultPage; - /** - * Only interesting for the class members! Useful to get the searched text etc. - */ - static CSearchDialog* const getSearchDialog(); - - /** - * The cinstructor of the dialog. It's protected because you should use the static public function openDialog. - * The dialog destroys itself if it was closed. - */ - CSearchDialog(QWidget *parent); - virtual ~CSearchDialog(); - /** - * Initializes this object. - */ - void initView(); - /** - * Starts the search with the given module list and given search text. - * Doesn't wait for the start button press, starts immediatly - */ - void startSearch( const ListCSwordModuleInfo modules, const QString& searchText); - /** - * Sets the list of modules for the search. - */ - void setModules( const ListCSwordModuleInfo modules ); - /** - * Returns the list of used modules. - */ - const ListCSwordModuleInfo modules(); - /** - * Returns the search text which is used for the search. - */ - void setSearchText( const QString searchText ); - /** - * Returns the search text which is set currently. - */ - const QString searchText(); - /** - * Returns the used search scope as a list key - */ - sword::ListKey searchScope(); - /** - * Returns true if the search used a scope, otherwise false. - */ - const CSwordModuleSearch::scopeType searchScopeType() const; - /** - * Returns they type of search which is set - */ - const int searchFlags() const; - /** - * Resets the parts to the default. - */ - void reset(); - -protected slots: - /** - * Updates the percentage bars. - */ - void percentUpdate(); - /** - * Starts the search with the set modules and the set search text. - */ - void startSearch(); - void searchFinished(); - void showModulesSelector(); - /** - * Initializes the signal slot connections - */ - void initConnections(); - /** - * Updates the progress. - */ - void updateProgress(); - /** - * Interrupts the search. - */ - void interruptSearch(); - /** - * Is the slot which is called when a page will be shown. - */ - void slotShowPage(QWidget* page); - /** Reimplementation. */ - virtual void slotClose(); - -private: - CSearchResultPage* m_searchResultPage; - CSearchOptionsPage* m_searchOptionsPage; - CSwordModuleSearch m_searcher; - struct { - int optionsPage; - int resultPage; - } m_index; - bool m_interruptedSearch; -}; - -class CModuleChooser : public KListView, public CPointers { - Q_OBJECT -public: - class ModuleCheckBoxItem : virtual public QCheckListItem { - public: - ModuleCheckBoxItem(QListViewItem* item, CSwordModuleInfo* module); - ~ModuleCheckBoxItem(); - /** - * Returns the used module. - */ - CSwordModuleInfo* const module() const; - private: - CSwordModuleInfo* m_module; - }; - - CModuleChooser(QWidget* parent); - ~CModuleChooser(); - /** - * Sets the list of modules and updates the state of the checkbox items. - */ - void setModules( ListCSwordModuleInfo modules ); - /** - * Returns a list of selected modules. - */ - ListCSwordModuleInfo modules(); - -public slots: - /** - * Reimplemented to open the folders which contain checked module items - */ - virtual void show(); - - -protected: // Protected methods - /** - * Initializes this widget and the childs of it. - */ - void initView(); - /** - * Initializes the tree of this widget. - */ - void initTree(); -}; - -class CModuleChooserDialog : public KDialogBase { - Q_OBJECT -public: - CModuleChooserDialog(QWidget* parentDialog, ListCSwordModuleInfo modules); - ~CModuleChooserDialog(); - -signals: - void modulesChanged(ListCSwordModuleInfo modules); - -protected: // Protected methods - /** - * Initializes the view of this dialog - */ - void initView(); - /** - * Initializes the connections of this dialog. - */ - void initConnections(); - -protected slots: // Protected slots - /** - * Reimplementation to handle the modules. - */ - virtual void slotOk(); - -private: - CModuleChooser* m_moduleChooser; -}; - -class CSearchAnalysisDialog : public KDialogBase { - Q_OBJECT -public: - CSearchAnalysisDialog(ListCSwordModuleInfo modules, QWidget* parentDialog); - ~CSearchAnalysisDialog(); - -protected: // Protected methods - /** - * Initializes the widgets SIGNAL and SLOT connections,. - */ - void initConnections(); - /** - * Initializes this dialog. - */ - void initView(); - -private: - CSearchAnalysis* m_analysis; - CSearchAnalysisView* m_analysisView; -}; - -class CRangeChooserDialog : public KDialogBase { - Q_OBJECT -public: - CRangeChooserDialog(QWidget* parentDialog); - ~CRangeChooserDialog(); - -protected: // Protected methods - class RangeItem : public KListViewItem { - public: - RangeItem(QListView*, QListViewItem* afterThis = 0, const QString caption = QString::null, const QString range = QString::null); - ~RangeItem(); - const QString& range(); - const QString caption(); - void setRange(QString range); - void setCaption(const QString); - private: - QString m_range; - }; - - /** - * Initializes the connections of this widget. - */ - void initConnections(); - /** - * Initializes the view of this object. - */ - void initView(); - -protected slots: // Protected slots - /** - * Adds a new range to the list. - */ - void addNewRange(); - void editRange(QListViewItem*); - /** - * Parses the entered text and prints out the result in the list box below the edit area. - */ - void parseRange(); - void nameChanged(const QString&); - void rangeChanged(); - /** - * Deletes the selected range. - */ - void deleteCurrentRange(); - virtual void slotDefault(); - virtual void slotOk(); - -private: - KListView* m_rangeList; - KListView* m_resultList; - QLineEdit* m_nameEdit; - QTextEdit* m_rangeEdit; - QPushButton* m_newRangeButton; - QPushButton* m_deleteRangeButton; -}; - -/** - * CSearchDialogAnaylsis shows the graphical analysis of the search result. - * @author The BibleTime Team - */ -class CSearchAnalysis : public QCanvas { - Q_OBJECT -public: - CSearchAnalysis(QObject *parent=0, const char *name=0); - virtual ~CSearchAnalysis(); - /** - * Starts the analysis of the search result. - * This should be called only once because - * QCanvas handles the updates automatically. - */ - void analyse(ListCSwordModuleInfo modules); - /** - * This function returns a color for each module - * @return The color at position index in the list - */ - static QColor getColor(int index); - /* - * This function returns a pointer to the list of AnalysisItems - */ - QDict<CSearchAnalysisItem>* getSearchAnalysisItemList(); - void reset(); - -protected slots: // Protected slots - /** - * No descriptions - */ - void slotResized(); - -protected: - void setModules(ListCSwordModuleInfo modules); - -private: - /** - * Returns the count of the book in the module - */ - const unsigned int getCount( const QString book, CSwordModuleInfo* module ); - - ListCSwordModuleInfo m_moduleList; - QDict<CSearchAnalysisItem> m_canvasItemList; - QMap<CSwordModuleInfo*,unsigned int> m_lastPosList; - int m_maxCount; - double m_scaleFactor; - CSearchAnalysisLegendItem* m_legend; - -public slots: // Public slots - void saveAsHTML(); -}; - - -//---------------------------------------------------------- -//---------------------------------------------------------- - -/** Paints the bars for one book for one or more modules - * - */ -class CSearchAnalysisItem : public QCanvasRectangle { -public: - /** - * Standard constructor. - */ - CSearchAnalysisItem(QCanvas* parent, const int moduleCount, const QString& bookname, double *scaleFactor, ListCSwordModuleInfo* modules); - virtual ~CSearchAnalysisItem(); - /** - * Sets the resultcount of this item - */ - void setCountForModule( const int moduleIndex, const int count); - - /** - * Returns the resultcount of this item - */ - int getCountForModule( const int moduleIndex); - /** - * Returns the width of this item. - */ - virtual int width(); - /** - * Returns the tooltip for this item. - */ - const QString getToolTip(); - -private: - virtual void draw (QPainter & painter); - - ListCSwordModuleInfo* m_moduleList; - double *m_scaleFactor; - QString m_bookName; - int m_moduleCount; - QMemArray<int> m_resultCountArray; - QPixmap* m_bufferPixmap; -}; - -class CSearchAnalysisLegendItem : public QCanvasRectangle { - -public: - CSearchAnalysisLegendItem(QCanvas* parent, ListCSwordModuleInfo* list ); - -private: - virtual void draw (QPainter & painter); - ListCSwordModuleInfo* m_moduleList; -}; - -//---------------------------------------------------------- -//---------------------------------------------------------- -class CSearchAnalysisView : public QCanvasView { - Q_OBJECT -public: - /** - * Standard constructor - */ - CSearchAnalysisView(QCanvas* canvas, QWidget* parent); - /** - * Returns the sizeHint for this view - * We give back the size of the parent widgetas default. - * This is a reimplementation from QCanvasView::sizeHint(). - */ - virtual QSize sizeHint(); - /** - * Returns the item at position p. - * If there no item at that point return 0. - */ - CSearchAnalysisItem* itemAt( const QPoint& p ); - -protected: - /** - * Reimplementation. - */ - virtual void resizeEvent(QResizeEvent* e); - -private: - class ToolTip : public QToolTip { - public: - ToolTip(QWidget* parent); - /** - * Displays a tooltip for position p - */ - virtual void maybeTip(const QPoint &pos); - }; - ToolTip* m_toolTip; -}; - -#endif diff --git a/bibletime/frontend/searchdialog/csearchdialogpages.cpp b/bibletime/frontend/searchdialog/csearchdialogpages.cpp deleted file mode 100644 index ac4eb3c..0000000 --- a/bibletime/frontend/searchdialog/csearchdialogpages.cpp +++ /dev/null @@ -1,851 +0,0 @@ -/*************************************************************************** - csearchdialogpages.cpp - description - ------------------- - begin : Die Jul 30 2002 - copyright : (C) 2002 by The BibleTime team - email : info@bibletime.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include "csearchdialogpages.h" - -#include "csearchdialog.h" - -#include "backend/centrydisplay.h" - -#include "frontend/cbtconfig.h" -#include "frontend/cdragdropmgr.h" -#include "frontend/cexportmanager.h" -#include "frontend/display/cdisplay.h" -#include "frontend/display/creaddisplay.h" - -#include "util/cresmgr.h" -#include "util/cpointers.h" -#include "util/ctoolclass.h" - -//Qt includes -#include <qlayout.h> -#include <qhbox.h> -#include <qlabel.h> -#include <qlistview.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qsplitter.h> -#include <qtooltip.h> -#include <qbuttongroup.h> -#include <qcheckbox.h> -#include <qwhatsthis.h> -#include <qheader.h> -#include <qgroupbox.h> -#include <qregexp.h> - -//KDE includes -#include <klocale.h> -#include <kaction.h> -#include <klistview.h> -#include <kcombobox.h> -#include <kprogress.h> -#include <kpopupmenu.h> -#include <ksqueezedtextlabel.h> - -/******************************************** -************ ModuleResultList ************** -********************************************/ - -CSearchResultView::CSearchResultView(QWidget* parent) : KListView(parent), m_module(0) { - initView(); - initConnections(); -}; - -CSearchResultView::~CSearchResultView() { -}; - -/** Initializes the view of this widget. */ -void CSearchResultView::initView(){ - addColumn(i18n("Found items")); - setFullWidth(true); - setSorting(-1); - setDragEnabled(true); - setSelectionModeExt(KListView::Extended); - - //setup the popup menu - m_popup = new KPopupMenu(this); -// m_popup->insertTitle(i18n("Bible window")); - - m_actions.copyMenu = new KActionMenu(i18n("Copy..."), CResMgr::searchdialog::result::foundItems::copyMenu::icon); - m_actions.copy.result = new KAction(i18n("Reference only"), KShortcut(0), this, SLOT(copyItems()), this); - m_actions.copyMenu->insert(m_actions.copy.result); - m_actions.copy.resultWithText = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(copyItemsWithText()), this); - m_actions.copyMenu->insert(m_actions.copy.resultWithText); - m_actions.copyMenu->plug(m_popup); - - m_actions.saveMenu = new KActionMenu(i18n("Save..."),CResMgr::searchdialog::result::foundItems::saveMenu::icon); - m_actions.save.result = new KAction(i18n("Reference only"), KShortcut(0), this, SLOT(saveItems()), this); - m_actions.saveMenu->insert(m_actions.save.result); - m_actions.save.resultWithText = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(saveItemsWithText()), this); - m_actions.saveMenu->insert(m_actions.save.resultWithText); - m_actions.saveMenu->plug(m_popup); - - m_actions.printMenu = new KActionMenu(i18n("Print..."),CResMgr::searchdialog::result::foundItems::printMenu::icon); - m_actions.print.result = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(printItems()), this); - m_actions.printMenu->insert(m_actions.print.result); - m_actions.printMenu->plug(m_popup); -} - -/** No descriptions */ -void CSearchResultView::initConnections(){ -// connect(this, SIGNAL(executed(QListViewItem*)), -// this, SLOT(executed(QListViewItem*))); - connect(this, SIGNAL(currentChanged(QListViewItem*)), - this, SLOT(executed(QListViewItem*))); - - connect(this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(showPopup(KListView*, QListViewItem*, const QPoint&))); -} - -/** Setups the list with the given module. */ -void CSearchResultView::setupTree(CSwordModuleInfo* m){ - clear(); - if (!m) - return; - m_module = m; - - sword::ListKey result = m->searchResult(); - const int count = result.Count(); - if (!count) - return; - - setUpdatesEnabled(false); - - QListViewItem* oldItem = 0; - KListViewItem* item = 0; - for (int index = 0; index < count; index++) { - item = new KListViewItem(this, oldItem); - item->setText(0,QString::fromLocal8Bit((const char*)*result.GetElement(index))); - oldItem = item; - } - - setUpdatesEnabled(true); - - setSelected(firstChild(), true); - executed(currentItem()); -} - -/** Is connected to the signal executed, which is emitted when a mew item was chosen. */ -void CSearchResultView::executed(QListViewItem* item){ -// Q_ASSERT(item); -// qWarning("executed"); - emit keySelected(item->text(0)); -} - -/** Reimplementation to show the popup menu. */ -void CSearchResultView::showPopup(KListView*, QListViewItem*, const QPoint& point){ - m_popup->exec(point); -} - -/** No descriptions */ -void CSearchResultView::printItems(){ - QPtrList<QListViewItem> items = selectedItems(); - CExportManager mgr(i18n("Print search result..."), true, i18n("Printing search result")); - - PrintItemList list; - for (QListViewItem* k = items.first(); k; k = items.next()) { - list.append( QStringPair(k->text(0), QString::null) ); - }; - mgr.printKeyList( list, module() ); -} - -/** No descriptions */ -void CSearchResultView::saveItems(){ - CExportManager mgr(i18n("Save search result..."), true, i18n("Saving search result")); - - CSwordModuleInfo* m = module(); - CSwordKey* k = 0; - QPtrList<QListViewItem> items = selectedItems(); - QPtrList<CSwordKey> keys; - for (QListViewItem* i = items.first(); i; i = items.next()) { - k = CSwordKey::createInstance( m ); - k->key(i->text(0)); - keys.append( k ); - }; - mgr.saveKeyList( keys, CExportManager::Text, false); - - keys.setAutoDelete(true); - keys.clear(); //delete all the keys we created -} - -/** No descriptions */ -void CSearchResultView::saveItemsWithText(){ - CExportManager mgr(i18n("Save search result..."), true, i18n("Saving search result")); - - CSwordModuleInfo* m = module(); - CSwordKey* k = 0; - QPtrList<QListViewItem> items = selectedItems(); - QPtrList<CSwordKey> keys; - for (QListViewItem* i = items.first(); i; i = items.next()) { - k = CSwordKey::createInstance( m ); - k->key(i->text(0)); - keys.append( k ); - }; - mgr.saveKeyList( keys, CExportManager::Text, true); - - keys.setAutoDelete(true); - keys.clear(); //delete all the keys we created -} - -/** No descriptions */ -void CSearchResultView::copyItems(){ - CExportManager mgr(i18n("Copy search result..."), true, i18n("Copying search result")); - - CSwordModuleInfo* m = module(); - CSwordKey* k = 0; - QPtrList<QListViewItem> items = selectedItems(); - QPtrList<CSwordKey> keys; - for (QListViewItem* i = items.first(); i; i = items.next()) { - k = CSwordKey::createInstance( m ); - k->key(i->text(0)); - keys.append( k ); - }; - mgr.copyKeyList( keys, CExportManager::Text, false); - - keys.setAutoDelete(true); - keys.clear(); //delete all the keys we created - -} - -/** No descriptions */ -void CSearchResultView::copyItemsWithText(){ - CExportManager mgr(i18n("Copy search result..."), true, i18n("Copying search result")); - - CSwordModuleInfo* m = module(); - CSwordKey* k = 0; - QPtrList<QListViewItem> items = selectedItems(); - QPtrList<CSwordKey> keys; - for (QListViewItem* i = items.first(); i; i = items.next()) { - k = CSwordKey::createInstance( m ); - k->key(i->text(0)); - keys.append( k ); - }; - mgr.copyKeyList( keys, CExportManager::Text, true); - - keys.setAutoDelete(true); - keys.clear(); //delete all the keys we created -} - -/** Returns the module which is currently used. */ -CSwordModuleInfo* const CSearchResultView::module(){ - return m_module; -} - -QDragObject* CSearchResultView::dragObject() { - //return a valid DragObject to make DnD possible! - - /* - * First get all selected items and fill with them the dndItems list. The return the QDragObject we got from CDRagDropMgr - */ - CDragDropMgr::ItemList dndItems; - - QPtrList<QListViewItem> items = selectedItems(); - for (items.first(); items.current(); items.next()) { - dndItems.append( CDragDropMgr::Item(m_module->name(), items.current()->text(0), QString::null) ); //no description - }; - - return CDragDropMgr::dragObject(dndItems, viewport()); -}; - -/******************************************** -************ ModuleResultList ************** -********************************************/ - -CModuleResultView::CModuleResultView(QWidget* parent) : KListView(parent) { - initView(); - initConnections(); -}; - -CModuleResultView::~CModuleResultView() { - -}; - -/** Initializes this widget. */ -void CModuleResultView::initView(){ - addColumn(i18n("Module")); - addColumn(i18n("Found items")); - -// setFullWidth(true); - setSorting(0, true); - setSorting(1, true); - setAllColumnsShowFocus(true); - - - //setup the popup menu - m_popup = new KPopupMenu(this); -// m_popup->insertTitle(i18n("Bible window")); - - m_actions.copyMenu = new KActionMenu(i18n("Copy..."), CResMgr::searchdialog::result::moduleList::copyMenu::icon); - m_actions.copy.result = new KAction(i18n("Reference only"), KShortcut(0), this, SLOT(copyResult()), this); - m_actions.copyMenu->insert(m_actions.copy.result); - m_actions.copy.resultWithText = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(copyResultWithText()), this); - m_actions.copyMenu->insert(m_actions.copy.resultWithText); - m_actions.copyMenu->plug(m_popup); - - m_actions.saveMenu = new KActionMenu(i18n("Save..."),CResMgr::searchdialog::result::moduleList::saveMenu::icon); - m_actions.save.result = new KAction(i18n("Reference only"), KShortcut(0), this, SLOT(saveResult()), this); - m_actions.saveMenu->insert(m_actions.save.result); - m_actions.save.resultWithText = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(saveResultWithText()), this); - m_actions.saveMenu->insert(m_actions.save.resultWithText); - m_actions.saveMenu->plug(m_popup); - - m_actions.printMenu = new KActionMenu(i18n("Print..."),CResMgr::searchdialog::result::moduleList::printMenu::icon); - m_actions.print.result = new KAction(i18n("Reference with text"), KShortcut(0), this, SLOT(printResult()), this); - m_actions.printMenu->insert(m_actions.print.result); - - - m_actions.printMenu->plug(m_popup); -} - -/** Initializes the connections of this widget, */ -void CModuleResultView::initConnections(){ - connect(this, SIGNAL(executed(QListViewItem*)), - SLOT(executed(QListViewItem*))); - connect(this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(showPopup(KListView*, QListViewItem*, const QPoint&))); -} - -/** Setups the tree using the given list of modules. */ -void CModuleResultView::setupTree( ListCSwordModuleInfo modules ){ - clear(); - QListViewItem* item = 0; - QListViewItem* oldItem = 0; - sword::ListKey result; - for (modules.first(); modules.current(); modules.next()) { - result = modules.current()->searchResult(); - item = new KListViewItem(this, modules.current()->name(), QString::number(result.Count()) ); - item->setPixmap(0,CToolClass::getIconForModule(modules.current()) ); - oldItem = item; - }; - - setSelected(currentItem(), true); - executed(currentItem()); -} - - -/** Is executed when an item was selected in the list. */ -void CModuleResultView::executed( QListViewItem* i ){ - if (CSwordModuleInfo* m = CPointers::backend()->findModuleByName(i->text(0))) { - emit moduleChanged(); - emit moduleSelected(m); - } -} - -/** Returns the currently active module. */ -CSwordModuleInfo* const CModuleResultView::activeModule(){ - Q_ASSERT(currentItem()); - if (currentItem()) - return CPointers::backend()->findModuleByName(currentItem()->text(0)); - return 0; -} - -/** No descriptions */ -void CModuleResultView::showPopup(KListView*, QListViewItem*, const QPoint& point){ - //make sure that all entries have the correct status - m_popup->exec(point); -} - -/** Copies the whole search result into the clipboard. */ -void CModuleResultView::copyResult(){ - if (CSwordModuleInfo* m = activeModule()) { - sword::ListKey result = m->searchResult(); - CExportManager mgr(i18n("Copy search result..."), true, i18n("Copying search result")); - mgr.copyKeyList(&result,m,CExportManager::Text,false); - }; -} - -/** Copies the whole search result with the text into the clipboard. */ -void CModuleResultView::copyResultWithText(){ - if (CSwordModuleInfo* m = activeModule()) { - sword::ListKey result = m->searchResult(); - CExportManager mgr(i18n("Copy search result..."), true, i18n("Copying search result")); - mgr.copyKeyList(&result,m,CExportManager::Text,true); - }; -} - -/** Saves the search result keys. */ -void CModuleResultView::saveResult(){ - if (CSwordModuleInfo* m = activeModule()) { - sword::ListKey result = m->searchResult(); - CExportManager mgr(i18n("Save search result..."), true, i18n("Saving search result")); - mgr.saveKeyList(&result,m,CExportManager::Text,false); - }; -} - -/** Saves the search result with it's text. */ -void CModuleResultView::saveResultWithText(){ - if (CSwordModuleInfo* m = activeModule()) { - sword::ListKey result = m->searchResult(); - CExportManager mgr(i18n("Save search result..."), true, i18n("Saving search result")); - mgr.saveKeyList(&result,m,CExportManager::Text,true); - }; -} - -/** Appends the whole search result to the printer queue. */ -void CModuleResultView::printResult(){ - if (CSwordModuleInfo* m = activeModule()) { - sword::ListKey result = m->searchResult(); - CExportManager mgr(i18n("Print search result..."), true, i18n("Printing search result")); - mgr.printKeyList(&result,m); - }; -} - -/******************************************** -********** CSearchDialogResultPage ********* -********************************************/ - -CSearchResultPage::CSearchResultPage(QWidget *parent, const char *name ) : QWidget(parent,name) { - initView(); - initConnections(); -} - -CSearchResultPage::~CSearchResultPage(){ - -} - -/** Initializes the view of this widget. */ -void CSearchResultPage::initView(){ - QVBoxLayout* mainLayout = new QVBoxLayout(this); - - QSplitter* splitter = new QSplitter(Vertical, this); - mainLayout->addWidget(splitter); - -// QHBox* layoutBox = new QHBox(splitter); -// layoutBox->setSpacing(3); - QSplitter* hSplitter = new QSplitter(Horizontal, splitter); - m_moduleListBox = new CModuleResultView(hSplitter); -// m_moduleListBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); -// layoutBox->setStretchFactor(m_moduleListBox, 0); - m_resultListBox = new CSearchResultView(hSplitter); - hSplitter->setResizeMode(m_moduleListBox, QSplitter::FollowSizeHint); - hSplitter->setResizeMode(m_resultListBox, QSplitter::Stretch); - -// layoutBox->setStretchFactor(m_resultListBox, 5); - - m_previewDisplay = CDisplay::createReadInstance(0, splitter); - - m_moduleListBox->resize(m_moduleListBox->sizeHint()); - splitter->setResizeMode(hSplitter, QSplitter::KeepSize); - splitter->setResizeMode(m_previewDisplay->view(), QSplitter::Stretch); - - m_analyseButton = new QPushButton(i18n("Show search analysis"), this); - connect(m_analyseButton, SIGNAL(clicked()), - this, SLOT(showAnalysis())); - mainLayout->addSpacing(5); - mainLayout->addWidget(m_analyseButton); -} - -/** Sets the modules which contain the result of each. */ -void CSearchResultPage::setSearchResult(ListCSwordModuleInfo modules){ - reset(); //clear current modules - - m_modules = modules; - m_moduleListBox->setupTree(modules); - m_moduleListBox->setMinimumWidth(m_moduleListBox->sizeHint().width()); - m_moduleListBox->adjustSize(); -// m_moduleListBox->parentWidget()->adjustSize(); - - - //have a Bible or commentary in the modules? - bool enable = false; - for (modules.first(); !enable && modules.current(); modules.next()) { - if (modules.current()->type() == CSwordModuleInfo::Bible ) { - enable = true; - }; - }; - m_analyseButton->setEnabled(enable); -} - - -/** Resets the current list of modules and the displayed list of found entries. */ -void CSearchResultPage::reset(){ - m_moduleListBox->clear(); - m_resultListBox->clear(); - m_previewDisplay->setText(QString::null); - m_analyseButton->setEnabled(false); - m_modules.setAutoDelete(false); //make sure we don't delete modules accidentally - m_modules.clear(); -} - - -/** Update the preview of the selected key. */ -void CSearchResultPage::updatePreview(const QString& key){ - if ( CSwordModuleInfo* module = m_moduleListBox->activeModule() ) { - if (CEntryDisplay* display = module->getDisplay()) { //do we have a display object? - ListCSwordModuleInfo moduleList; - moduleList.append(module); - - //mark the searched text part - const QString searchedText = CSearchDialog::getSearchDialog()->searchText(); - const int searchFlags = CSearchDialog::getSearchDialog()->searchFlags(); - const QString content = display->text( moduleList, key, CBTConfig::getDisplayOptionDefaults(), CBTConfig::getFilterOptionDefaults() ); - - const QString text = highlightSearchedText(content, searchedText, searchFlags); - - m_previewDisplay->setText( text ); - m_previewDisplay->moveToAnchor( key ); - } - else - m_previewDisplay->setText(QString::null); - } -} - -const QString CSearchResultPage::highlightSearchedText(const QString& content, const QString& searchedText, const int searchFlags) { - QString ret = content; - const bool cs = (searchFlags & CSwordModuleSearch::caseSensitive); - - int index = 0; - int length = searchedText.length(); - - const QString rep1 = QString::fromLatin1("<B STYLE=\"background-color:#FFFF66;\">"); - const QString rep2 = QString::fromLatin1("</B>"); - const unsigned int repLength = rep1.length() + rep1.length(); - - - if (searchFlags & CSwordModuleSearch::exactPhrase) { //exact phrase matching - while ( (index = ret.find(searchedText, index, cs)) != -1 ) { - if (!CToolClass::inHTMLTag(index, ret)) { - ret = ret.insert( index+length, rep2 ); - ret = ret.insert( index, rep1 ); - index += repLength; - } - index += repLength; - }; - } - else if (searchFlags & CSwordModuleSearch::multipleWords) { //multiple words - QStringList words = QStringList::split(" ", searchedText); - for ( int wi = 0; (unsigned int)wi < words.count(); ++wi ) { //search for every word in the list - QString word = words[ wi ]; - length = word.length(); - index = 0; //for every word start at the beginning - while ( (index = ret.find(word, index, cs)) != -1 ) { //while we found the word - if (!CToolClass::inHTMLTag(index, ret)) { - ret = ret.insert( index+length, rep2 ); - ret = ret.insert( index, rep1 ); - index += repLength; - } - index += length; - } - } - } - else { //multiple words or regular expression - //use re as regular expression and replace any occurences - QRegExp regExp( searchedText, cs ); - regExp.setMinimal( true ); - - while ( (index = regExp.search(ret, index)) != -1 ) { - if (!CToolClass::inHTMLTag(index, ret)) { - ret = ret.insert( index + regExp.matchedLength(), rep2 ); - ret = ret.insert( index, rep1 ); - index += regExp.matchedLength() + repLength; - } - index += length; - } - } - - return ret; //not implemented yet -}; - -/** Initializes the signal slot conections of the child widgets, */ -void CSearchResultPage::initConnections(){ - connect(m_resultListBox, SIGNAL(keySelected(const QString&)), - this, SLOT(updatePreview(const QString&))); - connect(m_moduleListBox, SIGNAL(moduleSelected(CSwordModuleInfo*)), - m_resultListBox, SLOT(setupTree(CSwordModuleInfo*))); - connect(m_moduleListBox, SIGNAL(moduleChanged()), - m_previewDisplay->connectionsProxy(), SLOT(clear())); -} - -/** Shows a dialog with the search analysis of the current search. */ -void CSearchResultPage::showAnalysis(){ - CSearchAnalysisDialog dlg(m_modules, this); - dlg.exec(); -} - -/*************************/ - -CSearchOptionsPage::CSearchOptionsPage(QWidget *parent, const char *name ) : QWidget(parent,name) { - initView(); - readSettings(); -} - -CSearchOptionsPage::~CSearchOptionsPage() { - saveSettings(); -} - -/** Returns the search text set in this page. */ -const QString CSearchOptionsPage::searchText() { - // we emulate OR by RegExp - if (m_multipleWordsORRadio->isChecked()) { - QString regexp(m_searchTextCombo->currentText()); - regexp = regexp.simplifyWhiteSpace(); - regexp.replace( QRegExp("\\s+"), "|" ); //replace one or more white spaces with regexp's OR marker - return regexp; - } - return m_searchTextCombo->currentText(); -} - -/** Sets the search text used in the page. */ -void CSearchOptionsPage::setSearchText(const QString& text) { - bool found = false; - int i = 0; - for (i = 0; !found && i < m_searchTextCombo->count(); ++i) { - if (m_searchTextCombo->text(i) == text) { - found = true; - } - } - - if (!found) { - i = 0; - m_searchTextCombo->insertItem( text,0 ); - } - - m_searchTextCombo->setCurrentItem(i); - m_searchTextCombo->reset(); - m_searchTextCombo->setFocus(); -} - -/** Initializes this page. */ -void CSearchOptionsPage::initView(){ - QGridLayout* grid = new QGridLayout(this,11,3); - grid->setSpacing(3); - - QGroupBox* box1 = new QGroupBox(2, Qt::Horizontal , i18n("Main search parameters"), this); - grid->addMultiCellWidget(box1, 0,1,0,2); - - m_modulesLabel = new QLabel(box1); - m_modulesLabel->setTextFormat(Qt::RichText); - m_modulesLabel->setAlignment( AlignLeft | WordBreak ); - - m_chooseModulesButton = new QPushButton(i18n("Choose modules"), box1); - connect(m_chooseModulesButton, SIGNAL(clicked()), - this, SLOT(chooseModules())); - QToolTip::add(m_chooseModulesButton, CResMgr::searchdialog::options::moduleChooserButton::tooltip); - QWhatsThis::add(m_chooseModulesButton, CResMgr::searchdialog::options::moduleChooserButton::whatsthis); - - QLabel* label = new QLabel(box1); - label->setText(i18n("Search text:")); - m_searchTextCombo = new KHistoryCombo(box1); - label->setAutoResize(true); - - m_searchTextCombo->setInsertionPolicy( QComboBox::AtBottom ); - m_searchTextCombo->setMaxCount(25); - m_searchTextCombo->setDuplicatesEnabled(false); - m_searchTextCombo->setFocusPolicy(QWidget::WheelFocus); - connect( m_searchTextCombo, SIGNAL(activated( const QString& )), - m_searchTextCombo, SLOT( addToHistory( const QString& )) - ); - connect( m_searchTextCombo, SIGNAL(returnPressed ( const QString& )), - m_searchTextCombo, SLOT(addToHistory(const QString&)) - ); - - QToolTip::add(m_searchTextCombo, CResMgr::searchdialog::options::searchedText::tooltip); - QWhatsThis::add(m_searchTextCombo, CResMgr::searchdialog::options::searchedText::whatsthis); - - QButtonGroup* group = new QButtonGroup(4, Vertical,i18n("Search type"), this); - - m_multipleWordsRadio = new QRadioButton(i18n("Multiple words (AND)"), group); - m_multipleWordsRadio->setChecked( true ); - QToolTip::add(m_multipleWordsRadio, CResMgr::searchdialog::options::searchType::multipleWords_and::tooltip); - QWhatsThis::add(m_multipleWordsRadio, CResMgr::searchdialog::options::searchType::multipleWords_and::whatsthis); - - - m_multipleWordsORRadio = new QRadioButton(i18n("Multiple words (OR)"), group); - QToolTip::add(m_multipleWordsORRadio, CResMgr::searchdialog::options::searchType::multipleWords_or::tooltip); - QWhatsThis::add(m_multipleWordsORRadio, CResMgr::searchdialog::options::searchType::multipleWords_or::whatsthis); - - m_exactTextRadio = new QRadioButton(i18n("Exact"), group); - QToolTip::add(m_exactTextRadio, CResMgr::searchdialog::options::searchType::exactMatch::tooltip); - QWhatsThis::add(m_exactTextRadio, CResMgr::searchdialog::options::searchType::exactMatch::whatsthis); - - m_regexpRadio = new QRadioButton(i18n("Regular expression"), group); - QToolTip::add(m_regexpRadio, CResMgr::searchdialog::options::searchType::regExp::tooltip); - QWhatsThis::add(m_regexpRadio, CResMgr::searchdialog::options::searchType::regExp::whatsthis); - - grid->addWidget(group, 4,0); - - group = new QButtonGroup(1,Vertical,i18n("Search options"), this); - m_caseSensitiveBox = new QCheckBox(i18n("Case sensitive search"), group); - QToolTip::add(m_caseSensitiveBox, CResMgr::searchdialog::options::searchOptions::caseSensitive::tooltip); - QWhatsThis::add(m_caseSensitiveBox, CResMgr::searchdialog::options::searchOptions::caseSensitive::whatsthis); - - grid->addWidget(group, 4,2); - - QGroupBox* box2 = new QGroupBox(2, Qt::Horizontal , i18n("Search scope"), this); - grid->addMultiCellWidget(box2, 6,7,0,2); - - m_rangeChooserCombo = new KComboBox(box2); - QToolTip::add(m_rangeChooserCombo, CResMgr::searchdialog::options::chooseScope::tooltip); - QWhatsThis::add(m_rangeChooserCombo, CResMgr::searchdialog::options::chooseScope::whatsthis); - - refreshRanges(); - m_chooseRangeButton = new QPushButton(i18n("Setup custom ranges"), box2); - connect(m_chooseRangeButton, SIGNAL(clicked()), - this, SLOT(setupRanges())); - - grid->setRowStretch(8,5); - - QGroupBox* box3 = new QGroupBox(2, Qt::Horizontal , i18n("Search progress"), this); - grid->addMultiCellWidget(box3, 9,10,0,2); - - - label = new QLabel(i18n("Current module:"), box3); - m_currentProgressBar = new KProgress(box3); - - label = new QLabel(i18n("All modules:"), box3); - m_overallProgressBar = new KProgress(box3); - - //set the initial focus - m_searchTextCombo->setFocus(); -} - -/** Sets the modules used by the search. */ -void CSearchOptionsPage::setModules( ListCSwordModuleInfo modules ) { - QString t = i18n("Searching in: "); - - m_modules.clear(); //remove old modules - // We make sure that a module is only one time in the list, e.g. if two display windows of the same module are opened - CSwordModuleInfo* current = modules.first(); - while (current) { - if ( !m_modules.containsRef(current) ) { - m_modules.append( current ); - - t += current->name(); - if (current != modules.getLast()) { - t += QString::fromLatin1(", "); - } - } - current = modules.next(); //next modules - }; - - m_modulesLabel->setText(t); -} - -/** Opens the modules chooser dialog. */ -void CSearchOptionsPage::chooseModules(){ - CModuleChooserDialog* dlg = new CModuleChooserDialog(this, modules()); - connect(dlg, SIGNAL(modulesChanged(ListCSwordModuleInfo)), - this, SLOT(setModules(ListCSwordModuleInfo))); - dlg->exec(); -} - -/** Returns the list of used modules. */ -const ListCSwordModuleInfo CSearchOptionsPage::modules(){ - return m_modules; -} - -/** Prepares the stuff which is required for a search, e.g. setting back the percentage bars. */ -void CSearchOptionsPage::prepareSearch(){ - m_overallProgressBar->setProgress(0); - m_currentProgressBar->setProgress(0); -} - -/** Sets the value for the "curret module" progress bar. */ -void CSearchOptionsPage::setCurrentModuleProgress( const int progress ){ - m_currentProgressBar->setProgress(progress); -} - -/** Sets the progress for the "all modules" bar. */ -void CSearchOptionsPage::setOverallProgress( const int progress ){ - m_overallProgressBar->setProgress(progress); -} - -/** Return the selected search type,. */ -const int CSearchOptionsPage::searchFlags() { - int ret = CSwordModuleSearch::multipleWords; //"multiple words" is standard - if (m_exactTextRadio->isChecked()) { - ret = CSwordModuleSearch::exactPhrase; - } - else if (m_regexpRadio->isChecked() || m_multipleWordsORRadio->isChecked()) { - ret = CSwordModuleSearch::regExp; - } - if (m_caseSensitiveBox->isChecked()) - ret |= CSwordModuleSearch::caseSensitive; - return ret; -} - -/** Sets all options back to the default. */ -void CSearchOptionsPage::reset(){ - m_multipleWordsRadio->setChecked(true); - m_rangeChooserCombo->setCurrentItem(0); //no scope - m_searchTextCombo->clearEdit(); -} - -/** Reads the settings for the searchdialog from disk. */ -void CSearchOptionsPage::saveSettings(){ - CBTConfig::set(CBTConfig::searchCompletionTexts, m_searchTextCombo->completionObject()->items()); - CBTConfig::set(CBTConfig::searchTexts, m_searchTextCombo->historyItems()); -} - -/** Reads the settings of the last searchdialog session. */ -void CSearchOptionsPage::readSettings(){ - m_searchTextCombo->completionObject()->setItems( CBTConfig::get(CBTConfig::searchCompletionTexts) ); - m_searchTextCombo->setHistoryItems( CBTConfig::get(CBTConfig::searchTexts) ); -} - -void CSearchOptionsPage::aboutToShow(){ - m_searchTextCombo->setFocus(); -} - -/** No descriptions */ -void CSearchOptionsPage::setupRanges(){ - CRangeChooserDialog* chooser = new CRangeChooserDialog(this); - chooser->exec(); - - refreshRanges(); -} - -/** refreshes the listof ranges and the range combobox. */ -void CSearchOptionsPage::refreshRanges(){ - //the first two options are fixed, the others can be edited using the "Setup ranges" button. - m_rangeChooserCombo->clear(); - m_rangeChooserCombo->insertItem(i18n("No search scope")); - m_rangeChooserCombo->insertItem(i18n("Last search result")); - - //insert the user-defined ranges - CBTConfig::StringMap map = CBTConfig::get(CBTConfig::searchScopes); - CBTConfig::StringMap::Iterator it; - for (it = map.begin(); it != map.end(); ++it) { - m_rangeChooserCombo->insertItem(it.key()); - }; -} - -/** Returns the selected search scope if a search scope was selected. */ -sword::ListKey CSearchOptionsPage::searchScope(){ - if (m_rangeChooserCombo->currentItem() > 1) { //neither "No Scope" nor "Last search result" - CBTConfig::StringMap map = CBTConfig::get(CBTConfig::searchScopes); - QString scope = map[ m_rangeChooserCombo->currentText() ]; - if (!scope.isEmpty()) - return sword::VerseKey().ParseVerseList( scope.local8Bit(), "Genesis 1:1", true); - }; - return sword::ListKey(); -} - -/** Returns the selected scope type. */ -const CSwordModuleSearch::scopeType CSearchOptionsPage::scopeType(){ - if (m_rangeChooserCombo->currentItem() == 0) { - return CSwordModuleSearch::Scope_NoScope; - } - else if (m_rangeChooserCombo->currentItem() == 1) { - return CSwordModuleSearch::Scope_LastSearch; - } - else { - return CSwordModuleSearch::Scope_Bounds; - }; - return CSwordModuleSearch::Scope_NoScope; -} - diff --git a/bibletime/frontend/searchdialog/csearchdialogpages.h b/bibletime/frontend/searchdialog/csearchdialogpages.h deleted file mode 100644 index 8dd9fb2..0000000 --- a/bibletime/frontend/searchdialog/csearchdialogpages.h +++ /dev/null @@ -1,336 +0,0 @@ -/*************************************************************************** - csearchdialogpages.h - description - ------------------- - begin : Die Jul 30 2002 - copyright : (C) 2002 by The BibleTime team - email : info@bibletime.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef CSEARCHDIALOGPAGES_H -#define CSEARCHDIALOGPAGES_H - -//BibleTime includes -#include "backend/cswordmoduleinfo.h" -#include "backend/cswordbackend.h" -#include "backend/cswordmodulesearch.h" - -//Qt includes -#include <qwidget.h> - -//KDE includes -#include <klistview.h> - -//forward declarations -class QLabel; -class QCheckBox; -class QPushButton; -class QRadioButton; - -class KComboBox; -class KActionMenu; -class KAction; -class KHistoryCombo; -class KProgress; -class KPopupMenu; - -class CReadDisplay; - -class CModuleResultView : public KListView { - Q_OBJECT -public: - CModuleResultView(QWidget* parent); - ~CModuleResultView(); - /** - * Setups the tree using the given list of modules. - */ - void setupTree( ListCSwordModuleInfo modules ); - /** - * Returns the currently active module. - */ - CSwordModuleInfo* const activeModule(); - -protected: // Protected methods - /** - * Initializes this widget. - */ - void initView(); - /** - * Initializes the connections of this widget - */ - void initConnections(); - -protected slots: // Protected slots - /** - * Is executed when an item was selected in the list. - */ - void executed( QListViewItem* ); - /** - * Copies the whole search result with the text into the clipboard. - */ - void copyResultWithText(); - /** - * Copies the whole search result into the clipboard. - */ - void copyResult(); - /** - * This slot opens the popup menu at the given position - */ - void showPopup(KListView*, QListViewItem*, const QPoint&); - /** - * Appends the whole search result to the printer queue. - */ - void printResult(); - /** - * Saves the search result with it's text. - */ - void saveResultWithText(); - /** - * Saves the search result keys. - */ - void saveResult(); - -signals: - void moduleSelected(CSwordModuleInfo*); - void moduleChanged(); - -private: - struct { - KActionMenu* saveMenu; - struct { - KAction* result; - KAction* resultWithText; - } save; - - KActionMenu* printMenu; - struct { - KAction* result; - } print; - - KActionMenu* copyMenu; - struct { - KAction* result; - KAction* resultWithText; - } copy; - - } m_actions; - KPopupMenu* m_popup; -}; - -class CSearchResultView : public KListView { - Q_OBJECT -public: - CSearchResultView(QWidget* parent); - virtual ~CSearchResultView(); - /** Returns the module which is currently used. */ - CSwordModuleInfo* const module(); - -protected: // Protected methods - /** - * Initializes the view of this widget. - */ - void initView(); - void initConnections(); - virtual QDragObject* dragObject(); - -public slots: // Public slots - void saveItems(); - /** - * Setups the list with the given module. - */ - void setupTree(CSwordModuleInfo*); - void copyItemsWithText(); - void copyItems(); - void saveItemsWithText(); - /** - * Reimplementation to show the popup menu. - */ - virtual void showPopup(KListView*, QListViewItem* i, const QPoint& point); - -protected slots: // Protected slots - void printItems(); - /** - * Is connected to the signal executed, which is emitted when a mew item was chosen. - */ - void executed(QListViewItem*); - -private: - struct { - KActionMenu* saveMenu; - struct { - KAction* result; - KAction* resultWithText; - } save; - - KActionMenu* printMenu; - struct { - KAction* result; - } print; - - KActionMenu* copyMenu; - struct { - KAction* result; - KAction* resultWithText; - } copy; - } m_actions; - KPopupMenu* m_popup; - CSwordModuleInfo* m_module; - -signals: // Signals - void keySelected(const QString&); -}; - - -/** The page of the search dialog which contains the search result part. - * @author The BibleTime team - */ -class CSearchResultPage : public QWidget { - Q_OBJECT -public: - CSearchResultPage(QWidget *parent=0, const char *name=0); - ~CSearchResultPage(); - /** - * Sets the modules which contain the result of each. - */ - void setSearchResult(ListCSwordModuleInfo modules); - -public slots: // Public slots - /** - * Resets the current löist of modules and the displayed list of found entries. - */ - void reset(); - -protected: // Protected methods - /** - * Initializes the view of this widget. - */ - void initView(); - /** - * Initializes the signal slot conections of the child widgets - */ - void initConnections(); - /** - * This function highlights the searched text in the content using the search type given by search flags - */ - const QString highlightSearchedText(const QString& content, const QString& searchedText, const int searchFlags); - -private: - CModuleResultView* m_moduleListBox; - CSearchResultView* m_resultListBox; - CReadDisplay* m_previewDisplay; - ListCSwordModuleInfo m_modules; - QPushButton* m_analyseButton; - -protected slots: // Protected slots - /** - * Update the preview of the selected key. - */ - void updatePreview(const QString& key); - /** - * Shows a dialog with the search analysis of the current search. - */ - void showAnalysis(); -}; - -class CSearchOptionsPage : public QWidget { - Q_OBJECT -public: - CSearchOptionsPage(QWidget *parent=0, const char *name=0); - ~CSearchOptionsPage(); - /** - * Sets the search text used in the page. - */ - void setSearchText(const QString& text); - /** - * Returns the search text set in this page. - */ - const QString searchText(); - /** - * Returns the list of used modules. - */ - const ListCSwordModuleInfo modules(); - /** - * Prepares the stuff which is required for a search, e.g. setting back the percentage bars. - */ - void prepareSearch(); - /** - * Return the selected search type,. - */ - const int searchFlags(); - /** - * Sets all options back to the default. - */ - void reset(); - /** - * Returns the selected search scope if a search scope was selected. - */ - sword::ListKey searchScope(); - /** - * Returns the selected scope type. - */ - const CSwordModuleSearch::scopeType scopeType(); - -private: - QLabel* m_modulesLabel; - KHistoryCombo* m_searchTextCombo; - QPushButton* m_chooseModulesButton; - ListCSwordModuleInfo m_modules; - - KComboBox* m_rangeChooserCombo; - QPushButton* m_chooseRangeButton; - QRadioButton* m_multipleWordsRadio; - QRadioButton* m_exactTextRadio; - QRadioButton* m_regexpRadio; - QRadioButton* m_multipleWordsORRadio; - QCheckBox* m_caseSensitiveBox; - KProgress* m_currentProgressBar; - KProgress* m_overallProgressBar; - -protected: // Protected methods - /** - * Initializes this page. - */ - void initView(); - /** - * Reads the settings of the last searchdialog session. - */ - void readSettings(); - /** - * Reads the settings for the searchdialog from disk. - */ - void saveSettings(); - -public slots: // Public slots - /** - * Sets the modules used by the search. - */ - void setModules( ListCSwordModuleInfo modules ); - /** - * Sets the progress for the "all modules" bar. - */ - void setOverallProgress( const int ); - /** - * Sets the value for the "curret module" progress bar. - */ - void setCurrentModuleProgress( const int ); - void aboutToShow(); - /** refreshes the listof ranges and the range combobox. */ - void refreshRanges(); - /** - * Opens the modules chooser dialog. - */ - void chooseModules(); - -protected slots: // Protected slots - void setupRanges(); -}; - -#endif |