diff options
Diffstat (limited to 'bibletime/frontend/mainindex')
-rw-r--r-- | bibletime/frontend/mainindex/Makefile.am | 18 | ||||
-rw-r--r-- | bibletime/frontend/mainindex/Makefile.in | 685 | ||||
-rw-r--r-- | bibletime/frontend/mainindex/cindexitem.cpp | 1253 | ||||
-rw-r--r-- | bibletime/frontend/mainindex/cindexitem.h | 379 | ||||
-rw-r--r-- | bibletime/frontend/mainindex/cmainindex.cpp | 634 | ||||
-rw-r--r-- | bibletime/frontend/mainindex/cmainindex.h | 212 |
6 files changed, 0 insertions, 3181 deletions
diff --git a/bibletime/frontend/mainindex/Makefile.am b/bibletime/frontend/mainindex/Makefile.am deleted file mode 100644 index e79b5b8..0000000 --- a/bibletime/frontend/mainindex/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDES = $(all_includes) -libmainindex_a_METASOURCES = AUTO -noinst_LIBRARIES = libmainindex.a - -libmainindex_a_SOURCES = \ -cmainindex.cpp \ -cindexitem.cpp - -all_headers = \ -cmainindex.h \ -cindexitem.h - -EXTRA_DIST = $(libmainindex_a_SOURCES) $(all_headers) - - - - - diff --git a/bibletime/frontend/mainindex/Makefile.in b/bibletime/frontend/mainindex/Makefile.in deleted file mode 100644 index 1ae5e2d..0000000 --- a/bibletime/frontend/mainindex/Makefile.in +++ /dev/null @@ -1,685 +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) -#>- libmainindex_a_METASOURCES = AUTO -noinst_LIBRARIES = libmainindex.a - -libmainindex_a_SOURCES = \ -cmainindex.cpp \ -cindexitem.cpp - - -all_headers = \ -cmainindex.h \ -cindexitem.h - - -EXTRA_DIST = $(libmainindex_a_SOURCES) $(all_headers) -subdir = bibletime/frontend/mainindex -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - -libmainindex_a_AR = $(AR) cru -libmainindex_a_LIBADD = -am_libmainindex_a_OBJECTS = cmainindex.$(OBJEXT) cindexitem.$(OBJEXT) -#>- libmainindex_a_OBJECTS = $(am_libmainindex_a_OBJECTS) -#>+ 5 -libmainindex_a_final_OBJECTS = libmainindex_a.all_cpp.o -libmainindex_a_nofinal_OBJECTS = cmainindex.$(OBJEXT) cindexitem.$(OBJEXT)\ -cmainindex.moc.o -@KDE_USE_FINAL_FALSE@libmainindex_a_OBJECTS = $(libmainindex_a_nofinal_OBJECTS) -@KDE_USE_FINAL_TRUE@libmainindex_a_OBJECTS = $(libmainindex_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)/cindexitem.Po \ -#>- @AMDEP_TRUE@ ./$(DEPDIR)/cmainindex.Po -#>+ 4 -@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/cmainindex.moc.P $(DEPDIR)/libmainindex_a.all_cpp.P ./$(DEPDIR)/cindexitem.Po \ -@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/cmainindex.Po -@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = $(DEPDIR)/cmainindex.moc.P ./$(DEPDIR)/cindexitem.Po \ -@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/cmainindex.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 = $(libmainindex_a_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(libmainindex_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/mainindex/Makefile -#>+ 3 - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu bibletime/frontend/mainindex/Makefile - cd $(top_srcdir) && perl admin/am_edit bibletime/frontend/mainindex/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) -libmainindex.a: $(libmainindex_a_OBJECTS) $(libmainindex_a_DEPENDENCIES) - -rm -f libmainindex.a - $(libmainindex_a_AR) libmainindex.a $(libmainindex_a_OBJECTS) $(libmainindex_a_LIBADD) - $(RANLIB) libmainindex.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cindexitem.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmainindex.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 -cmainindex.moc.cpp: $(srcdir)/cmainindex.h - $(MOC) $(srcdir)/cmainindex.h -o cmainindex.moc.cpp - -#>+ 2 -mocs: cmainindex.moc.cpp - -#>+ 3 -clean-metasources: - -rm -f cmainindex.moc.cpp - -#>+ 2 -KDE_DIST=cindexitem.h cmainindex.h - -#>+ 2 -docs-am: - -#>+ 6 -force-reedit: - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu bibletime/frontend/mainindex/Makefile - cd $(top_srcdir) && perl admin/am_edit bibletime/frontend/mainindex/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 -libmainindex_a.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/cmainindex.cpp $(srcdir)/cindexitem.cpp cmainindex.moc.cpp - @echo 'creating libmainindex_a.all_cpp.cpp ...'; \ - rm -f libmainindex_a.all_cpp.files libmainindex_a.all_cpp.final; \ - echo "#define KDE_USE_FINAL 1" >> libmainindex_a.all_cpp.final; \ - for file in cmainindex.cpp cindexitem.cpp cmainindex.moc.cpp ; do \ - echo "#include \"$$file\"" >> libmainindex_a.all_cpp.files; \ - test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libmainindex_a.all_cpp.final; \ - done; \ - cat libmainindex_a.all_cpp.final libmainindex_a.all_cpp.files > libmainindex_a.all_cpp.cpp; \ - rm -f libmainindex_a.all_cpp.final libmainindex_a.all_cpp.files - -#>+ 3 -clean-final: - -rm -f libmainindex_a.all_cpp.cpp - -#>+ 3 -final: - $(MAKE) libmainindex_a_OBJECTS="$(libmainindex_a_final_OBJECTS)" all-am - -#>+ 3 -final-install: - $(MAKE) libmainindex_a_OBJECTS="$(libmainindex_a_final_OBJECTS)" install-am - -#>+ 3 -no-final: - $(MAKE) libmainindex_a_OBJECTS="$(libmainindex_a_nofinal_OBJECTS)" all-am - -#>+ 3 -no-final-install: - $(MAKE) libmainindex_a_OBJECTS="$(libmainindex_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/mainindex/cindexitem.cpp b/bibletime/frontend/mainindex/cindexitem.cpp deleted file mode 100644 index 4977400..0000000 --- a/bibletime/frontend/mainindex/cindexitem.cpp +++ /dev/null @@ -1,1253 +0,0 @@ -/*************************************************************************** - cindexitem.cpp - description - ------------------- - begin : Sam Jun 22 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. * - * * - ***************************************************************************/ - -//BibleTime includes -#include "cindexitem.h" -#include "cmainindex.h" - -#include "backend/creferencemanager.h" -#include "backend/cswordmoduleinfo.h" -#include "backend/cswordversekey.h" -#include "backend/clanguagemgr.h" - -#include "frontend/searchdialog/csearchdialog.h" -#include "frontend/cexportmanager.h" -#include "frontend/ctooltipmanager.h" -#include "frontend/cbtconfig.h" -#include "frontend/cinputdialog.h" -#include "frontend/cexportmanager.h" -#include "frontend/cdragdropmgr.h" - -#include "util/cresmgr.h" -#include "util/ctoolclass.h" - -#include <string.h> - -//Qt includes -#include <qdragobject.h> -#include <qstringlist.h> -#include <qfile.h> -#include <qstring.h> -#include <qtextstream.h> - -//KDE includes -#include <kconfig.h> -#include <klocale.h> -#include <kfiledialog.h> -#include <kiconloader.h> -#include <kstandarddirs.h> - -#define CURRENT_SYNTAX_VERSION 1 - -using std::string; - -CItemBase::CItemBase(CMainIndex* mainIndex, const Type type) - : KListViewItem(mainIndex), - m_type(type), - m_sortingEnabled(true) -{ - -} - -CItemBase::CItemBase(CItemBase* parentItem, const Type type) - : KListViewItem(parentItem), - m_type(type), - m_sortingEnabled(true) -{ - -} - -CItemBase::~CItemBase() { -} - -const QString CItemBase::toolTip() { - return QString::null; -} - -/** Returns the used main index. */ -CMainIndex* CItemBase::listView() const{ - return dynamic_cast<CMainIndex*>( QListViewItem::listView() ); -} - -void CItemBase::init() { - update(); -} - -void CItemBase::update() { -} - -const CItemBase::Type& CItemBase::type() const{ - return m_type; -}; - -void CItemBase::moveAfter( CItemBase* const item ){ - if (!item) - return; - - if ( parent() != item->parent() ) { //different levels -// if (type == AllowDifferentParents) { //different parents are allowed -// if (item->parent()) -// item->parent()->insertItem(this); //insert item to the childs -// else -// listView()->insertItem(this); -// moveItem(item); -// } - } - else { - moveItem(item); //both items are on the same level, so we can use moveItem - } -} - -void CItemBase::dropped( QDropEvent* /*e*/ ) { -} - - -/** Returns true if the given action should be enabled in the popup menu. */ -const bool CItemBase::enableAction( const MenuAction /*action*/ ){ - return false; //this base class has no valif actions -} - -/** No descriptions */ -const bool CItemBase::isMovable(){ - return false; -} - -const bool CItemBase::allowAutoOpen( const QMimeSource* ) const { - return false; -}; - -/** This function engables or disables sorting depending on the parameter. */ -void CItemBase::setSortingEnabled( const bool& enableSort ){ - m_sortingEnabled = enableSort; -} - -/** Returns true whether the sorting is enabled or not. */ -const bool CItemBase::isSortingEnabled(){ - return m_sortingEnabled; -} - -/** Reimplementation which takes care of the our sortingEnabled setting. */ -void CItemBase::sortChildItems( int col, bool asc ){ - if (!isSortingEnabled()) { - return; - } - else { - KListViewItem::sortChildItems( col, asc ); - } -} - -/** Reimplementation which takes care of the our sortingEnabled setting. */ -void CItemBase::sort(){ - if (!isSortingEnabled()) { - return; - } - else { - KListViewItem::sort(); - } -} - -/* ---------------------------------------------- */ -/* ---------- new class: CModuleItem ------------ */ -/* ---------------------------------------------- */ - -CModuleItem::CModuleItem(CTreeFolder* parentItem, CSwordModuleInfo* module) : CItemBase(parentItem), m_module(module) { -} - -CModuleItem::~CModuleItem() { -} - -/** No descriptions */ -void CModuleItem::update(){ - if (m_module) { - setPixmap(0, CToolClass::getIconForModule(m_module)); - setText(0,m_module->name() ); - } -} - -void CModuleItem::init(){ - setDragEnabled(false); - setDropEnabled(true); - - update(); -} - - -/** Reimplementation to handle text drops on a module. In this case open the searchdialog. In the case of a referebnce open the module at the given position. */ -bool CModuleItem::acceptDrop( const QMimeSource* src ) const { - if (CDragDropMgr::canDecode(src)) { - if (CDragDropMgr::dndType(src) == CDragDropMgr::Item::Bookmark) { - CDragDropMgr::Item item = CDragDropMgr::decode(src).first(); - CSwordModuleInfo* m = backend()->findModuleByName( item.bookmarkModule() ); - if (m && module()->type() == m->type()) { //it makes only sense - return true; - } - //but we also allow drops from bibles on commentaries and the other way from commentaries - else if (m && (module()->type() == CSwordModuleInfo::Bible) && (m->type() == CSwordModuleInfo::Commentary)) { - return true; - } - else if (m && (module()->type() == CSwordModuleInfo::Commentary) && (m->type() == CSwordModuleInfo::Bible)) { - return true; - } - } - else if(CDragDropMgr::dndType(src) == CDragDropMgr::Item::Text) { //text drop on a module - return true; - }; - } - return false; //default return value -} - -/** No descriptions */ -void CModuleItem::dropped( QDropEvent* e ){ - /* Something was dropped on a module item - * - * 1. If the drop type is plain text open the searchdialog for this text and start the search - * 2. If the type is Bookmark, open the module at the specified position - * - * We support only the first drop item, more is not useful - */ - - if (acceptDrop(e)) { - CDragDropMgr::ItemList dndItems = CDragDropMgr::decode(e); - CDragDropMgr::Item item = dndItems.first(); - if (CDragDropMgr::dndType(e) == CDragDropMgr::Item::Text) { //open the searchdialog -// qWarning("Text dropped!"); - if ( module() ) { - ListCSwordModuleInfo modules; - modules.append(module()); - - CSearchDialog::openDialog(modules, item.text()); - } - } - else if (CDragDropMgr::dndType(e) == CDragDropMgr::Item::Bookmark) { //open the module -// qWarning("type is Bookmark!"); - CSwordModuleInfo* m = backend()->findModuleByName( item.bookmarkModule() ); - if (m) { //it makes only sense to create a new window for a module with the same type - if ((module()->type() == m->type()) || - ((module()->type() == CSwordModuleInfo::Bible || module()->type() == CSwordModuleInfo::Commentary) - && (m->type() == CSwordModuleInfo::Bible || m->type() == CSwordModuleInfo::Commentary))) - { //same base type of module - ListCSwordModuleInfo modules; - modules.append(module()); - - listView()->emitModulesChosen(modules, item.bookmarkKey()); - }; - } - } -// else { -//// qWarning("type is Unknown!"); -// }; - }; -} - - -/** Reimplementation. */ -const QString CModuleItem::toolTip(){ - QString text; - text = QString::fromLatin1("<DIV STYLE=\"border-bottom:thin solid black;\">") - + i18n("Module") - + QString::fromLatin1(": <B>%1</B></DIV>").arg( module()->name() ) - + ((module()->category() == CSwordModuleInfo::Cult) ? QString::fromLatin1("<B>%1</B><BR>").arg(i18n("Take care, this module contains cult / questionable material!")) : QString::null); - text += QString::fromLatin1("<DIV STYLE=\"border-bottom:thin solid black;\">") + module()->config(CSwordModuleInfo::Description) + QString::fromLatin1("</DIV>"); - text += i18n("Language")+ QString::fromLatin1(": %1<BR>").arg(module()->language().translatedName()); - if (module()->isEncrypted()) - text += i18n("Unlock key") + QString::fromLatin1(": %1<BR>") - .arg(!module()->config(CSwordModuleInfo::CipherKey).isEmpty() ? module()->config(CSwordModuleInfo::CipherKey) : QString("<FONT COLOR=\"red\">%1</FONT>").arg(i18n("not set"))); - if (module()->hasVersion()) - text += i18n("Version") + QString::fromLatin1(": %1<BR>").arg(module()->config(CSwordModuleInfo::ModuleVersion)); - - QString options; - unsigned int opts; - for (opts = CSwordBackend::filterTypesMIN; opts <= CSwordBackend::filterTypesMAX; ++opts){ - if (module()->has( static_cast<CSwordBackend::FilterTypes>(opts) )) { - if (!options.isEmpty()) - options += QString::fromLatin1(", "); - options += CSwordBackend::translatedOptionName( static_cast<CSwordBackend::FilterTypes>(opts) ); - } - } - if (!options.isEmpty()) - text += i18n("Options") + QString::fromLatin1(": <font size= \"-1\">") + options + QString::fromLatin1("</font>"); - - if (text.right(4) == QString::fromLatin1("<BR>")) - text = text.left(text.length()-4); - return text; -} - -/** Returns the used module. */ -CSwordModuleInfo* const CModuleItem::module() const { - return m_module; -} - -/** Returns the about module info of the used module. */ -const QString CModuleItem::aboutInfo(){ - QString text; - - if (module()->hasVersion()) - text += QString::fromLatin1("<b>%1:</b> %2<br>") - .arg(i18n("Version")) - .arg(module()->config(CSwordModuleInfo::ModuleVersion)); - - text += QString::fromLatin1("<b>%1:</b> %2<br><b>%3:</b> %4<br>") - .arg(i18n("Location")) - .arg(module()->config(CSwordModuleInfo::AbsoluteDataPath)) - .arg(i18n("Language")) - .arg(module()->language().translatedName()); - - if (module()->isWritable()) - text += QString::fromLatin1("<b>%1:</b> %2<br>") - .arg(i18n("Writable")) - .arg(i18n("yes")); - - if ( module()->isEncrypted() ) - text += QString::fromLatin1("<b>%1:</b> %2<br>") - .arg(i18n("Unlock key")) - .arg(module()->config(CSwordModuleInfo::CipherKey)); - - QString options; - unsigned int opts; - for (opts = CSwordBackend::filterTypesMIN; opts <= CSwordBackend::filterTypesMAX; ++opts){ - if (module()->has( static_cast<CSwordBackend::FilterTypes>(opts) )){ - if (!options.isEmpty()) - options += QString::fromLatin1(", "); - options += CSwordBackend::translatedOptionName( static_cast<CSwordBackend::FilterTypes>(opts) ); - } - } - if (!options.isEmpty()) - text += QString("<b>%1:</b> %2<br>") - .arg(i18n("Features")) - .arg(options); - - if (m_module->category() == CSwordModuleInfo::Cult) { //clearly say the module contains cult/questionable materials - text += QString::fromLatin1("<BR><B>%1</B><BR><BR>") - .arg(i18n("Take care, this module contains cult / questionable material!")); - }; - - text += QString::fromLatin1("<b>%1:</b><br> <font size=\"-1\">%2</font>") - .arg(i18n("About")) - .arg(module()->config(CSwordModuleInfo::AboutInformation)); - return text; -} - - -/** Reimplementation from CItemBase. */ -const bool CModuleItem::enableAction( const MenuAction action ){ - if (action == EditModule) { - if (!module()) - return false; - return module()->isWritable(); - } - - if (action == SearchInModules || action == AboutModule) - return true; - if (module()->isEncrypted() && action == UnlockModule) - return true; - return false; -} - -/* ----------------------------------------------*/ -/* ---------- new class: CBookmarkItem ------------*/ -/* ----------------------------------------------*/ - -CBookmarkItem::CBookmarkItem(CFolderBase* parentItem, CSwordModuleInfo* module, const QString& key, const QString& description) - : CItemBase(parentItem), - m_description(description), - m_moduleName(module ? module->name() : QString::null) -{ - if ((module && (module->type() == CSwordModuleInfo::Bible) || (module->type() == CSwordModuleInfo::Commentary)) ) { - CSwordVerseKey vk(0); - vk = key; - vk.setLocale("en"); - m_key = vk.key(); //the m_key member is always the english key! - } - else { - m_key = key; - }; - - m_startupXML = QDomElement(); //empty XML code -} - -CBookmarkItem::CBookmarkItem(CFolderBase* parentItem, QDomElement& xml ) - : CItemBase(parentItem), - m_key(QString::null), - m_description(QString::null), - m_moduleName(QString::null) -{ - m_startupXML = xml; -} - -CBookmarkItem::~CBookmarkItem() { - -} - -/** No descriptions */ -void CBookmarkItem::update(){ - const QString title = QString::fromLatin1("%1 (%2)").arg(key()).arg(module() ? module()->name() : i18n("unknown")); - setText(0, title); - setPixmap(0,SmallIcon(CResMgr::mainIndex::bookmark::icon,16)); -} - -void CBookmarkItem::init(){ - if (!m_startupXML.isNull()) { //we have some XML code to parse - loadFromXML(m_startupXML); - } - - update(); - setDropEnabled(false); - setDragEnabled(false); - -// if (!module()) -// setSelectable(false); -} - -/** Reimplementation. */ -const QString CBookmarkItem::toolTip(){ - if (!module()) { - return QString::null; - } - - return CTooltipManager::textForReference(module()->name(), key(), description()); -} - -/** Returns the used module. */ -CSwordModuleInfo* const CBookmarkItem::module() { - CSwordModuleInfo* m = backend()->findModuleByName(m_moduleName); -// Q_ASSERT(m); - return m; -} - -/** Returns the used key. */ -const QString CBookmarkItem::key(){ - const QString englishKeyName = englishKey(); - if (!module()) { - return englishKeyName; - } - - QString returnKeyName = englishKeyName; - if ((module()->type() == CSwordModuleInfo::Bible) || (module()->type() == CSwordModuleInfo::Commentary)) { - CSwordVerseKey vk(0); - vk = englishKeyName; - vk.setLocale( backend()->booknameLanguage().latin1() ); - - returnKeyName = vk.key(); //the returned key is always in the currently set bookname language - } - - return returnKeyName; -} - -/** Returns the used description. */ -const QString& CBookmarkItem::description(){ - return m_description; -} - -/** No descriptions */ -const bool CBookmarkItem::isMovable(){ - return true; -} - -/** Reimplementation to handle the menu entries of the main index. */ -const bool CBookmarkItem::enableAction(const MenuAction action){ - if (action == ChangeBookmark || (module() && (action == PrintBookmarks)) || action == DeleteEntries) - return true; - - return false; -} - -void CBookmarkItem::print(){ - if (!module()) - return; - - CExportManager mgr(i18n("Print bookmark"),false); - mgr.printKey(module(), key(), key(), description()); -} - -/** Changes this bookmark. */ -void CBookmarkItem::rename(){ - bool ok = false; - QString newDescription = CInputDialog::getText(i18n("Change description ..."),i18n("Enter a new description for the chosen bookmark."), description(), &ok, listView(), true); - if (ok) { - m_description = newDescription; - update(); - } -} - -/** Reimplementation of CItemBase::saveToXML. */ -QDomElement CBookmarkItem::saveToXML( QDomDocument& doc ){ - QDomElement elem = doc.createElement("Bookmark"); - - elem.setAttribute("key", englishKey()); - elem.setAttribute("description", description()); - elem.setAttribute("modulename", m_moduleName); - elem.setAttribute("moduledescription", module() ? module()->config(CSwordModuleInfo::Description) : QString::null); - - return elem; -} - -void CBookmarkItem::loadFromXML( QDomElement& element ) { - if (element.isNull()) - return; - - //find the right module - if (element.hasAttribute("modulename")) { - //we use the name in all cases, even if the module isn't installed anymore - m_moduleName = element.attribute("modulename"); - } - - if (element.hasAttribute("key")) { - m_key = element.attribute("key"); - } - - if (element.hasAttribute("description")) { - m_description = element.attribute("description"); - } -} - -/** Returns the english key. */ -const QString& CBookmarkItem::englishKey(){ - return m_key; -} - -/** Reimplementation. Returns false everytime because a bookmarks has not possible drops. */ -bool CBookmarkItem::acceptDrop(const QMimeSource* /*src*/){ - return false; -} - -/****************************************/ -/***** class: CItemFolder *************/ -/****************************************/ - -CFolderBase::CFolderBase(CMainIndex* mainIndex, const Type type) : CItemBase(mainIndex, type) { -} - -CFolderBase::CFolderBase(CFolderBase* parentItem, const Type type) : CItemBase(parentItem, type) { -} - -CFolderBase::CFolderBase(CFolderBase* parentFolder, const QString& caption) : CItemBase(parentFolder){ - setText(0, caption); -} - -CFolderBase::~CFolderBase() { -} - -const bool CFolderBase::isFolder() { - return true; -} - -void CFolderBase::update() { - CItemBase::update(); - if (isOpen() && childCount()) - setPixmap(0, SmallIcon(CResMgr::mainIndex::openedFolder::icon, 16)); - else - setPixmap(0, SmallIcon(CResMgr::mainIndex::closedFolder::icon, 16)); -} - -void CFolderBase::init() { - CItemBase::init(); - setDropEnabled(false); - setDragEnabled(false); -} - -/** No descriptions */ -void CFolderBase::setOpen( bool open ){ - KListViewItem::setOpen(open); - update(); -} - -/** The function which renames this folder. */ -void CFolderBase::rename(){ - startRename(0); -} - -/** Creates a new sub folder of this folder. */ -void CFolderBase::newSubFolder(){ - if (dynamic_cast<CBookmarkFolder*>(this) || dynamic_cast<Bookmarks::SubFolder*>(this) ) { - Bookmarks::SubFolder* f = new Bookmarks::SubFolder(this, i18n("New folder")); - f->init(); - - listView()->setCurrentItem(f); - listView()->ensureItemVisible(f); - f->rename(); - } -} - -/** Reimplementation. Returns true if the drop is accepted. */ -const bool CFolderBase::allowAutoOpen( const QMimeSource* ) const{ - return true; -} - -/** Reimplementation. Returns false because folders have no use for drops (except for the bookmark folders) */ -bool CFolderBase::acceptDrop(const QMimeSource*){ -// qWarning("CFolderBase::acceptDrop"); - return false; -} - -/****************************************/ -/***** class: CTreeFolder *************/ -/****************************************/ - - -CTreeFolder::CTreeFolder(CMainIndex* mainIndex, const Type type, const QString& language) : CFolderBase(mainIndex, type) { - m_language = language; -} - -CTreeFolder::CTreeFolder(CFolderBase* item, const Type type, const QString& language) : CFolderBase(item, type) { - m_language = language; -} - -CTreeFolder::~CTreeFolder(){ -} - -void CTreeFolder::addGroup(const Type type, const QString language){ - CTreeFolder* i = 0; - if (type == BookmarkFolder) { - i = new CBookmarkFolder(this); - } - else if (type == OldBookmarkFolder) { - i = new Bookmarks::OldBookmarksFolder(this); - } - else { - i = new CTreeFolder(this, type, language); - } - i->init(); - if (!i->childCount()) - delete i; -} - -void CTreeFolder::addModule(CSwordModuleInfo* const module){ - CModuleItem* i = new CModuleItem(this, module); - i->init(); -} - -void CTreeFolder::addBookmark(CSwordModuleInfo* module, const QString& key, const QString& description){ - CBookmarkItem* i = new CBookmarkItem(this, module, key, description); - i->init(); -} - -void CTreeFolder::update(){ - CFolderBase::update(); -} - -void CTreeFolder::init(){ - if (language() == "*") { - switch (type()) { - case BibleModuleFolder: - setText(0,i18n("Bibles")); - break; - case CommentaryModuleFolder: - setText(0,i18n("Commentaries")); - break; - case LexiconModuleFolder: - setText(0,i18n("Lexicons")); - break; - case BookModuleFolder: - setText(0,i18n("Books")); - break; - case DevotionalModuleFolder: - setText(0,i18n("Daily devotionals")); - break; - case GlossaryModuleFolder: - setText(0,i18n("Glossaries")); - break; - case BookmarkFolder: - setText(0,i18n("Bookmarks")); - break; - case OldBookmarkFolder: - setText(0,i18n("Old bookmarks")); - break; - default: - setText(0, i18n("Unknown")); - break; - }; - } - else { - CLanguageMgr::Language lang = languageMgr()->languageForAbbrev( language() ); - - setText(0, !language().isEmpty() ? ( lang.isValid() ? lang.translatedName() : language()) : i18n("Unknown language")); - } - initTree(); - update(); -} - -void CTreeFolder::initTree(){ -// qWarning("CTreeMgr::initTree"); - if (type() == Unknown) - return; - - CSwordModuleInfo::ModuleType moduleType = CSwordModuleInfo::Unknown; - if (type() == BibleModuleFolder) - moduleType = CSwordModuleInfo::Bible; - else if (type() == CommentaryModuleFolder) - moduleType = CSwordModuleInfo::Commentary; - else if (type() == LexiconModuleFolder || type() == GlossaryModuleFolder || type() == DevotionalModuleFolder) - moduleType = CSwordModuleInfo::Lexicon; - else if (type() == BookModuleFolder) - moduleType = CSwordModuleInfo::GenericBook; - - //get all modules by using the given type - ListCSwordModuleInfo allModules = backend()->moduleList(); - ListCSwordModuleInfo usedModules; - for (CSwordModuleInfo* m = allModules.first(); m; m = allModules.next()) { - if (m->type() == moduleType) { //found a module, check if the type is correct (devotional etc.) - if (type() == GlossaryModuleFolder && !m->category() == CSwordModuleInfo::Glossary) { //not a gglossary - continue; - } - if (type() == DevotionalModuleFolder && (m->category() != CSwordModuleInfo::DailyDevotional)) {//not a devotional - continue; - } - if (type() == LexiconModuleFolder && ( (m->category() == CSwordModuleInfo::DailyDevotional) || (m->category() == CSwordModuleInfo::Glossary) )) { - //while looking for lexicons glossaries and devotionals shouldn't be used - continue; - } - - if (language() == QString::fromLatin1("*") || (language() != QString::fromLatin1("*") && QString::fromLatin1(m->module()->Lang()) == language()) )//right type and language! - usedModules.append(m); - } - } - - //we have now all modules we want to have - if (language() == QString::fromLatin1("*")) { //create subfolders for each language - QStringList usedLangs; - for (CSwordModuleInfo* m = usedModules.first(); m; m = usedModules.next()) { - QString lang = QString::fromLatin1(m->module()->Lang()); -// if (lang.isEmpty()) -// lang = "); - if (!usedLangs.contains(lang)) { - usedLangs.append(lang); - } - } - QStringList::iterator it; - for (it = usedLangs.begin(); it != usedLangs.end(); ++it) { - addGroup(/**it,*/ type(), *it); - } - } - else if (usedModules.count() > 0){ //create subitems with the given type and language - for (CSwordModuleInfo* m = usedModules.first(); m; m = usedModules.next()) { - addModule(m); - } - } - - sortChildItems(0,true); -} - -const QString& CTreeFolder::language() const { - return m_language; -}; - -/* --------------------------------------------------*/ -/* ---------- new class: CBookmarkFolder::SubFolder--*/ -/* --------------------------------------------------*/ - -namespace Bookmarks { - /* --------------------------------------------------------------------------*/ - /* ---------- new class: CBookmarkFolder::OldBookmarkImport -----------------*/ - /* --------------------------------------------------------------------------*/ - const QString OldBookmarkImport::oldBookmarksXML( const QString& configFileName ) { - QString fileName = (configFileName.isEmpty()) ? "bt-groupmanager" : configFileName; - KConfig* config = new KSimpleConfig( fileName ); - - KConfigGroupSaver groupSaver(config, configFileName.isEmpty() ? "Groupmanager" : "Bookmarks"); - - QDomDocument doc("DOC"); - doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) ); - - QDomElement content = doc.createElement("SwordBookmarks"); - content.setAttribute("syntaxVersion", CURRENT_SYNTAX_VERSION); - doc.appendChild(content); - - //first create the bookmark groups in the XML document, then add the bookmarks to each parent - QMap<int, QDomElement> parentMap; //maps parent ids to dom elements - - - QStringList groupList = config->readListEntry("Groups"); - QValueList<int> parentList = config->readIntListEntry("Group parents"); - - QStringList::Iterator it_groups = groupList.begin(); - QValueList<int>::Iterator it_parents = parentList.begin(); - - int parentIDCounter = 0; - while ( (it_groups != groupList.end()) && (it_parents != parentList.end()) ) { - QDomElement parentElement = (*it_parents == -1) ? content : parentMap[*it_parents]; - if (parentElement.isNull()) { - qWarning("EMPTY PARENT FOUND!"); - parentElement = content; - }; - - QDomElement elem = doc.createElement("Folder"); - elem.setAttribute("caption", (*it_groups)); - parentMap.insert(parentIDCounter, elem); - - parentElement.appendChild( elem ); - - - ++it_parents; - ++it_groups; - ++parentIDCounter; - } - - //groups are now read in, create now the bookmarks - parentList = config->readIntListEntry("Bookmark parents"); - QStringList bookmarkList = config->readListEntry("Bookmarks"); - QStringList bookmarkModulesList = config->readListEntry("Bookmark modules"); - QStringList bookmarkDescriptionsList = config->readListEntry("Bookmark descriptions"); - - it_parents = parentList.begin(); - QStringList::Iterator it_bookmarks = bookmarkList.begin(); - QStringList::Iterator it_modules = bookmarkModulesList.begin(); - QStringList::Iterator it_descriptions = bookmarkDescriptionsList.begin(); - - while ( it_bookmarks != bookmarkList.end() - && it_parents != parentList.end() - && it_modules != bookmarkModulesList.end() - ) - { - QDomElement parentElement = ((*it_parents) == -1) ? content : parentMap[(*it_parents)]; - if (parentElement.isNull()) { - qWarning("EMPTY PARENT FOUND!"); - parentElement = content; - }; - QDomElement elem = doc.createElement("Bookmark"); - - elem.setAttribute("key", *it_bookmarks); - elem.setAttribute("description", *it_descriptions); - elem.setAttribute("modulename", *it_modules); - - CSwordModuleInfo* m = CPointers::backend()->findModuleByName( *it_modules ); - elem.setAttribute("moduledescription", m ? m->config(CSwordModuleInfo::Description) : QString::null); - - parentElement.appendChild( elem ); - - - ++it_parents; - ++it_modules; - ++it_descriptions; - ++it_bookmarks; - }; - - return doc.toString(); - }; - - /******************** - * New class: OldBookmarkFolder - *********************/ - - OldBookmarksFolder::OldBookmarksFolder(CTreeFolder* folder) : CBookmarkFolder(folder, OldBookmarkFolder) { - } - - OldBookmarksFolder::~OldBookmarksFolder() { - } - - /** Reimplementation to handle special bookmark tree. */ - void OldBookmarksFolder::initTree(){ - // Import the bookmarks of the previous BibleTime versions - if (!CBTConfig::get( CBTConfig::readOldBookmarks )) { //if we havn't yet loaded the old bookmarks - loadBookmarksFromXML( Bookmarks::OldBookmarkImport::oldBookmarksXML() ); - } - } - - - QDomElement OldBookmarksFolder::saveToXML( QDomDocument& doc ) { - QDomElement elem = doc.createElement("Folder"); - elem.setAttribute("caption", text(0)); - - // Append the XML nodes of all child items - CItemBase* i = dynamic_cast<CItemBase*>(firstChild()); - while( i ) { - if (i->parent() == this) { - QDomElement newElem = i->saveToXML( doc ); - if (!newElem.isNull()) { - elem.appendChild( newElem ); //append to this folder - } - } - i = dynamic_cast<CItemBase*>( i->nextSibling() ); - } - - // Save to config, that we imported the old bookmarks and that we have them on disk - CBTConfig::set( CBTConfig::readOldBookmarks, true ); - - return elem; - } - - void OldBookmarksFolder::loadFromXML( QDomElement& /*element*/ ) { - //this function is empty because the folder imports the old 1.2 bookmarks from the bt-groupmanager config file - } - - - // New class SubFolder - - SubFolder::SubFolder(CFolderBase* parentItem, const QString& caption) : CBookmarkFolder(parentItem, BookmarkFolder) { - m_startupXML = QDomElement(); - setText( 0, caption ); - } - - SubFolder::SubFolder(CFolderBase* parentItem, QDomElement& xml ) : CBookmarkFolder(parentItem, BookmarkFolder) { - m_startupXML = xml; - } - - SubFolder::~SubFolder() { - } - - void SubFolder::init() { - CFolderBase::init(); - if (!m_startupXML.isNull()) - loadFromXML(m_startupXML); - - setDropEnabled(true); - setRenameEnabled(0,true); - } - -// /** Is called when an item was dropped on this subfolder. */ -// bool SubFolder::acceptDrop(const QMimeSource * src) const { -// return CDragDropMgr::canDecode(src) && (CDragDropMgr::dndType(src) == CDragDropMgr::Item::Bookmark); -// } - - /** Reimplementation from CItemBase. */ - const bool SubFolder::enableAction(const MenuAction action){ - if (action == ChangeFolder || action == NewFolder || action == DeleteEntries || action == ImportBookmarks ) - return true; - - if (action == ExportBookmarks || action == ImportBookmarks ) - return true; //not yet implemented - - return false; - } - - /** Returns the XML code which represents the content of this folder. */ - QDomElement SubFolder::saveToXML( QDomDocument& doc ) { - /** - * Save all subitems (bookmarks and folders) to the XML file. - * We get the XML code for the items by calling their own saveToXML implementations. - */ - QDomElement elem = doc.createElement("Folder"); - elem.setAttribute("caption", text(0)); - - //append the XML nodes of all child items - CItemBase* i = dynamic_cast<CItemBase*>(firstChild()); - while( i ) { - if (i->parent() == this) { - QDomElement newElem = i->saveToXML( doc ); - if (!newElem.isNull()) { - elem.appendChild( newElem ); //append to this folder - } - } - i = dynamic_cast<CItemBase*>( i->nextSibling() ); - } - return elem; - } - - /** Loads the content of this folder from the XML code passed as argument to this function. */ - void SubFolder::loadFromXML( QDomElement& elem ) { - //get the caption and restore all child items! - if (elem.hasAttribute("caption")) - setText(0, elem.attribute("caption")); - - //restore all child items - QDomElement child = elem.firstChild().toElement(); - CItemBase* oldItem = 0; - while ( !child.isNull() && child.parentNode() == elem ) { - CItemBase* i = 0; - if (child.tagName() == "Folder") { - i = new Bookmarks::SubFolder(this, child); - } - else if (child.tagName() == "Bookmark") { - i = new CBookmarkItem(this, child); - } - i->init(); - if (oldItem) - i->moveAfter(oldItem); - oldItem = i; - - child = child.nextSibling().toElement(); - } - } -}; - - -/* --------------------------------------------------*/ -/* ---------- new class: CBookmarkFolder ------------*/ -/* --------------------------------------------------*/ - -CBookmarkFolder::CBookmarkFolder(CMainIndex* mainIndex, const Type type) : CTreeFolder(mainIndex, type, "*") { - setSortingEnabled(false); -} - -CBookmarkFolder::CBookmarkFolder(CFolderBase* parentItem, const Type type) : CTreeFolder(parentItem, type, "*") { - setSortingEnabled(false); -} - -CBookmarkFolder::~CBookmarkFolder() { -} - -void CBookmarkFolder::initTree(){ - addGroup(OldBookmarkFolder, "*"); - - KStandardDirs stdDirs; - const QString path = stdDirs.saveLocation("data", "bibletime/"); - if (!path.isEmpty()) { - loadBookmarks(path + "bookmarks.xml"); - } -} - -/** Reimplementation. */ -const bool CBookmarkFolder::enableAction(const MenuAction action){ - if (action == NewFolder || action == ImportBookmarks) - return true; - - if (action == ExportBookmarks && childCount()) - return true; - - return false; -} - - -void CBookmarkFolder::exportBookmarks(){ - QString fileName = KFileDialog::getSaveFileName(QString::null, i18n("*.btb | BibleTime bookmark files (*.btb)\n*.* | All files (*.*)"), 0, i18n("BibleTime - Export bookmarks")); - if (!fileName.isEmpty()) { - saveBookmarks( fileName, false ); //false means we don't want to overwrite the file without asking the user - }; -} - - -void CBookmarkFolder::importBookmarks(){ - QString fileName = KFileDialog::getOpenFileName(QString::null, i18n("*.btb | BibleTime bookmark files (*.btb)\n*.* | All files (*.*)"), 0, i18n("BibleTime - Import bookmarks")); - if (!fileName.isEmpty()) { - //we have to decide if we should load an old bookmark file from 1.2 or earlier or the new XML format of > 1.3 - if ( !loadBookmarks(fileName) ) { //if this failed try to load it as old bookmark file - loadBookmarksFromXML( Bookmarks::OldBookmarkImport::oldBookmarksXML( fileName ) ); - }; - }; -} - -bool CBookmarkFolder::acceptDrop(const QMimeSource * src) const { - qWarning("bool CBookmarkFolder::acceptDrop(const QMimeSource * src): return%ii", (CDragDropMgr::canDecode(src) && (CDragDropMgr::dndType(src) == CDragDropMgr::Item::Bookmark))); - return (CDragDropMgr::canDecode(src) && (CDragDropMgr::dndType(src) == CDragDropMgr::Item::Bookmark)); -} - -void CBookmarkFolder::dropped(QDropEvent *e) { - qWarning("CBookmarkFolder::dropped?"); - if (acceptDrop(e)) { - qWarning("CBookmarkFolder: item drop accepted"); - CDragDropMgr::ItemList dndItems = CDragDropMgr::decode(e); - - qWarning("decoded items: %i", dndItems.count() ); - CDragDropMgr::ItemList::Iterator it; - CItemBase* previousItem = 0; - for( it = dndItems.begin(); it != dndItems.end(); ++it) { - CSwordModuleInfo* module = backend()->findModuleByName( (*it).bookmarkModule() ); - CBookmarkItem* i = new CBookmarkItem(this, module, (*it).bookmarkKey(), (*it).bookmarkDescription()); - qWarning("created new item"); - if (previousItem) { - i->moveAfter( previousItem ); - qWarning("moved new item"); - } - i->init(); - previousItem = i; - }; - }; -} - -/** Saves the bookmarks in a file. */ -const bool CBookmarkFolder::saveBookmarks( const QString& filename, const bool& forceOverwrite ){ - QDomDocument doc("DOC"); - doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) ); - - QDomElement content = doc.createElement("SwordBookmarks"); - content.setAttribute("syntaxVersion", CURRENT_SYNTAX_VERSION); - doc.appendChild(content); - - //append the XML nodes of all child items - CItemBase* i = dynamic_cast<CItemBase*>( firstChild() ); - while( i ) { - if (i->parent() == this) { //only one level under this folder - QDomElement newElem = i->saveToXML( doc ); // the cild creates it's own XML code - if (!newElem.isNull()) { - content.appendChild( newElem ); //append to this folder - } - } - i = dynamic_cast<CItemBase*>( i->nextSibling() ); - } - - return CToolClass::savePlainFile(filename, doc.toString(), forceOverwrite, QTextStream::UnicodeUTF8); -} - -const bool CBookmarkFolder::loadBookmarksFromXML( const QString& xml ){ - QDomDocument doc; - doc.setContent(xml); - QDomElement document = doc.documentElement(); - if( document.tagName() != "SwordBookmarks" ) { - qWarning("Not a BibleTime Bookmark XML file"); - return false; - } - - CItemBase* oldItem = 0; - //restore all child items - QDomElement child = document.firstChild().toElement(); - while ( !child.isNull() && child.parentNode() == document) { - CItemBase* i = 0; - if (child.tagName() == "Folder") { - i = new Bookmarks::SubFolder(this, child); - } - else if (child.tagName() == "Bookmark") { - i = new CBookmarkItem(this, child); - } - if (!i) { - break; - } - - i->init(); - if (oldItem) { - i->moveAfter(oldItem); - } - oldItem = i; - - if (!child.nextSibling().isNull()) { - child = child.nextSibling().toElement(); - } - else { - break; - } - } - return true; -} - -/** Loads bookmarks from a file. */ -const bool CBookmarkFolder::loadBookmarks( const QString& filename ){ - QFile file(filename); - if (!file.exists()) - return false; - - QString xml; - if (file.open(IO_ReadOnly)) { - QTextStream t; - t.setEncoding(QTextStream::UnicodeUTF8); //set encoding before file is used for input! - t.setDevice(&file); - xml = t.read(); - file.close(); - } - - return loadBookmarksFromXML( xml ); -} - -/* NEW CLASS */ - -CGlossaryFolder::CGlossaryFolder(CMainIndex* mainIndex, const Type type, const QString& fromLanguage, const QString& toLanguage) - : CTreeFolder(mainIndex, type, fromLanguage) -{ - m_fromLanguage = fromLanguage; - m_toLanguage = toLanguage; -} - -CGlossaryFolder::CGlossaryFolder(CFolderBase* item, const Type type, const QString& fromLanguage, const QString& toLanguage) - : CTreeFolder(item, type, fromLanguage) -{ - m_fromLanguage = fromLanguage; - m_toLanguage = toLanguage; -} - -CGlossaryFolder::~CGlossaryFolder(){ -} - -void CGlossaryFolder::initTree(){ - if (type() == Unknown) - return; - - //get all modules by using the lexicon type - ListCSwordModuleInfo allModules = backend()->moduleList(); - ListCSwordModuleInfo usedModules; - for (CSwordModuleInfo* m = allModules.first(); m; m = allModules.next()) { - if (m->type() == CSwordModuleInfo::Lexicon) { //found a module, check if the type is correct (devotional etc.) - if ((type() == GlossaryModuleFolder) && (m->category() != CSwordModuleInfo::Glossary)) { //not a glossary - continue; - } - //found a glossary - if (language() == QString::fromLatin1("*") - || (language() != QString::fromLatin1("*") - && m->config(CSwordModuleInfo::GlossaryFrom) == fromLanguage() - && m->config(CSwordModuleInfo::GlossaryTo) == toLanguage() - ) - ) - { //right type and language! - usedModules.append(m); - } - } - } - - //we have now all modules we want to have - if (language() == QString::fromLatin1("*")) { //create subfolders for each language - typedef std::pair<QString, QString> LanguagePair; - typedef QValueList<LanguagePair> LanguagePairList; - - LanguagePairList usedLangs; - for (CSwordModuleInfo* m = usedModules.first(); m; m = usedModules.next()) { - LanguagePair langPair( m->config(CSwordModuleInfo::GlossaryFrom), m->config(CSwordModuleInfo::GlossaryTo) ); - if (!usedLangs.contains(langPair)) { - usedLangs.append(langPair); - } - } - LanguagePairList::iterator it; - for (it = usedLangs.begin(); it != usedLangs.end(); ++it) { - addGroup(type(), (*it).first, (*it).second); - } - } - else if (usedModules.count() > 0){ //create subitems with the given type and languages - for (CSwordModuleInfo* m = usedModules.first(); m; m = usedModules.next()) { - addModule(m); - } - } - - sortChildItems(0,true); -} - -void CGlossaryFolder::init(){ - if (language() == "*") { - setText(0,i18n("Glossaries")); - } - else { - CLanguageMgr::Language fromLang = languageMgr()->languageForAbbrev( m_fromLanguage ); - CLanguageMgr::Language toLang = languageMgr()->languageForAbbrev( m_toLanguage ); - - QString fromLangString = fromLang.translatedName(); - QString toLangString = toLang.translatedName(); - - if (fromLangString.isEmpty()) { //use abbrev! - fromLangString = m_fromLanguage; - }; - if (toLangString.isEmpty()) { //use abbrev! - toLangString = m_toLanguage; - }; - - - setText(0, fromLangString + " - " + toLangString ); - } - initTree(); - update(); -} - -/** Returns the language this glossary folder maps from. */ -const QString& CGlossaryFolder::fromLanguage() const{ - return m_fromLanguage; -} - -/** Returns the language this glossary folder maps to. */ -const QString& CGlossaryFolder::toLanguage() const{ - return m_toLanguage; -} - -void CGlossaryFolder::addGroup(const Type type, const QString& fromLanguage, const QString& toLanguage) { - CTreeFolder* i = new CGlossaryFolder(this, type, fromLanguage, toLanguage); - i->init(); - if (!i->childCount()) - delete i; -} - diff --git a/bibletime/frontend/mainindex/cindexitem.h b/bibletime/frontend/mainindex/cindexitem.h deleted file mode 100644 index c0fc642..0000000 --- a/bibletime/frontend/mainindex/cindexitem.h +++ /dev/null @@ -1,379 +0,0 @@ -/*************************************************************************** - cindexitem.h - description - ------------------- - begin : Sam Jun 22 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 CINDEXITEM_H -#define CINDEXITEM_H - -//BibleTime includes -#include "util/cpointers.h" - -#include "backend/cswordmoduleinfo.h" - -//Qt includes -#include <qdom.h> - -//KDE includes -#include <klistview.h> - -class KConfig; -class CFolderBase; -class CTreeFolder; -class CMainIndex; - -class CItemBase : public KListViewItem, public CPointers { -public: - enum Type { - Unknown = 0, - BookmarkFolder, - Bookmark, - OldBookmarkFolder, /* Bookmarks in the old format from BibleTime 1.1.x and 1.2.x */ - BibleModuleFolder, - CommentaryModuleFolder, - LexiconModuleFolder, - BookModuleFolder, - DevotionalModuleFolder, - GlossaryModuleFolder, - ModuleLanguageFolder, - Module - }; - enum MenuAction { - NewFolder = 0, - ChangeFolder, - - ChangeBookmark, - ImportBookmarks, - ExportBookmarks, - PrintBookmarks, - - DeleteEntries, - - EditModule, - SearchInModules, - UnlockModule, - AboutModule, - - ActionBegin = NewFolder, - ActionEnd = AboutModule - }; - - CItemBase(CMainIndex* mainIndex, const Type type = Unknown); - CItemBase(CItemBase* item, const Type type = Unknown); - - virtual ~CItemBase(); - virtual const QString toolTip(); - virtual CMainIndex* listView() const; - /** - * Returns if the implementation of this class is a folder item or not. - * Reimplement this function to return the correct value. - */ - virtual const bool isFolder() { return false; }; - const Type& type() const; - - virtual void init(); - virtual void update(); - void moveAfter( CItemBase* const item ); - /** - * Returns true if the given action should be enabled in the popup menu. - */ - virtual const bool enableAction( const MenuAction action ); - virtual const bool isMovable(); - - /** - * Returns the XML code which represents the content of this folder. - */ - virtual QDomElement saveToXML( QDomDocument& /*document*/ ) { return QDomElement(); }; - /** - * Loads the content of this folder from the XML code passed as argument to this function. - */ - virtual void loadFromXML( QDomElement& /*element*/ ) {}; - /** - * Returns true whether the sorting is enabled or not. - */ - const bool isSortingEnabled(); - /** - * This function engables or disables sorting depending on the parameter. - */ - void setSortingEnabled( const bool& enableSorting ); - /** - * Reimplementation which takes care of the our isSortingEnabled() setting. - */ - virtual void sortChildItems( int col, bool asc ); - /** - * Reimplementation which takes care of the our isSortingEnabled() setting. - */ - virtual void sort(); - -protected: - friend class CMainIndex; - virtual void dropped( QDropEvent* e ); - /** - * Reimplementation. Returns true if the auto opening of this folder is allowd - * The default return value is "false" - */ - virtual const bool allowAutoOpen( const QMimeSource* src ) const; - -private: - Type m_type; - bool m_sortingEnabled; -}; - -class CModuleItem : public CItemBase { -public: - CModuleItem(CTreeFolder* item, CSwordModuleInfo* module); - virtual ~CModuleItem(); - virtual CSwordModuleInfo* const module() const; - virtual const QString toolTip(); - - /** - * Reimplementation from CItemBase. - */ - virtual const bool enableAction( const MenuAction action ); - virtual void update(); - virtual void init(); - /** - * Returns the about module info of the used module. - */ - const QString aboutInfo(); - -protected: // Protected methods - /** - * Reimplementation to handle text drops on a module. - * In this case open the searchdialog. In the case of a referebnce open the module at the given position. - */ - virtual bool acceptDrop( const QMimeSource* src ) const; - virtual void dropped( QDropEvent* e ); - -private: - CSwordModuleInfo* m_module; -}; - -class CBookmarkItem : public CItemBase { -public: - CBookmarkItem(CFolderBase* parentItem, CSwordModuleInfo* module, const QString& key, const QString& description); - CBookmarkItem(CFolderBase* parentItem, QDomElement& xml); - ~CBookmarkItem(); - CSwordModuleInfo* const module(); - const QString key(); - const QString& description(); - virtual const QString toolTip(); - - virtual void update(); - virtual void init(); - virtual const bool isMovable(); - /** - * Reimplementation to handle the menu entries of the main index. - */ - virtual const bool enableAction(const MenuAction action); - /** - * Prints this bookmark. - */ - void print(); - /** - * Changes this bookmark. - */ - void rename(); - /** - * Reimplementation of CItemBase::saveToXML. - */ - virtual QDomElement saveToXML( QDomDocument& document ); - /** - * Loads the content of this folder from the XML code passed as argument to this function. - */ - virtual void loadFromXML( QDomElement& element ); - -private: - QString m_key; - QString m_description; - QString m_moduleName; - - QDomElement m_startupXML; - -private: // Private methods - /** - * Returns the english key. - * Only used internal of this class implementation. - */ - const QString& englishKey(); -protected: // Protected methods - /** - * Reimplementation. Returns false everytime - * because a bookmarks - * has not possible drops. - */ - virtual bool acceptDrop(const QMimeSource * src); - /** - * Compares this item to another one. Used for sorting. - */ -// virtual int compare( QListViewItem*, int col, bool ascending) const; -}; - - -class CFolderBase : public CItemBase { -public: - CFolderBase(CMainIndex* mainIndex, const Type type); - CFolderBase(CFolderBase* parentFolder, const Type type); - CFolderBase(CFolderBase* parentFolder, const QString& caption); - virtual ~CFolderBase(); - - virtual const bool isFolder(); - - virtual void update(); - virtual void init(); - virtual void setOpen( bool open ); - /** - * The function which renames this folder. - */ - void rename(); - virtual void newSubFolder(); - -protected: - /** - * Reimplementation. Returns true if the auto opening of this folder is allowd - */ - virtual const bool allowAutoOpen( const QMimeSource* src ) const; - /** Reimplementation. Returns false because folders have no use for drops (except for the bookmark folders) */ - bool acceptDrop(const QMimeSource * src); -}; - -/** The base class for all items in the tree. Subclasses for module folders, modules and bookmarks exist. - * @author The BibleTime team - */ -class CTreeFolder : public CFolderBase { -public: - CTreeFolder(CMainIndex* mainIndex, const Type type, const QString& language ); - CTreeFolder(CFolderBase* parentFolder, const Type type, const QString& language ); - ~CTreeFolder(); - virtual void addGroup(const Type type, const QString language); - virtual void addModule(CSwordModuleInfo* const); - virtual void addBookmark(CSwordModuleInfo* module, const QString& key, const QString& description); - - virtual void initTree(); - - virtual void update(); - virtual void init(); - - virtual const QString& language() const; - -private: - QString m_language; -}; - -class CGlossaryFolder : public CTreeFolder { -public: - CGlossaryFolder(CMainIndex* mainIndex, const Type type, const QString& fromLanguage, const QString& toLanguage ); - CGlossaryFolder(CFolderBase* parentFolder, const Type type, const QString& fromLanguage, const QString& toLanguage ); - ~CGlossaryFolder(); - - virtual void initTree(); - virtual void init(); - virtual void addGroup(const Type type, const QString& fromLanguage, const QString& toLanguage); - /** - * Returns the language this glossary folder maps from. - */ - const QString& fromLanguage() const; - /** - * Returns the language this glossary folder maps from. - */ - const QString& toLanguage() const; - -private: - QString m_fromLanguage; - QString m_toLanguage; -}; - -class CBookmarkFolder : public CTreeFolder { -public: - CBookmarkFolder(CMainIndex* mainIndex, const Type type = BookmarkFolder); - CBookmarkFolder(CFolderBase* parentItem, const Type type = BookmarkFolder); - virtual ~CBookmarkFolder(); - virtual const bool enableAction(const MenuAction action); - virtual void exportBookmarks(); - virtual void importBookmarks(); - virtual bool acceptDrop(const QMimeSource * src) const; - virtual void dropped(QDropEvent *e); - - /** - * Loads bookmarks from XML content - */ - const bool loadBookmarksFromXML( const QString& xml ); - /** - * Loads bookmarks from a file. - */ - const bool loadBookmarks( const QString& ); - /** - * Saves the bookmarks in a file. - */ - const bool saveBookmarks( const QString& filename, const bool& forceOverwrite = true ); - -protected: // Protected methods - virtual void initTree(); -}; - - -namespace Bookmarks { - class OldBookmarksFolder : public CBookmarkFolder { - public: - OldBookmarksFolder(CTreeFolder* item); - virtual ~OldBookmarksFolder(); - virtual void initTree(); - /** - * Returns the XML code which represents the content of this folder. - */ - virtual QDomElement saveToXML( QDomDocument& document ); - /** - * Loads the content of this folder from the XML code passed as argument to this function. - */ - virtual void loadFromXML( QDomElement& element ); - }; - - class OldBookmarkImport { - public: - /** - * This function converts the old config based bookmarks into a valid 1.3 XML file, so importing is easy - */ - static const QString oldBookmarksXML( const QString& configFileName = QString::null ); - private: - // made provate because we offer one static functions which doesn't need constructor and destructor - OldBookmarkImport(); - ~OldBookmarkImport(); - }; - - class SubFolder : public CBookmarkFolder { - public: - SubFolder(CFolderBase* parentItem, const QString& caption); - SubFolder(CFolderBase* parentItem, QDomElement& xml); - virtual ~SubFolder(); - virtual void init(); - /** - * Reimplementation from CItemBase. - */ - const bool enableAction(const MenuAction action); - /** - * Returns the XML code which represents the content of this folder. - */ - virtual QDomElement saveToXML( QDomDocument& document ); - /** - * Loads the content of this folder from the XML code passed as argument to this function. - */ - virtual void loadFromXML( QDomElement& element ); - - private: - QDomElement m_startupXML; - }; -}; - -#endif diff --git a/bibletime/frontend/mainindex/cmainindex.cpp b/bibletime/frontend/mainindex/cmainindex.cpp deleted file mode 100644 index fe7279a..0000000 --- a/bibletime/frontend/mainindex/cmainindex.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/*************************************************************************** - cmainindex.cpp - description - ------------------- - begin : Sam Jun 22 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. * - * * - ***************************************************************************/ - -//BibleTime includes -#include "cmainindex.h" -#include "cindexitem.h" - -#include "backend/creferencemanager.h" -#include "backend/cswordmoduleinfo.h" - -#include "frontend/searchdialog/csearchdialog.h" -#include "frontend/cbtconfig.h" -#include "frontend/cdragdropmgr.h" - -#include "util/cresmgr.h" - -//Qt includes -#include <qheader.h> -#include <qwhatsthis.h> -#include <qlistview.h> -#include <qdragobject.h> -#include <qinputdialog.h> - -//KDE includes -#include <klocale.h> -#include <kstandarddirs.h> -#include <kpopupmenu.h> -#include <kmessagebox.h> -#include <kglobalsettings.h> - -CMainIndex::ToolTip::ToolTip(QWidget* parent) : CToolTip(parent) { -} - -void CMainIndex::ToolTip::maybeTip(const QPoint& p) { - if (!parentWidget()->inherits("CMainIndex")) - return; - - CMainIndex* m = 0; - if ( !(m = dynamic_cast<CMainIndex*>(parentWidget())) ) - return; - - CItemBase* i = 0; - if ( !( i = dynamic_cast<CItemBase*>(m->itemAt(p))) ) - return; - - QRect r = m->itemRect(i); - if (!r.isValid()) { - return; - } - - //get type of item and display correct text - const QString text = i->toolTip(); - if (!text.isEmpty()) { - QPoint globalPoint = m->viewport()->mapTo(m, p); - tip(globalPoint, r, text); - } -} - -/*new class : CMainIndex*/ -CMainIndex::CMainIndex(QWidget *parent) : KListView(parent), - m_searchDialog(0), m_toolTip(0), m_itemsMovable(false), m_autoOpenFolder(0), m_autoOpenTimer(this) -{ - initView(); - initConnections(); -} - -CMainIndex::~CMainIndex(){ - saveBookmarks(); -} - -/** Reimplementation. Adds the given group to the tree. */ -void CMainIndex::addGroup(const CItemBase::Type type, const QString language){ - CTreeFolder *i = 0; - switch (type) { - case CItemBase::BookmarkFolder: - i = new CBookmarkFolder(this); - break; - case CItemBase::GlossaryModuleFolder: - i = new CGlossaryFolder(this, type, language, QString::null); //we have no second language - break; - default: - i = new CTreeFolder(this, type, language); - break; - } - if (i) { - i->init(); - if (i->childCount() == 0 && type != CItemBase::BookmarkFolder) { - delete i; - } - } -} - - -/** Initializes the view. */ -void CMainIndex::initView(){ - addColumn(QString::null); - header()->hide(); - - m_toolTip = new ToolTip(this); - setTooltipColumn(-1); - setShowToolTips(false);//to disable Qt's tooltips - - setBackgroundMode(PaletteBase); - setFullWidth(true); - - setAcceptDrops( true ); - setDragEnabled( true ); - setDropVisualizer( true ); - setDropHighlighter( true ); - setAutoOpen(true); - viewport()->setAcceptDrops(true); - setRootIsDecorated(false); - setAllColumnsShowFocus(true); - setItemsMovable(false); - setSelectionModeExt(Extended); - - //setup the popup menu - m_popup = new KPopupMenu(viewport()); - m_popup->insertTitle(i18n("Main index")); - - m_actions.newFolder = new KAction(i18n("Create a new folder"), CResMgr::mainIndex::newFolder::icon, 0, this, SLOT(createNewFolder()), this); - m_actions.changeFolder = new KAction(i18n("Change this folder"),CResMgr::mainIndex::changeFolder::icon, 0, this, SLOT(changeFolder()), this); - - m_actions.changeBookmark = new KAction(i18n("Change this bookmark"),CResMgr::mainIndex::changeBookmark::icon, 0, this, SLOT(changeBookmark()), this); - m_actions.importBookmarks = new KAction(i18n("Import bookmarks"),CResMgr::mainIndex::importBookmarks::icon, 0, this, SLOT(importBookmarks()), this); - m_actions.exportBookmarks = new KAction(i18n("Export bookmarks"),CResMgr::mainIndex::exportBookmarks::icon, 0, this, SLOT(exportBookmarks()), this); - m_actions.printBookmarks = new KAction(i18n("Print bookmarks"),CResMgr::mainIndex::printBookmarks::icon, 0, this, SLOT(printBookmarks()), this); - - m_actions.deleteEntries = new KAction(i18n("Remove selected item(s)"),CResMgr::mainIndex::deleteItems::icon, 0, this, SLOT(deleteEntries()), this); - - m_actions.editModuleMenu = new KActionMenu(i18n("Edit this module"),CResMgr::mainIndex::editModuleMenu::icon, this); - m_actions.editModulePlain = new KAction(i18n("Plain text"),CResMgr::mainIndex::editModulePlain::icon, 0, this, SLOT(editModulePlain()), this); - m_actions.editModuleHTML = new KAction(i18n("HTML"),CResMgr::mainIndex::editModuleHTML::icon, 0, this, SLOT(editModuleHTML()), this); - - m_actions.searchInModules = new KAction(i18n("Search in selected module(s)"),CResMgr::mainIndex::search::icon, 0, this, SLOT(searchInModules()), this); - m_actions.unlockModule = new KAction(i18n("Unlock this module"),CResMgr::mainIndex::unlockModule::icon, 0, this, SLOT(unlockModule()), this); - m_actions.aboutModule = new KAction(i18n("About this module"),CResMgr::mainIndex::aboutModule::icon, 0, this, SLOT(aboutModule()), this); - - - m_actions.newFolder->plug(m_popup); - m_actions.changeFolder->plug(m_popup); - (new KActionSeparator(this))->plug(m_popup); - m_actions.changeBookmark->plug(m_popup); - m_actions.importBookmarks->plug(m_popup); - m_actions.exportBookmarks->plug(m_popup); - m_actions.printBookmarks->plug(m_popup); - (new KActionSeparator(this))->plug(m_popup); - m_actions.deleteEntries->plug(m_popup); - (new KActionSeparator(this))->plug(m_popup); - m_actions.editModuleMenu->plug(m_popup); - m_actions.editModuleMenu->insert(m_actions.editModulePlain); //sub item of edit module menu - m_actions.editModuleMenu->insert(m_actions.editModuleHTML); //sub item of edit module menu - - m_actions.searchInModules->plug(m_popup); - m_actions.unlockModule->plug(m_popup); - m_actions.aboutModule->plug(m_popup); -} - -/** Initialize the SIGNAL<->SLOT connections */ -void CMainIndex::initConnections(){ - connect(this, SIGNAL(executed(QListViewItem*)), - SLOT(slotExecuted(QListViewItem*))); - connect(this, SIGNAL(dropped(QDropEvent*, QListViewItem*, QListViewItem*)), - SLOT(dropped(QDropEvent*, QListViewItem*, QListViewItem*))); -// connect(this, SIGNAL(moved( QPtrList<QListViewItem>& items, QPtrList<QListViewItem>& afterFirst, QPtrList<QListViewItem>& afterNow)), -// SLOT(moved( QPtrList<QListViewItem>& items, QPtrList<QListViewItem>& afterFirst, QPtrList<QListViewItem>& afterNow))); - connect(this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - SLOT(contextMenu(KListView*, QListViewItem*, const QPoint&))); - connect(&m_autoOpenTimer, SIGNAL(timeout()), - this, SLOT(autoOpenTimeout())); -} - -/** Is called when an item was clicked/double clicked. */ -void CMainIndex::slotExecuted( QListViewItem* i ){ - CItemBase* ci = dynamic_cast<CItemBase*>(i); - if (!ci) - return; - - if (ci->isFolder()) { - i->setOpen(!i->isOpen()); - } - else if (CModuleItem* m = dynamic_cast<CModuleItem*>(i)) { //clicked on a module - CSwordModuleInfo* mod = m->module(); - ListCSwordModuleInfo modules; - modules.append(mod); - emit createReadDisplayWindow(modules, QString::null); - } - else if (CBookmarkItem* b = dynamic_cast<CBookmarkItem*>(i) ) { //clicked on a bookmark - if (CSwordModuleInfo* mod = b->module()) { - ListCSwordModuleInfo modules; - modules.append(mod); - emit createReadDisplayWindow(modules, b->key()); - } - } -} - -/** Reimplementation. Returns the drag object for the current selection. */ -QDragObject* CMainIndex::dragObject() { - if (!m_itemsMovable) { - return false; - }; - - CDragDropMgr::ItemList dndItems; - - QPtrList<QListViewItem> items = selectedItems(); - for (items.first(); items.current(); items.next()) { - if (CItemBase* i = dynamic_cast<CItemBase*>(items.current())) { - //we can move this item! - if (!i->isMovable()) { //we can only drag items which allow us to do it, e.g. which are movable - continue; - }; - - if (CBookmarkItem* bookmark = dynamic_cast<CBookmarkItem*>( items.current() )) { - //take care of bookmarks which have no valid module any more, e.g. if it was uninstalled - const QString moduleName = bookmark->module() ? bookmark->module()->name() : QString::null; - dndItems.append( CDragDropMgr::Item(moduleName, bookmark->key(), bookmark->description()) ); - } - } - } - - return CDragDropMgr::dragObject( dndItems, viewport() ); -} - -/** Reimplementation from KListView. Returns true if the drag is acceptable for the listview. */ -bool CMainIndex::acceptDrag( QDropEvent* event ) const { -// qWarning("CMainIndex::acceptDrag( QDropEvent* event )"); - - const QPoint pos = contentsToViewport(event->pos()); - if (CItemBase* i = dynamic_cast<CItemBase*>(itemAt(pos))) { - return i->acceptDrop(event); - } - return false; -} - -/** No descriptions */ -void CMainIndex::initTree(){ - addGroup(CItemBase::BookmarkFolder, QString::fromLatin1("*")); - addGroup(CItemBase::BibleModuleFolder, QString::fromLatin1("*")); - addGroup(CItemBase::BookModuleFolder, QString::fromLatin1("*")); - addGroup(CItemBase::CommentaryModuleFolder, QString::fromLatin1("*")); - addGroup(CItemBase::DevotionalModuleFolder, QString::fromLatin1("*")); - addGroup(CItemBase::GlossaryModuleFolder, QString::fromLatin1("*")); - addGroup(CItemBase::LexiconModuleFolder, QString::fromLatin1("*")); -} - -/** No descriptions */ -void CMainIndex::dropped( QDropEvent* e, QListViewItem* parent, QListViewItem* after){ -// qWarning("CMainIndex::dropped"); - Q_ASSERT(after); - Q_ASSERT(parent); - - if (after) - qWarning("DROP AFTER %s", after->text(0).latin1()); - if (parent) - qWarning("DROP parent %s", parent->text(0).latin1()); - - //the drop was started in this main index widget - if (m_itemsMovable && e->source() == viewport()) { - /* - * If the drag was started from the main index and should move items and if the destination is the bookmark - * folder or one of its subfolders - * we remove the current items because the new ones will be inserted soon. - */ - if (dynamic_cast<CBookmarkFolder*>(parent) || dynamic_cast<Bookmarks::SubFolder*>(parent)) { //we drop onto the bookmark folder or one of it's subfolders - QPtrList<QListViewItem> items = selectedItems(); - items.setAutoDelete(true); - items.clear(); //delete the selected items we dragged - }; - }; - - //finally do the drop, either with external drop data or with the moved items' data - CItemBase* parentItem = dynamic_cast<CItemBase*>(parent); - CItemBase* afterItem = dynamic_cast<CItemBase*>(after); - if (afterItem && afterItem->isFolder()) { - afterItem->setOpen(true); - afterItem->dropped(e); - } - else if (afterItem && !afterItem->isFolder() && parentItem) { - parentItem->setOpen(true); - parentItem->dropped(e); - } - else if (parentItem) { - parentItem->setOpen(true); - parentItem->dropped(e); - } -} - -/** No descriptions */ -void CMainIndex::emitModulesChosen( ListCSwordModuleInfo modules, QString key ){ - emit createReadDisplayWindow(modules, key); -} - -/** Returns the correct KAction object for the given type of action. */ -KAction* const CMainIndex::action( const CItemBase::MenuAction type ) const { - switch (type) { - case CItemBase::NewFolder: - return m_actions.newFolder; - case CItemBase::ChangeFolder: - return m_actions.changeFolder; - - case CItemBase::ChangeBookmark: - return m_actions.changeBookmark; - case CItemBase::ImportBookmarks: - return m_actions.importBookmarks; - case CItemBase::ExportBookmarks: - return m_actions.exportBookmarks; - case CItemBase::PrintBookmarks: - return m_actions.printBookmarks; - - case CItemBase::DeleteEntries: - return m_actions.deleteEntries; - - case CItemBase::EditModule: - return m_actions.editModuleMenu; - case CItemBase::SearchInModules: - return m_actions.searchInModules; - case CItemBase::UnlockModule: - return m_actions.unlockModule; - case CItemBase::AboutModule: - return m_actions.aboutModule; - default: - return 0; - }; -} - -/** Shows the context menu at the given position. */ -void CMainIndex::contextMenu(KListView* /*list*/, QListViewItem* i, const QPoint& p){ - //setup menu entries depending on current selection - QPtrList<QListViewItem> items = selectedItems(); - - if (items.count() == 0) { //special handling for no selection - - } - else if (items.count() == 1) { //special handling for one selected item - CItemBase* item = dynamic_cast<CItemBase*>(i); - CItemBase::MenuAction actionType; - for (int index = CItemBase::ActionBegin; index <= CItemBase::ActionEnd; ++index) { - actionType = static_cast<CItemBase::MenuAction>(index); - if (KAction* a = action(actionType)) - a->setEnabled( item->enableAction(actionType) ); - } - } - else { - //first disable all actions - CItemBase::MenuAction actionType; - for (int index = CItemBase::ActionBegin; index <= CItemBase::ActionEnd; ++index) { - actionType = static_cast<CItemBase::MenuAction>(index); - if (KAction* a = action(actionType)) - a->setEnabled(false); - } - - for (int index = CItemBase::ActionBegin; index <= CItemBase::ActionEnd; ++index) { - actionType = static_cast<CItemBase::MenuAction>(index); - bool enableAction = isMultiAction(actionType); - for (items.first(); items.current(); items.next()) { - CItemBase* i = dynamic_cast<CItemBase*>(items.current()); - enableAction = enableAction && i->enableAction(actionType); - } - if (enableAction) { - KAction* a = action(actionType) ; - if (i && a) - a->setEnabled(enableAction); - } - } - } - m_popup->exec(p); -} - -/** Adds a new subfolder to the current item. */ -void CMainIndex::createNewFolder(){ - if (CFolderBase* i = dynamic_cast<CFolderBase*>(currentItem()) ) { - i->newSubFolder(); - } -} - -/** Opens a dialog to change the current folder. */ -void CMainIndex::changeFolder(){ - if (CFolderBase* i = dynamic_cast<CFolderBase*>(currentItem()) ) { - i->rename(); - } -} - -/** Changes the current bookmark. */ -void CMainIndex::changeBookmark(){ - if (CBookmarkItem* i = dynamic_cast<CBookmarkItem*>(currentItem()) ) { - i->rename(); - } -} - -/** Exports the bookmarks being in the selected folder. */ -void CMainIndex::exportBookmarks(){ - if (CBookmarkFolder* i = dynamic_cast<CBookmarkFolder*>(currentItem()) ) { - i->exportBookmarks(); - } -} - -/** Import bookmarks from a file and add them to the selected folder. */ -void CMainIndex::importBookmarks(){ - if (CBookmarkFolder* i = dynamic_cast<CBookmarkFolder*>(currentItem()) ) { - i->importBookmarks(); - } -} - -/** Prints the selected bookmarks. */ -void CMainIndex::printBookmarks(){ - QPtrList<QListViewItem> items = selectedItems(); - for (items.first(); items.current(); items.next()) { - if (CBookmarkItem* i = dynamic_cast<CBookmarkItem*>(items.current())) { - i->print(); - } - } -} - -/** Deletes the selected entries. */ -void CMainIndex::deleteEntries() { - QPtrList<QListViewItem> items = selectedItems(); - if (!items.count()) - return; - - if (KMessageBox::warningYesNo(this, i18n("Do you really want to delete the selected items and child-items?"), i18n("Delete Items")) != KMessageBox::Yes) { - return; - } - -// We have to go backwards because otherwise deleting folders would delete their childs => crash - for (items.last(); items.current(); items.prev()) { - if (CItemBase* i = dynamic_cast<CItemBase*>(items.current())) { - if (i->enableAction(CItemBase::DeleteEntries)) { - delete i; - } - } - } -} - -/** Opens the searchdialog for the selected modules. */ -void CMainIndex::searchInModules(){ - QPtrList<QListViewItem> items = selectedItems(); - ListCSwordModuleInfo modules; - for (items.first(); items.current(); items.next()) { - if (CModuleItem* i = dynamic_cast<CModuleItem*>(items.current())) { - if (i->module()) - modules.append(i->module()); - } - } - - if (modules.isEmpty()) { //get a list of useful default modules for the search if no modules were selected - CSwordModuleInfo* m = CPointers::backend()->findModuleByDescription( CBTConfig::get(CBTConfig::standardBible )); - if (m) - modules.append(m); - } - - CSearchDialog::openDialog(modules, QString::null); -} - -/** Unlocks the current module. */ -void CMainIndex::unlockModule(){ - if (CModuleItem* i = dynamic_cast<CModuleItem*>(currentItem())) { - bool ok; - QString unlockKey = QInputDialog::getText(i18n("BibleTime - Unlock module"),i18n("Enter the unlock key for this module."),QLineEdit::Normal, i->module()->config(CSwordModuleInfo::CipherKey), &ok); - if (ok) { - /*const bool ret =*/ i->module()->unlock( unlockKey ); -// if ( !ret ) { // an error occured -// -// } - } - } -} - -/** Shows information about the current module. */ -void CMainIndex::aboutModule(){ - if (CModuleItem* i = dynamic_cast<CModuleItem*>(currentItem())) { - KMessageBox::about(this, i->aboutInfo(), i->module()->config(CSwordModuleInfo::Description), false); - } -} - -/** Reimplementation. Takes care of movable items. */ -void CMainIndex::startDrag(){ - QPtrList<QListViewItem> items = selectedItems(); - m_itemsMovable = true; - for (items.first(); items.current() && m_itemsMovable; items.next()) { - if (CItemBase* i = dynamic_cast<CItemBase*>(items.current())) { - m_itemsMovable = m_itemsMovable && i->isMovable(); - } - else { - m_itemsMovable = false; - } - } - KListView::startDrag(); -} - -/** Reimplementation to support the items dragEnter and dragLeave functions. */ -void CMainIndex::contentsDragMoveEvent( QDragMoveEvent* event ){ -// qWarning("void CMainIndex:: drag move event ( QDragLeaveEvent* e )"); - if ( CItemBase* i = dynamic_cast<CItemBase*>( itemAt( contentsToViewport(event->pos())) )) { - if (i->allowAutoOpen(event) || (i->acceptDrop(event) && i->isFolder() && i->allowAutoOpen(event) && !i->isOpen() && autoOpen()) ) { -// qWarning("autoopen: %s", i->text(0).latin1()); - if (m_autoOpenFolder != i) { - m_autoOpenTimer.stop(); - } - m_autoOpenFolder = i; - m_autoOpenTimer.start( 400, true ); - } - else { - m_autoOpenFolder = 0; - } - } - else { - m_autoOpenFolder = 0; - } - - KListView::contentsDragMoveEvent(event); -} - -void CMainIndex::autoOpenTimeout(){ - m_autoOpenTimer.stop(); - if (m_autoOpenFolder && !m_autoOpenFolder->isOpen() && m_autoOpenFolder->childCount()) { - m_autoOpenFolder->setOpen(true); - } -} - -/** No descriptions */ -void CMainIndex::contentsDragLeaveEvent( QDragLeaveEvent* e ){ -// qWarning("void CMainIndex::contentsDragLeaveEvent( QDragLeaveEvent* e )"); - m_autoOpenTimer.stop(); - KListView::contentsDragLeaveEvent(e); -} - -/** Returns true if more than one netry is supported by this action type. Returns false for actions which support only one entry, e.g. about module etc. */ -const bool CMainIndex::isMultiAction( const CItemBase::MenuAction type ) const { - switch (type) { - case CItemBase::NewFolder: - return false; - case CItemBase::ChangeFolder: - return false; - - case CItemBase::ChangeBookmark: - return false; - case CItemBase::ImportBookmarks: - return false; - case CItemBase::ExportBookmarks: - return false; - case CItemBase::PrintBookmarks: - return true; - - case CItemBase::DeleteEntries: - return true; - - case CItemBase::EditModule: - return false; - case CItemBase::SearchInModules: - return true; - case CItemBase::UnlockModule: - return false; - case CItemBase::AboutModule: - return false; - } - return false; -} - -/** Is called when items should be moved. */ -void CMainIndex::moved( QPtrList<QListViewItem>& /*items*/, QPtrList<QListViewItem>& /*afterFirst*/, QPtrList<QListViewItem>& /*afterNow*/){ -} - -/** Opens an editor window to edit the modules content. */ -void CMainIndex::editModulePlain(){ - QPtrList<QListViewItem> items = selectedItems(); - ListCSwordModuleInfo modules; - for (items.first(); items.current(); items.next()) { - if (CModuleItem* i = dynamic_cast<CModuleItem*>(items.current())) { - modules.append(i->module()); - } - } - if (modules.count() == 1) { - emit createWriteDisplayWindow(modules.first(), QString::null, CDisplayWindow::PlainTextWindow); - }; -} - -/** Opens an editor window to edit the modules content. */ -void CMainIndex::editModuleHTML(){ - QPtrList<QListViewItem> items = selectedItems(); - ListCSwordModuleInfo modules; - for (items.first(); items.current(); items.next()) { - if (CModuleItem* i = dynamic_cast<CModuleItem*>(items.current())) { - modules.append(i->module()); - } - } - if (modules.count() == 1) { - emit createWriteDisplayWindow(modules.first(), QString::null, CDisplayWindow::HTMLWindow); - }; -} - -/** Reloads the main index's Sword dependend things like modules */ -void CMainIndex::reloadSword(){ - //reload the modules -// saveBookmarks(); - clear(); - initTree(); -} - -/** Saves the bookmarks to disk */ -void CMainIndex::saveBookmarks(){ - //find the bookmark folder -// qWarning("void CMainIndex::saveBookmarks(){"); - CItemBase* i = 0; - QListViewItemIterator it( this ); - while ( it.current() != 0 ) { - i = dynamic_cast<CItemBase*>( it.current() ); - if (i && i->type() == CItemBase::BookmarkFolder) { //found the bookmark folder - KStandardDirs stdDirs; - const QString path = stdDirs.saveLocation("data", "bibletime/"); - if (!path.isEmpty()) { - //save the bookmarks to the right file - if (CBookmarkFolder* f = dynamic_cast<CBookmarkFolder*>(i)) { - f->saveBookmarks( path + "bookmarks.xml" ); - } - } - break; - } - ++it; - } -} diff --git a/bibletime/frontend/mainindex/cmainindex.h b/bibletime/frontend/mainindex/cmainindex.h deleted file mode 100644 index 7a337a7..0000000 --- a/bibletime/frontend/mainindex/cmainindex.h +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** - cmainindex.h - description - ------------------- - begin : Sam Jun 22 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 CMAININDEX_H -#define CMAININDEX_H - -//BibleTime includes -#include "cindexitem.h" - -#include "backend/cswordmoduleinfo.h" -#include "frontend/displaywindow/cdisplaywindow.h" -#include "frontend/ctooltip.h" - -#include "util/cpointers.h" - -//Qt includes -#include <qwidget.h> -#include <qtimer.h> - -//KDE includes -#include <kaction.h> -#include <klistview.h> - -/** The class which manages all bookmarks and modules. The modules are put into own, fixed subfolders sorted by language. - * @author The BibleTime team - */ - -class CSearchDialog; - -class CMainIndex : public KListView { - Q_OBJECT - - class ToolTip : public CToolTip { - public: - ToolTip(QWidget* parent); - /** - * Displays a tooltip for position p using the getToolTip() function of CGroupManagerItem - */ - virtual void maybeTip( const QPoint &pos); - }; - -public: - CMainIndex(QWidget *parent); - virtual ~CMainIndex(); - void initTree(); - /** - * Opens the searchdialog using the given modules using the given search text. - */ - void emitModulesChosen( ListCSwordModuleInfo modules, QString key ); - /** Saves the bookmarks to disk */ - void saveBookmarks(); - /** Reloads the main index's Sword dependend things like modules */ - void reloadSword(); - -protected: // Protected methods - /** - * Reimplementation. Adds the given group to the tree. - */ - virtual void addGroup( const CItemBase::Type type, const QString language); - /** - * Initialize the SIGNAL<->SLOT connections - */ - void initConnections(); - /** - * Reimplementation. Returns the drag object for the current selection. - */ - virtual QDragObject* dragObject(); - /** - * Reimplementation from KListView. Returns true if the drag is acceptable for the listview. - */ - virtual bool acceptDrag( QDropEvent* event ) const; - /** - * Returns the correct KAction object for the given type of action. - */ - KAction* const action( const CItemBase::MenuAction type ) const; - /** - * Reimplementation. Takes care of movable items. - */ - virtual void startDrag(); - /** - * Reimplementation to support the items dragEnter and dragLeave functions. - */ - virtual void contentsDragMoveEvent( QDragMoveEvent* event ); - virtual void contentsDragLeaveEvent( QDragLeaveEvent* e ); - -public slots: - /** - * Opens the searchdialog for the selected modules. - */ - void searchInModules(); - -protected slots: // Protected slots - /** - * Is called when an item was clicked/double clicked. - */ - void slotExecuted( QListViewItem* ); - void dropped( QDropEvent*, QListViewItem*, QListViewItem*); - /** - * Shows the context menu at the given position. - */ - void contextMenu(KListView*, QListViewItem*, const QPoint&); - /** - * Adds a new subfolder to the current item. - */ - void createNewFolder(); - /** - * Opens a dialog to change the current folder. - */ - void changeFolder(); - /** - * Exports the bookmarks being in the selected folder. - */ - void exportBookmarks(); - /** - * Changes the current bookmark. - */ - void changeBookmark(); - /** - * Import bookmarks from a file and add them to the selected folder. - */ - void importBookmarks(); - /** - * Deletes the selected entries. - */ - void deleteEntries(); - /** - * Prints the selected bookmarks. - */ - void printBookmarks(); - /** - * Shows information about the current module. - */ - void aboutModule(); - /** - * Unlocks the current module. - */ - void unlockModule(); - void autoOpenTimeout(); - /** - * Is called when items should be moved. - */ - void moved( QPtrList<QListViewItem>& items, QPtrList<QListViewItem>& afterFirst, QPtrList<QListViewItem>& afterNow); - /** - * Opens a plain text editor window to edit the modules content. - */ - void editModulePlain(); - /** - * Opens an HTML editor window to edit the modules content. - */ - void editModuleHTML(); - -private: // Private methods - CSearchDialog* m_searchDialog; - ToolTip* m_toolTip; - bool m_itemsMovable; - QListViewItem* m_autoOpenFolder; - QTimer m_autoOpenTimer; - - /** - * Initializes the view. - */ - void initView(); - /** - * Returns true if more than one netry is supported by this action type. - * Returns false for actions which support only one entry, e.g. about module etc. - */ - const bool isMultiAction( const CItemBase::MenuAction type ) const; - - struct Actions { - KAction* newFolder; - KAction* changeFolder; - - KAction* changeBookmark; - KAction* importBookmarks; - KAction* exportBookmarks; - KAction* printBookmarks; - - KAction* deleteEntries; - - KActionMenu* editModuleMenu; - KAction* editModulePlain; - KAction* editModuleHTML; - - KAction* searchInModules; - KAction* unlockModule; - KAction* aboutModule; - } m_actions; - KPopupMenu* m_popup; - -signals: // Signals - /** - * Is emitted when a module should be opened, - */ - void createReadDisplayWindow( ListCSwordModuleInfo, const QString& ); - void createWriteDisplayWindow( CSwordModuleInfo*, const QString&, const CDisplayWindow::WriteWindowType& ); -}; - -#endif |