From 3aef1afb880077b776d9807b1186a6744d851760 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Wed, 19 Feb 2014 18:58:08 -0600 Subject: Add help handbook, add DocPath, rename files. --- Makefile.am | 2 +- doc/Makefile.am | 1 + doc/en/Makefile.am | 2 + doc/en/index.docbook | 61 ++++++++++++ kchmviewer.kdevses | 74 --------------- lib/tdeio-msits/kchmviewer.desktop | 1 + src/Makefile.am | 8 +- src/kchmbookmarkwindow.h | 2 +- src/kchmconfig.cpp | 2 +- src/kchmcontentswindow.cpp | 2 +- src/kchmcontentswindow.h | 2 +- src/kchmdialogchooseurlfromlist.cpp | 2 +- src/kchmlistitemtooltip.h | 2 +- src/kchmmainwindow.cpp | 2 +- src/kchmmainwindow.h | 2 +- src/kchmnavtoolbar.cpp | 2 +- src/kchmsearchtoolbar.h | 2 +- src/kchmsearchwindow.h | 2 +- src/kchmsetupdialog.cpp | 7 ++ src/kchmviewwindow.h | 2 +- src/kchmviewwindow_qtextbrowser.cpp | 2 +- src/kchmviewwindow_qtextbrowser.h | 2 +- src/kchmviewwindowmgr.cpp | 2 +- src/kchmviewwindowmgr.h | 2 +- src/kde-qt.cpp | 52 ----------- src/kde-qt.h | 150 ------------------------------ src/kde/Makefile.am | 8 -- src/kde/kchmdcopiface.cpp | 86 ----------------- src/kde/kchmdcopiface.h | 59 ------------ src/kde/kchmdcopiface_skel.cpp | 98 -------------------- src/kde/kchmviewwindow_tdehtmlpart.cpp | 163 --------------------------------- src/kde/kchmviewwindow_tdehtmlpart.h | 118 ------------------------ src/main.cpp | 4 +- src/tde-tqt.cpp | 52 +++++++++++ src/tde-tqt.h | 150 ++++++++++++++++++++++++++++++ src/tde/Makefile.am | 8 ++ src/tde/kchmdcopiface.cpp | 86 +++++++++++++++++ src/tde/kchmdcopiface.h | 59 ++++++++++++ src/tde/kchmdcopiface_skel.cpp | 98 ++++++++++++++++++++ src/tde/kchmviewwindow_tdehtmlpart.cpp | 163 +++++++++++++++++++++++++++++++++ src/tde/kchmviewwindow_tdehtmlpart.h | 118 ++++++++++++++++++++++++ subdirs | 2 +- 42 files changed, 830 insertions(+), 832 deletions(-) create mode 100644 doc/Makefile.am create mode 100644 doc/en/Makefile.am create mode 100644 doc/en/index.docbook delete mode 100644 kchmviewer.kdevses delete mode 100644 src/kde-qt.cpp delete mode 100644 src/kde-qt.h delete mode 100644 src/kde/Makefile.am delete mode 100644 src/kde/kchmdcopiface.cpp delete mode 100644 src/kde/kchmdcopiface.h delete mode 100644 src/kde/kchmdcopiface_skel.cpp delete mode 100644 src/kde/kchmviewwindow_tdehtmlpart.cpp delete mode 100644 src/kde/kchmviewwindow_tdehtmlpart.h create mode 100644 src/tde-tqt.cpp create mode 100644 src/tde-tqt.h create mode 100644 src/tde/Makefile.am create mode 100644 src/tde/kchmdcopiface.cpp create mode 100644 src/tde/kchmdcopiface.h create mode 100644 src/tde/kchmdcopiface_skel.cpp create mode 100644 src/tde/kchmviewwindow_tdehtmlpart.cpp create mode 100644 src/tde/kchmviewwindow_tdehtmlpart.h diff --git a/Makefile.am b/Makefile.am index d0665f9..dd66115 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = foreign 1.6 -SUBDIRS = lib src po +SUBDIRS = lib src po doc package-messages: $(MAKE) -f admin/Makefile.common package-messages diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..81fee21 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = en diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am new file mode 100644 index 0000000..72e7ae5 --- /dev/null +++ b/doc/en/Makefile.am @@ -0,0 +1,2 @@ +KDE_LANG = en +KDE_DOCS = kchmviewer diff --git a/doc/en/index.docbook b/doc/en/index.docbook new file mode 100644 index 0000000..3226287 --- /dev/null +++ b/doc/en/index.docbook @@ -0,0 +1,61 @@ + +KCHMViewer"> + + + +]> + +
+The &kappname; Handbook + + +The &kappname; Handbook + + +&tde-authors; + + + +&tde-release-version; +Reviewed: &tde-release-date; + + +&tde-copyright-date; +&tde-team; + + + + + + +&kappname; is a Microsoft help file (CHM) viewer. + + + + +TDE +CHM + + + + + +We Apologize +No documentation has yet been written for &kappname;. + +If you need help, please check The &tde; +web site, submit questions to the +&tde; mail lists, or file a bug report at the +&tde; bug tracker. + +If you are interested in helping, please consider writing the help file. +Submitting a basic text file is acceptable as the &tde-team; will convert the text. + +Thank you for helping and thank you for your patience. + +&underFDL; + + + +
diff --git a/kchmviewer.kdevses b/kchmviewer.kdevses deleted file mode 100644 index 47a0b2f..0000000 --- a/kchmviewer.kdevses +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/tdeio-msits/kchmviewer.desktop b/lib/tdeio-msits/kchmviewer.desktop index 31558d8..83dd1cc 100644 --- a/lib/tdeio-msits/kchmviewer.desktop +++ b/lib/tdeio-msits/kchmviewer.desktop @@ -9,3 +9,4 @@ Name=KchmViewer GenericName=CHM (MS-Help) Viewer Comment=A viewer for CHM (MS-Help) files MimeType=application/chm +DocPath=kchmviewer/index.html diff --git a/src/Makefile.am b/src/Makefile.am index e14ed77..cd05f38 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,13 +1,13 @@ if AMC_USE_KDE -LIB_KDEEXTRADIR = kde -LIB_KDEEXTRA = kde/libkdeextra.a +LIB_KDEEXTRADIR = tde +LIB_KDEEXTRA = tde/libkdeextra.a endif bin_PROGRAMS = kchmviewer kchmviewer_SOURCES = iconstorage.cpp kchmbookmarkwindow.cpp kchmconfig.cpp \ kchmindexwindow.cpp kchmmainwindow.cpp kchmsearchtoolbar.cpp kchmsearchwindow.cpp \ kchmsettings.cpp kchmsourcefactory.cpp kchmtreeviewitem.cpp kchmviewwindow.cpp main.cpp \ - kchmdialogchooseurlfromlist.cpp kde-qt.cpp kchmviewwindow_qtextbrowser.cpp \ + kchmdialogchooseurlfromlist.cpp tde-tqt.cpp kchmviewwindow_qtextbrowser.cpp \ kchmsetupdialog.ui kqtempfile.cpp kchmnavtoolbar.cpp kchmviewwindowmgr.cpp \ kchmkeyeventfilter.cpp kchmcontentswindow.cpp kchmsearchengine_impl.cpp \ kchmsearchengine.cpp @@ -28,7 +28,7 @@ KDE_ICON = AUTO noinst_HEADERS = kchmsettings.h forwarddeclarations.h kchmsourcefactory.h \ iconstorage.h kchmbookmarkwindow.h kchmconfig.h kchmtreeviewitem.h \ kchmdialogchooseurlfromlist.h kchmviewwindow.h kchmindexwindow.h \ - kchmmainwindow.h kchmviewwindow_qtextbrowser.h kchmsearchtoolbar.h kde-qt.h \ + kchmmainwindow.h kchmviewwindow_qtextbrowser.h kchmsearchtoolbar.h tde-tqt.h \ kchmsearchwindow.h kqtempfile.h kqrunprocess.h kchmnavtoolbar.h kchmviewwindowmgr.h \ kchmkeyeventfilter.h kchmcontentswindow.h kchmlistitemtooltip.h kchmsearchengine_impl.h \ kchmsearchengine.h diff --git a/src/kchmbookmarkwindow.h b/src/kchmbookmarkwindow.h index ef57278..2a79b49 100644 --- a/src/kchmbookmarkwindow.h +++ b/src/kchmbookmarkwindow.h @@ -22,7 +22,7 @@ #ifndef KCHMBOOKMARKWINDOW_H #define KCHMBOOKMARKWINDOW_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "forwarddeclarations.h" #include "kchmsettings.h" diff --git a/src/kchmconfig.cpp b/src/kchmconfig.cpp index 8f33057..c96acb0 100644 --- a/src/kchmconfig.cpp +++ b/src/kchmconfig.cpp @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmconfig.h" #include "kchmsettings.h" #include "kchmmainwindow.h" diff --git a/src/kchmcontentswindow.cpp b/src/kchmcontentswindow.cpp index b98b444..200df61 100644 --- a/src/kchmcontentswindow.cpp +++ b/src/kchmcontentswindow.cpp @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "kde-qt.h" +#include "tde-tqt.h" #include "libchmfile.h" diff --git a/src/kchmcontentswindow.h b/src/kchmcontentswindow.h index e47b0fb..5c29956 100644 --- a/src/kchmcontentswindow.h +++ b/src/kchmcontentswindow.h @@ -22,7 +22,7 @@ #ifndef INCLUDE_KCHMCONTENTSWINDOW_H #define INCLUDE_KCHMCONTENTSWINDOW_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmtreeviewitem.h" /** diff --git a/src/kchmdialogchooseurlfromlist.cpp b/src/kchmdialogchooseurlfromlist.cpp index 41bc64a..bb50a13 100644 --- a/src/kchmdialogchooseurlfromlist.cpp +++ b/src/kchmdialogchooseurlfromlist.cpp @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmdialogchooseurlfromlist.h" #include "kchmtreeviewitem.h" diff --git a/src/kchmlistitemtooltip.h b/src/kchmlistitemtooltip.h index 8bf43bf..1867900 100644 --- a/src/kchmlistitemtooltip.h +++ b/src/kchmlistitemtooltip.h @@ -22,7 +22,7 @@ #ifndef INCLUDE_KCHMLISTITEMTOOLTIP_H #define INCLUDE_KCHMLISTITEMTOOLTIP_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "forwarddeclarations.h" /** diff --git a/src/kchmmainwindow.cpp b/src/kchmmainwindow.cpp index da29e54..5aabdae 100644 --- a/src/kchmmainwindow.cpp +++ b/src/kchmmainwindow.cpp @@ -26,7 +26,7 @@ #include #include -#include "kde-qt.h" +#include "tde-tqt.h" #include #include diff --git a/src/kchmmainwindow.h b/src/kchmmainwindow.h index 586e0ee..a4d1127 100644 --- a/src/kchmmainwindow.h +++ b/src/kchmmainwindow.h @@ -22,7 +22,7 @@ #ifndef KCHMMAINWINDOW_H #define KCHMMAINWINDOW_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "libchmfile.h" diff --git a/src/kchmnavtoolbar.cpp b/src/kchmnavtoolbar.cpp index de42ece..7ebb6fc 100644 --- a/src/kchmnavtoolbar.cpp +++ b/src/kchmnavtoolbar.cpp @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmnavtoolbar.h" #include "kchmmainwindow.h" #include "kchmviewwindow.h" diff --git a/src/kchmsearchtoolbar.h b/src/kchmsearchtoolbar.h index cde8e95..f031cca 100644 --- a/src/kchmsearchtoolbar.h +++ b/src/kchmsearchtoolbar.h @@ -22,7 +22,7 @@ #ifndef KCHMSEARCHTOOLBAR_H #define KCHMSEARCHTOOLBAR_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "forwarddeclarations.h" diff --git a/src/kchmsearchwindow.h b/src/kchmsearchwindow.h index e52066d..5a068a8 100644 --- a/src/kchmsearchwindow.h +++ b/src/kchmsearchwindow.h @@ -22,7 +22,7 @@ #ifndef KCHMSEARCHWINDOW_H #define KCHMSEARCHWINDOW_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmsettings.h" #include "forwarddeclarations.h" diff --git a/src/kchmsetupdialog.cpp b/src/kchmsetupdialog.cpp index c7e8b6b..592db23 100644 --- a/src/kchmsetupdialog.cpp +++ b/src/kchmsetupdialog.cpp @@ -23,6 +23,7 @@ #include #include #include +#include /* * Constructs a KCHMSetupDialog as a child of 'parent', with the @@ -277,6 +278,7 @@ KCHMSetupDialog::KCHMSetupDialog( TQWidget* parent, const char* name, bool modal clearWState( WState_Polished ); // signals and slots connections + connect( buttonHelp, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotShowHelp() ) ); connect( buttonOk, TQT_SIGNAL( clicked() ), this, TQT_SLOT( accept() ) ); connect( buttonCancel, TQT_SIGNAL( clicked() ), this, TQT_SLOT( reject() ) ); connect( m_radioUseTDEHTMLPart, TQT_SIGNAL( toggled(bool) ), groupKhtmlSecurity, TQT_SLOT( setEnabled(bool) ) ); @@ -311,6 +313,11 @@ KCHMSetupDialog::KCHMSetupDialog( TQWidget* parent, const char* name, bool modal setTabOrder( buttonOk, buttonCancel ); } +void KCHMSetupDialog::slotShowHelp() +{ + kapp->invokeHelp( TQString(), "kchmviewer" ); +} + /* * Destroys the object and frees any allocated resources */ diff --git a/src/kchmviewwindow.h b/src/kchmviewwindow.h index fae779e..9a23a01 100644 --- a/src/kchmviewwindow.h +++ b/src/kchmviewwindow.h @@ -23,7 +23,7 @@ #define KCHMVIEWWINDOW_H #include "forwarddeclarations.h" -#include "kde-qt.h" +#include "tde-tqt.h" /** @author Georgy Yunaev diff --git a/src/kchmviewwindow_qtextbrowser.cpp b/src/kchmviewwindow_qtextbrowser.cpp index dea8626..41db166 100644 --- a/src/kchmviewwindow_qtextbrowser.cpp +++ b/src/kchmviewwindow_qtextbrowser.cpp @@ -24,7 +24,7 @@ #include #include -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmmainwindow.h" #include "kchmviewwindow_qtextbrowser.h" diff --git a/src/kchmviewwindow_qtextbrowser.h b/src/kchmviewwindow_qtextbrowser.h index df76985..15550cb 100644 --- a/src/kchmviewwindow_qtextbrowser.h +++ b/src/kchmviewwindow_qtextbrowser.h @@ -22,7 +22,7 @@ #ifndef KCHMVIEWWINDOW_TQTEXTBROWSER_H #define KCHMVIEWWINDOW_TQTEXTBROWSER_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmviewwindow.h" #include "kchmsourcefactory.h" diff --git a/src/kchmviewwindowmgr.cpp b/src/kchmviewwindowmgr.cpp index 6499951..bf2bc69 100644 --- a/src/kchmviewwindowmgr.cpp +++ b/src/kchmviewwindowmgr.cpp @@ -30,7 +30,7 @@ #include "kchmviewwindow_qtextbrowser.h" #if defined (USE_KDE) - #include "kde/kchmviewwindow_tdehtmlpart.h" + #include "tde/kchmviewwindow_tdehtmlpart.h" #endif diff --git a/src/kchmviewwindowmgr.h b/src/kchmviewwindowmgr.h index 34d791f..eea46de 100644 --- a/src/kchmviewwindowmgr.h +++ b/src/kchmviewwindowmgr.h @@ -22,7 +22,7 @@ #ifndef INCLUDE_KCHMVIEWWINDOWMGR_H #define INCLUDE_KCHMVIEWWINDOWMGR_H -#include "kde-qt.h" +#include "tde-tqt.h" #include "forwarddeclarations.h" #include "kchmsettings.h" diff --git a/src/kde-qt.cpp b/src/kde-qt.cpp deleted file mode 100644 index d12e01b..0000000 --- a/src/kde-qt.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "kde-qt.h" - -#if defined (USE_KDE) -KQListView::KQListView( TQWidget * parent, const char * name, int ) - : TDEListView (parent, name) -#else -KQListView::KQListView( TQWidget * parent, const char * name, int f ) - : TQListView (parent, name, f) -#endif -{ -} - -#if defined (USE_KDE) -KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator ) - : KProgressDialog( creator, 0, captionText, labelText, true ) -{ - setAllowCancel( true ); - showCancelButton( true ); - setAutoClose( true ); - setButtonText( cancelButtonText ); - setTotalSteps( totalSteps ); - setMinimumDuration( 1 ); -} -#else -KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator ) - : TQProgressDialog( labelText, cancelButtonText, totalSteps, creator, 0, false ) -{ - setCaption( captionText ); - setMinimumDuration( 1 ); -} -#endif diff --git a/src/kde-qt.h b/src/kde-qt.h deleted file mode 100644 index f60c09e..0000000 --- a/src/kde-qt.h +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef KDE_TQT_H -#define KDE_TQT_H - -#include "config.h" - -#if defined (USE_KDE) - - #define KQ_CLASSNAME(name) K##name - #define TDEQ_CLASSNAME(name) TDE##name - #define KQ_DECLARECLASS(name) class KQ##name : public K##name - #define TDEQ_DECLARECLASS(name) class TDEQ##name : public TDE##name - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - -#else /* !USE_KDE */ - - #define KQ_CLASSNAME(name) Q##name - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #define i18n(A) tr(A) - -#endif /* USE_KDE */ - -/* common non-wrapped UI classes */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* common utility classes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class KQMainWindow : public TDEQ_CLASSNAME(MainWindow) -{ -public: - KQMainWindow ( TQWidget * parent, const char * name, WFlags f ) - : TDEQ_CLASSNAME(MainWindow) (parent, name, f) {}; -}; - - -class KQListView : public TDEQ_CLASSNAME(ListView) -{ -public: - KQListView(TQWidget *parent = 0, const char *name = 0, int f = 0); -}; - - -class KTQProgressModalDialog : public KQ_CLASSNAME(ProgressDialog) -{ - public: - KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator = 0 ); - - // Seems like people have fun making classes incompatible -#if defined (USE_KDE) - void setTotalSteps( int totalSteps ) { progressBar ()->setTotalSteps( totalSteps ); } - void setProgress( int progress ) { progressBar ()->setProgress( progress ); } -#else - bool wasCancelled() { return wasCanceled(); } -#endif -}; - -class KTQTabWidget : public KQ_CLASSNAME(TabWidget) -{ -public: - KTQTabWidget (TQWidget *parent = 0, const char *name = 0, int f = 0) - : KQ_CLASSNAME(TabWidget) (parent, name, f) {}; -}; - -class KTQPopupMenu : public TDEQ_CLASSNAME(PopupMenu) -{ -public: - KTQPopupMenu (TQWidget *parent = 0 ) - : TDEQ_CLASSNAME(PopupMenu) (parent) {}; -}; - -#include -#include -#include -#include -#include -#include -#include -#include - - -class KCHMShowWaitCursor -{ - public: - KCHMShowWaitCursor() { TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) ); } - ~KCHMShowWaitCursor() { TQApplication::restoreOverrideCursor(); } -}; - - -#endif /* KDE_TQT_H */ diff --git a/src/kde/Makefile.am b/src/kde/Makefile.am deleted file mode 100644 index 8524867..0000000 --- a/src/kde/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -lib_LIBRARIES=libkdeextra.a -libkdeextra_a_SOURCES = kchmdcopiface.cpp kchmdcopiface.skel kchmviewwindow_tdehtmlpart.cpp -noinst_HEADERS = kchmdcopiface.h kchmviewwindow_tdehtmlpart.h - -INCLUDES = $(QT_INCLUDES) $(CHM_INCLUDES) $(KDE_INCLUDES) $(LIBCHMFILE_INCLUDES) - -METASOURCES = AUTO -KDE_OPTIONS = qtonly diff --git a/src/kde/kchmdcopiface.cpp b/src/kde/kchmdcopiface.cpp deleted file mode 100644 index d6a90da..0000000 --- a/src/kde/kchmdcopiface.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2005 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "kchmdcopiface.h" -#include "kchmdcopiface.moc" - -#include "kchmmainwindow.h" -#include "kchmsearchwindow.h" - - -KCHMDCOPIface::KCHMDCOPIface(TQObject *parent, const char *name) - : TQObject(parent, name), DCOPObject( "KCHMDCOPIface" ) -{ -} - - -KCHMDCOPIface::~KCHMDCOPIface() -{ -} - - -void KCHMDCOPIface::loadHelpFile( const TQString & filename, const TQString & page2open ) -{ - TQStringList args; - - args.push_back( filename ); - args.push_back( page2open ); - - tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "loadAndOpen", args ) ); -} - - -void KCHMDCOPIface::openPage( const TQString & page2open ) -{ - TQStringList args; - - args.push_back( page2open ); - tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "openPage", args ) ); -} - - -void KCHMDCOPIface::guiFindInIndex( const TQString & word ) -{ - TQStringList args; - - args.push_back( word ); - tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "findInIndex", args ) ); -} - - -void KCHMDCOPIface::guiSearchQuery( const TQString & query ) -{ - TQStringList args; - - args.push_back( query ); - tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "searchQuery", args ) ); -} - -TQStringList KCHMDCOPIface::searchQuery( const TQString & query ) -{ - TQStringList results; - - if ( ::mainWindow->searchWindow()->searchQuery( query, &results ) ) - return results; - else - return TQStringList(); -} - diff --git a/src/kde/kchmdcopiface.h b/src/kde/kchmdcopiface.h deleted file mode 100644 index 6922a82..0000000 --- a/src/kde/kchmdcopiface.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2005 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef KCHMDCOPIFACE_H -#define KCHMDCOPIFACE_H - -#include -#include -#include -#include - -class KCHMDCOPIface : public TQObject, public DCOPObject -{ - Q_OBJECT -// - K_DCOP - - public: - KCHMDCOPIface( TQObject *parent = 0, const char *name = 0 ); - ~KCHMDCOPIface(); - - k_dcop: - //! Loads a CHM file \a filename , and opens the URL \a url. Use URL "/" to open default homepage - void loadHelpFile( const TQString& filename, const TQString& url ); - - //! Opens a specific \a url inside the loaded CHM file - void openPage( const TQString& url ); - - //! Tries to find word in index, opening the index window and scrolling it there - void guiFindInIndex( const TQString& word ); - - //! Executes a search in GUI. \a query contains the complete search query. - void guiSearchQuery( const TQString& query ); - - //! Executes a search; GUI is not involved and user sees nothing. - //! \a query contains the complete search query. - //! Returns a list of URLs, or empty array if nothing os - TQStringList searchQuery( const TQString& query ); -}; - -#endif diff --git a/src/kde/kchmdcopiface_skel.cpp b/src/kde/kchmdcopiface_skel.cpp deleted file mode 100644 index be1e994..0000000 --- a/src/kde/kchmdcopiface_skel.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** DCOP Skeleton generated by dcopidl2cpp from kchmdcopiface.kidl -** -** WARNING! All changes made in this file will be lost! -** -*****************************************************************************/ - -#include "./kchmdcopiface.h" - -#include - - -static const char* const KCHMDCOPIface_ftable[6][3] = { - { "void", "loadHelpFile(TQString,TQString)", "loadHelpFile(TQString filename,TQString url)" }, - { "void", "openPage(TQString)", "openPage(TQString url)" }, - { "void", "guiFindInIndex(TQString)", "guiFindInIndex(TQString word)" }, - { "void", "guiSearchQuery(TQString)", "guiSearchQuery(TQString query)" }, - { TQSTRINGLIST_OBJECT_NAME_STRING, "searchQuery(TQString)", "searchQuery(TQString query)" }, - { 0, 0, 0 } -}; -static const int KCHMDCOPIface_ftable_hiddens[5] = { - 0, - 0, - 0, - 0, - 0, -}; - -bool KCHMDCOPIface::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData) -{ - if ( fun == KCHMDCOPIface_ftable[0][1] ) { // void loadHelpFile(TQString,TQString) - TQString arg0; - TQString arg1; - TQDataStream arg( data, IO_ReadOnly ); - if (arg.atEnd()) return false; - arg >> arg0; - if (arg.atEnd()) return false; - arg >> arg1; - replyType = KCHMDCOPIface_ftable[0][0]; - loadHelpFile(arg0, arg1 ); - } else if ( fun == KCHMDCOPIface_ftable[1][1] ) { // void openPage(TQString) - TQString arg0; - TQDataStream arg( data, IO_ReadOnly ); - if (arg.atEnd()) return false; - arg >> arg0; - replyType = KCHMDCOPIface_ftable[1][0]; - openPage(arg0 ); - } else if ( fun == KCHMDCOPIface_ftable[2][1] ) { // void guiFindInIndex(TQString) - TQString arg0; - TQDataStream arg( data, IO_ReadOnly ); - if (arg.atEnd()) return false; - arg >> arg0; - replyType = KCHMDCOPIface_ftable[2][0]; - guiFindInIndex(arg0 ); - } else if ( fun == KCHMDCOPIface_ftable[3][1] ) { // void guiSearchQuery(TQString) - TQString arg0; - TQDataStream arg( data, IO_ReadOnly ); - if (arg.atEnd()) return false; - arg >> arg0; - replyType = KCHMDCOPIface_ftable[3][0]; - guiSearchQuery(arg0 ); - } else if ( fun == KCHMDCOPIface_ftable[4][1] ) { // TQStringList searchQuery(TQString) - TQString arg0; - TQDataStream arg( data, IO_ReadOnly ); - if (arg.atEnd()) return false; - arg >> arg0; - replyType = KCHMDCOPIface_ftable[4][0]; - TQDataStream _replyStream( replyData, IO_WriteOnly ); - _replyStream << searchQuery(arg0 ); - } else { - return DCOPObject::process( fun, data, replyType, replyData ); - } - return true; -} - -QCStringList KCHMDCOPIface::interfaces() -{ - QCStringList ifaces = DCOPObject::interfaces(); - ifaces += "KCHMDCOPIface"; - return ifaces; -} - -QCStringList KCHMDCOPIface::functions() -{ - QCStringList funcs = DCOPObject::functions(); - for ( int i = 0; KCHMDCOPIface_ftable[i][2]; i++ ) { - if (KCHMDCOPIface_ftable_hiddens[i]) - continue; - TQCString func = KCHMDCOPIface_ftable[i][0]; - func += ' '; - func += KCHMDCOPIface_ftable[i][2]; - funcs << func; - } - return funcs; -} - - diff --git a/src/kde/kchmviewwindow_tdehtmlpart.cpp b/src/kde/kchmviewwindow_tdehtmlpart.cpp deleted file mode 100644 index 73f136e..0000000 --- a/src/kde/kchmviewwindow_tdehtmlpart.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include - -#include -#include - -#include "kde-qt.h" -#include "kchmmainwindow.h" -#include "kchmconfig.h" -#include "kchmviewwindow_tdehtmlpart.h" - -#include "kchmviewwindow_tdehtmlpart.moc" - - -TQWidget * KCHMViewWindow_TDEHTMLPart::getTQWidget() -{ - return view(); -} - -KCHMViewWindow_TDEHTMLPart::KCHMViewWindow_TDEHTMLPart( TQTabWidget * parent ) - : TDEHTMLPart ( parent ), KCHMViewWindow ( parent ) -{ - m_zoomfactor = 0; - m_currentEncoding = 0; - m_searchForward = true; - - invalidate(); - - connect( browserExtension(), TQT_SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ), - this, TQT_SLOT ( onOpenURLRequest( const KURL &, const KParts::URLArgs & )) ); - - connect( this, TQT_SIGNAL ( popupMenu ( const TQString &, const TQPoint &) ), - this, TQT_SLOT ( onPopupMenu ( const TQString &, const TQPoint &) ) ); -} - - -KCHMViewWindow_TDEHTMLPart::~KCHMViewWindow_TDEHTMLPart() -{ -} - -bool KCHMViewWindow_TDEHTMLPart::openPage (const TQString& url) -{ - // Set or change the encoding - if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding() ) - { - m_currentEncoding = ::mainWindow->chmFile()->currentEncoding(); - setEncoding ( m_currentEncoding->qtcodec, TRUE ); - } - - TQString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url; - openURL ( KURL(fullurl) ); - - return true; -} - -void KCHMViewWindow_TDEHTMLPart::setZoomFactor( int zoom ) -{ - m_zoomfactor = zoom; - - // Default ZoomFactor is 100, any increase or decrease should modify this value. - TDEHTMLPart::setZoomFactor ( 100 + (m_zoomfactor * 10) ); -} - -void KCHMViewWindow_TDEHTMLPart::invalidate( ) -{ - m_zoomfactor = 0; - m_searchForward = true; - m_searchText = TQString(); - - setJScriptEnabled ( appConfig.m_kdeEnableJS ); - setJavaEnabled ( appConfig.m_kdeEnableJava ); - setMetaRefreshEnabled ( appConfig.m_kdeEnableRefresh ); - setPluginsEnabled ( appConfig.m_kdeEnablePlugins ); - - KCHMViewWindow::invalidate( ); -} - -int KCHMViewWindow_TDEHTMLPart::getScrollbarPosition( ) -{ - return view()->contentsY (); -} - -void KCHMViewWindow_TDEHTMLPart::setScrollbarPosition( int pos ) -{ - view()->scrollBy (0, pos); -} - -void KCHMViewWindow_TDEHTMLPart::addZoomFactor( int value ) -{ - setZoomFactor( m_zoomfactor + value); -} - -bool KCHMViewWindow_TDEHTMLPart::printCurrentPage() -{ - view()->print(); - return true; -} - -void KCHMViewWindow_TDEHTMLPart::searchWord( const TQString & word, bool forward, bool ) -{ - if ( word != m_searchText || forward != m_searchForward ) - { - m_searchText = word; - m_searchForward = forward; - - findText ( word, forward ? 0 : KFindDialog::FindBackwards, ::mainWindow, 0 ); - } - - findTextNext (); -} - -void KCHMViewWindow_TDEHTMLPart::onOpenURLRequest( const KURL & url, const KParts::URLArgs & ) -{ - bool sourcechange = true; - emit signalLinkClicked ( url.prettyURL(), sourcechange ); -} - -void KCHMViewWindow_TDEHTMLPart::slotLinkClicked( const TQString & newlink ) -{ - bool notused; - emit signalLinkClicked (newlink, notused); -} - - -void KCHMViewWindow_TDEHTMLPart::clipSelectAll() -{ - selectAll (); -} - -void KCHMViewWindow_TDEHTMLPart::clipCopy() -{ - TQString text = selectedText(); - - if ( !text.isEmpty() ) - TQApplication::clipboard()->setText( text ); -} - -void KCHMViewWindow_TDEHTMLPart::onPopupMenu ( const TQString &url, const TQPoint & point ) -{ - KTQPopupMenu * menu = getContextMenu( url, view() ); - menu->exec( point ); -} - diff --git a/src/kde/kchmviewwindow_tdehtmlpart.h b/src/kde/kchmviewwindow_tdehtmlpart.h deleted file mode 100644 index 4bc45c7..0000000 --- a/src/kde/kchmviewwindow_tdehtmlpart.h +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * - * Please do not use email address above for bug reports; see * - * the README file * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef KCHMVIEWWINDOW_TDEHTMLPART_H -#define KCHMVIEWWINDOW_TDEHTMLPART_H - -#include "kde-qt.h" - -#include "kchmviewwindow.h" -#include "kchmsourcefactory.h" -#include "libchmtextencoding.h" - -#ifdef Q_MOC_RUN -#define USE_KDE -#endif // Q_MOC_RUN - -/** -@author Georgy Yunaev -*/ -/* - * For TQt-only version, we cannot compile KCHMViewWindow_TDEHTMLPart. However, - * we cannot just exclude it, because it would not generate a MOC file for a KDE - * version. Therefore we declare it, and compile the .moc file, but do not provide - * the class methods. - */ -#if defined (USE_KDE) -class KCHMViewWindow_TDEHTMLPart : public TDEHTMLPart, public KCHMViewWindow -{ -Q_OBJECT - -public: - KCHMViewWindow_TDEHTMLPart( TQTabWidget * parent ); - ~KCHMViewWindow_TDEHTMLPart(); - - //! Open a page from current chm archive - virtual bool openPage (const TQString& url); - - //! Invalidate current view, doing all the cleanups etc. - virtual void invalidate(); - - //! Return current ZoomFactor. - virtual int getZoomFactor() const { return m_zoomfactor; } - - //! Sets ZoomFactor. The value returned by getZoomFactor(), given to this function, should give the same result. - virtual void setZoomFactor (int zoom); - - //! Relatively changes ZoomFactor. Most common values are -1 and 1. - virtual void addZoomFactor (int value); - - //! Popups the print dialog, and prints the current page on the printer. - virtual bool printCurrentPage(); - - //! Initiates the find-in-page search, if succeed, cursor moved to the first entry - virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false ); - - //! Select the content of the whole page - virtual void clipSelectAll(); - - //! Copies the selected content to the clipboard - virtual void clipCopy(); - - /*! - * Return current scrollbar position in view window. Saved on program exit. - * There is no restriction on returned value, except that giving this value to - * setScrollbarPosition() should move the scrollbar in the same position. - */ - virtual int getScrollbarPosition(); - - //! Sets the scrollbar position. - virtual void setScrollbarPosition(int pos); - - virtual TQObject * getTQObject() { return this; } - virtual TQWidget * getTQWidget(); - -signals: - /*! - * Emitted when the user clicked on the link, before the page changed. - * If signalLinkClicked() sets follow_link to false, the current page should NOT change. - * Otherwise it should be changed to the new link value. - */ - void signalLinkClicked ( const TQString & newlink, bool& follow_link ); - -private slots: - virtual void slotLinkClicked ( const TQString & newlink); - virtual void onOpenURLRequest( const KURL &, const KParts::URLArgs & ); - virtual void onPopupMenu ( const TQString & url, const TQPoint & point ); - -private: - void setSource ( const TQString & name ); - - int m_zoomfactor; - bool m_searchForward; - TQString m_searchText; - - const LCHMTextEncoding * m_currentEncoding; -}; - -#endif /* USE_KDE */ - -#endif /* KCHMVIEWWINDOW_TDEHTMLPART_H */ diff --git a/src/main.cpp b/src/main.cpp index 8e84f20..35542f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "kde-qt.h" +#include "tde-tqt.h" #include "kchmmainwindow.h" #include "kchmconfig.h" @@ -29,7 +29,7 @@ #include #include - #include "kde/kchmdcopiface.h" + #include "tde/kchmdcopiface.h" #endif KCHMMainWindow * mainWindow; diff --git a/src/tde-tqt.cpp b/src/tde-tqt.cpp new file mode 100644 index 0000000..f668466 --- /dev/null +++ b/src/tde-tqt.cpp @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "tde-tqt.h" + +#if defined (USE_KDE) +KQListView::KQListView( TQWidget * parent, const char * name, int ) + : TDEListView (parent, name) +#else +KQListView::KQListView( TQWidget * parent, const char * name, int f ) + : TQListView (parent, name, f) +#endif +{ +} + +#if defined (USE_KDE) +KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator ) + : KProgressDialog( creator, 0, captionText, labelText, true ) +{ + setAllowCancel( true ); + showCancelButton( true ); + setAutoClose( true ); + setButtonText( cancelButtonText ); + setTotalSteps( totalSteps ); + setMinimumDuration( 1 ); +} +#else +KTQProgressModalDialog::KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator ) + : TQProgressDialog( labelText, cancelButtonText, totalSteps, creator, 0, false ) +{ + setCaption( captionText ); + setMinimumDuration( 1 ); +} +#endif diff --git a/src/tde-tqt.h b/src/tde-tqt.h new file mode 100644 index 0000000..f60c09e --- /dev/null +++ b/src/tde-tqt.h @@ -0,0 +1,150 @@ +/*************************************************************************** + * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef KDE_TQT_H +#define KDE_TQT_H + +#include "config.h" + +#if defined (USE_KDE) + + #define KQ_CLASSNAME(name) K##name + #define TDEQ_CLASSNAME(name) TDE##name + #define KQ_DECLARECLASS(name) class KQ##name : public K##name + #define TDEQ_DECLARECLASS(name) class TDEQ##name : public TDE##name + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + +#else /* !USE_KDE */ + + #define KQ_CLASSNAME(name) Q##name + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #define i18n(A) tr(A) + +#endif /* USE_KDE */ + +/* common non-wrapped UI classes */ +#include +#include +#include +#include +#include +#include +#include +#include + +/* common utility classes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class KQMainWindow : public TDEQ_CLASSNAME(MainWindow) +{ +public: + KQMainWindow ( TQWidget * parent, const char * name, WFlags f ) + : TDEQ_CLASSNAME(MainWindow) (parent, name, f) {}; +}; + + +class KQListView : public TDEQ_CLASSNAME(ListView) +{ +public: + KQListView(TQWidget *parent = 0, const char *name = 0, int f = 0); +}; + + +class KTQProgressModalDialog : public KQ_CLASSNAME(ProgressDialog) +{ + public: + KTQProgressModalDialog ( const TQString & captionText, const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator = 0 ); + + // Seems like people have fun making classes incompatible +#if defined (USE_KDE) + void setTotalSteps( int totalSteps ) { progressBar ()->setTotalSteps( totalSteps ); } + void setProgress( int progress ) { progressBar ()->setProgress( progress ); } +#else + bool wasCancelled() { return wasCanceled(); } +#endif +}; + +class KTQTabWidget : public KQ_CLASSNAME(TabWidget) +{ +public: + KTQTabWidget (TQWidget *parent = 0, const char *name = 0, int f = 0) + : KQ_CLASSNAME(TabWidget) (parent, name, f) {}; +}; + +class KTQPopupMenu : public TDEQ_CLASSNAME(PopupMenu) +{ +public: + KTQPopupMenu (TQWidget *parent = 0 ) + : TDEQ_CLASSNAME(PopupMenu) (parent) {}; +}; + +#include +#include +#include +#include +#include +#include +#include +#include + + +class KCHMShowWaitCursor +{ + public: + KCHMShowWaitCursor() { TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) ); } + ~KCHMShowWaitCursor() { TQApplication::restoreOverrideCursor(); } +}; + + +#endif /* KDE_TQT_H */ diff --git a/src/tde/Makefile.am b/src/tde/Makefile.am new file mode 100644 index 0000000..8524867 --- /dev/null +++ b/src/tde/Makefile.am @@ -0,0 +1,8 @@ +lib_LIBRARIES=libkdeextra.a +libkdeextra_a_SOURCES = kchmdcopiface.cpp kchmdcopiface.skel kchmviewwindow_tdehtmlpart.cpp +noinst_HEADERS = kchmdcopiface.h kchmviewwindow_tdehtmlpart.h + +INCLUDES = $(QT_INCLUDES) $(CHM_INCLUDES) $(KDE_INCLUDES) $(LIBCHMFILE_INCLUDES) + +METASOURCES = AUTO +KDE_OPTIONS = qtonly diff --git a/src/tde/kchmdcopiface.cpp b/src/tde/kchmdcopiface.cpp new file mode 100644 index 0000000..d6a90da --- /dev/null +++ b/src/tde/kchmdcopiface.cpp @@ -0,0 +1,86 @@ +/*************************************************************************** + * Copyright (C) 2004-2005 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "kchmdcopiface.h" +#include "kchmdcopiface.moc" + +#include "kchmmainwindow.h" +#include "kchmsearchwindow.h" + + +KCHMDCOPIface::KCHMDCOPIface(TQObject *parent, const char *name) + : TQObject(parent, name), DCOPObject( "KCHMDCOPIface" ) +{ +} + + +KCHMDCOPIface::~KCHMDCOPIface() +{ +} + + +void KCHMDCOPIface::loadHelpFile( const TQString & filename, const TQString & page2open ) +{ + TQStringList args; + + args.push_back( filename ); + args.push_back( page2open ); + + tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "loadAndOpen", args ) ); +} + + +void KCHMDCOPIface::openPage( const TQString & page2open ) +{ + TQStringList args; + + args.push_back( page2open ); + tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "openPage", args ) ); +} + + +void KCHMDCOPIface::guiFindInIndex( const TQString & word ) +{ + TQStringList args; + + args.push_back( word ); + tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "findInIndex", args ) ); +} + + +void KCHMDCOPIface::guiSearchQuery( const TQString & query ) +{ + TQStringList args; + + args.push_back( query ); + tqApp->postEvent( ::mainWindow, new KCHMUserEvent( "searchQuery", args ) ); +} + +TQStringList KCHMDCOPIface::searchQuery( const TQString & query ) +{ + TQStringList results; + + if ( ::mainWindow->searchWindow()->searchQuery( query, &results ) ) + return results; + else + return TQStringList(); +} + diff --git a/src/tde/kchmdcopiface.h b/src/tde/kchmdcopiface.h new file mode 100644 index 0000000..6922a82 --- /dev/null +++ b/src/tde/kchmdcopiface.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2004-2005 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef KCHMDCOPIFACE_H +#define KCHMDCOPIFACE_H + +#include +#include +#include +#include + +class KCHMDCOPIface : public TQObject, public DCOPObject +{ + Q_OBJECT +// + K_DCOP + + public: + KCHMDCOPIface( TQObject *parent = 0, const char *name = 0 ); + ~KCHMDCOPIface(); + + k_dcop: + //! Loads a CHM file \a filename , and opens the URL \a url. Use URL "/" to open default homepage + void loadHelpFile( const TQString& filename, const TQString& url ); + + //! Opens a specific \a url inside the loaded CHM file + void openPage( const TQString& url ); + + //! Tries to find word in index, opening the index window and scrolling it there + void guiFindInIndex( const TQString& word ); + + //! Executes a search in GUI. \a query contains the complete search query. + void guiSearchQuery( const TQString& query ); + + //! Executes a search; GUI is not involved and user sees nothing. + //! \a query contains the complete search query. + //! Returns a list of URLs, or empty array if nothing os + TQStringList searchQuery( const TQString& query ); +}; + +#endif diff --git a/src/tde/kchmdcopiface_skel.cpp b/src/tde/kchmdcopiface_skel.cpp new file mode 100644 index 0000000..be1e994 --- /dev/null +++ b/src/tde/kchmdcopiface_skel.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** DCOP Skeleton generated by dcopidl2cpp from kchmdcopiface.kidl +** +** WARNING! All changes made in this file will be lost! +** +*****************************************************************************/ + +#include "./kchmdcopiface.h" + +#include + + +static const char* const KCHMDCOPIface_ftable[6][3] = { + { "void", "loadHelpFile(TQString,TQString)", "loadHelpFile(TQString filename,TQString url)" }, + { "void", "openPage(TQString)", "openPage(TQString url)" }, + { "void", "guiFindInIndex(TQString)", "guiFindInIndex(TQString word)" }, + { "void", "guiSearchQuery(TQString)", "guiSearchQuery(TQString query)" }, + { TQSTRINGLIST_OBJECT_NAME_STRING, "searchQuery(TQString)", "searchQuery(TQString query)" }, + { 0, 0, 0 } +}; +static const int KCHMDCOPIface_ftable_hiddens[5] = { + 0, + 0, + 0, + 0, + 0, +}; + +bool KCHMDCOPIface::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData) +{ + if ( fun == KCHMDCOPIface_ftable[0][1] ) { // void loadHelpFile(TQString,TQString) + TQString arg0; + TQString arg1; + TQDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = KCHMDCOPIface_ftable[0][0]; + loadHelpFile(arg0, arg1 ); + } else if ( fun == KCHMDCOPIface_ftable[1][1] ) { // void openPage(TQString) + TQString arg0; + TQDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = KCHMDCOPIface_ftable[1][0]; + openPage(arg0 ); + } else if ( fun == KCHMDCOPIface_ftable[2][1] ) { // void guiFindInIndex(TQString) + TQString arg0; + TQDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = KCHMDCOPIface_ftable[2][0]; + guiFindInIndex(arg0 ); + } else if ( fun == KCHMDCOPIface_ftable[3][1] ) { // void guiSearchQuery(TQString) + TQString arg0; + TQDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = KCHMDCOPIface_ftable[3][0]; + guiSearchQuery(arg0 ); + } else if ( fun == KCHMDCOPIface_ftable[4][1] ) { // TQStringList searchQuery(TQString) + TQString arg0; + TQDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = KCHMDCOPIface_ftable[4][0]; + TQDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << searchQuery(arg0 ); + } else { + return DCOPObject::process( fun, data, replyType, replyData ); + } + return true; +} + +QCStringList KCHMDCOPIface::interfaces() +{ + QCStringList ifaces = DCOPObject::interfaces(); + ifaces += "KCHMDCOPIface"; + return ifaces; +} + +QCStringList KCHMDCOPIface::functions() +{ + QCStringList funcs = DCOPObject::functions(); + for ( int i = 0; KCHMDCOPIface_ftable[i][2]; i++ ) { + if (KCHMDCOPIface_ftable_hiddens[i]) + continue; + TQCString func = KCHMDCOPIface_ftable[i][0]; + func += ' '; + func += KCHMDCOPIface_ftable[i][2]; + funcs << func; + } + return funcs; +} + + diff --git a/src/tde/kchmviewwindow_tdehtmlpart.cpp b/src/tde/kchmviewwindow_tdehtmlpart.cpp new file mode 100644 index 0000000..3a57e35 --- /dev/null +++ b/src/tde/kchmviewwindow_tdehtmlpart.cpp @@ -0,0 +1,163 @@ +/*************************************************************************** + * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include + +#include +#include + +#include "tde-tqt.h" +#include "kchmmainwindow.h" +#include "kchmconfig.h" +#include "kchmviewwindow_tdehtmlpart.h" + +#include "kchmviewwindow_tdehtmlpart.moc" + + +TQWidget * KCHMViewWindow_TDEHTMLPart::getTQWidget() +{ + return view(); +} + +KCHMViewWindow_TDEHTMLPart::KCHMViewWindow_TDEHTMLPart( TQTabWidget * parent ) + : TDEHTMLPart ( parent ), KCHMViewWindow ( parent ) +{ + m_zoomfactor = 0; + m_currentEncoding = 0; + m_searchForward = true; + + invalidate(); + + connect( browserExtension(), TQT_SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ), + this, TQT_SLOT ( onOpenURLRequest( const KURL &, const KParts::URLArgs & )) ); + + connect( this, TQT_SIGNAL ( popupMenu ( const TQString &, const TQPoint &) ), + this, TQT_SLOT ( onPopupMenu ( const TQString &, const TQPoint &) ) ); +} + + +KCHMViewWindow_TDEHTMLPart::~KCHMViewWindow_TDEHTMLPart() +{ +} + +bool KCHMViewWindow_TDEHTMLPart::openPage (const TQString& url) +{ + // Set or change the encoding + if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding() ) + { + m_currentEncoding = ::mainWindow->chmFile()->currentEncoding(); + setEncoding ( m_currentEncoding->qtcodec, TRUE ); + } + + TQString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url; + openURL ( KURL(fullurl) ); + + return true; +} + +void KCHMViewWindow_TDEHTMLPart::setZoomFactor( int zoom ) +{ + m_zoomfactor = zoom; + + // Default ZoomFactor is 100, any increase or decrease should modify this value. + TDEHTMLPart::setZoomFactor ( 100 + (m_zoomfactor * 10) ); +} + +void KCHMViewWindow_TDEHTMLPart::invalidate( ) +{ + m_zoomfactor = 0; + m_searchForward = true; + m_searchText = TQString(); + + setJScriptEnabled ( appConfig.m_kdeEnableJS ); + setJavaEnabled ( appConfig.m_kdeEnableJava ); + setMetaRefreshEnabled ( appConfig.m_kdeEnableRefresh ); + setPluginsEnabled ( appConfig.m_kdeEnablePlugins ); + + KCHMViewWindow::invalidate( ); +} + +int KCHMViewWindow_TDEHTMLPart::getScrollbarPosition( ) +{ + return view()->contentsY (); +} + +void KCHMViewWindow_TDEHTMLPart::setScrollbarPosition( int pos ) +{ + view()->scrollBy (0, pos); +} + +void KCHMViewWindow_TDEHTMLPart::addZoomFactor( int value ) +{ + setZoomFactor( m_zoomfactor + value); +} + +bool KCHMViewWindow_TDEHTMLPart::printCurrentPage() +{ + view()->print(); + return true; +} + +void KCHMViewWindow_TDEHTMLPart::searchWord( const TQString & word, bool forward, bool ) +{ + if ( word != m_searchText || forward != m_searchForward ) + { + m_searchText = word; + m_searchForward = forward; + + findText ( word, forward ? 0 : KFindDialog::FindBackwards, ::mainWindow, 0 ); + } + + findTextNext (); +} + +void KCHMViewWindow_TDEHTMLPart::onOpenURLRequest( const KURL & url, const KParts::URLArgs & ) +{ + bool sourcechange = true; + emit signalLinkClicked ( url.prettyURL(), sourcechange ); +} + +void KCHMViewWindow_TDEHTMLPart::slotLinkClicked( const TQString & newlink ) +{ + bool notused; + emit signalLinkClicked (newlink, notused); +} + + +void KCHMViewWindow_TDEHTMLPart::clipSelectAll() +{ + selectAll (); +} + +void KCHMViewWindow_TDEHTMLPart::clipCopy() +{ + TQString text = selectedText(); + + if ( !text.isEmpty() ) + TQApplication::clipboard()->setText( text ); +} + +void KCHMViewWindow_TDEHTMLPart::onPopupMenu ( const TQString &url, const TQPoint & point ) +{ + KTQPopupMenu * menu = getContextMenu( url, view() ); + menu->exec( point ); +} + diff --git a/src/tde/kchmviewwindow_tdehtmlpart.h b/src/tde/kchmviewwindow_tdehtmlpart.h new file mode 100644 index 0000000..0dcbe47 --- /dev/null +++ b/src/tde/kchmviewwindow_tdehtmlpart.h @@ -0,0 +1,118 @@ +/*************************************************************************** + * Copyright (C) 2004-2007 by Georgy Yunaev, gyunaev@ulduzsoft.com * + * Please do not use email address above for bug reports; see * + * the README file * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef KCHMVIEWWINDOW_TDEHTMLPART_H +#define KCHMVIEWWINDOW_TDEHTMLPART_H + +#include "tde-tqt.h" + +#include "kchmviewwindow.h" +#include "kchmsourcefactory.h" +#include "libchmtextencoding.h" + +#ifdef Q_MOC_RUN +#define USE_KDE +#endif // Q_MOC_RUN + +/** +@author Georgy Yunaev +*/ +/* + * For TQt-only version, we cannot compile KCHMViewWindow_TDEHTMLPart. However, + * we cannot just exclude it, because it would not generate a MOC file for a KDE + * version. Therefore we declare it, and compile the .moc file, but do not provide + * the class methods. + */ +#if defined (USE_KDE) +class KCHMViewWindow_TDEHTMLPart : public TDEHTMLPart, public KCHMViewWindow +{ +Q_OBJECT + +public: + KCHMViewWindow_TDEHTMLPart( TQTabWidget * parent ); + ~KCHMViewWindow_TDEHTMLPart(); + + //! Open a page from current chm archive + virtual bool openPage (const TQString& url); + + //! Invalidate current view, doing all the cleanups etc. + virtual void invalidate(); + + //! Return current ZoomFactor. + virtual int getZoomFactor() const { return m_zoomfactor; } + + //! Sets ZoomFactor. The value returned by getZoomFactor(), given to this function, should give the same result. + virtual void setZoomFactor (int zoom); + + //! Relatively changes ZoomFactor. Most common values are -1 and 1. + virtual void addZoomFactor (int value); + + //! Popups the print dialog, and prints the current page on the printer. + virtual bool printCurrentPage(); + + //! Initiates the find-in-page search, if succeed, cursor moved to the first entry + virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false ); + + //! Select the content of the whole page + virtual void clipSelectAll(); + + //! Copies the selected content to the clipboard + virtual void clipCopy(); + + /*! + * Return current scrollbar position in view window. Saved on program exit. + * There is no restriction on returned value, except that giving this value to + * setScrollbarPosition() should move the scrollbar in the same position. + */ + virtual int getScrollbarPosition(); + + //! Sets the scrollbar position. + virtual void setScrollbarPosition(int pos); + + virtual TQObject * getTQObject() { return this; } + virtual TQWidget * getTQWidget(); + +signals: + /*! + * Emitted when the user clicked on the link, before the page changed. + * If signalLinkClicked() sets follow_link to false, the current page should NOT change. + * Otherwise it should be changed to the new link value. + */ + void signalLinkClicked ( const TQString & newlink, bool& follow_link ); + +private slots: + virtual void slotLinkClicked ( const TQString & newlink); + virtual void onOpenURLRequest( const KURL &, const KParts::URLArgs & ); + virtual void onPopupMenu ( const TQString & url, const TQPoint & point ); + +private: + void setSource ( const TQString & name ); + + int m_zoomfactor; + bool m_searchForward; + TQString m_searchText; + + const LCHMTextEncoding * m_currentEncoding; +}; + +#endif /* USE_KDE */ + +#endif /* KCHMVIEWWINDOW_TDEHTMLPART_H */ diff --git a/subdirs b/subdirs index 2841462..c73839a 100644 --- a/subdirs +++ b/subdirs @@ -1,4 +1,4 @@ -kchmviewer-3.1 +doc lib po src -- cgit v1.2.3