From 6392f5a9dfce2bf83617d49bb7f332181ec6004e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 25 May 2014 15:37:31 +0900 Subject: Revert "Finish renaming tdevelop components" This reverts commit 722ce1efbac31c61b1d4b13f7e075c9f311e3e73. --- lib/CMakeLists.txt | 4 +- lib/Makefile.am | 10 +- lib/catalog/CMakeLists.txt | 4 +- lib/catalog/Makefile.am | 14 +- lib/cppparser/CMakeLists.txt | 6 +- lib/cppparser/Makefile.am | 12 +- lib/cppparser/lexer.cpp | 4 +- lib/interfaces/CMakeLists.txt | 34 +- lib/interfaces/KDevCoreIface.cpp | 59 +++ lib/interfaces/KDevCoreIface.h | 52 +++ lib/interfaces/KDevPartControllerIface.cpp | 95 ++++ lib/interfaces/KDevPartControllerIface.h | 64 +++ lib/interfaces/Makefile.am | 38 +- lib/interfaces/TDevCoreIface.cpp | 59 --- lib/interfaces/TDevCoreIface.h | 52 --- lib/interfaces/TDevPartControllerIface.cpp | 95 ---- lib/interfaces/TDevPartControllerIface.h | 64 --- lib/interfaces/extensions/CMakeLists.txt | 20 +- lib/interfaces/extensions/Mainpage.dox | 10 +- lib/interfaces/extensions/Makefile.am | 18 +- lib/interfaces/extensions/codebrowserfrontend.h | 8 +- lib/interfaces/extensions/dcop/CMakeLists.txt | 10 +- .../extensions/dcop/KDevAppFrontendIface.cpp | 76 +++ .../extensions/dcop/KDevAppFrontendIface.h | 52 +++ .../extensions/dcop/KDevMakeFrontendIface.cpp | 46 ++ .../extensions/dcop/KDevMakeFrontendIface.h | 45 ++ lib/interfaces/extensions/dcop/Makefile.am | 10 +- .../extensions/dcop/TDevAppFrontendIface.cpp | 76 --- .../extensions/dcop/TDevAppFrontendIface.h | 52 --- .../extensions/dcop/TDevMakeFrontendIface.cpp | 46 -- .../extensions/dcop/TDevMakeFrontendIface.h | 45 -- lib/interfaces/extensions/kdevappfrontend.cpp | 2 + lib/interfaces/extensions/kdevappfrontend.h | 116 +++++ lib/interfaces/extensions/kdevcreatefile.h | 146 ++++++ lib/interfaces/extensions/kdevdifffrontend.cpp | 33 ++ lib/interfaces/extensions/kdevdifffrontend.h | 79 ++++ lib/interfaces/extensions/kdevmakefrontend.cpp | 2 + lib/interfaces/extensions/kdevmakefrontend.h | 107 +++++ lib/interfaces/extensions/kdevquickopen.h | 130 ++++++ lib/interfaces/extensions/kdevsourceformatter.h | 69 +++ lib/interfaces/extensions/kdevversioncontrol.h | 239 ++++++++++ lib/interfaces/extensions/tdevappfrontend.cpp | 2 - lib/interfaces/extensions/tdevappfrontend.h | 116 ----- lib/interfaces/extensions/tdevcreatefile.h | 146 ------ lib/interfaces/extensions/tdevdifffrontend.cpp | 33 -- lib/interfaces/extensions/tdevdifffrontend.h | 79 ---- lib/interfaces/extensions/tdevmakefrontend.cpp | 2 - lib/interfaces/extensions/tdevmakefrontend.h | 107 ----- lib/interfaces/extensions/tdevquickopen.h | 130 ------ lib/interfaces/extensions/tdevsourceformatter.h | 69 --- lib/interfaces/extensions/tdevversioncontrol.h | 239 ---------- lib/interfaces/external/Mainpage.dox | 14 +- lib/interfaces/extras/CMakeLists.txt | 8 +- lib/interfaces/extras/Makefile.am | 14 +- lib/interfaces/extras/kdevcompileroptions.cpp | 8 + lib/interfaces/extras/kdevcompileroptions.h | 91 ++++ lib/interfaces/extras/kdevvcsintegrator.cpp | 26 ++ lib/interfaces/extras/kdevvcsintegrator.h | 77 ++++ lib/interfaces/extras/tdevcompileroptions.cpp | 8 - lib/interfaces/extras/tdevcompileroptions.h | 91 ---- lib/interfaces/extras/tdevvcsintegrator.cpp | 26 -- lib/interfaces/extras/tdevvcsintegrator.h | 77 ---- lib/interfaces/katedocumentmanagerinterface.cpp | 4 +- lib/interfaces/katedocumentmanagerinterface.h | 6 +- lib/interfaces/kdevapi.cpp | 93 ++++ lib/interfaces/kdevapi.h | 104 +++++ lib/interfaces/kdevcoderepository.cpp | 71 +++ lib/interfaces/kdevcoderepository.h | 95 ++++ lib/interfaces/kdevcore.cpp | 298 ++++++++++++ lib/interfaces/kdevcore.h | 388 ++++++++++++++++ lib/interfaces/kdevdesignerintegration.cpp | 40 ++ lib/interfaces/kdevdesignerintegration.h | 98 ++++ lib/interfaces/kdevdesignerintegrationiface.cpp | 63 +++ lib/interfaces/kdevdesignerintegrationiface.h | 49 ++ lib/interfaces/kdevgenericfactory.h | 91 ++++ lib/interfaces/kdevlanguagesupport.cpp | 166 +++++++ lib/interfaces/kdevlanguagesupport.h | 261 +++++++++++ lib/interfaces/kdevmainwindow.cpp | 28 ++ lib/interfaces/kdevmainwindow.h | 101 ++++ lib/interfaces/kdevpartcontroller.cpp | 30 ++ lib/interfaces/kdevpartcontroller.h | 176 +++++++ lib/interfaces/kdevplugin.cpp | 139 ++++++ lib/interfaces/kdevplugin.h | 201 ++++++++ lib/interfaces/kdevplugincontroller.cpp | 49 ++ lib/interfaces/kdevplugincontroller.h | 119 +++++ lib/interfaces/kdevplugininfo.cpp | 181 ++++++++ lib/interfaces/kdevplugininfo.h | 111 +++++ lib/interfaces/kdevproject.cpp | 164 +++++++ lib/interfaces/kdevproject.h | 219 +++++++++ lib/interfaces/kdevprojectiface.cpp | 186 ++++++++ lib/interfaces/kdevprojectiface.h | 82 ++++ lib/interfaces/tdevapi.cpp | 93 ---- lib/interfaces/tdevapi.h | 104 ----- lib/interfaces/tdevcoderepository.cpp | 71 --- lib/interfaces/tdevcoderepository.h | 95 ---- lib/interfaces/tdevcore.cpp | 298 ------------ lib/interfaces/tdevcore.h | 388 ---------------- lib/interfaces/tdevdesignerintegration.cpp | 40 -- lib/interfaces/tdevdesignerintegration.h | 98 ---- lib/interfaces/tdevdesignerintegrationiface.cpp | 63 --- lib/interfaces/tdevdesignerintegrationiface.h | 49 -- lib/interfaces/tdevgenericfactory.h | 91 ---- lib/interfaces/tdevlanguagesupport.cpp | 166 ------- lib/interfaces/tdevlanguagesupport.h | 261 ----------- lib/interfaces/tdevmainwindow.cpp | 28 -- lib/interfaces/tdevmainwindow.h | 101 ---- lib/interfaces/tdevpartcontroller.cpp | 30 -- lib/interfaces/tdevpartcontroller.h | 176 ------- lib/interfaces/tdevplugin.cpp | 139 ------ lib/interfaces/tdevplugin.h | 201 -------- lib/interfaces/tdevplugincontroller.cpp | 49 -- lib/interfaces/tdevplugincontroller.h | 119 ----- lib/interfaces/tdevplugininfo.cpp | 181 -------- lib/interfaces/tdevplugininfo.h | 111 ----- lib/interfaces/tdevproject.cpp | 164 ------- lib/interfaces/tdevproject.h | 219 --------- lib/interfaces/tdevprojectiface.cpp | 186 -------- lib/interfaces/tdevprojectiface.h | 82 ---- lib/util/CMakeLists.txt | 8 +- lib/util/Makefile.am | 18 +- lib/util/configwidgetproxy.cpp | 4 +- lib/util/configwidgetproxy.h | 8 +- lib/util/filetemplate.cpp | 18 +- lib/util/filetemplate.h | 12 +- lib/util/kdeveditorutil.cpp | 89 ++++ lib/util/kdeveditorutil.h | 67 +++ lib/util/kdevjobtimer.cpp | 39 ++ lib/util/kdevjobtimer.h | 40 ++ lib/util/kdevshellwidget.cpp | 125 +++++ lib/util/kdevshellwidget.h | 101 ++++ lib/util/tdeveditorutil.cpp | 89 ---- lib/util/tdeveditorutil.h | 67 --- lib/util/tdevjobtimer.cpp | 39 -- lib/util/tdevjobtimer.h | 40 -- lib/util/tdevshellwidget.cpp | 125 ----- lib/util/tdevshellwidget.h | 101 ---- lib/widgets/CMakeLists.txt | 10 +- lib/widgets/Makefile.am | 24 +- lib/widgets/kdevhtml_partui.rc | 18 + lib/widgets/kdevhtmlpart.cpp | 512 +++++++++++++++++++++ lib/widgets/kdevhtmlpart.h | 111 +++++ lib/widgets/kdevtabwidget.cpp | 66 +++ lib/widgets/propeditor/CMakeLists.txt | 4 +- lib/widgets/propeditor/Makefile.am | 14 +- lib/widgets/tdevhtml_partui.rc | 18 - lib/widgets/tdevhtmlpart.cpp | 512 --------------------- lib/widgets/tdevhtmlpart.h | 111 ----- lib/widgets/tdevtabwidget.cpp | 66 --- 148 files changed, 6569 insertions(+), 6569 deletions(-) create mode 100644 lib/interfaces/KDevCoreIface.cpp create mode 100644 lib/interfaces/KDevCoreIface.h create mode 100644 lib/interfaces/KDevPartControllerIface.cpp create mode 100644 lib/interfaces/KDevPartControllerIface.h delete mode 100644 lib/interfaces/TDevCoreIface.cpp delete mode 100644 lib/interfaces/TDevCoreIface.h delete mode 100644 lib/interfaces/TDevPartControllerIface.cpp delete mode 100644 lib/interfaces/TDevPartControllerIface.h create mode 100644 lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp create mode 100644 lib/interfaces/extensions/dcop/KDevAppFrontendIface.h create mode 100644 lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp create mode 100644 lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h delete mode 100644 lib/interfaces/extensions/dcop/TDevAppFrontendIface.cpp delete mode 100644 lib/interfaces/extensions/dcop/TDevAppFrontendIface.h delete mode 100644 lib/interfaces/extensions/dcop/TDevMakeFrontendIface.cpp delete mode 100644 lib/interfaces/extensions/dcop/TDevMakeFrontendIface.h create mode 100644 lib/interfaces/extensions/kdevappfrontend.cpp create mode 100644 lib/interfaces/extensions/kdevappfrontend.h create mode 100644 lib/interfaces/extensions/kdevcreatefile.h create mode 100644 lib/interfaces/extensions/kdevdifffrontend.cpp create mode 100644 lib/interfaces/extensions/kdevdifffrontend.h create mode 100644 lib/interfaces/extensions/kdevmakefrontend.cpp create mode 100644 lib/interfaces/extensions/kdevmakefrontend.h create mode 100644 lib/interfaces/extensions/kdevquickopen.h create mode 100644 lib/interfaces/extensions/kdevsourceformatter.h create mode 100644 lib/interfaces/extensions/kdevversioncontrol.h delete mode 100644 lib/interfaces/extensions/tdevappfrontend.cpp delete mode 100644 lib/interfaces/extensions/tdevappfrontend.h delete mode 100644 lib/interfaces/extensions/tdevcreatefile.h delete mode 100644 lib/interfaces/extensions/tdevdifffrontend.cpp delete mode 100644 lib/interfaces/extensions/tdevdifffrontend.h delete mode 100644 lib/interfaces/extensions/tdevmakefrontend.cpp delete mode 100644 lib/interfaces/extensions/tdevmakefrontend.h delete mode 100644 lib/interfaces/extensions/tdevquickopen.h delete mode 100644 lib/interfaces/extensions/tdevsourceformatter.h delete mode 100644 lib/interfaces/extensions/tdevversioncontrol.h create mode 100644 lib/interfaces/extras/kdevcompileroptions.cpp create mode 100644 lib/interfaces/extras/kdevcompileroptions.h create mode 100644 lib/interfaces/extras/kdevvcsintegrator.cpp create mode 100644 lib/interfaces/extras/kdevvcsintegrator.h delete mode 100644 lib/interfaces/extras/tdevcompileroptions.cpp delete mode 100644 lib/interfaces/extras/tdevcompileroptions.h delete mode 100644 lib/interfaces/extras/tdevvcsintegrator.cpp delete mode 100644 lib/interfaces/extras/tdevvcsintegrator.h create mode 100644 lib/interfaces/kdevapi.cpp create mode 100644 lib/interfaces/kdevapi.h create mode 100644 lib/interfaces/kdevcoderepository.cpp create mode 100644 lib/interfaces/kdevcoderepository.h create mode 100644 lib/interfaces/kdevcore.cpp create mode 100644 lib/interfaces/kdevcore.h create mode 100644 lib/interfaces/kdevdesignerintegration.cpp create mode 100644 lib/interfaces/kdevdesignerintegration.h create mode 100644 lib/interfaces/kdevdesignerintegrationiface.cpp create mode 100644 lib/interfaces/kdevdesignerintegrationiface.h create mode 100644 lib/interfaces/kdevgenericfactory.h create mode 100644 lib/interfaces/kdevlanguagesupport.cpp create mode 100644 lib/interfaces/kdevlanguagesupport.h create mode 100644 lib/interfaces/kdevmainwindow.cpp create mode 100644 lib/interfaces/kdevmainwindow.h create mode 100644 lib/interfaces/kdevpartcontroller.cpp create mode 100644 lib/interfaces/kdevpartcontroller.h create mode 100644 lib/interfaces/kdevplugin.cpp create mode 100644 lib/interfaces/kdevplugin.h create mode 100644 lib/interfaces/kdevplugincontroller.cpp create mode 100644 lib/interfaces/kdevplugincontroller.h create mode 100644 lib/interfaces/kdevplugininfo.cpp create mode 100644 lib/interfaces/kdevplugininfo.h create mode 100644 lib/interfaces/kdevproject.cpp create mode 100644 lib/interfaces/kdevproject.h create mode 100644 lib/interfaces/kdevprojectiface.cpp create mode 100644 lib/interfaces/kdevprojectiface.h delete mode 100644 lib/interfaces/tdevapi.cpp delete mode 100644 lib/interfaces/tdevapi.h delete mode 100644 lib/interfaces/tdevcoderepository.cpp delete mode 100644 lib/interfaces/tdevcoderepository.h delete mode 100644 lib/interfaces/tdevcore.cpp delete mode 100644 lib/interfaces/tdevcore.h delete mode 100644 lib/interfaces/tdevdesignerintegration.cpp delete mode 100644 lib/interfaces/tdevdesignerintegration.h delete mode 100644 lib/interfaces/tdevdesignerintegrationiface.cpp delete mode 100644 lib/interfaces/tdevdesignerintegrationiface.h delete mode 100644 lib/interfaces/tdevgenericfactory.h delete mode 100644 lib/interfaces/tdevlanguagesupport.cpp delete mode 100644 lib/interfaces/tdevlanguagesupport.h delete mode 100644 lib/interfaces/tdevmainwindow.cpp delete mode 100644 lib/interfaces/tdevmainwindow.h delete mode 100644 lib/interfaces/tdevpartcontroller.cpp delete mode 100644 lib/interfaces/tdevpartcontroller.h delete mode 100644 lib/interfaces/tdevplugin.cpp delete mode 100644 lib/interfaces/tdevplugin.h delete mode 100644 lib/interfaces/tdevplugincontroller.cpp delete mode 100644 lib/interfaces/tdevplugincontroller.h delete mode 100644 lib/interfaces/tdevplugininfo.cpp delete mode 100644 lib/interfaces/tdevplugininfo.h delete mode 100644 lib/interfaces/tdevproject.cpp delete mode 100644 lib/interfaces/tdevproject.h delete mode 100644 lib/interfaces/tdevprojectiface.cpp delete mode 100644 lib/interfaces/tdevprojectiface.h create mode 100644 lib/util/kdeveditorutil.cpp create mode 100644 lib/util/kdeveditorutil.h create mode 100644 lib/util/kdevjobtimer.cpp create mode 100644 lib/util/kdevjobtimer.h create mode 100644 lib/util/kdevshellwidget.cpp create mode 100644 lib/util/kdevshellwidget.h delete mode 100644 lib/util/tdeveditorutil.cpp delete mode 100644 lib/util/tdeveditorutil.h delete mode 100644 lib/util/tdevjobtimer.cpp delete mode 100644 lib/util/tdevjobtimer.h delete mode 100644 lib/util/tdevshellwidget.cpp delete mode 100644 lib/util/tdevshellwidget.h create mode 100644 lib/widgets/kdevhtml_partui.rc create mode 100644 lib/widgets/kdevhtmlpart.cpp create mode 100644 lib/widgets/kdevhtmlpart.h create mode 100644 lib/widgets/kdevtabwidget.cpp delete mode 100644 lib/widgets/tdevhtml_partui.rc delete mode 100644 lib/widgets/tdevhtmlpart.cpp delete mode 100644 lib/widgets/tdevhtmlpart.h delete mode 100644 lib/widgets/tdevtabwidget.cpp (limited to 'lib') diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e9088337..0398ddf0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -31,9 +31,9 @@ link_directories( tde_add_library( tdevelop SHARED SOURCES dummy.cpp VERSION 1.0.0 - EMBED tdevutil-static tdevinterfaces-static + EMBED kdevutil-static kdevinterfaces-static LINK - tdevpropertyeditor-shared + kdevpropertyeditor-shared tdescript-shared tdeparts-shared tdetexteditor-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/lib/Makefile.am b/lib/Makefile.am index 55b974c5..d590051e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ -# Here resides the library of general TDevelop-related utilities, +# Here resides the library of general KDevelop-related utilities, # which may be linked by any plugin or part. This is installed # as a shared library, including header files @@ -6,11 +6,11 @@ INCLUDES = $(all_includes) lib_LTLIBRARIES = libtdevelop.la libtdevelop_la_LDFLAGS = -no-undefined $(all_libraries) -version-info 1:0 -libtdevelop_la_LIBADD = $(top_builddir)/lib/interfaces/libtdevinterfaces.la \ - $(top_builddir)/lib/widgets/propeditor/libtdevpropertyeditor.la $(LIB_TDEIO) +libtdevelop_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la \ + $(top_builddir)/lib/widgets/propeditor/libkdevpropertyeditor.la $(LIB_TDEIO) -# $(top_builddir)/lib/util/libtdevutil.la $(top_builddir)/lib/widgets/propeditor/libtdevpropertyeditor.la \ -# $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la $(top_builddir)/lib/interfaces/extensions/libtdevextensions.la \ +# $(top_builddir)/lib/util/libkdevutil.la $(top_builddir)/lib/widgets/propeditor/libkdevpropertyeditor.la \ +# $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la $(top_builddir)/lib/interfaces/extensions/libkdevextensions.la \ # -ltdetexteditor $(LIB_TDEPARTS) $(LIB_TDEIO) -ltdescript libtdevelop_la_SOURCES = dummy.cpp diff --git a/lib/catalog/CMakeLists.txt b/lib/catalog/CMakeLists.txt index 13b008d1..5c1b4f2b 100644 --- a/lib/catalog/CMakeLists.txt +++ b/lib/catalog/CMakeLists.txt @@ -28,9 +28,9 @@ install( FILES DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/catalog ) -##### tdevcatalog (shared) ###################### +##### kdevcatalog (shared) ###################### -tde_add_library( tdevcatalog SHARED AUTOMOC +tde_add_library( kdevcatalog SHARED AUTOMOC SOURCES tag.cpp catalog.cpp VERSION 0.0.0 LINK tdecore-shared ${BDB_LIBRARY} diff --git a/lib/catalog/Makefile.am b/lib/catalog/Makefile.am index e45a2530..c8c7ddc1 100644 --- a/lib/catalog/Makefile.am +++ b/lib/catalog/Makefile.am @@ -1,13 +1,13 @@ INCLUDES = $(all_includes) $(DB3INCLUDES) -lib_LTLIBRARIES = libtdevcatalog.la -libtdevcatalog_la_SOURCES = tag.cpp catalog.cpp -libtdevcatalog_la_LDFLAGS = -no-undefined $(all_libraries) $(DB3LDFLAGS) -libtdevcatalog_la_LIBADD = -l$(DB3LIB) $(LIB_TDECORE) $(LIB_QT) +lib_LTLIBRARIES = libkdevcatalog.la +libkdevcatalog_la_SOURCES = tag.cpp catalog.cpp +libkdevcatalog_la_LDFLAGS = -no-undefined $(all_libraries) $(DB3LDFLAGS) +libkdevcatalog_la_LIBADD = -l$(DB3LIB) $(LIB_TDECORE) $(LIB_QT) -tdevcatalogincludedir = $(includedir)/tdevelop/catalog -tdevcataloginclude_HEADERS = catalog.h tag.h +kdevcatalogincludedir = $(includedir)/tdevelop/catalog +kdevcataloginclude_HEADERS = catalog.h tag.h DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = TDevelop Catalog Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/cppparser/CMakeLists.txt b/lib/cppparser/CMakeLists.txt index 20db36c5..3b53e900 100644 --- a/lib/cppparser/CMakeLists.txt +++ b/lib/cppparser/CMakeLists.txt @@ -31,13 +31,13 @@ install( FILES DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/cppparser ) -##### tdevcppparser (shared) #################### +##### kdevcppparser (shared) #################### -tde_add_library( tdevcppparser SHARED AUTOMOC +tde_add_library( kdevcppparser SHARED AUTOMOC SOURCES ast.cpp cachemanager.cpp driver.cpp errors.cpp lexer.cpp lexercache.cpp lookup.cpp parser.cpp tree_parser.cpp VERSION 0.0.0 - LINK tdevinterfaces-static tdeio-shared + LINK kdevinterfaces-static tdeio-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/lib/cppparser/Makefile.am b/lib/cppparser/Makefile.am index 082c8227..4e62cebf 100644 --- a/lib/cppparser/Makefile.am +++ b/lib/cppparser/Makefile.am @@ -1,11 +1,11 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) AM_CXXFLAGS = -DKDEVELOP_BGPARSER -lib_LTLIBRARIES = libtdevcppparser.la -libtdevcppparser_la_LDFLAGS = $(all_libraries) -libtdevcppparser_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(top_builddir)/lib/interfaces/libtdevinterfaces.la -lDCOP $(LIB_TDEUI) $(LIB_TDEPARTS) -ltdetexteditor $(LIB_TDEIO) -ltdescript -libtdevcppparser_la_SOURCES = ast.cpp cachemanager.cpp driver.cpp errors.cpp \ +lib_LTLIBRARIES = libkdevcppparser.la +libkdevcppparser_la_LDFLAGS = $(all_libraries) +libkdevcppparser_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(top_builddir)/lib/interfaces/libkdevinterfaces.la -lDCOP $(LIB_TDEUI) $(LIB_TDEPARTS) -ltdetexteditor $(LIB_TDEIO) -ltdescript +libkdevcppparser_la_SOURCES = ast.cpp cachemanager.cpp driver.cpp errors.cpp \ lexer.cpp lexercache.cpp lookup.cpp parser.cpp tree_parser.cpp -tdevcppparserincludedir = $(includedir)/tdevelop/cppparser -tdevcppparserinclude_HEADERS = ast.h driver.h lexer.h parser.h tree_parser.h errors.h lookup.h cachemanager.h lexercache.h macro.h +kdevcppparserincludedir = $(includedir)/tdevelop/cppparser +kdevcppparserinclude_HEADERS = ast.h driver.h lexer.h parser.h tree_parser.h errors.h lookup.h cachemanager.h lexercache.h macro.h diff --git a/lib/cppparser/lexer.cpp b/lib/cppparser/lexer.cpp index 5f01a19e..5325c80f 100644 --- a/lib/cppparser/lexer.cpp +++ b/lib/cppparser/lexer.cpp @@ -30,7 +30,7 @@ #if defined( KDEVELOP_BGPARSER ) #include -class TDevTread: public TQThread +class KDevTread: public TQThread { public: static void yield() @@ -41,7 +41,7 @@ public: inline void qthread_yield() { - TDevTread::yield(); + KDevTread::yield(); } #endif diff --git a/lib/interfaces/CMakeLists.txt b/lib/interfaces/CMakeLists.txt index 47d6855d..94b07bec 100644 --- a/lib/interfaces/CMakeLists.txt +++ b/lib/interfaces/CMakeLists.txt @@ -27,12 +27,12 @@ include_directories( ##### headers ################################### install( FILES - tdevlanguagesupport.h tdevmainwindow.h tdevpartcontroller.h - tdevplugin.h tdevproject.h tdevcore.h tdevcoderepository.h + kdevlanguagesupport.h kdevmainwindow.h kdevpartcontroller.h + kdevplugin.h kdevproject.h kdevcore.h kdevcoderepository.h codemodel.h codemodel_utils.h codemodel_treeparser.h - tdevgenericfactory.h tdevapi.h tdevdesignerintegration.h - tdevplugincontroller.h tdevplugininfo.h TDevCoreIface.h - TDevPartControllerIface.h katedocumentmanagerinterface.h + kdevgenericfactory.h kdevapi.h kdevdesignerintegration.h + kdevplugincontroller.h kdevplugininfo.h KDevCoreIface.h + KDevPartControllerIface.h katedocumentmanagerinterface.h hashedstring.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/interfaces ) @@ -42,20 +42,20 @@ install( FILES DESTINATION ${SERVICETYPES_INSTALL_DIR} ) -##### tdevinterfaces (static) ################### +##### kdevinterfaces (static) ################### -tde_add_library( tdevinterfaces STATIC_PIC AUTOMOC +tde_add_library( kdevinterfaces STATIC_PIC AUTOMOC SOURCES - tdevcore.cpp tdevproject.cpp tdevlanguagesupport.cpp - tdevpartcontroller.cpp tdevapi.cpp TDevCoreIface.skel - tdevmainwindow.cpp TDevPartControllerIface.skel - tdevplugin.cpp tdevcoderepository.cpp + kdevcore.cpp kdevproject.cpp kdevlanguagesupport.cpp + kdevpartcontroller.cpp kdevapi.cpp KDevCoreIface.skel + kdevmainwindow.cpp KDevPartControllerIface.skel + kdevplugin.cpp kdevcoderepository.cpp codemodel.cpp codemodel_treeparser.cpp - codemodel_utils.cpp tdevdesignerintegration.cpp - tdevplugincontroller.cpp tdevplugininfo.cpp - TDevCoreIface.cpp TDevPartControllerIface.cpp + codemodel_utils.cpp kdevdesignerintegration.cpp + kdevplugincontroller.cpp kdevplugininfo.cpp + KDevCoreIface.cpp KDevPartControllerIface.cpp katedocumentmanagerinterface.cpp - katedocumentmanagerinterface.skel tdevprojectiface.cpp - tdevprojectiface.skel tdevdesignerintegrationiface.cpp - tdevdesignerintegrationiface.skel hashedstring.cpp + katedocumentmanagerinterface.skel kdevprojectiface.cpp + kdevprojectiface.skel kdevdesignerintegrationiface.cpp + kdevdesignerintegrationiface.skel hashedstring.cpp ) diff --git a/lib/interfaces/KDevCoreIface.cpp b/lib/interfaces/KDevCoreIface.cpp new file mode 100644 index 00000000..aa70e01b --- /dev/null +++ b/lib/interfaces/KDevCoreIface.cpp @@ -0,0 +1,59 @@ + + +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include +#include +#include "KDevCoreIface.h" +#include "kdevcore.h" + + +KDevCoreIface::KDevCoreIface(KDevCore *core) + : TQObject(core), DCOPObject("KDevCore"), m_core(core) +{ + connect( m_core, TQT_SIGNAL(projectOpened()), this, TQT_SLOT(forwardProjectOpened()) ); + connect( m_core, TQT_SIGNAL(projectClosed()), this, TQT_SLOT(forwardProjectClosed()) ); +} + + +KDevCoreIface::~KDevCoreIface() +{} + + +void KDevCoreIface::forwardProjectOpened() +{ + kdDebug(9000) << "dcop emitting project opened" << endl; + emitDCOPSignal("projectOpened()", TQByteArray()); +} + + +void KDevCoreIface::forwardProjectClosed() +{ + kdDebug(9000) << "dcop emitting project closed" << endl; + emitDCOPSignal("projectClosed()", TQByteArray()); +} + +void KDevCoreIface::openProject( const TQString & projectFileName ) +{ + m_core->openProject(projectFileName); +} + +#include "KDevCoreIface.moc" diff --git a/lib/interfaces/KDevCoreIface.h b/lib/interfaces/KDevCoreIface.h new file mode 100644 index 00000000..612c8457 --- /dev/null +++ b/lib/interfaces/KDevCoreIface.h @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef _KDEVCOREIFACE_H_ +#define _KDEVCOREIFACE_H_ + +#include +#include + +class KDevCore; + + +class KDevCoreIface : public TQObject, public DCOPObject +{ + Q_OBJECT +// + K_DCOP + +public: + + KDevCoreIface( KDevCore *core ); + ~KDevCoreIface(); + +k_dcop: + void openProject(const TQString& projectFileName); + +private slots: + void forwardProjectOpened(); + void forwardProjectClosed(); + +private: + KDevCore *m_core; +}; + +#endif diff --git a/lib/interfaces/KDevPartControllerIface.cpp b/lib/interfaces/KDevPartControllerIface.cpp new file mode 100644 index 00000000..1b184453 --- /dev/null +++ b/lib/interfaces/KDevPartControllerIface.cpp @@ -0,0 +1,95 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Hoelzer-Kluepfel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include +#include +#include + + +#include "KDevPartControllerIface.h" +#include "kdevpartcontroller.h" + + +KDevPartControllerIface::KDevPartControllerIface(KDevPartController *pc) + : TQObject(pc), DCOPObject("KDevPartController"), m_controller(pc) +{ + connect(pc, TQT_SIGNAL(loadedFile(const KURL &)), this, TQT_SLOT(forwardLoadedFile(const KURL &))); + connect(pc, TQT_SIGNAL(savedFile(const KURL &)), this, TQT_SLOT(forwardSavedFile(const KURL &))); + connect(pc, TQT_SIGNAL(closedFile(const KURL &)), this, TQT_SLOT(forwardClosedFile(const KURL &))); +} + + +KDevPartControllerIface::~KDevPartControllerIface() +{ +} + + +void KDevPartControllerIface::editDocument(const TQString &url, int lineNum) +{ + m_controller->editDocument(KURL(url), lineNum); +} + + +void KDevPartControllerIface::showDocument(const TQString &url, bool newWin) +{ + m_controller->showDocument(KURL(url), newWin); +} + + +void KDevPartControllerIface::saveAllFiles() +{ + m_controller->saveAllFiles(); +} + + +void KDevPartControllerIface::revertAllFiles() +{ + m_controller->revertAllFiles(); +} + + +void KDevPartControllerIface::forwardLoadedFile(const KURL &fileName) +{ + kdDebug(9000) << "dcop emitting loadedFile " << fileName << endl; + emitDCOPSignal("projectOpened()", TQByteArray()); +} + + +void KDevPartControllerIface::forwardSavedFile(const KURL &fileName) +{ + kdDebug(9000) << "dcop emitting savedFile " << fileName << endl; + emitDCOPSignal("projectClosed()", TQByteArray()); +} + +void KDevPartControllerIface::forwardClosedFile(const KURL &fileName) +{ + kdDebug(9000) << "dcop emitting closedFile " << fileName << endl; + emitDCOPSignal("projectClosed()", TQByteArray()); +} + +bool KDevPartControllerIface::closeAllFiles( ) +{ + return m_controller->closeAllFiles(); +} + +uint KDevPartControllerIface::documentState( const KURL & url ) +{ + return (uint) m_controller->documentState(url); +} + +#include "KDevPartControllerIface.moc" diff --git a/lib/interfaces/KDevPartControllerIface.h b/lib/interfaces/KDevPartControllerIface.h new file mode 100644 index 00000000..8c3647ea --- /dev/null +++ b/lib/interfaces/KDevPartControllerIface.h @@ -0,0 +1,64 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Hoelzer-Kluepfel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef _KDEVPARTCONTROLLERIFACE_H_ +#define _KDEVPARTCONTROLLERIFACE_H_ + +#include +#include +#include + +class KDevPartController; + +class KDevPartControllerIface : public TQObject, public DCOPObject +{ + Q_OBJECT +// + K_DCOP + +public: + + KDevPartControllerIface(KDevPartController *pc); + ~KDevPartControllerIface(); + + +k_dcop: + + void editDocument(const TQString &url, int lineNum); + void showDocument(const TQString &url, bool newWin); + + void saveAllFiles(); + void revertAllFiles(); + + bool closeAllFiles(); + uint documentState( const KURL & url ); + +private slots: + + void forwardLoadedFile(const KURL &fileName); + void forwardSavedFile(const KURL &fileName); + void forwardClosedFile(const KURL &fileName); + +private: + + KDevPartController *m_controller; + +}; + + +#endif diff --git a/lib/interfaces/Makefile.am b/lib/interfaces/Makefile.am index 93533492..1944f4f9 100644 --- a/lib/interfaces/Makefile.am +++ b/lib/interfaces/Makefile.am @@ -1,27 +1,27 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/cppparser \ $(all_includes) -noinst_LTLIBRARIES = libtdevinterfaces.la +noinst_LTLIBRARIES = libkdevinterfaces.la -libtdevinterfaces_la_SOURCES = tdevcore.cpp tdevproject.cpp \ - tdevlanguagesupport.cpp tdevpartcontroller.cpp tdevapi.cpp TDevCoreIface.skel \ - tdevmainwindow.cpp TDevPartControllerIface.skel tdevplugin.cpp tdevcoderepository.cpp \ +libkdevinterfaces_la_SOURCES = kdevcore.cpp kdevproject.cpp \ + kdevlanguagesupport.cpp kdevpartcontroller.cpp kdevapi.cpp KDevCoreIface.skel \ + kdevmainwindow.cpp KDevPartControllerIface.skel kdevplugin.cpp kdevcoderepository.cpp \ codemodel.cpp codemodel_treeparser.cpp codemodel_utils.cpp \ - tdevdesignerintegration.cpp tdevplugincontroller.cpp tdevplugininfo.cpp TDevCoreIface.cpp \ - TDevPartControllerIface.cpp katedocumentmanagerinterface.cpp katedocumentmanagerinterface.skel \ - tdevprojectiface.cpp tdevprojectiface.skel tdevdesignerintegrationiface.cpp \ - tdevdesignerintegrationiface.skel hashedstring.cpp -libtdevinterfaces_la_LDFLAGS = -no-undefined $(all_libraries) -libtdevinterfaces_la_LIBADD = $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la \ - $(top_builddir)/lib/util/libtdevutil.la \ + kdevdesignerintegration.cpp kdevplugincontroller.cpp kdevplugininfo.cpp KDevCoreIface.cpp \ + KDevPartControllerIface.cpp katedocumentmanagerinterface.cpp katedocumentmanagerinterface.skel \ + kdevprojectiface.cpp kdevprojectiface.skel kdevdesignerintegrationiface.cpp \ + kdevdesignerintegrationiface.skel hashedstring.cpp +libkdevinterfaces_la_LDFLAGS = -no-undefined $(all_libraries) +libkdevinterfaces_la_LIBADD = $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la \ + $(top_builddir)/lib/util/libkdevutil.la \ $(LIB_TDEUI) $(LIB_TDEHTML) $(LIB_TDEPARTS) -ltdetexteditor -ltdescript -lDCOP tdevelopincludedir = $(includedir)/tdevelop/interfaces -tdevelopinclude_HEADERS = tdevlanguagesupport.h tdevmainwindow.h \ - tdevpartcontroller.h tdevplugin.h tdevproject.h tdevcore.h tdevcoderepository.h codemodel.h \ - codemodel_utils.h codemodel_treeparser.h tdevgenericfactory.h tdevapi.h \ - tdevdesignerintegration.h tdevplugincontroller.h tdevplugininfo.h TDevCoreIface.h \ - TDevPartControllerIface.h katedocumentmanagerinterface.h \ +tdevelopinclude_HEADERS = kdevlanguagesupport.h kdevmainwindow.h \ + kdevpartcontroller.h kdevplugin.h kdevproject.h kdevcore.h kdevcoderepository.h codemodel.h \ + codemodel_utils.h codemodel_treeparser.h kdevgenericfactory.h kdevapi.h \ + kdevdesignerintegration.h kdevplugincontroller.h kdevplugininfo.h KDevCoreIface.h \ + KDevPartControllerIface.h katedocumentmanagerinterface.h \ hashedstring.h @@ -33,8 +33,8 @@ METASOURCES = AUTO SUBDIRS = extensions external extras -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils tdevutil designer_integration tdevcatalog tdevprofileslib tdevextensions +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions DOXYGEN_PROJECTNAME = TDevelop Interfaces Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am -noinst_HEADERS = tdevprojectiface.h tdevdesignerintegrationiface.h +noinst_HEADERS = kdevprojectiface.h kdevdesignerintegrationiface.h diff --git a/lib/interfaces/TDevCoreIface.cpp b/lib/interfaces/TDevCoreIface.cpp deleted file mode 100644 index 39d4bb97..00000000 --- a/lib/interfaces/TDevCoreIface.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -/* This file is part of the KDE project - Copyright (C) 2001 Bernd Gehrmann - Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include -#include -#include "TDevCoreIface.h" -#include "tdevcore.h" - - -TDevCoreIface::TDevCoreIface(TDevCore *core) - : TQObject(core), DCOPObject("TDevCore"), m_core(core) -{ - connect( m_core, TQT_SIGNAL(projectOpened()), this, TQT_SLOT(forwardProjectOpened()) ); - connect( m_core, TQT_SIGNAL(projectClosed()), this, TQT_SLOT(forwardProjectClosed()) ); -} - - -TDevCoreIface::~TDevCoreIface() -{} - - -void TDevCoreIface::forwardProjectOpened() -{ - kdDebug(9000) << "dcop emitting project opened" << endl; - emitDCOPSignal("projectOpened()", TQByteArray()); -} - - -void TDevCoreIface::forwardProjectClosed() -{ - kdDebug(9000) << "dcop emitting project closed" << endl; - emitDCOPSignal("projectClosed()", TQByteArray()); -} - -void TDevCoreIface::openProject( const TQString & projectFileName ) -{ - m_core->openProject(projectFileName); -} - -#include "TDevCoreIface.moc" diff --git a/lib/interfaces/TDevCoreIface.h b/lib/interfaces/TDevCoreIface.h deleted file mode 100644 index f259005a..00000000 --- a/lib/interfaces/TDevCoreIface.h +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Bernd Gehrmann - Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef _TDEVCOREIFACE_H_ -#define _TDEVCOREIFACE_H_ - -#include -#include - -class TDevCore; - - -class TDevCoreIface : public TQObject, public DCOPObject -{ - Q_OBJECT -// - K_DCOP - -public: - - TDevCoreIface( TDevCore *core ); - ~TDevCoreIface(); - -k_dcop: - void openProject(const TQString& projectFileName); - -private slots: - void forwardProjectOpened(); - void forwardProjectClosed(); - -private: - TDevCore *m_core; -}; - -#endif diff --git a/lib/interfaces/TDevPartControllerIface.cpp b/lib/interfaces/TDevPartControllerIface.cpp deleted file mode 100644 index e8bd1bb7..00000000 --- a/lib/interfaces/TDevPartControllerIface.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Matthias Hoelzer-Kluepfel - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include -#include -#include - - -#include "TDevPartControllerIface.h" -#include "tdevpartcontroller.h" - - -TDevPartControllerIface::TDevPartControllerIface(TDevPartController *pc) - : TQObject(pc), DCOPObject("TDevPartController"), m_controller(pc) -{ - connect(pc, TQT_SIGNAL(loadedFile(const KURL &)), this, TQT_SLOT(forwardLoadedFile(const KURL &))); - connect(pc, TQT_SIGNAL(savedFile(const KURL &)), this, TQT_SLOT(forwardSavedFile(const KURL &))); - connect(pc, TQT_SIGNAL(closedFile(const KURL &)), this, TQT_SLOT(forwardClosedFile(const KURL &))); -} - - -TDevPartControllerIface::~TDevPartControllerIface() -{ -} - - -void TDevPartControllerIface::editDocument(const TQString &url, int lineNum) -{ - m_controller->editDocument(KURL(url), lineNum); -} - - -void TDevPartControllerIface::showDocument(const TQString &url, bool newWin) -{ - m_controller->showDocument(KURL(url), newWin); -} - - -void TDevPartControllerIface::saveAllFiles() -{ - m_controller->saveAllFiles(); -} - - -void TDevPartControllerIface::revertAllFiles() -{ - m_controller->revertAllFiles(); -} - - -void TDevPartControllerIface::forwardLoadedFile(const KURL &fileName) -{ - kdDebug(9000) << "dcop emitting loadedFile " << fileName << endl; - emitDCOPSignal("projectOpened()", TQByteArray()); -} - - -void TDevPartControllerIface::forwardSavedFile(const KURL &fileName) -{ - kdDebug(9000) << "dcop emitting savedFile " << fileName << endl; - emitDCOPSignal("projectClosed()", TQByteArray()); -} - -void TDevPartControllerIface::forwardClosedFile(const KURL &fileName) -{ - kdDebug(9000) << "dcop emitting closedFile " << fileName << endl; - emitDCOPSignal("projectClosed()", TQByteArray()); -} - -bool TDevPartControllerIface::closeAllFiles( ) -{ - return m_controller->closeAllFiles(); -} - -uint TDevPartControllerIface::documentState( const KURL & url ) -{ - return (uint) m_controller->documentState(url); -} - -#include "TDevPartControllerIface.moc" diff --git a/lib/interfaces/TDevPartControllerIface.h b/lib/interfaces/TDevPartControllerIface.h deleted file mode 100644 index 87a4e04e..00000000 --- a/lib/interfaces/TDevPartControllerIface.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Matthias Hoelzer-Kluepfel - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef _TDEVPARTCONTROLLERIFACE_H_ -#define _TDEVPARTCONTROLLERIFACE_H_ - -#include -#include -#include - -class TDevPartController; - -class TDevPartControllerIface : public TQObject, public DCOPObject -{ - Q_OBJECT -// - K_DCOP - -public: - - TDevPartControllerIface(TDevPartController *pc); - ~TDevPartControllerIface(); - - -k_dcop: - - void editDocument(const TQString &url, int lineNum); - void showDocument(const TQString &url, bool newWin); - - void saveAllFiles(); - void revertAllFiles(); - - bool closeAllFiles(); - uint documentState( const KURL & url ); - -private slots: - - void forwardLoadedFile(const KURL &fileName); - void forwardSavedFile(const KURL &fileName); - void forwardClosedFile(const KURL &fileName); - -private: - - TDevPartController *m_controller; - -}; - - -#endif diff --git a/lib/interfaces/extensions/CMakeLists.txt b/lib/interfaces/extensions/CMakeLists.txt index cf5514be..459c1197 100644 --- a/lib/interfaces/extensions/CMakeLists.txt +++ b/lib/interfaces/extensions/CMakeLists.txt @@ -22,9 +22,9 @@ include_directories( ##### headers ################################### install( FILES - codebrowserfrontend.h tdevappfrontend.h tdevcreatefile.h - tdevdifffrontend.h tdevmakefrontend.h tdevquickopen.h - tdevsourceformatter.h tdevversioncontrol.h + codebrowserfrontend.h kdevappfrontend.h kdevcreatefile.h + kdevdifffrontend.h kdevmakefrontend.h kdevquickopen.h + kdevsourceformatter.h kdevversioncontrol.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/interfaces/extensions ) install( FILES @@ -35,20 +35,20 @@ install( FILES DESTINATION ${SERVICETYPES_INSTALL_DIR} ) -##### tdevextensions (static) ################### +##### kdevextensions (static) ################### add_custom_command( OUTPUT codebrowserfrontend.moc.cpp COMMAND ${TMOC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codebrowserfrontend.h -o codebrowserfrontend.moc.cpp DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/codebrowserfrontend.h ) -add_custom_command( OUTPUT tdevversioncontrol.moc.cpp +add_custom_command( OUTPUT kdevversioncontrol.moc.cpp COMMAND - ${TMOC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tdevversioncontrol.h -o tdevversioncontrol.moc.cpp - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tdevversioncontrol.h ) + ${TMOC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kdevversioncontrol.h -o kdevversioncontrol.moc.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kdevversioncontrol.h ) -tde_add_library( tdevextensions STATIC_PIC AUTOMOC +tde_add_library( kdevextensions STATIC_PIC AUTOMOC SOURCES - tdevappfrontend.cpp tdevappfrontend.cpp tdevmakefrontend.cpp - codebrowserfrontend.moc.cpp tdevversioncontrol.moc.cpp + kdevappfrontend.cpp kdevappfrontend.cpp kdevmakefrontend.cpp + codebrowserfrontend.moc.cpp kdevversioncontrol.moc.cpp ) diff --git a/lib/interfaces/extensions/Mainpage.dox b/lib/interfaces/extensions/Mainpage.dox index 37c72c16..3b493fde 100644 --- a/lib/interfaces/extensions/Mainpage.dox +++ b/lib/interfaces/extensions/Mainpage.dox @@ -10,8 +10,8 @@ This library contains extension interfaces used by TDevelop plugin architecture. \section whatisextension What is the TDevelop extension Extension is a TDevelop plugin which implements one of extension interfaces. -Extension is usually not important enough to be returned by @ref TDevApi and @ref TDevPlugin -methods. Therefore extension instance can be obtained by @ref TDevPlugin::extension method. +Extension is usually not important enough to be returned by @ref KDevApi and @ref KDevPlugin +methods. Therefore extension instance can be obtained by @ref KDevPlugin::extension method. Note: extension plugins can be either core, global and project plugins. They are loaded in the same way other plugins are. But extensions differ from usual plugins. @@ -36,10 +36,10 @@ those should be loaded at a time. This can be accomplished by: @endcode - Define an abstract base class for an extension like: @code - class KDevMyExtension: public TDevPlugin { + class KDevMyExtension: public KDevPlugin { public: - KDevMyExtension(const TDevPluginInfo *info, QObject* parent, const char* name) - :TDevPlugin(info, parent, name) {} + KDevMyExtension(const KDevPluginInfo *info, QObject* parent, const char* name) + :KDevPlugin(info, parent, name) {} virtual void doSomething() = 0; }; diff --git a/lib/interfaces/extensions/Makefile.am b/lib/interfaces/extensions/Makefile.am index 55f4d774..a6d00bc2 100644 --- a/lib/interfaces/extensions/Makefile.am +++ b/lib/interfaces/extensions/Makefile.am @@ -1,7 +1,7 @@ tdevelopincludeextdir = $(includedir)/tdevelop/interfaces/extensions -tdevelopincludeext_HEADERS = codebrowserfrontend.h tdevappfrontend.h \ - tdevcreatefile.h tdevdifffrontend.h tdevmakefrontend.h tdevquickopen.h \ - tdevsourceformatter.h tdevversioncontrol.h +tdevelopincludeext_HEADERS = codebrowserfrontend.h kdevappfrontend.h \ + kdevcreatefile.h kdevdifffrontend.h kdevmakefrontend.h kdevquickopen.h \ + kdevsourceformatter.h kdevversioncontrol.h servicetypedir = $(kde_servicetypesdir) servicetype_DATA = tdevelopappfrontend.desktop \ @@ -10,14 +10,14 @@ servicetype_DATA = tdevelopappfrontend.desktop \ tdevelopversioncontrol.desktop SUBDIRS = dcop -libtdevextensions_la_LDFLAGS = $(all_libraries) -noinst_LTLIBRARIES = libtdevextensions.la -libtdevextensions_la_SOURCES = tdevappfrontend.cpp tdevmakefrontend.cpp +libkdevextensions_la_LDFLAGS = $(all_libraries) +noinst_LTLIBRARIES = libkdevextensions.la +libkdevextensions_la_SOURCES = kdevappfrontend.cpp kdevmakefrontend.cpp INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) METASOURCES = AUTO -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils tdevinterfaces -DOXYGEN_PROJECTNAME = TDevelop Extension Interfaces Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces +DOXYGEN_PROJECTNAME = KDevelop Extension Interfaces Library +DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am noinst_HEADERS = codebrowserfrontend.h diff --git a/lib/interfaces/extensions/codebrowserfrontend.h b/lib/interfaces/extensions/codebrowserfrontend.h index 68c4e90f..e8158fe4 100644 --- a/lib/interfaces/extensions/codebrowserfrontend.h +++ b/lib/interfaces/extensions/codebrowserfrontend.h @@ -20,18 +20,18 @@ #define CODEBROWSERRONTEND_H -#include +#include #include namespace Extensions { -class TDevCodeBrowserFrontend : public TDevPlugin { +class KDevCodeBrowserFrontend : public KDevPlugin { Q_OBJECT public: - TDevCodeBrowserFrontend(const TDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) - :TDevPlugin(info, parent, name ? name : "CodeBrowserFrontend") {} + KDevCodeBrowserFrontend(const KDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) + :KDevPlugin(info, parent, name ? name : "CodeBrowserFrontend") {} ///Used by the quickopen-plugin to notify extensions that it jumped to a searched item virtual bool jumpedToItem( ItemDom item ) = 0; diff --git a/lib/interfaces/extensions/dcop/CMakeLists.txt b/lib/interfaces/extensions/dcop/CMakeLists.txt index 8658d320..b6255fc6 100644 --- a/lib/interfaces/extensions/dcop/CMakeLists.txt +++ b/lib/interfaces/extensions/dcop/CMakeLists.txt @@ -21,14 +21,14 @@ include_directories( ##### headers ################################### install( FILES - TDevAppFrontendIface.h TDevMakeFrontendIface.h + KDevAppFrontendIface.h KDevMakeFrontendIface.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/interfaces/extensions/dcop ) -##### tdevdcopextensions (static) ############### +##### kdevdcopextensions (static) ############### -tde_add_library( tdevdcopextensions STATIC_PIC +tde_add_library( kdevdcopextensions STATIC_PIC SOURCES - TDevAppFrontendIface.cpp TDevMakeFrontendIface.cpp - TDevAppFrontendIface.skel TDevMakeFrontendIface.skel + KDevAppFrontendIface.cpp KDevMakeFrontendIface.cpp + KDevAppFrontendIface.skel KDevMakeFrontendIface.skel ) diff --git a/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp new file mode 100644 index 00000000..1eca4bfc --- /dev/null +++ b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp @@ -0,0 +1,76 @@ + + +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Roberto Raggi + Copyright (C) 2002 Bernd Gehrmann + Copyright (C) 2003 Amilcar do Carmo Lucas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "KDevAppFrontendIface.h" +#include "kdevappfrontend.h" + + +KDevAppFrontendIface::KDevAppFrontendIface(KDevAppFrontend *appFrontend) + : DCOPObject("KDevAppFrontend"), m_appFrontend(appFrontend) +{ +} + + +KDevAppFrontendIface::~KDevAppFrontendIface() +{} + + +void KDevAppFrontendIface::startAppCommand(const TQString &directory, const TQString &command, bool inTerminal) +{ + m_appFrontend->startAppCommand(directory, command, inTerminal); +} + +void KDevAppFrontendIface::stopApplication( ) +{ + m_appFrontend->stopApplication(); +} + +bool KDevAppFrontendIface::isRunning( ) +{ + return m_appFrontend->isRunning(); +} + +void KDevAppFrontendIface::clearView( ) +{ + m_appFrontend->clearView(); +} + +void KDevAppFrontendIface::insertStderrLine( const TQCString & line ) +{ + m_appFrontend->insertStderrLine(line); +} + +void KDevAppFrontendIface::insertStdoutLine( const TQCString & line ) +{ + m_appFrontend->insertStdoutLine(line); +} + +void KDevAppFrontendIface::addPartialStderrLine( const TQCString& line ) +{ + m_appFrontend->addPartialStderrLine(line); +} + +void KDevAppFrontendIface::addPartialStdoutLine( const TQCString& line ) +{ + m_appFrontend->addPartialStdoutLine(line); +} diff --git a/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h new file mode 100644 index 00000000..3903e897 --- /dev/null +++ b/lib/interfaces/extensions/dcop/KDevAppFrontendIface.h @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Roberto Raggi + Copyright (C) 2002 Bernd Gehrmann + Copyright (C) 2003 Amilcar do Carmo Lucas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef _KDEVAPPFRONTENDIFACE_H_ +#define _KDEVAPPFRONTENDIFACE_H_ + +#include + +class KDevAppFrontend; + +class KDevAppFrontendIface : public DCOPObject +{ + K_DCOP + +public: + + KDevAppFrontendIface( KDevAppFrontend *appFrontend ); + ~KDevAppFrontendIface(); + +k_dcop: + void startAppCommand(const TQString &directory, const TQString &command, bool inTerminal); + void stopApplication(); + bool isRunning(); + void clearView(); + void insertStderrLine(const TQCString &line); + void insertStdoutLine(const TQCString &line); + void addPartialStderrLine(const TQCString &line); + void addPartialStdoutLine(const TQCString &line); + +private: + KDevAppFrontend *m_appFrontend; +}; + +#endif diff --git a/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp new file mode 100644 index 00000000..73305e4a --- /dev/null +++ b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp @@ -0,0 +1,46 @@ + + +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001 Bernd Gehrmann + Copyright (C) 2002 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "KDevMakeFrontendIface.h" +#include "kdevmakefrontend.h" + + +KDevMakeFrontendIface::KDevMakeFrontendIface(KDevMakeFrontend *makeFrontend) + : DCOPObject("KDevMakeFrontend") +{ + m_makeFrontend = makeFrontend; +} + + +KDevMakeFrontendIface::~KDevMakeFrontendIface() +{} + + +void KDevMakeFrontendIface::queueCommand(const TQString &dir, const TQString &command) +{ + m_makeFrontend->queueCommand(dir, command); +} + +bool KDevMakeFrontendIface::isRunning( ) +{ + return m_makeFrontend->isRunning(); +} diff --git a/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h new file mode 100644 index 00000000..53217359 --- /dev/null +++ b/lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h @@ -0,0 +1,45 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001 Bernd Gehrmann + Copyright (C) 2002 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef _KDEVMAKEFRONTENDIFACE_H_ +#define _KDEVMAKEFRONTENDIFACE_H_ + +#include + +class KDevMakeFrontend; + +class KDevMakeFrontendIface : public DCOPObject +{ + K_DCOP + +public: + + KDevMakeFrontendIface( KDevMakeFrontend *makeFrontend ); + ~KDevMakeFrontendIface(); + +k_dcop: + void queueCommand(const TQString &dir, const TQString &command); + bool isRunning(); + +private: + KDevMakeFrontend *m_makeFrontend; +}; + +#endif diff --git a/lib/interfaces/extensions/dcop/Makefile.am b/lib/interfaces/extensions/dcop/Makefile.am index e46606ac..116c4979 100644 --- a/lib/interfaces/extensions/dcop/Makefile.am +++ b/lib/interfaces/extensions/dcop/Makefile.am @@ -1,10 +1,10 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions $(all_includes) METASOURCES = AUTO -noinst_LTLIBRARIES = libtdevdcopextensions.la -libtdevdcopextensions_la_LDFLAGS = $(all_libraries) -libtdevdcopextensions_la_SOURCES = TDevAppFrontendIface.cpp \ - TDevMakeFrontendIface.cpp TDevAppFrontendIface.skel TDevMakeFrontendIface.skel +noinst_LTLIBRARIES = libkdevdcopextensions.la +libkdevdcopextensions_la_LDFLAGS = $(all_libraries) +libkdevdcopextensions_la_SOURCES = KDevAppFrontendIface.cpp \ + KDevMakeFrontendIface.cpp KDevAppFrontendIface.skel KDevMakeFrontendIface.skel dcopincludeextdir = $(includedir)/tdevelop/interfaces/extensions/dcop -dcopincludeext_HEADERS = TDevAppFrontendIface.h TDevMakeFrontendIface.h +dcopincludeext_HEADERS = KDevAppFrontendIface.h KDevMakeFrontendIface.h diff --git a/lib/interfaces/extensions/dcop/TDevAppFrontendIface.cpp b/lib/interfaces/extensions/dcop/TDevAppFrontendIface.cpp deleted file mode 100644 index a42d0d7d..00000000 --- a/lib/interfaces/extensions/dcop/TDevAppFrontendIface.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Roberto Raggi - Copyright (C) 2002 Bernd Gehrmann - Copyright (C) 2003 Amilcar do Carmo Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "TDevAppFrontendIface.h" -#include "tdevappfrontend.h" - - -TDevAppFrontendIface::TDevAppFrontendIface(TDevAppFrontend *appFrontend) - : DCOPObject("TDevAppFrontend"), m_appFrontend(appFrontend) -{ -} - - -TDevAppFrontendIface::~TDevAppFrontendIface() -{} - - -void TDevAppFrontendIface::startAppCommand(const TQString &directory, const TQString &command, bool inTerminal) -{ - m_appFrontend->startAppCommand(directory, command, inTerminal); -} - -void TDevAppFrontendIface::stopApplication( ) -{ - m_appFrontend->stopApplication(); -} - -bool TDevAppFrontendIface::isRunning( ) -{ - return m_appFrontend->isRunning(); -} - -void TDevAppFrontendIface::clearView( ) -{ - m_appFrontend->clearView(); -} - -void TDevAppFrontendIface::insertStderrLine( const TQCString & line ) -{ - m_appFrontend->insertStderrLine(line); -} - -void TDevAppFrontendIface::insertStdoutLine( const TQCString & line ) -{ - m_appFrontend->insertStdoutLine(line); -} - -void TDevAppFrontendIface::addPartialStderrLine( const TQCString& line ) -{ - m_appFrontend->addPartialStderrLine(line); -} - -void TDevAppFrontendIface::addPartialStdoutLine( const TQCString& line ) -{ - m_appFrontend->addPartialStdoutLine(line); -} diff --git a/lib/interfaces/extensions/dcop/TDevAppFrontendIface.h b/lib/interfaces/extensions/dcop/TDevAppFrontendIface.h deleted file mode 100644 index 5061c782..00000000 --- a/lib/interfaces/extensions/dcop/TDevAppFrontendIface.h +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Roberto Raggi - Copyright (C) 2002 Bernd Gehrmann - Copyright (C) 2003 Amilcar do Carmo Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef _TDEVAPPFRONTENDIFACE_H_ -#define _TDEVAPPFRONTENDIFACE_H_ - -#include - -class TDevAppFrontend; - -class TDevAppFrontendIface : public DCOPObject -{ - K_DCOP - -public: - - TDevAppFrontendIface( TDevAppFrontend *appFrontend ); - ~TDevAppFrontendIface(); - -k_dcop: - void startAppCommand(const TQString &directory, const TQString &command, bool inTerminal); - void stopApplication(); - bool isRunning(); - void clearView(); - void insertStderrLine(const TQCString &line); - void insertStdoutLine(const TQCString &line); - void addPartialStderrLine(const TQCString &line); - void addPartialStdoutLine(const TQCString &line); - -private: - TDevAppFrontend *m_appFrontend; -}; - -#endif diff --git a/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.cpp b/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.cpp deleted file mode 100644 index 06bd432f..00000000 --- a/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001 Bernd Gehrmann - Copyright (C) 2002 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "TDevMakeFrontendIface.h" -#include "tdevmakefrontend.h" - - -TDevMakeFrontendIface::TDevMakeFrontendIface(TDevMakeFrontend *makeFrontend) - : DCOPObject("TDevMakeFrontend") -{ - m_makeFrontend = makeFrontend; -} - - -TDevMakeFrontendIface::~TDevMakeFrontendIface() -{} - - -void TDevMakeFrontendIface::queueCommand(const TQString &dir, const TQString &command) -{ - m_makeFrontend->queueCommand(dir, command); -} - -bool TDevMakeFrontendIface::isRunning( ) -{ - return m_makeFrontend->isRunning(); -} diff --git a/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.h b/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.h deleted file mode 100644 index 3aee75be..00000000 --- a/lib/interfaces/extensions/dcop/TDevMakeFrontendIface.h +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001 Bernd Gehrmann - Copyright (C) 2002 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef _TDEVMAKEFRONTENDIFACE_H_ -#define _TDEVMAKEFRONTENDIFACE_H_ - -#include - -class TDevMakeFrontend; - -class TDevMakeFrontendIface : public DCOPObject -{ - K_DCOP - -public: - - TDevMakeFrontendIface( TDevMakeFrontend *makeFrontend ); - ~TDevMakeFrontendIface(); - -k_dcop: - void queueCommand(const TQString &dir, const TQString &command); - bool isRunning(); - -private: - TDevMakeFrontend *m_makeFrontend; -}; - -#endif diff --git a/lib/interfaces/extensions/kdevappfrontend.cpp b/lib/interfaces/extensions/kdevappfrontend.cpp new file mode 100644 index 00000000..3d918fe2 --- /dev/null +++ b/lib/interfaces/extensions/kdevappfrontend.cpp @@ -0,0 +1,2 @@ +#include "kdevappfrontend.h" +#include "kdevappfrontend.moc" diff --git a/lib/interfaces/extensions/kdevappfrontend.h b/lib/interfaces/extensions/kdevappfrontend.h new file mode 100644 index 00000000..76952f35 --- /dev/null +++ b/lib/interfaces/extensions/kdevappfrontend.h @@ -0,0 +1,116 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002 John Firebaugh + Copyright (C) 2003 Amilcar do Carmo Lucas + Copyright (C) 2003 Hamish Rodda + Copyright (C) 2003 Jens Dagerbo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVAPPFRONTEND_H +#define KDEVAPPFRONTEND_H + +#include +#include + +/** +@file kdevappfrontend.h +Application frontend interface. +*/ + +/** +Application frontend interface. +This interface is responsible for handling the running of an application in KDevelop. +Currently, this interface defines ways to do the following: +- check if the application is running; +- execute the application; +- stop the currently running application; +- control the output view as seen in the 'Application' tool dock. + +Instances that implement this interface are available through extension architecture: +@code +KDevAppFrontend *apf = extension("TDevelop/AppFrontend"); +if (apf) { + // do something +} else { + // fail +} +@endcode +@sa KDevPlugin::extension method documentation. +*/ +class KDevAppFrontend : public KDevPlugin +{ + Q_OBJECT + + +public: + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevAppFrontend(const KDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) + :KDevPlugin(info, parent, name ? name : "KDevAppFrontend") {} + + /**@return Whether the application is currently running.*/ + virtual bool isRunning() = 0; + +public slots: + /** + * The component shall start to execute an app-like command. + * Running the application is always asynchronous. + * @param directory The working directory to start the app in, + * if empty then the user's home directory is used. + * @param program A program to start. + * @param inTerminal If true then the program is started in an external konsole. + */ + virtual void startAppCommand(const TQString &directory, const TQString &program, bool inTerminal) = 0; + + /** + * Stops the currently running application. + */ + virtual void stopApplication() = 0; + + /** + * Inserts a string into the application output view. + * @param line A string to insert. + */ + virtual void insertStdoutLine(const TQCString &line) = 0; + + /** + * Inserts a string into the application output view marked as stderr output + * (usually colored). + * @param line An error string to insert. + */ + virtual void insertStderrLine(const TQCString &line) = 0; + + virtual void addPartialStderrLine( const TQCString& line ) = 0; + virtual void addPartialStdoutLine( const TQCString& line ) = 0; + + /** + * Clears the output view. + */ + virtual void clearView() = 0; +}; + +#endif diff --git a/lib/interfaces/extensions/kdevcreatefile.h b/lib/interfaces/extensions/kdevcreatefile.h new file mode 100644 index 00000000..35b98d19 --- /dev/null +++ b/lib/interfaces/extensions/kdevcreatefile.h @@ -0,0 +1,146 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Julian Rockey + Copyright (C) 2003 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVCREATEFILE_H +#define KDEVCREATEFILE_H + +#include + +#include + +/** +@file kdevcreatefile.h +File creation facility interface. +*/ + +/** +File creation facility interface. + +An abstract class for all extensions that are responsible for file creation. + +Instances that implement this interface are available through extension architecture: +@code +KDevCreateFile *cf = extension("TDevelop/CreateFile"); +if (cf) { + // do something +} else { + // fail +} +@endcode +@sa KDevPlugin::extension method documentation. +*/ +class KDevCreateFile : public KDevPlugin +{ + +public: + /**File created with @ref KDevCreateFile implementation.*/ + class CreatedFile { + + public: + /**The status of a file.*/ + enum Status { + STATUS_OK /** + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevdifffrontend.h" + + +KDevDiffFrontend::KDevDiffFrontend(const KDevPluginInfo *info, TQObject *parent, const char *name) + : KDevPlugin(info, parent, name ? name : "KDevDiffFrontend") +{ +} + +KDevDiffFrontend::~KDevDiffFrontend() +{ +} + +#include "kdevdifffrontend.moc" diff --git a/lib/interfaces/extensions/kdevdifffrontend.h b/lib/interfaces/extensions/kdevdifffrontend.h new file mode 100644 index 00000000..6d4cb2b6 --- /dev/null +++ b/lib/interfaces/extensions/kdevdifffrontend.h @@ -0,0 +1,79 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Harald Fernengel + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVDIFFFRONTEND_H +#define KDEVDIFFFRONTEND_H + +#include +#include + +/** +@file kdevdifffrontend.h +Diff frontend interface. +*/ + +/** +KDevelop diff frontend interface. +This is the abstract base class for plugins that want to display differencies between +files. + +Instances that implement this interface are available through extension architecture: +@code +KDevDiffFrontend *df = extension("TDevelop/DiffFrontend"); +if (df) { + // do something +} else { + // fail +} +@endcode +@sa KDevPlugin::extension method documentation. +*/ +class KDevDiffFrontend : public KDevPlugin +{ + +public: + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevDiffFrontend( const KDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) + :KDevPlugin(info, parent, name ? name : "KDevDiffFrontend") {} + + /**Displays the patch. + @param diff A string which contains a patch in unified format.*/ + virtual void showDiff( const TQString& diff ) = 0; + + /**Displays a patch file. + @param url An url of the patch file.*/ + virtual void openURL( const KURL &url ) = 0; + + /**Displays the difference between the two files. + @param url1 First file to compare. + @param url2 Second file to compare.*/ + virtual void showDiff( const KURL &url1, const KURL &url2 ) = 0; + +}; + +#endif diff --git a/lib/interfaces/extensions/kdevmakefrontend.cpp b/lib/interfaces/extensions/kdevmakefrontend.cpp new file mode 100644 index 00000000..5e035270 --- /dev/null +++ b/lib/interfaces/extensions/kdevmakefrontend.cpp @@ -0,0 +1,2 @@ +#include "kdevmakefrontend.h" +#include "kdevmakefrontend.moc" diff --git a/lib/interfaces/extensions/kdevmakefrontend.h b/lib/interfaces/extensions/kdevmakefrontend.h new file mode 100644 index 00000000..52afa3d3 --- /dev/null +++ b/lib/interfaces/extensions/kdevmakefrontend.h @@ -0,0 +1,107 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001 Sandy Meier + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Amilcar do Carmo Lucas + Copyright (C) 2003 Hamish Rodda + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVMAKEFRONTEND_H +#define KDEVMAKEFRONTEND_H + +#include +#include + +/** +@file kdevmakefrontend.h +Make frontend interface. +*/ + +/** +KDevelop make frontend interface. +This is the abstract base class for plugins that are able to run "make" +or similar commands to build a project, api documentation, etc. + +Instances that implement this interface are available through extension architecture: +@code +KDevMakeFrontend *mf = extension("TDevelop/MakeFrontend"); +if (mf) { + // do something +} else { + // fail +} +@endcode +@sa KDevPlugin::extension method documentation. +*/ +class KDevMakeFrontend : public KDevPlugin +{ + Q_OBJECT + + +public: + + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevMakeFrontend(const KDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) + :KDevPlugin(info, parent, name ? name : "KDevMakeFrontend") {} + + /**@return The widget where the make output is shown.*/ + virtual TQWidget* widget() { return 0L; } + + /**The component shall start to execute a make-like command. + * Commands are always asynchronous. You can submit several jobs + * without caring about another job already running. There are + * executed in the order in which they are submitted. If one of + * then fails, all following jobs are dropped. + * You should not make any assumptions about the directory in which + * the command is started. If the command depends on that, put and + * explicit 'cd' into the command. + * @param dir A starting directory to find files when parsing compiler error + * messages. + * @param command A shell command to execute. + */ + virtual void queueCommand(const TQString &dir, const TQString &command) = 0; + + /**@return Whether the application is currently running.*/ + virtual bool isRunning() = 0; + + /**Advices to synchronize the settings from TDEConfig because they were changed externally.*/ + virtual void updateSettingsFromConfig() = 0; + +signals: + /** + * Only emitted if the command was succesfully finished. + */ + void commandFinished(const TQString &command); + + /** + * Emitted if a command failed. + */ + void commandFailed(const TQString &command); +}; + +#endif diff --git a/lib/interfaces/extensions/kdevquickopen.h b/lib/interfaces/extensions/kdevquickopen.h new file mode 100644 index 00000000..91dce7ca --- /dev/null +++ b/lib/interfaces/extensions/kdevquickopen.h @@ -0,0 +1,130 @@ +/* This file is part of the KDE project + Copyright (C) 2007 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVQUICKOPEN_H +#define KDEVQUICKOPEN_H + +#include +#include + +/** +@file kdevquickopen.h +Source formatter interface. +*/ + +/** +Quick open plugin interface. + +Use it when you need to present a dialog to choose between files to open. +@code +KDevQuickOpen *qo = extension("TDevelop/QuickOpen"); +if (qo) { + // do something +} else { + // fail +} +@endcode +@sa @ref KDevPlugin::extension method documentation. +@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. +*/ +class KDevQuickOpen : public KDevPlugin +{ +public: + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevQuickOpen(const KDevPluginInfo *info, TQObject* parent, const char* name) + :KDevPlugin(info, parent, name) {} + + /**Shows the file selection dialog. + @param text A list of urls to open.*/ + virtual void quickOpenFile(const KURL::List urls) = 0; +}; + +#endif +/* This file is part of the KDE project + Copyright (C) 2007 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVQUICKOPEN_H +#define KDEVQUICKOPEN_H + +#include +#include + +/** +@file kdevquickopen.h +Source formatter interface. +*/ + +/** +Quick open plugin interface. + +Use it when you need to present a dialog to choose between files to open. +@code +KDevQuickOpen *qo = extension("TDevelop/QuickOpen"); +if (qo) { + // do something +} else { + // fail +} +@endcode +@sa @ref KDevPlugin::extension method documentation. +@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. +*/ +class KDevQuickOpen : public KDevPlugin +{ +public: + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevQuickOpen(const KDevPluginInfo *info, TQObject* parent, const char* name) + :KDevPlugin(info, parent, name) {} + + /**Shows the file selection dialog. + @param text A list of urls to open.*/ + virtual void quickOpenFile(const KURL::List urls) = 0; +}; + +#endif diff --git a/lib/interfaces/extensions/kdevsourceformatter.h b/lib/interfaces/extensions/kdevsourceformatter.h new file mode 100644 index 00000000..c4a380cf --- /dev/null +++ b/lib/interfaces/extensions/kdevsourceformatter.h @@ -0,0 +1,69 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVSOURCEFORMATTER_H +#define KDEVSOURCEFORMATTER_H + +#include + +/** +@file kdevsourceformatter.h +Source formatter interface. +*/ + +/** +Source formatter interface. +This interface is responsible for formatting source files and strings of code. + +Instances that implement this interface are available through extension architecture: +@code +KDevSourceFormatter *sf = extension("TDevelop/SourceFormatter"); +if (sf) { + // do something +} else { + // fail +} +@endcode +@sa @ref KDevPlugin::extension method documentation. +@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. +*/ +class KDevSourceFormatter : public KDevPlugin +{ +public: + /**Constructor. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevSourceFormatter(const KDevPluginInfo *info, TQObject* parent, const char* name) + :KDevPlugin(info, parent, name) {} + + /**Formats the source. + @param text A string with a code. + @return The formatted string.*/ + virtual TQString formatSource(const TQString text) = 0; + + /**@return The indentation string. For example, tab or four spaces can be returned.*/ + virtual TQString indentString() const = 0; +}; + +#endif diff --git a/lib/interfaces/extensions/kdevversioncontrol.h b/lib/interfaces/extensions/kdevversioncontrol.h new file mode 100644 index 00000000..a19c6275 --- /dev/null +++ b/lib/interfaces/extensions/kdevversioncontrol.h @@ -0,0 +1,239 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2003 Mario Scalas + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVVERSIONCONTROL_H +#define KDEVVERSIONCONTROL_H + +#include +#include +#include +#include +#include + +#include + +/** +@file kdevversioncontrol.h +Version control system interface and utility classes. +*/ + +/** +Info about file state in VCS. + +Used, for example in file views to display VCS related information about files. +*/ +struct VCSFileInfo +{ + /**State of the file.*/ + enum FileState { + Unknown /** VCSFileInfoMap; @endcode +*/ +typedef TQMap VCSFileInfoMap; + +class KDevVCSFileInfoProvider; + + +/** +KDevelop version control system interface. +This is the abstract base class which encapsulates everything +necessary for communicating with version control systems. +VCS support plugins should implement this interface. + +Instances that implement this interface are available through extension architecture: +@code +KDevVersionControl *vcs = extension("TDevelop/VersionControl"); +if (vcs) { + // do something +} else { + // fail +} +@endcode +@sa KDevPlugin::extension method documentation. +*/ +class KDevVersionControl: public KDevPlugin +{ + Q_OBJECT + + +public: + /**Constructs a VCS plugin. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevVersionControl(const KDevPluginInfo *info, TQObject *parent, const char *name ) + :KDevPlugin(info, parent, name ) {} + + /**Creates a new project in the passed path @p dir. This should instantiate + VCS infrastructure and import a project into the VCS in that directory. + @param dir The absolute path to the directory where VCS infrastructure should be + created.*/ + virtual void createNewProject(const TQString& dir) = 0; + + /**Fetches a module from remote repository, so it can be used for importing. + @return true in case of success.*/ + virtual bool fetchFromRepository() = 0; + + /**@return The file info provider for this version control (0 if none is available).*/ + virtual KDevVCSFileInfoProvider *fileInfoProvider() const = 0; + + /**Checks if the directory is valid for this version control (for example + CVS may check for the presence of "/CVS/" subdir and something else) + @param dirPath The absolute path of the directory. + @return true if the directory is valid for this version control + warning: this returns false by default.*/ + virtual bool isValidDirectory(const TQString &dirPath) const = 0; + + +signals: + /**Emitted when the Version Control has finished importing a module from remote + repository + @param destinationDir The directory where the module has been fetched.*/ + void finishedFetching(TQString destinationDir); + +}; + +/** +Basic interface for providing info on file registered in a version control repository repository. +*/ +class KDevVCSFileInfoProvider: public TQObject +{ + Q_OBJECT + +public: + /**Constructor. + @param parent The parent VCS plugin. + @param name The name of a provider object.*/ + KDevVCSFileInfoProvider(KDevVersionControl *parent, const char *name) + : TQObject( parent, name ), m_owner(parent) {} + + /**Gets the status for local files in the specified directory: + the info are collected locally so they are necessarily in sync with the repository + + This is a synchronous operation (blocking). + @param dirPath The relative (to project dir) directory path to stat. + @return Status for all registered files.*/ + virtual const VCSFileInfoMap *status(const TQString &dirPath) = 0; + + /**Starts a request for directory status to the remote repository. + Requests and answers are asynchronous. + + This is an asynchronous operation for requesting data, so + for obvious reasons: the caller must connect the statusReady() signal and + check for the return value of this method. + @param dirPath The (relative to project directory) directory which status you are asking for. + @param callerData The pointer to some data you want the provider will return + to you when it has done. + @param recursive If false, retrieve information only for dirPath's immediate children. + @param checkRepos If true, contact remote repository and augment repository's status. + If false, retrieve only for local modification information. + @return true if the request has been successfully started, false otherwise.*/ + virtual bool requestStatus( const TQString &dirPath, void *callerData, bool recursive = true, bool checkRepos = true ) = 0; + +signals: + /**Emitted when the status request to remote repository has finished. + @param fileInfoMap The status for registered in repository files. + @param callerData The pointer to some data you want the provider will return + to you when it has done + @see requestStatus for to find out when this signal should be used.*/ + void statusReady(const VCSFileInfoMap &fileInfoMap, void *callerData); + +protected: + /**@return The version control which owns this provider.*/ + KDevVersionControl *owner() const { return m_owner; } + +private: + KDevVersionControl *m_owner; + +private: + KDevVCSFileInfoProvider( const KDevVCSFileInfoProvider & ); + KDevVCSFileInfoProvider &operator=( const KDevVCSFileInfoProvider & ); +}; + +#endif diff --git a/lib/interfaces/extensions/tdevappfrontend.cpp b/lib/interfaces/extensions/tdevappfrontend.cpp deleted file mode 100644 index 4f7c52a7..00000000 --- a/lib/interfaces/extensions/tdevappfrontend.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "tdevappfrontend.h" -#include "tdevappfrontend.moc" diff --git a/lib/interfaces/extensions/tdevappfrontend.h b/lib/interfaces/extensions/tdevappfrontend.h deleted file mode 100644 index 085d3c9d..00000000 --- a/lib/interfaces/extensions/tdevappfrontend.h +++ /dev/null @@ -1,116 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2002 John Firebaugh - Copyright (C) 2003 Amilcar do Carmo Lucas - Copyright (C) 2003 Hamish Rodda - Copyright (C) 2003 Jens Dagerbo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVAPPFRONTEND_H -#define TDEVAPPFRONTEND_H - -#include -#include - -/** -@file tdevappfrontend.h -Application frontend interface. -*/ - -/** -Application frontend interface. -This interface is responsible for handling the running of an application in KDevelop. -Currently, this interface defines ways to do the following: -- check if the application is running; -- execute the application; -- stop the currently running application; -- control the output view as seen in the 'Application' tool dock. - -Instances that implement this interface are available through extension architecture: -@code -TDevAppFrontend *apf = extension("TDevelop/AppFrontend"); -if (apf) { - // do something -} else { - // fail -} -@endcode -@sa TDevPlugin::extension method documentation. -*/ -class TDevAppFrontend : public TDevPlugin -{ - Q_OBJECT - - -public: - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevAppFrontend(const TDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) - :TDevPlugin(info, parent, name ? name : "TDevAppFrontend") {} - - /**@return Whether the application is currently running.*/ - virtual bool isRunning() = 0; - -public slots: - /** - * The component shall start to execute an app-like command. - * Running the application is always asynchronous. - * @param directory The working directory to start the app in, - * if empty then the user's home directory is used. - * @param program A program to start. - * @param inTerminal If true then the program is started in an external konsole. - */ - virtual void startAppCommand(const TQString &directory, const TQString &program, bool inTerminal) = 0; - - /** - * Stops the currently running application. - */ - virtual void stopApplication() = 0; - - /** - * Inserts a string into the application output view. - * @param line A string to insert. - */ - virtual void insertStdoutLine(const TQCString &line) = 0; - - /** - * Inserts a string into the application output view marked as stderr output - * (usually colored). - * @param line An error string to insert. - */ - virtual void insertStderrLine(const TQCString &line) = 0; - - virtual void addPartialStderrLine( const TQCString& line ) = 0; - virtual void addPartialStdoutLine( const TQCString& line ) = 0; - - /** - * Clears the output view. - */ - virtual void clearView() = 0; -}; - -#endif diff --git a/lib/interfaces/extensions/tdevcreatefile.h b/lib/interfaces/extensions/tdevcreatefile.h deleted file mode 100644 index b1148e94..00000000 --- a/lib/interfaces/extensions/tdevcreatefile.h +++ /dev/null @@ -1,146 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Julian Rockey - Copyright (C) 2003 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVCREATEFILE_H -#define TDEVCREATEFILE_H - -#include - -#include - -/** -@file tdevcreatefile.h -File creation facility interface. -*/ - -/** -File creation facility interface. - -An abstract class for all extensions that are responsible for file creation. - -Instances that implement this interface are available through extension architecture: -@code -TDevCreateFile *cf = extension("TDevelop/CreateFile"); -if (cf) { - // do something -} else { - // fail -} -@endcode -@sa TDevPlugin::extension method documentation. -*/ -class TDevCreateFile : public TDevPlugin -{ - -public: - /**File created with @ref TDevCreateFile implementation.*/ - class CreatedFile { - - public: - /**The status of a file.*/ - enum Status { - STATUS_OK /** - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevdifffrontend.h" - - -TDevDiffFrontend::TDevDiffFrontend(const TDevPluginInfo *info, TQObject *parent, const char *name) - : TDevPlugin(info, parent, name ? name : "TDevDiffFrontend") -{ -} - -TDevDiffFrontend::~TDevDiffFrontend() -{ -} - -#include "tdevdifffrontend.moc" diff --git a/lib/interfaces/extensions/tdevdifffrontend.h b/lib/interfaces/extensions/tdevdifffrontend.h deleted file mode 100644 index c0c343cb..00000000 --- a/lib/interfaces/extensions/tdevdifffrontend.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Harald Fernengel - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVDIFFFRONTEND_H -#define TDEVDIFFFRONTEND_H - -#include -#include - -/** -@file tdevdifffrontend.h -Diff frontend interface. -*/ - -/** -KDevelop diff frontend interface. -This is the abstract base class for plugins that want to display differencies between -files. - -Instances that implement this interface are available through extension architecture: -@code -TDevDiffFrontend *df = extension("TDevelop/DiffFrontend"); -if (df) { - // do something -} else { - // fail -} -@endcode -@sa TDevPlugin::extension method documentation. -*/ -class TDevDiffFrontend : public TDevPlugin -{ - -public: - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevDiffFrontend( const TDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) - :TDevPlugin(info, parent, name ? name : "TDevDiffFrontend") {} - - /**Displays the patch. - @param diff A string which contains a patch in unified format.*/ - virtual void showDiff( const TQString& diff ) = 0; - - /**Displays a patch file. - @param url An url of the patch file.*/ - virtual void openURL( const KURL &url ) = 0; - - /**Displays the difference between the two files. - @param url1 First file to compare. - @param url2 Second file to compare.*/ - virtual void showDiff( const KURL &url1, const KURL &url2 ) = 0; - -}; - -#endif diff --git a/lib/interfaces/extensions/tdevmakefrontend.cpp b/lib/interfaces/extensions/tdevmakefrontend.cpp deleted file mode 100644 index 140d074d..00000000 --- a/lib/interfaces/extensions/tdevmakefrontend.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "tdevmakefrontend.h" -#include "tdevmakefrontend.moc" diff --git a/lib/interfaces/extensions/tdevmakefrontend.h b/lib/interfaces/extensions/tdevmakefrontend.h deleted file mode 100644 index 47b14fc4..00000000 --- a/lib/interfaces/extensions/tdevmakefrontend.h +++ /dev/null @@ -1,107 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001 Sandy Meier - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Amilcar do Carmo Lucas - Copyright (C) 2003 Hamish Rodda - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVMAKEFRONTEND_H -#define TDEVMAKEFRONTEND_H - -#include -#include - -/** -@file tdevmakefrontend.h -Make frontend interface. -*/ - -/** -KDevelop make frontend interface. -This is the abstract base class for plugins that are able to run "make" -or similar commands to build a project, api documentation, etc. - -Instances that implement this interface are available through extension architecture: -@code -TDevMakeFrontend *mf = extension("TDevelop/MakeFrontend"); -if (mf) { - // do something -} else { - // fail -} -@endcode -@sa TDevPlugin::extension method documentation. -*/ -class TDevMakeFrontend : public TDevPlugin -{ - Q_OBJECT - - -public: - - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevMakeFrontend(const TDevPluginInfo *info, TQObject *parent=0, const char *name=0 ) - :TDevPlugin(info, parent, name ? name : "TDevMakeFrontend") {} - - /**@return The widget where the make output is shown.*/ - virtual TQWidget* widget() { return 0L; } - - /**The component shall start to execute a make-like command. - * Commands are always asynchronous. You can submit several jobs - * without caring about another job already running. There are - * executed in the order in which they are submitted. If one of - * then fails, all following jobs are dropped. - * You should not make any assumptions about the directory in which - * the command is started. If the command depends on that, put and - * explicit 'cd' into the command. - * @param dir A starting directory to find files when parsing compiler error - * messages. - * @param command A shell command to execute. - */ - virtual void queueCommand(const TQString &dir, const TQString &command) = 0; - - /**@return Whether the application is currently running.*/ - virtual bool isRunning() = 0; - - /**Advices to synchronize the settings from TDEConfig because they were changed externally.*/ - virtual void updateSettingsFromConfig() = 0; - -signals: - /** - * Only emitted if the command was succesfully finished. - */ - void commandFinished(const TQString &command); - - /** - * Emitted if a command failed. - */ - void commandFailed(const TQString &command); -}; - -#endif diff --git a/lib/interfaces/extensions/tdevquickopen.h b/lib/interfaces/extensions/tdevquickopen.h deleted file mode 100644 index e1fd2f65..00000000 --- a/lib/interfaces/extensions/tdevquickopen.h +++ /dev/null @@ -1,130 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVQUICKOPEN_H -#define TDEVQUICKOPEN_H - -#include -#include - -/** -@file tdevquickopen.h -Source formatter interface. -*/ - -/** -Quick open plugin interface. - -Use it when you need to present a dialog to choose between files to open. -@code -KDevQuickOpen *qo = extension("TDevelop/QuickOpen"); -if (qo) { - // do something -} else { - // fail -} -@endcode -@sa @ref TDevPlugin::extension method documentation. -@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. -*/ -class KDevQuickOpen : public TDevPlugin -{ -public: - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - KDevQuickOpen(const TDevPluginInfo *info, TQObject* parent, const char* name) - :TDevPlugin(info, parent, name) {} - - /**Shows the file selection dialog. - @param text A list of urls to open.*/ - virtual void quickOpenFile(const KURL::List urls) = 0; -}; - -#endif -/* This file is part of the KDE project - Copyright (C) 2007 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVQUICKOPEN_H -#define TDEVQUICKOPEN_H - -#include -#include - -/** -@file tdevquickopen.h -Source formatter interface. -*/ - -/** -Quick open plugin interface. - -Use it when you need to present a dialog to choose between files to open. -@code -KDevQuickOpen *qo = extension("TDevelop/QuickOpen"); -if (qo) { - // do something -} else { - // fail -} -@endcode -@sa @ref TDevPlugin::extension method documentation. -@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. -*/ -class KDevQuickOpen : public TDevPlugin -{ -public: - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - KDevQuickOpen(const TDevPluginInfo *info, TQObject* parent, const char* name) - :TDevPlugin(info, parent, name) {} - - /**Shows the file selection dialog. - @param text A list of urls to open.*/ - virtual void quickOpenFile(const KURL::List urls) = 0; -}; - -#endif diff --git a/lib/interfaces/extensions/tdevsourceformatter.h b/lib/interfaces/extensions/tdevsourceformatter.h deleted file mode 100644 index 3403a5d2..00000000 --- a/lib/interfaces/extensions/tdevsourceformatter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003-2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVSOURCEFORMATTER_H -#define TDEVSOURCEFORMATTER_H - -#include - -/** -@file tdevsourceformatter.h -Source formatter interface. -*/ - -/** -Source formatter interface. -This interface is responsible for formatting source files and strings of code. - -Instances that implement this interface are available through extension architecture: -@code -KDevSourceFormatter *sf = extension("TDevelop/SourceFormatter"); -if (sf) { - // do something -} else { - // fail -} -@endcode -@sa @ref TDevPlugin::extension method documentation. -@sa @ref whatisextension and @ref creatingextension sections of Platform API documentation. -*/ -class KDevSourceFormatter : public TDevPlugin -{ -public: - /**Constructor. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - KDevSourceFormatter(const TDevPluginInfo *info, TQObject* parent, const char* name) - :TDevPlugin(info, parent, name) {} - - /**Formats the source. - @param text A string with a code. - @return The formatted string.*/ - virtual TQString formatSource(const TQString text) = 0; - - /**@return The indentation string. For example, tab or four spaces can be returned.*/ - virtual TQString indentString() const = 0; -}; - -#endif diff --git a/lib/interfaces/extensions/tdevversioncontrol.h b/lib/interfaces/extensions/tdevversioncontrol.h deleted file mode 100644 index d796e31f..00000000 --- a/lib/interfaces/extensions/tdevversioncontrol.h +++ /dev/null @@ -1,239 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2003 Mario Scalas - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVVERSIONCONTROL_H -#define TDEVVERSIONCONTROL_H - -#include -#include -#include -#include -#include - -#include - -/** -@file tdevversioncontrol.h -Version control system interface and utility classes. -*/ - -/** -Info about file state in VCS. - -Used, for example in file views to display VCS related information about files. -*/ -struct VCSFileInfo -{ - /**State of the file.*/ - enum FileState { - Unknown /** VCSFileInfoMap; @endcode -*/ -typedef TQMap VCSFileInfoMap; - -class TDevVCSFileInfoProvider; - - -/** -KDevelop version control system interface. -This is the abstract base class which encapsulates everything -necessary for communicating with version control systems. -VCS support plugins should implement this interface. - -Instances that implement this interface are available through extension architecture: -@code -TDevVersionControl *vcs = extension("TDevelop/VersionControl"); -if (vcs) { - // do something -} else { - // fail -} -@endcode -@sa TDevPlugin::extension method documentation. -*/ -class TDevVersionControl: public TDevPlugin -{ - Q_OBJECT - - -public: - /**Constructs a VCS plugin. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevVersionControl(const TDevPluginInfo *info, TQObject *parent, const char *name ) - :TDevPlugin(info, parent, name ) {} - - /**Creates a new project in the passed path @p dir. This should instantiate - VCS infrastructure and import a project into the VCS in that directory. - @param dir The absolute path to the directory where VCS infrastructure should be - created.*/ - virtual void createNewProject(const TQString& dir) = 0; - - /**Fetches a module from remote repository, so it can be used for importing. - @return true in case of success.*/ - virtual bool fetchFromRepository() = 0; - - /**@return The file info provider for this version control (0 if none is available).*/ - virtual TDevVCSFileInfoProvider *fileInfoProvider() const = 0; - - /**Checks if the directory is valid for this version control (for example - CVS may check for the presence of "/CVS/" subdir and something else) - @param dirPath The absolute path of the directory. - @return true if the directory is valid for this version control - warning: this returns false by default.*/ - virtual bool isValidDirectory(const TQString &dirPath) const = 0; - - -signals: - /**Emitted when the Version Control has finished importing a module from remote - repository - @param destinationDir The directory where the module has been fetched.*/ - void finishedFetching(TQString destinationDir); - -}; - -/** -Basic interface for providing info on file registered in a version control repository repository. -*/ -class TDevVCSFileInfoProvider: public TQObject -{ - Q_OBJECT - -public: - /**Constructor. - @param parent The parent VCS plugin. - @param name The name of a provider object.*/ - TDevVCSFileInfoProvider(TDevVersionControl *parent, const char *name) - : TQObject( parent, name ), m_owner(parent) {} - - /**Gets the status for local files in the specified directory: - the info are collected locally so they are necessarily in sync with the repository - - This is a synchronous operation (blocking). - @param dirPath The relative (to project dir) directory path to stat. - @return Status for all registered files.*/ - virtual const VCSFileInfoMap *status(const TQString &dirPath) = 0; - - /**Starts a request for directory status to the remote repository. - Requests and answers are asynchronous. - - This is an asynchronous operation for requesting data, so - for obvious reasons: the caller must connect the statusReady() signal and - check for the return value of this method. - @param dirPath The (relative to project directory) directory which status you are asking for. - @param callerData The pointer to some data you want the provider will return - to you when it has done. - @param recursive If false, retrieve information only for dirPath's immediate children. - @param checkRepos If true, contact remote repository and augment repository's status. - If false, retrieve only for local modification information. - @return true if the request has been successfully started, false otherwise.*/ - virtual bool requestStatus( const TQString &dirPath, void *callerData, bool recursive = true, bool checkRepos = true ) = 0; - -signals: - /**Emitted when the status request to remote repository has finished. - @param fileInfoMap The status for registered in repository files. - @param callerData The pointer to some data you want the provider will return - to you when it has done - @see requestStatus for to find out when this signal should be used.*/ - void statusReady(const VCSFileInfoMap &fileInfoMap, void *callerData); - -protected: - /**@return The version control which owns this provider.*/ - TDevVersionControl *owner() const { return m_owner; } - -private: - TDevVersionControl *m_owner; - -private: - TDevVCSFileInfoProvider( const TDevVCSFileInfoProvider & ); - TDevVCSFileInfoProvider &operator=( const TDevVCSFileInfoProvider & ); -}; - -#endif diff --git a/lib/interfaces/external/Mainpage.dox b/lib/interfaces/external/Mainpage.dox index 6c2fb2b9..4ed571dd 100644 --- a/lib/interfaces/external/Mainpage.dox +++ b/lib/interfaces/external/Mainpage.dox @@ -30,7 +30,7 @@ are connected to corresponding Q_SLOTS of TDevelop designer integration engine w Each language support which wants to use integrated designer, must reimplement @code -virtual TDevDesignerIntegration *TDevLanguageSupport::designer(KInterfaceDesigner::DesignerType type) +virtual KDevDesignerIntegration *KDevLanguageSupport::designer(KInterfaceDesigner::DesignerType type) @endcode method and return designer integration object. @@ -39,15 +39,15 @@ developers. With the convenience library writing %Qt designer integration for th trivial task. -\section tdevdesigner KDevelop Designer technical overview -KDevelop version >= 3.1 comes with a customized version (fork ;)) of %Qt Designer. It is called KDevelop Designer (TDevDesigner, tdevdesigner from the command line). TDevDesigner has some important differences: -- TDevDesigner provides a read/write KPart which can be embedded into any application which wants to edit .ui files. TDevelop IDE embeds TDevDesigner this way. -- TDevDesigner uses %KDE icons and dialogs and thus provides better integration with a system. +\section kdevdesigner KDevelop Designer technical overview +KDevelop version >= 3.1 comes with a customized version (fork ;)) of %Qt Designer. It is called KDevelop Designer (KDevDesigner, kdevdesigner from the command line). KDevDesigner has some important differences: +- KDevDesigner provides a read/write KPart which can be embedded into any application which wants to edit .ui files. TDevelop IDE embeds KDevDesigner this way. +- KDevDesigner uses %KDE icons and dialogs and thus provides better integration with a system. . -It is safe to preview forms with some %KDE widgets from tdeui and tdeio libraries - TDevDesigner part is linked to those libraries so it will not crash under some circumstances. +It is safe to preview forms with some %KDE widgets from tdeui and tdeio libraries - KDevDesigner part is linked to those libraries so it will not crash under some circumstances. -TDevDesigner will not create .ui.h files - this feature is completely disabled. Integrated TDevDesigner will use subclassing approach, standalone does not allow to enter code. +KDevDesigner will not create .ui.h files - this feature is completely disabled. Integrated KDevDesigner will use subclassing approach, standalone does not allow to enter code. \section other Other information diff --git a/lib/interfaces/extras/CMakeLists.txt b/lib/interfaces/extras/CMakeLists.txt index afe233aa..eb4cdb75 100644 --- a/lib/interfaces/extras/CMakeLists.txt +++ b/lib/interfaces/extras/CMakeLists.txt @@ -22,7 +22,7 @@ link_directories( ##### headers ################################### install( FILES - tdevcompileroptions.h tdevvcsintegrator.h + kdevcompileroptions.h kdevvcsintegrator.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/interfaces/extras ) install( FILES @@ -30,10 +30,10 @@ install( FILES DESTINATION ${SERVICETYPES_INSTALL_DIR} ) -##### tdevextras (shared) ####################### +##### kdevextras (shared) ####################### -tde_add_library( tdevextras SHARED AUTOMOC - SOURCES tdevcompileroptions.cpp tdevvcsintegrator.cpp +tde_add_library( kdevextras SHARED AUTOMOC + SOURCES kdevcompileroptions.cpp kdevvcsintegrator.cpp VERSION 0.0.0 LINK ${TQT_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} diff --git a/lib/interfaces/extras/Makefile.am b/lib/interfaces/extras/Makefile.am index c504621e..67615223 100644 --- a/lib/interfaces/extras/Makefile.am +++ b/lib/interfaces/extras/Makefile.am @@ -1,18 +1,18 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ $(all_includes) METASOURCES = AUTO -libtdevextras_la_LIBADD = $(LIB_QT) -libtdevextras_la_LDFLAGS = $(all_libraries) -lib_LTLIBRARIES = libtdevextras.la +libkdevextras_la_LIBADD = $(LIB_QT) +libkdevextras_la_LDFLAGS = $(all_libraries) +lib_LTLIBRARIES = libkdevextras.la tdevelopincludedir = $(includedir)/tdevelop/interfaces/extras servicetypedir = $(kde_servicetypesdir) -tdevelopinclude_HEADERS = tdevcompileroptions.h tdevvcsintegrator.h -libtdevextras_la_SOURCES = tdevcompileroptions.cpp tdevvcsintegrator.cpp +tdevelopinclude_HEADERS = kdevcompileroptions.h kdevvcsintegrator.h +libkdevextras_la_SOURCES = kdevcompileroptions.cpp kdevvcsintegrator.cpp servicetype_DATA = tdevelopcompileroptions.desktop \ tdevelopvcsintegrator.desktop -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils tdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevinterfaces DOXYGEN_PROJECTNAME = TDevelop Extra Interfaces Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am diff --git a/lib/interfaces/extras/kdevcompileroptions.cpp b/lib/interfaces/extras/kdevcompileroptions.cpp new file mode 100644 index 00000000..22c701f1 --- /dev/null +++ b/lib/interfaces/extras/kdevcompileroptions.cpp @@ -0,0 +1,8 @@ +#include "kdevcompileroptions.h" + +KDevCompilerOptions::KDevCompilerOptions( TQObject * parent, const char * name ) + :TQObject(parent, name) +{ +} + +#include "kdevcompileroptions.moc" diff --git a/lib/interfaces/extras/kdevcompileroptions.h b/lib/interfaces/extras/kdevcompileroptions.h new file mode 100644 index 00000000..6544c5d0 --- /dev/null +++ b/lib/interfaces/extras/kdevcompileroptions.h @@ -0,0 +1,91 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** +@file kdevcompileroptions.h +The interface to compiler options configuration. +*/ + +#ifndef _KDEVCOMPILEROPTIONS_H_ +#define _KDEVCOMPILEROPTIONS_H_ + +#include + +/** +The interface to compiler options configuration. +Used by build systems to give users a compiler options configuration dialog. + +Common use case: +@code +static KDevCompilerOptions *createCompilerOptions( const TQString &name, TQObject *parent ) +{ + KService::Ptr service = KService::serviceByDesktopName( name ); + if ( !service ) + return 0; + + KLibFactory *factory = KLibLoader::self()->factory(TQFile::encodeName(service->library())); + if (!factory) + return 0; + + TQStringList args; + TQVariant prop = service->property("X-TDevelop-Args"); + if (prop.isValid()) + args = TQStringList::split(" ", prop.toString()); + + TQObject *obj = factory->create(parent, service->name().latin1(), + "KDevCompilerOptions", args); + + if (!obj->inherits("KDevCompilerOptions")) + return 0; + + KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj; + return dlg; +} + +... +KDevCompilerOptions *plugin = createCompilerOptions(compilerName, parent); +TQString flags = ""; //old compiler flags +if ( plugin ) +{ + flags = plugin->exec( parent, flags ); //new compiler flags are returned + delete plugin; +} +@endcode +*/ +class KDevCompilerOptions : public TQObject +{ + Q_OBJECT + + +public: + KDevCompilerOptions( TQObject *parent=0, const char *name=0 ); + + /** + * Opens a dialog which allows the user to configure the + * compiler options. The initial settings in the dialog + * will be set from the flags argument of this method. + * After the dialog is accepted, the new settings will + * be returned as a string. If the dialog was cancelled, + * TQString() is returned. + */ + virtual TQString exec(TQWidget *parent, const TQString &flags) = 0; +}; + +#endif diff --git a/lib/interfaces/extras/kdevvcsintegrator.cpp b/lib/interfaces/extras/kdevvcsintegrator.cpp new file mode 100644 index 00000000..5a6ab429 --- /dev/null +++ b/lib/interfaces/extras/kdevvcsintegrator.cpp @@ -0,0 +1,26 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevvcsintegrator.h" + +KDevVCSIntegrator::KDevVCSIntegrator(TQObject *parent, const char *name) + :TQObject(parent, name) +{ +} + +#include "kdevvcsintegrator.moc" diff --git a/lib/interfaces/extras/kdevvcsintegrator.h b/lib/interfaces/extras/kdevvcsintegrator.h new file mode 100644 index 00000000..793070b3 --- /dev/null +++ b/lib/interfaces/extras/kdevvcsintegrator.h @@ -0,0 +1,77 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVVCSINTEGRATOR_H +#define KDEVVCSINTEGRATOR_H + +#include + +/** +@file kdevvcsintegrator.h +The interface to VCS integrators. +*/ + +class TQDomDocument; +class TQWidget; + +/** +VCS Integration Dialog. + +Usually it is created as: +@code +class MyVCSDialog: public TQWidget, public VCSDialog { + MyVCSDialog(TQWidget *parent = 0, const char *name = 0); + virtual void accept() { ... } + virtual void init(const TQString &projectName, const TQString &projectLocation) { ... } + virtual TQWidget *self() { + return const_cast(this); + } +} +@endcode +*/ +class VCSDialog { +public: + VCSDialog() { } + /**Implement all integration actions here. Do not use TQDialog::accept method + to perform integration actions.*/ + virtual void accept() = 0; + /**Init integration dialog with the project name and location.*/ + virtual void init(const TQString &projectName, const TQString &projectLocation) = 0; + /**Reimplement to return an actual integration widget. Use TQWidgets for that, not + TQDialogs because integrator dialogs are usually have parent containers.*/ + virtual TQWidget *self() = 0; +}; + +/** +The interface to VCS integrators. +VCS integrator takes care about setting up VCS for new and existing projects. +It can, for example, perform checkout or import operations. +*/ +class KDevVCSIntegrator: public TQObject { + Q_OBJECT + +public: + KDevVCSIntegrator(TQObject *parent = 0, const char *name = 0); + + /**Reimplement to return a dialog to fetch the project from VCS.*/ + virtual VCSDialog *fetcher(TQWidget *parent) = 0; + /**Reimplement to return a dialog to integrate the project into VCS.*/ + virtual VCSDialog *integrator(TQWidget *parent) = 0; +}; + +#endif diff --git a/lib/interfaces/extras/tdevcompileroptions.cpp b/lib/interfaces/extras/tdevcompileroptions.cpp deleted file mode 100644 index 9eead32f..00000000 --- a/lib/interfaces/extras/tdevcompileroptions.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "tdevcompileroptions.h" - -TDevCompilerOptions::TDevCompilerOptions( TQObject * parent, const char * name ) - :TQObject(parent, name) -{ -} - -#include "tdevcompileroptions.moc" diff --git a/lib/interfaces/extras/tdevcompileroptions.h b/lib/interfaces/extras/tdevcompileroptions.h deleted file mode 100644 index b8509a99..00000000 --- a/lib/interfaces/extras/tdevcompileroptions.h +++ /dev/null @@ -1,91 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -/** -@file tdevcompileroptions.h -The interface to compiler options configuration. -*/ - -#ifndef _TDEVCOMPILEROPTIONS_H_ -#define _TDEVCOMPILEROPTIONS_H_ - -#include - -/** -The interface to compiler options configuration. -Used by build systems to give users a compiler options configuration dialog. - -Common use case: -@code -static TDevCompilerOptions *createCompilerOptions( const TQString &name, TQObject *parent ) -{ - KService::Ptr service = KService::serviceByDesktopName( name ); - if ( !service ) - return 0; - - KLibFactory *factory = KLibLoader::self()->factory(TQFile::encodeName(service->library())); - if (!factory) - return 0; - - TQStringList args; - TQVariant prop = service->property("X-TDevelop-Args"); - if (prop.isValid()) - args = TQStringList::split(" ", prop.toString()); - - TQObject *obj = factory->create(parent, service->name().latin1(), - "TDevCompilerOptions", args); - - if (!obj->inherits("TDevCompilerOptions")) - return 0; - - TDevCompilerOptions *dlg = (TDevCompilerOptions*) obj; - return dlg; -} - -... -TDevCompilerOptions *plugin = createCompilerOptions(compilerName, parent); -TQString flags = ""; //old compiler flags -if ( plugin ) -{ - flags = plugin->exec( parent, flags ); //new compiler flags are returned - delete plugin; -} -@endcode -*/ -class TDevCompilerOptions : public TQObject -{ - Q_OBJECT - - -public: - TDevCompilerOptions( TQObject *parent=0, const char *name=0 ); - - /** - * Opens a dialog which allows the user to configure the - * compiler options. The initial settings in the dialog - * will be set from the flags argument of this method. - * After the dialog is accepted, the new settings will - * be returned as a string. If the dialog was cancelled, - * TQString() is returned. - */ - virtual TQString exec(TQWidget *parent, const TQString &flags) = 0; -}; - -#endif diff --git a/lib/interfaces/extras/tdevvcsintegrator.cpp b/lib/interfaces/extras/tdevvcsintegrator.cpp deleted file mode 100644 index 26bf915d..00000000 --- a/lib/interfaces/extras/tdevvcsintegrator.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevvcsintegrator.h" - -TDevVCSIntegrator::TDevVCSIntegrator(TQObject *parent, const char *name) - :TQObject(parent, name) -{ -} - -#include "tdevvcsintegrator.moc" diff --git a/lib/interfaces/extras/tdevvcsintegrator.h b/lib/interfaces/extras/tdevvcsintegrator.h deleted file mode 100644 index 23ee6c22..00000000 --- a/lib/interfaces/extras/tdevvcsintegrator.h +++ /dev/null @@ -1,77 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVVCSINTEGRATOR_H -#define TDEVVCSINTEGRATOR_H - -#include - -/** -@file tdevvcsintegrator.h -The interface to VCS integrators. -*/ - -class TQDomDocument; -class TQWidget; - -/** -VCS Integration Dialog. - -Usually it is created as: -@code -class MyVCSDialog: public TQWidget, public VCSDialog { - MyVCSDialog(TQWidget *parent = 0, const char *name = 0); - virtual void accept() { ... } - virtual void init(const TQString &projectName, const TQString &projectLocation) { ... } - virtual TQWidget *self() { - return const_cast(this); - } -} -@endcode -*/ -class VCSDialog { -public: - VCSDialog() { } - /**Implement all integration actions here. Do not use TQDialog::accept method - to perform integration actions.*/ - virtual void accept() = 0; - /**Init integration dialog with the project name and location.*/ - virtual void init(const TQString &projectName, const TQString &projectLocation) = 0; - /**Reimplement to return an actual integration widget. Use TQWidgets for that, not - TQDialogs because integrator dialogs are usually have parent containers.*/ - virtual TQWidget *self() = 0; -}; - -/** -The interface to VCS integrators. -VCS integrator takes care about setting up VCS for new and existing projects. -It can, for example, perform checkout or import operations. -*/ -class TDevVCSIntegrator: public TQObject { - Q_OBJECT - -public: - TDevVCSIntegrator(TQObject *parent = 0, const char *name = 0); - - /**Reimplement to return a dialog to fetch the project from VCS.*/ - virtual VCSDialog *fetcher(TQWidget *parent) = 0; - /**Reimplement to return a dialog to integrate the project into VCS.*/ - virtual VCSDialog *integrator(TQWidget *parent) = 0; -}; - -#endif diff --git a/lib/interfaces/katedocumentmanagerinterface.cpp b/lib/interfaces/katedocumentmanagerinterface.cpp index 360be1c4..0afbcc81 100644 --- a/lib/interfaces/katedocumentmanagerinterface.cpp +++ b/lib/interfaces/katedocumentmanagerinterface.cpp @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ #include "katedocumentmanagerinterface.h" -#include "tdevpartcontroller.h" +#include "kdevpartcontroller.h" #include #include #include @@ -26,7 +26,7 @@ #include #include -KateDocumentManagerInterface::KateDocumentManagerInterface( TDevPartController *pc) +KateDocumentManagerInterface::KateDocumentManagerInterface( KDevPartController *pc) : TQObject(pc), DCOPObject("KateDocumentManager"), m_controller(pc) { diff --git a/lib/interfaces/katedocumentmanagerinterface.h b/lib/interfaces/katedocumentmanagerinterface.h index 235c7738..8bdbdf8f 100644 --- a/lib/interfaces/katedocumentmanagerinterface.h +++ b/lib/interfaces/katedocumentmanagerinterface.h @@ -23,7 +23,7 @@ #include #include #include -class TDevPartController; +class KDevPartController; /** This is an emulated interface to provide compatibility with Kate scripts. @@ -36,7 +36,7 @@ class KateDocumentManagerInterface : public TQObject, public DCOPObject { // K_DCOP public: - KateDocumentManagerInterface( TDevPartController *pc ); + KateDocumentManagerInterface( KDevPartController *pc ); ~KateDocumentManagerInterface(); @@ -53,7 +53,7 @@ k_dcop: uint documents(); private: - TDevPartController *m_controller; + KDevPartController *m_controller; }; #endif diff --git a/lib/interfaces/kdevapi.cpp b/lib/interfaces/kdevapi.cpp new file mode 100644 index 00000000..04cf078d --- /dev/null +++ b/lib/interfaces/kdevapi.cpp @@ -0,0 +1,93 @@ +/* This file is part of the KDE project + Copyright (C) 2000-2001 Bernd Gehrmann + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevapi.h" + +#include "kdevcoderepository.h" + +/////////////////////////////////////////////////////////////////////////////// +// class KDevApi::Private +/////////////////////////////////////////////////////////////////////////////// + +class KDevApi::Private +{ +public: + Private() + : m_projectDom(0), m_project(0), m_languageSupport(0), + m_codeRepository(0) + {} + + TQDomDocument *m_projectDom; + KDevProject *m_project; + KDevLanguageSupport *m_languageSupport; + KDevCodeRepository* m_codeRepository; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class KDevApi +/////////////////////////////////////////////////////////////////////////////// + +KDevApi::KDevApi() +{ + d = new KDevApi::Private; + d->m_codeRepository = new KDevCodeRepository(); +} + +KDevApi::~KDevApi() +{ + delete d->m_codeRepository; + delete d; +} + +KDevProject *KDevApi::project() const +{ + return d->m_project; +} + +void KDevApi::setProject(KDevProject *project) +{ + d->m_project = project; +} + +KDevLanguageSupport *KDevApi::languageSupport() const +{ + return d->m_languageSupport; +} + +void KDevApi::setLanguageSupport(KDevLanguageSupport *languageSupport) +{ + d->m_languageSupport = languageSupport; +} + +TQDomDocument *KDevApi::projectDom() const +{ + return d->m_projectDom; +} + +void KDevApi::setProjectDom(TQDomDocument *dom) +{ + d->m_projectDom = dom; +} + +KDevCodeRepository *KDevApi::codeRepository() const +{ + return d->m_codeRepository; +} + +#include "kdevapi.moc" diff --git a/lib/interfaces/kdevapi.h b/lib/interfaces/kdevapi.h new file mode 100644 index 00000000..d1f4f5cc --- /dev/null +++ b/lib/interfaces/kdevapi.h @@ -0,0 +1,104 @@ +/* This file is part of the KDE project + Copyright (C) 2000-2001 Bernd Gehrmann + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVAPI_H +#define KDEVAPI_H + +#include + +class TQStringList; +class TQDomDocument; +class KDevCore; +class KDevProject; +class KDevLanguageSupport; +class CodeModel; +class KDevPartController; +class KDevMainWindow; +class KDevCodeRepository; +class KDevPlugin; +class KDevPluginController; + +/** +@file kdevapi.h +KDevelop API interface. +*/ + +/** +The interface to KDevelop's core components. +Needs to be implemented in a shell. Developers do not need to use this +class because @ref KDevPlugin already provides API convenience methods. +*/ +class KDevApi: public TQObject +{ + Q_OBJECT + +public: + /**Constructor.*/ + KDevApi(); + + /**Destructor.*/ + virtual ~KDevApi(); + + /**@return A reference to the toplevel widget.*/ + virtual KDevMainWindow *mainWindow() const = 0; + + /**@return A reference to the part controller which is used to manipulate loaded KParts.*/ + virtual KDevPartController *partController() const = 0; + + /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/ + virtual KDevPluginController *pluginController() const = 0; + + /**@return A reference to the application core - an object which provides + basic functionalities for inter-parts communications / cooperation.*/ + virtual KDevCore *core() const = 0; + + /**@return A reference to the memory symbol store.*/ + virtual CodeModel *codeModel() const = 0; + + /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/ + TQDomDocument *projectDom() const; + + /**Sets the Document Object Model for the current project. + @param dom The project DOM.*/ + void setProjectDom(TQDomDocument *dom); + + /**@return A reference to the current project component or 0 if no project is loaded.*/ + KDevProject *project() const; + + /**Sets the current project. + @param project The project plugin which becames the current project.*/ + void setProject(KDevProject *project); + + /**@return A reference to the language support component or 0 if no support available.*/ + KDevLanguageSupport *languageSupport() const; + + /**Sets the object charged of providing handling for the source files written in particular + language (languages support component). + @param languageSupport The language support plugin.*/ + void setLanguageSupport(KDevLanguageSupport *languageSupport); + + /**@return A reference to the code repository (accessor to persistent symbol stores).*/ + KDevCodeRepository *codeRepository() const; + +private: + class Private; + Private *d; +}; + +#endif diff --git a/lib/interfaces/kdevcoderepository.cpp b/lib/interfaces/kdevcoderepository.cpp new file mode 100644 index 00000000..26249544 --- /dev/null +++ b/lib/interfaces/kdevcoderepository.cpp @@ -0,0 +1,71 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevcoderepository.h" + +struct KDevCodeRepositoryData +{ + Catalog* mainCatalog; + TQValueList catalogs; + + KDevCodeRepositoryData(): mainCatalog( 0 ) {} +}; + +KDevCodeRepository::KDevCodeRepository( ) + : d( new KDevCodeRepositoryData ) +{ +} + +KDevCodeRepository::~KDevCodeRepository( ) +{ + delete( d ); +} + +Catalog* KDevCodeRepository::mainCatalog() +{ + return d->mainCatalog; +} + +void KDevCodeRepository::setMainCatalog( Catalog * mainCatalog ) +{ + d->mainCatalog = mainCatalog; +} + +void KDevCodeRepository::registerCatalog( Catalog * catalog ) +{ + d->catalogs.append( catalog ); + emit catalogRegistered( catalog ); +} + +void KDevCodeRepository::unregisterCatalog( Catalog * catalog ) +{ + d->catalogs.remove( catalog ); + emit catalogUnregistered( catalog ); +} + +void KDevCodeRepository::touchCatalog( Catalog * catalog ) +{ + emit catalogChanged( catalog ); +} + +TQValueList< Catalog * > KDevCodeRepository::registeredCatalogs( ) +{ + return d->catalogs; +} + +#include "kdevcoderepository.moc" diff --git a/lib/interfaces/kdevcoderepository.h b/lib/interfaces/kdevcoderepository.h new file mode 100644 index 00000000..4e1dd765 --- /dev/null +++ b/lib/interfaces/kdevcoderepository.h @@ -0,0 +1,95 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Roberto Raggi + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVCODEREPOSITORY_H +#define KDEVCODEREPOSITORY_H + +#include +#include + +/** +@file kdevcoderepository.h +Code repository - the persistent symbol store accessor. +*/ + +class KDevCodeRepositoryData; +class Catalog; + +/** +Code repository - the persistent symbol store accessor. +Symbols from parsed files can be saved to the persistent symbol store. +Persistence in this case means that symbol database is never loaded into memory +and works like a usual database which executes queries. + +Code repository consists from @ref Catalog objects that represent separate symbol +databases. Catalogs can be created/loaded/unloaded dynamically. +To find a symbol in the repository each catalog should be queried. + +Persistent symbol store is useful to keep information about code that +never or rarely changes. System libraries are perfect examples of such code. +Symbols from code contained in project files are better stored in memory +symbol store like @ref CodeModel. +*/ +class KDevCodeRepository : public TQObject +{ + Q_OBJECT + +public: + /**Constructor.*/ + KDevCodeRepository(); + /**Destructor.*/ + virtual ~KDevCodeRepository(); + + /**@return The main catalog. Each catalog can be marked is main + to provide easy access to it.*/ + Catalog* mainCatalog(); + /**Sets the main catalog. + @param mainCatalog The catalog to be marked as main.*/ + void setMainCatalog( Catalog* mainCatalog ); + + /**@return The list of registered catalogs.*/ + TQValueList registeredCatalogs(); + + /**Registers catalog in the repository. + @param catalog The catalog to register.*/ + void registerCatalog( Catalog* catalog ); + /**Unregisters catalog from the repository. + @param catalog The catalog to unregister.*/ + void unregisterCatalog( Catalog* catalog ); + /**Marks catalog as changed and emits @ref catalogChanged signal. + @param catalog The catalog to touch.*/ + void touchCatalog( Catalog* catalog ); + +signals: + /**Emitted when a new catalog is registered. + @param catalog The new catalog.*/ + void catalogRegistered( Catalog* catalog ); + + /**Emitted when a catalog in removed + @param catalog The catalog that was removed.*/ + void catalogUnregistered( Catalog* catalog ); + + /**Emitted when the contens of catalog is changed. + @param catalog Changed catalog.*/ + void catalogChanged( Catalog* catalog ); + +private: + KDevCodeRepositoryData* d; +}; + +#endif diff --git a/lib/interfaces/kdevcore.cpp b/lib/interfaces/kdevcore.cpp new file mode 100644 index 00000000..dda66cbf --- /dev/null +++ b/lib/interfaces/kdevcore.cpp @@ -0,0 +1,298 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003 Amilcar do Carmo Lucas + Copyright (C) 2003 Jens Dagerbo + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "KDevCoreIface.h" +#include "kdevcore.h" + +#include "urlutil.h" + +/////////////////////////////////////////////////////////////////////////////// +// class Context +/////////////////////////////////////////////////////////////////////////////// + +Context::Context() +{ +} + +Context::~Context() +{ +} + +bool Context::hasType( int aType ) const +{ + return aType == this->type(); +} + +/////////////////////////////////////////////////////////////////////////////// +// class EditorContext +/////////////////////////////////////////////////////////////////////////////// + +class EditorContext::Private +{ +public: + Private( const KURL &url, int line, int col, const TQString &linestr, + const TQString &wordstr ) + : m_url(url), m_line(line), m_col(col), + m_linestr(linestr), m_wordstr(wordstr) + { + } + + KURL m_url; + int m_line, m_col; + TQString m_linestr, m_wordstr; +}; + +EditorContext::EditorContext( const KURL &url, int line, int col, + const TQString &linestr, const TQString &wordstr ) + : Context(), d( new Private(url, line, col, linestr, wordstr) ) +{ +} + +EditorContext::~EditorContext() +{ + delete d; + d = 0; +} + +int EditorContext::type() const +{ + return Context::EditorContext; +} + +const KURL &EditorContext::url() const +{ + return d->m_url; +} + +int EditorContext::line() const +{ + return d->m_line; +} + +int EditorContext::col() const +{ + return d->m_col; +} + +TQString EditorContext::currentLine() const +{ + return d->m_linestr; +} + +TQString EditorContext::currentWord() const +{ + return d->m_wordstr; +} + +/////////////////////////////////////////////////////////////////////////////// +// class FileContext +/////////////////////////////////////////////////////////////////////////////// + +class FileContext::Private +{ +public: + Private( const KURL::List &someURLs ) : m_urls(someURLs) + { + if (m_urls.count() == 0) + { + m_fileName = "INVALID-FILENAME"; + m_isDirectory = false; // well, "true" should be ok too ... + } + else + { + m_fileName = m_urls[0].path(); + m_isDirectory = URLUtil::isDirectory( m_urls[0] ); + } + } + Private( const TQString &fileName, bool isDirectory ) + : m_fileName(fileName), m_isDirectory(isDirectory) + { + } + + KURL::List m_urls; + /// \FIXME the following data members should be removed, but first other + // parts should be modified to comply with this change. + TQString m_fileName; + bool m_isDirectory; +}; + +FileContext::FileContext( const KURL::List &someURLs ) + : Context(), d( new Private(someURLs) ) +{ +} + +FileContext::~FileContext() +{ + delete d; + d = 0; +} + +int FileContext::type() const +{ + return Context::FileContext; +} + +const KURL::List &FileContext::urls() const +{ + return d->m_urls; +} + +/////////////////////////////////////////////////////////////////////////////// +// class DocumentationContext +/////////////////////////////////////////////////////////////////////////////// + +class DocumentationContext::Private +{ +public: + Private( const TQString &url, const TQString &selection ) + : m_url(url), m_selection(selection) + { + } + + TQString m_url; + TQString m_selection; +}; + +DocumentationContext::DocumentationContext( const TQString &url, const TQString &selection ) + : Context(), d( new Private(url, selection) ) +{ +} + +DocumentationContext::DocumentationContext( const DocumentationContext &aContext ) + : Context(), d( 0 ) +{ + *this = aContext; +} + +DocumentationContext &DocumentationContext::operator=( const DocumentationContext &aContext) +{ + if (d) { + delete d; d = 0; + } + d = new Private( *aContext.d ); + return *this; +} + +DocumentationContext::~DocumentationContext() +{ + delete d; + d = 0; +} + +int DocumentationContext::type() const +{ + return Context::DocumentationContext; +} + +TQString DocumentationContext::url() const +{ + return d->m_url; +} + +TQString DocumentationContext::selection() const +{ + return d->m_selection; +} + +/////////////////////////////////////////////////////////////////////////////// +// class CodeModelItemContext +/////////////////////////////////////////////////////////////////////////////// + +class CodeModelItemContext::Private +{ +public: + Private( const CodeModelItem* item ) : m_item( item ) {} + + const CodeModelItem* m_item; +}; + +CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item ) + : Context(), d( new Private(item) ) +{ +} + +CodeModelItemContext::~CodeModelItemContext() +{ + delete d; + d = 0; +} + +int CodeModelItemContext::type() const +{ + return Context::CodeModelItemContext; +} + +const CodeModelItem* CodeModelItemContext::item() const +{ + return d->m_item; +} + +/////////////////////////////////////////////////////////////////////////////// +// class ProjectModelItemContext +/////////////////////////////////////////////////////////////////////////////// + +class ProjectModelItemContext::Private +{ +public: + Private( const ProjectModelItem* item ) : m_item( item ) {} + + const ProjectModelItem* m_item; +}; + +ProjectModelItemContext::ProjectModelItemContext( const ProjectModelItem* item ) + : Context(), d( new Private(item) ) +{ +} + +ProjectModelItemContext::~ProjectModelItemContext() +{ + delete d; + d = 0; +} + +int ProjectModelItemContext::type() const +{ + return Context::ProjectModelItemContext; +} + +const ProjectModelItem* ProjectModelItemContext::item() const +{ + return d->m_item; +} + + +/////////////////////////////////////////////////////////////////////////////// +// class KDevCore +/////////////////////////////////////////////////////////////////////////////// + +KDevCore::KDevCore( TQObject *parent, const char *name ) + : TQObject( parent, name ) +{ + new KDevCoreIface(this); +} + +KDevCore::~KDevCore() +{ +} + +#include "kdevcore.moc" diff --git a/lib/interfaces/kdevcore.h b/lib/interfaces/kdevcore.h new file mode 100644 index 00000000..fad2891a --- /dev/null +++ b/lib/interfaces/kdevcore.h @@ -0,0 +1,388 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2001 Sandy Meier + Copyright (C) 2002 Daniel Engelschalt + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003 Harald Fernengel + Copyright (C) 2003 Hamish Rodda + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVCORE_H +#define KDEVCORE_H + +/** +@file kdevcore.h +The interface to the application core and context menu classes. +*/ + +#include +#include +#include + +#include + +class KDialogBase; +class KDevPlugin; +class CodeModelItem; +class ProjectModelItem; + +namespace KParts +{ + class Part; +} + +class TQStatusBar; +class TQPopupMenu; + +/** +Base class for every context. +Think of a Context-based class as "useful +info associated to a context menu". Several context menu can be defined, +each defining different information: because of these context menus being +used in many modules, they are defined here. + +When context menu with a certain "context" associated appears, KDevelop core +sends a notification signal and all plugins which receive this signal have +the ability to add own items into the menu. For example, VCS plugin could +add "commit" and "update" menu items to the context menu of a file. + +How to use context from a plugin: +-# Create a popup menu in context menu event handler: @code TDEPopupMenu menu(this); @endcode +-# Create a context: @code MyContext context(param). @endcode +-# Fill a context menu: @code core()->fillContextMenu(&menu, &context); @endcode +-# Show the popup menu: @code menu.exec(event->globalPos()); @endcode +. +In this example @em event is an object of TQContextMenuEvent class which you have access +to if you reimplement TQWidget::contextMenuEvent method. + +How to fill context menu from a plugin: +-# Create a @code contextMenu(TQPopupMenu *, const Context *) @endcode slot in your plugin class. +-# Connect KDevCore::contextMenu(TQPopupMenu *, const Context *) signal to that slot in +the constructor of your plugin:\n +@code +connect(core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), + this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *))); +@endcode +-# Fill the menu in the slot you created, for example:\n +@code +if (context->hasType(Context::EditorContext)) +{ + const EditorContext *econtext = static_cast(context); + int id = popup->insertItem(i18n("My Menu Item 1"), this, TQT_SLOT(myMenuAction1())); + popup->setWhatsThis(id, i18n("What's this for my menu item 1")); +} +else if context->hasType(MyContext)) +{ + int id = popup->insertItem(... + ... +} +... +@endcode +*/ +class Context +{ +public: + /**Pre-defined context types. More may be added so it is possible to add custom + contexts. We reserve enum values until 1000 (yeah, it is one thousand ) + for tdevelop official context types.*/ + enum Type + { + EditorContext, /** + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevdesignerintegration.h" +#include "kdevdesignerintegrationiface.h" + +class KDevDesignerIntegration::KDevDesignerIntegrationPrivate { +public: + KDevDesignerIntegrationIface *m_iface; +}; + +KDevDesignerIntegration::KDevDesignerIntegration(TQObject *parent, const char *name) + : TQObject(parent, name) +{ + dptr = new KDevDesignerIntegrationPrivate(); + + dptr->m_iface = new KDevDesignerIntegrationIface(this); +} + +KDevDesignerIntegration::~KDevDesignerIntegration() +{ + delete dptr; +} + +#include "kdevdesignerintegration.moc" diff --git a/lib/interfaces/kdevdesignerintegration.h b/lib/interfaces/kdevdesignerintegration.h new file mode 100644 index 00000000..528926cb --- /dev/null +++ b/lib/interfaces/kdevdesignerintegration.h @@ -0,0 +1,98 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVDESIGNERINTEGRATION_H +#define KDEVDESIGNERINTEGRATION_H + +#include +#include +#include + +/** +@file kdevdesignerintegration.h +TDevelop designer integration interface. +*/ + +/** +TDevelop designer integration interface. +Designer integration object provides functionality which is used by integrated +into KDevelop GUI designers: +- adding/removing/editing functions (class methods); +- opening form implementation files; +- saving and loading designer integration settings. +. + +Designer integration is a layer between visual form (GUI) designer of any type +and the current language support. Usually designers create some kind of forms +and allow developers to define actions which are executed upon some GUI events +(for example, TQt Designer allows to define slots connected to GUI signals). +The actual code with action implementations needs to be written by hand in source +files. Designer integration captures such implementation requests and opens +necessary files at desired line numbers and adds (edits, removes) code for implementations. + +For example, TQt Designer integration should be able to create an subclass for a form +and reimplement slots defined in the form. +*/ +class KDevDesignerIntegration : public TQObject +{ +Q_OBJECT + +public: + /**Constructor. + @param parent Parent object. + @param name Internal name.*/ + KDevDesignerIntegration(TQObject *parent = 0, const char *name = 0); + /**Destructor.*/ + ~KDevDesignerIntegration(); + + /**Saves designer integration settings.*/ + virtual void saveSettings(TQDomDocument dom, TQString path) = 0; + /**Loads designer integration settings.*/ + virtual void loadSettings(TQDomDocument dom, TQString path) = 0; + +public slots: + /**Adds the implementation for a function. + @param formName The name of a GUI form. + @param function The function which needs to be implemented in the source.*/ + virtual void addFunction(const TQString &formName, KInterfaceDesigner::Function function) = 0; + + /**Removes the implementation of a function. + @param formName The name of a GUI form. + @param function The function which needs to be removed from the source.*/ + virtual void removeFunction(const TQString &formName, KInterfaceDesigner::Function function) = 0; + + /**Edites the implementation of a function. + @param formName The name of a GUI form. + @param oldFunction The function which needs to be edited from the source. + @param function The new function declaration.*/ + virtual void editFunction(const TQString &formName, KInterfaceDesigner::Function oldFunction, KInterfaceDesigner::Function function) = 0; + + /**Opens the function and jumps to the line number of its definition (declaration). + @param formName The name of a GUI form. + @param functionName The name of a function to find in the source.*/ + virtual void openFunction(const TQString &formName, const TQString &functionName) = 0; + + /**Opens the form source. + @param formName The name of a GUI form.*/ + virtual void openSource(const TQString &formName) = 0; + private: + class KDevDesignerIntegrationPrivate; + KDevDesignerIntegrationPrivate *dptr; +}; + +#endif diff --git a/lib/interfaces/kdevdesignerintegrationiface.cpp b/lib/interfaces/kdevdesignerintegrationiface.cpp new file mode 100644 index 00000000..964ca340 --- /dev/null +++ b/lib/interfaces/kdevdesignerintegrationiface.cpp @@ -0,0 +1,63 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Ian Reinhart Geiser + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevdesignerintegrationiface.h" +#include +#include "kdevdesignerintegration.h" + +KDevDesignerIntegrationIface::KDevDesignerIntegrationIface(KDevDesignerIntegration *p) + : DCOPObject("GUIDesigner"), m_designer(p) +{ + //FIXME figure out what number our interface is... +} + + +KDevDesignerIntegrationIface::~KDevDesignerIntegrationIface() +{ +} + +void KDevDesignerIntegrationIface::addFunction( const TQString & formName, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) +{ + KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; + m_designer->addFunction(formName, f); +} + +void KDevDesignerIntegrationIface::removeFunction( const TQString & formName, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) +{ + KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; + m_designer->addFunction(formName, f); +} + +void KDevDesignerIntegrationIface::editFunction( const TQString & formName, TQString oldReturnType, TQString oldFunction, TQString oldSpecifier, TQString oldAccess, uint oldType, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) +{ + KInterfaceDesigner::Function fold = {oldReturnType, oldFunction, oldSpecifier, oldAccess, (KInterfaceDesigner::FunctionType)oldType }; + KInterfaceDesigner::Function fnew = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; + m_designer->editFunction(formName,fold,fnew); +} + +void KDevDesignerIntegrationIface::openFunction( const TQString & formName, const TQString & functionName ) +{ + m_designer->openFunction(formName,functionName); +} + +void KDevDesignerIntegrationIface::openSource( const TQString & formName ) +{ + m_designer->openSource(formName); +} + + diff --git a/lib/interfaces/kdevdesignerintegrationiface.h b/lib/interfaces/kdevdesignerintegrationiface.h new file mode 100644 index 00000000..c6c8988a --- /dev/null +++ b/lib/interfaces/kdevdesignerintegrationiface.h @@ -0,0 +1,49 @@ +/* I am drunk. + Copyright (C) 2005 Ian Reinhart Geiser + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVDESIGNERINTEGRATIONIFACE_H +#define KDEVDESIGNERINTEGRATIONIFACE_H + +#include +class KDevDesignerIntegration; +/** +The dcop interface for GUI designers in KDevelop. + +@author KDevelop Authors +*/ +class KDevDesignerIntegrationIface : public DCOPObject +{ + K_DCOP +public: + KDevDesignerIntegrationIface(KDevDesignerIntegration *p); + + ~KDevDesignerIntegrationIface(); +k_dcop: + void addFunction(const TQString &formName, TQString returnType, TQString function,TQString specifier,TQString access,uint type); + void removeFunction(const TQString &formName, TQString returnType, TQString function,TQString specifier,TQString access,uint type); + void editFunction(const TQString &formName, TQString oldReturnType, TQString oldFunction, + TQString oldSpecifier,TQString oldAccess,uint oldType, + TQString returnType, TQString function,TQString specifier,TQString access,uint type); + void openFunction(const TQString &formName, const TQString &functionName); + void openSource(const TQString &formName); + + private: + KDevDesignerIntegration *m_designer; +}; + +#endif diff --git a/lib/interfaces/kdevgenericfactory.h b/lib/interfaces/kdevgenericfactory.h new file mode 100644 index 00000000..6f8d3dc9 --- /dev/null +++ b/lib/interfaces/kdevgenericfactory.h @@ -0,0 +1,91 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Harald Fernengel + * Copyright (C) 2004 Alexander Dymo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#include +#include + +/** +@file kdevgenericfactory.h +KDevelop generic plugin factory. +*/ + +/** +This class provides a generic implementation of a KLibFactory for +use with TDevelop plugins. +Usually it is convenient to use K_EXPORT_COMPONENT_FACTORY macro +to create factories for TDevelop plugins. For example, for DummyPlugin +the factory can be created (in dummyplugin.cpp file) as: +@code +typedef KDevGenericFactory DummyPluginFactory; +K_EXPORT_COMPONENT_FACTORY(libkdevdummyplugin, DummyPluginFactory( data ) ) +@endcode +Data should be a const static object. This way it complies with the requirements +for data objecs of KDevGenericFactory constructor. + +Important:
+There is no need to create @ref TDEAboutData objects. It is more useful to create +a static const @ref KDevPluginInfo object which can be used also in the constructor +of a plugin. + +For example, dummyplugin.cpp file could contain: +@code +#include + +static const KDevPluginInfo data("KDevDummyPlugin"); +typedef KDevGenericFactory DummyPluginFactory; +K_EXPORT_COMPONENT_FACTORY(libkdevdummyplugin, DummyPluginFactory( data ) ) + +DummyPlugin::DummyPlugin(TQObject *parent, const char *name, const TQStringList & ) + :KDevPlugin(&data, parent, name) +{ +} +@endcode + +In the example above the duplication of information is avoided as same @ref KDevPluginInfo +objects are used for plugin and for plugin factory. This is possible because @ref KDevPluginInfo +class has an operator to cast @ref KDevPluginInfo to @ref TDEAboutData. +*/ +template +class KDevGenericFactory: public KGenericFactory +{ +public: + /**Constructor. + @param data A reference to TDEAboutData with an information about the plugin. + Data should have: + - plugin name as an application name; + - untranslated plugin generic name as a product name; + - license type number. + . + data object should live as long as factory lives.*/ + KDevGenericFactory(TDEAboutData *data) + :KGenericFactory(data->appName()), aboutData(data) + { + } + + /**Creates an instance.*/ + TDEInstance *createInstance() + { + return new TDEInstance(aboutData); + } + +private: + TDEAboutData *aboutData; + +}; + diff --git a/lib/interfaces/kdevlanguagesupport.cpp b/lib/interfaces/kdevlanguagesupport.cpp new file mode 100644 index 00000000..aa5b560c --- /dev/null +++ b/lib/interfaces/kdevlanguagesupport.cpp @@ -0,0 +1,166 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Alexander Dymo + Copyright (C) 2003 Amilcar do Carmo Lucas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "codemodel.h" + +#include + +#include "kdevdesignerintegration.h" +#include "kdevlanguagesupport.h" + +KDevLanguageSupport::KDevLanguageSupport(const KDevPluginInfo *info, TQObject *parent, const char *name) + : KDevPlugin(info, parent, name ? name : "KDevLanguageSupport" ) +{ +} + +KDevLanguageSupport::~KDevLanguageSupport() +{ +} + +KDevLanguageSupport::Features KDevLanguageSupport::features() +{ + return Features(0); +} + +KMimeType::List KDevLanguageSupport::mimeTypes() +{ + return KMimeType::List(); +} + +TQString KDevLanguageSupport::formatTag( const Tag& /*tag*/ ) +{ + return TQString(); +} + +TQString KDevLanguageSupport::formatClassName(const TQString &name) +{ + return name; +} + +TQString KDevLanguageSupport::unformatClassName(const TQString &name) +{ + return name; +} + +bool KDevLanguageSupport::shouldSplitDocument(const KURL &url) +{ + return false; +} + +Qt::Orientation KDevLanguageSupport::splitOrientation() const +{ + return Qt::Vertical; +} + +void KDevLanguageSupport::addClass() +{ +} + +void KDevLanguageSupport::addMethod( ClassDom /*klass*/ ) +{ +} + +void KDevLanguageSupport::implementVirtualMethods( ClassDom /*klass*/ ) +{ +} + +void KDevLanguageSupport::addAttribute( ClassDom /*klass*/ ) +{ +} + +TQStringList KDevLanguageSupport::subclassWidget(const TQString& /*formName*/) +{ + return TQStringList(); +} + +TQStringList KDevLanguageSupport::updateWidget(const TQString& /*formName*/, const TQString& /*fileName*/) +{ + return TQStringList(); +} + +TQString KDevLanguageSupport::formatModelItem( const CodeModelItem *item, bool /*shortDescription*/ ) +{ + return item->name(); +} + +void KDevLanguageSupport::addFunction( DesignerType type, const TQString & formName, Function function ) +{ +// kdDebug() << "KDevLanguageSupport::addFunction: 1" << endl; + KDevDesignerIntegration *designerIntegration = designer(type); +// kdDebug() << "KDevLanguageSupport::addFunction: 2" << endl; + if (!designerIntegration) + { +// kdDebug() << "KDevLanguageSupport::addFunction: x" << endl; + return; + } +// kdDebug() << "KDevLanguageSupport::addFunction: 3" << endl; + designerIntegration->addFunction(formName, function); +// kdDebug() << "KDevLanguageSupport::addFunction: 4" << endl; +} + +void KDevLanguageSupport::editFunction( DesignerType type, const TQString & formName, Function oldFunction, Function function ) +{ + KDevDesignerIntegration *designerIntegration = designer(type); + if (!designerIntegration) + return; + designerIntegration->editFunction(formName, oldFunction, function); +} + +void KDevLanguageSupport::removeFunction( DesignerType type, const TQString & formName, Function function ) +{ + KDevDesignerIntegration *designerIntegration = designer(type); + if (!designerIntegration) + return; + designerIntegration->removeFunction(formName, function); +} + +KDevDesignerIntegration * KDevLanguageSupport::designer( DesignerType // type + ) +{ + return 0; +} + +void KDevLanguageSupport::openFunction( DesignerType type, const TQString & formName, const TQString & functionName ) +{ + KDevDesignerIntegration *designerIntegration = designer(type); + if (!designerIntegration) + return; + designerIntegration->openFunction(formName, functionName); +} + +void KDevLanguageSupport::createAccessMethods( ClassDom // theClass + , VariableDom // theVariable + ) +{ +} + +void KDevLanguageSupport::openSource( DesignerType type, const TQString & formName) +{ + KDevDesignerIntegration *designerIntegration = designer(type); + if (!designerIntegration) + return; + designerIntegration->openSource(formName); +} + +#include "kdevlanguagesupport.moc" diff --git a/lib/interfaces/kdevlanguagesupport.h b/lib/interfaces/kdevlanguagesupport.h new file mode 100644 index 00000000..42221868 --- /dev/null +++ b/lib/interfaces/kdevlanguagesupport.h @@ -0,0 +1,261 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Amilcar do Carmo Lucas + Copyright (C) 2003-2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVLANGUAGESUPPORT_H +#define KDEVLANGUAGESUPPORT_H + +#include +#include +#include +#include "kdevplugin.h" +#include "codemodel.h" +#include + +/** +@file kdevlanguagesupport.h +Interface to programming language specific features. +*/ + +class Tag; +class KDevDesignerIntegration; + +using namespace KInterfaceDesigner; + +/** +KDevelop language support interface - the base class for all programming language support plugins. +Language support is used to load facilities specific to certain programming language. +Language supports are usually loaded among with a project. In this case project file defines +which language support to load. + +Language support plugin is a good place for: +- a language parser which fills memory and persistent symbol store +(see @ref CodeModel and @ref KDevCodeRepository); +- code wizards specific to a programming language (like new class wizard); +- GUI designer integration (see @ref KDevLanguageSupport::designer method +documentation and @ref KDevDesignerIntegration class documentation; +- symbol (class, function, etc.) name formatting to a human-readable convention (pretty +formatted name). +. +*/ +class KDevLanguageSupport: public KDevPlugin +{ + Q_OBJECT + + +public: + + /**Features supported by this language support.*/ + enum Features { + /*features of the language itself*/ + Classes=1 /**loadSettings(*project()->projectDom(), "kdevmylangsupport/designerintegration"); + saveDesignerToCache(type, des); + } + break; + } + return des; + @endcode + @ref ImplementationWidget and @ref TQtDesignerIntegration classes are available + from designerintegration support library. + @param type The type of the designer to integrate. + @return The pointer to designer integration of given type or 0.*/ + virtual KDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type); + +public slots: + /**Adds a function requested by a GUI designer. No need to reimplement this slot + unless you want to use specific implementation of KDevDesignerIntegration interface. + @param type The type of integrated designer. + @param formName The name of a GUI form. + @param function The function to implement (add).*/ + void addFunction(DesignerType type, const TQString &formName, Function function); + + /**Removes a function requested by a GUI designer. No need to reimplement this slot + unless you want to use specific implementation of KDevDesignerIntegration interface. + @param type The type of integrated designer. + @param formName The name of a GUI form. + @param function The function to remove.*/ + void removeFunction(DesignerType type, const TQString &formName, Function function); + + /**Edits a function requested by a GUI designer. No need to reimplement this slot + unless you want to use specific implementation of KDevDesignerIntegration interface. + @param type The type of integrated designer. + @param formName The name of a GUI form. + @param oldFunction The old function signature before editing. + @param function The new function signature after editing.*/ + void editFunction(DesignerType type, const TQString &formName, Function oldFunction, Function function); + + /**Opens a function requested by a GUI designer. No need to reimplement this slot + unless you want to use specific implementation of KDevDesignerIntegration interface. + @param type The type of integrated designer. + @param formName The name of a GUI form. + @param functionName The name of a function to seek in the code for.*/ + void openFunction(DesignerType type, const TQString &formName, const TQString &functionName); + + /**Opens a form source requested by a GUI designer. No need to reimplement this slot + unless you want to use specific implementation of KDevDesignerIntegration interface. + @param type The type of integrated designer. + @param formName The name of a GUI form.*/ + void openSource(DesignerType type, const TQString &formName); + +signals: + /**Emitted when the content of the memory symbol store has been modified.*/ + void updatedSourceInfo(); + + /**Emitted before removing the file from the memory symbol store.*/ + void aboutToRemoveSourceInfo(const TQString& fileName); + + /**Emitted when a file has been removed from the memory symbol store.*/ + void removedSourceInfo(const TQString& fileName); + + /**Emitted when a file has been added to the memory symbol store.*/ + void addedSourceInfo( const TQString& fileName ); + + /**Emitted when the language part changes the Split View orientation.*/ + void splitOrientationChanged( Qt::Orientation orientation ); +}; + +#endif diff --git a/lib/interfaces/kdevmainwindow.cpp b/lib/interfaces/kdevmainwindow.cpp new file mode 100644 index 00000000..4b95f669 --- /dev/null +++ b/lib/interfaces/kdevmainwindow.cpp @@ -0,0 +1,28 @@ +/* This file is part of the KDE project + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevmainwindow.h" + +#include +#include + +KStatusBar *KDevMainWindow::statusBar() +{ + return main()->statusBar(); +} diff --git a/lib/interfaces/kdevmainwindow.h b/lib/interfaces/kdevmainwindow.h new file mode 100644 index 00000000..8138ab78 --- /dev/null +++ b/lib/interfaces/kdevmainwindow.h @@ -0,0 +1,101 @@ +/* This file is part of the KDE project + Copyright (C) 2003 F@lk Brettschneider + Copyright (C) 2003 John Firebaugh + Copyright (C) 2003 Amilcar do Carmo Lucas + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEV_MAINWINDOW_H +#define KDEV_MAINWINDOW_H + +#include + +class TQWidget; +class KStatusBar; +class TDEMainWindow; + +/** +@file kdevmainwindow.h +KDevelop main window interface. +*/ + +/** +KDevelop main window interface. +Provides methods to control the main window of an application. +*/ +class KDevMainWindow +{ +public: + /**Destroys the main window*/ + virtual ~KDevMainWindow() {} // must be virtual! + + /**Embeds a view of a part into the main window. + @param view The view to embed. Must be a KPart. + @param title The title of a view. + @param toolTip The tooltip of a view.*/ + virtual void embedPartView(TQWidget *view, const TQString &title, const TQString& toolTip = TQString()) = 0; + + /**Embeds a toolview at the left of the main window. + @param view The view to embed. Must be a KPart. + @param title The title of a view. + @param toolTip The tooltip of a view.*/ + virtual void embedSelectView(TQWidget *view, const TQString &title, const TQString &toolTip) = 0; + + /**Embeds a toolview at the bottom of the main window. + @param view The view to embed. Must be a KPart. + @param title The title of a view. + @param toolTip The tooltip of a view.*/ + virtual void embedOutputView(TQWidget *view, const TQString &title, const TQString &toolTip) = 0; + + /**Embeds a toolview at the right of the main window. + @param view The view to embed. Must be a KPart. + @param title The title of a view. + @param toolTip The tooltip of a view.*/ + virtual void embedSelectViewRight(TQWidget* view, const TQString& title, const TQString &toolTip) = 0; + + /**Removes a view from the main window. + @param view The view to remove.*/ + virtual void removeView(TQWidget *view) = 0; + + /**Shows or hides a view. + @param pView The view to show or hide. + @param bEnabled true if view should be shown, false it it is not.*/ + virtual void setViewAvailable(TQWidget *pView, bool bEnabled) = 0; + + /**Raises a view (shows it if it was minimized). + @param view The view to be raised.*/ + virtual void raiseView(TQWidget *view) = 0; + + /**Minimize a view. + @param view The view to be lowered.*/ + virtual void lowerView(TQWidget *view) = 0; + + /**Loads main window settings.*/ + virtual void loadSettings() = 0; + + /**Sets the current document's caption, if applicable. + @param caption the caption to set.*/ + virtual void setCurrentDocumentCaption( const TQString &caption ) = 0; + + /**@return TDEMainWindow object which actually represents the main window.*/ + virtual TDEMainWindow *main() = 0; + + /**@return KStatusBar object which actually represents the status bar in the main window.*/ + KStatusBar *statusBar(); +}; + +#endif diff --git a/lib/interfaces/kdevpartcontroller.cpp b/lib/interfaces/kdevpartcontroller.cpp new file mode 100644 index 00000000..58f1dc2a --- /dev/null +++ b/lib/interfaces/kdevpartcontroller.cpp @@ -0,0 +1,30 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Hoelzer-Kluepfel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "KDevPartControllerIface.h" +#include "kdevpartcontroller.h" +#include "katedocumentmanagerinterface.h" + +KDevPartController::KDevPartController(TQWidget *parent) + : KParts::PartManager(parent) +{ + new KDevPartControllerIface(this); + new KateDocumentManagerInterface(this); +} + +#include "kdevpartcontroller.moc" diff --git a/lib/interfaces/kdevpartcontroller.h b/lib/interfaces/kdevpartcontroller.h new file mode 100644 index 00000000..fd8e6830 --- /dev/null +++ b/lib/interfaces/kdevpartcontroller.h @@ -0,0 +1,176 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Bernd Gehrmann + Copyright (C) 2003 Roberto Raggi + Copyright (C) 2003 Hamish Rodda + Copyright (C) 2003 Harald Fernengel + Copyright (C) 2003 Jens Dagerbo + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEV_PARTCONTROLLER_H +#define KDEV_PARTCONTROLLER_H + +#include +#include +#include + +/** +@file kdevpartcontroller.h +KDevelop part controller interface. +*/ + +namespace KParts +{ + class ReadOnlyPart; +} + +/**Document state enum.*/ +enum DocumentState +{ + Clean, /** + Copyright (C) 2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2002 Harald Fernengel + Copyright (C) 2002 F@lk Brettschneider + Copyright (C) 2003 Julian Rockey + Copyright (C) 2003 Roberto Raggi + Copyright (C) 2003 Jens Dagerbo + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003-2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevplugin.h" + +#include "kdevapi.h" +#include "kdevcore.h" +#include "kdevplugininfo.h" +#include "kdevpartcontroller.h" +#include "kdevplugincontroller.h" + +#include +#include +#include + +#include +#include + +#include + +/////////////////////////////////////////////////////////////////////////////// +// struct KDevPlugin::Private +/////////////////////////////////////////////////////////////////////////////// + +struct KDevPlugin::Private +{ + const KDevPluginInfo *info; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class KDevPlugin +/////////////////////////////////////////////////////////////////////////////// + +KDevPlugin::KDevPlugin(const KDevPluginInfo *info, TQObject *parent, const char *name) + :TQObject(parent, name), d(new Private) +{ + assert(parent->inherits( "KDevApi" )); + m_api = static_cast( parent ); + + actionCollection()->setHighlightingEnabled( true ); + + d->info = info; + TDEGlobal::iconLoader()->addAppDir("tdevelop"); +} + +KDevPlugin::~KDevPlugin() +{ + delete( d ); +} + +KDevMainWindow *KDevPlugin::mainWindow() +{ + return m_api->mainWindow(); +} + +KDevCore *KDevPlugin::core() const +{ + return m_api->core(); +} + +KDevProject *KDevPlugin::project() const +{ + return m_api->project(); +} + +CodeModel *KDevPlugin::codeModel() const +{ + return m_api->codeModel(); +} + +TQDomDocument *KDevPlugin::projectDom() const +{ + return m_api->projectDom(); +} + +KDevLanguageSupport *KDevPlugin::languageSupport() const +{ + return m_api->languageSupport(); +} + +KDevPartController *KDevPlugin::partController() const +{ + return m_api->partController(); +} + +KDevPluginController *KDevPlugin::pluginController() const +{ + return m_api->pluginController(); +} + +void KDevPlugin::restorePartialProjectSession(const TQDomElement* /*el*/) +{ + // there's still nothing to do in the base class +} + +void KDevPlugin::savePartialProjectSession(TQDomElement* /*el*/) +{ + // there's still nothing to do in the base class +} + +KDevCodeRepository * KDevPlugin::codeRepository() const +{ + return m_api->codeRepository(); +} + +KDevPlugin * KDevPlugin::extension_internal(const TQString &serviceType, const TQString &constraint) +{ + return m_api->pluginController()->extension(serviceType, constraint); +} + +const KDevPluginInfo *KDevPlugin::info() +{ + return d->info; +} + +#include "kdevplugin.moc" diff --git a/lib/interfaces/kdevplugin.h b/lib/interfaces/kdevplugin.h new file mode 100644 index 00000000..31cc5550 --- /dev/null +++ b/lib/interfaces/kdevplugin.h @@ -0,0 +1,201 @@ +/* This file is part of the KDE project + Copyright (C) 1999-2001 Bernd Gehrmann + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVPLUGIN_H +#define KDEVPLUGIN_H + +#include +#include +#include "kdevapi.h" + +class KDevCore; +class KDevProject; +class KDevVersionControl; +class KDevLanguageSupport; +class KDevPartController; +class KDevMainWindow; +class KDevCodeRepository; +class CodeModel; +class KDevPluginInfo; +class TQDomElement; + +/** +@file kdevplugin.h +TDevelop plugin interface. +*/ + +/**Current TDevelop plugin interface version. Interfaces declare plugin version to make sure +old source (or binary) incompatible plugins are not loaded. Increase this if +it is necessary that old plugins stop working.*/ +#define TDEVELOP_PLUGIN_VERSION 5 + +/** +The base class for all TDevelop plugins. +Plugin is a component which is loaded into TDevelop shell at startup or by request. +Each plugin should have corresponding .desktop file with a description. +.desktop file template looks like: +@code +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Name= +GenericName= +Comment= +Icon= +X-TDevelop-Plugin-Version= +X-TDevelop-Plugin-Homepage= +X-TDevelop-Plugin-BugsEmailAddress= +X-TDevelop-Plugin-Copyright= +X-TDE-Library= +X-TDevelop-Version= +X-TDevelop-Scope= +X-TDevelop-Properties= +X-TDevelop-Args= +@endcode +Description of parameters in .desktop file: +- Name is a non-translatable name of a plugin, it is used in TDETrader queries +to search for a plugin (required); +- GenericName is a translatable name of a plugin, it is used to show +plugin names in GUI (required); +- Comment is a short description about the plugin (optional); +- Icon is a plugin icon (preferred); +- X-TDevelop-Plugin-Version is a version of a plugin (optional); +- X-TDevelop-Plugin-Homepage is a home page of a plugin (optional); +- X-TDevelop-Plugin-License is a license (optional). can be: GPL, LGPL, BSD, Artistic, +TQPL or Custom. If this property is not set, license is considered as unknown; +- X-TDevelop-Plugin-BugsEmailAddress is an email address for bug reports (optional); +- X-TDevelop-Plugin-Copyright is a copyright statement (optional); +- X-TDE-Library is a name of library which contains the plugin (required); +- X-TDevelop-Version is a version of TDevelop interfaces which is supported by the plugin (required); +- X-TDevelop-Scope is a scope of a plugin (see below for explanation) (required); +- X-TDevelop-Args is a list of additional arguments passed to plugins constructor (optional); +- X-TDevelop-Properties is a list of properties which this plugin supports, see @ref Profile class documentation for explanation (required to work with shells that support profiles). +. +Plugin scope can be either: +- Core +- Global +- Project +. +Global plugins are plugins which require only shell to be loaded and do not operate on @ref KDevProject interface and/or do not use project wide information.\n +Core plugins are global plugins which offer some important "core" functionality and thus +are not selectable by user in plugin configuration pages.\n +Project plugins require a project to be loaded and are usually loaded/unloaded among with the project. +If your plugin use @ref KDevProject interface and/or operate on project-related information then this is the project plugin. + +@sa KDevGenericFactory class documentation for an information about plugin instantiation +and writing factories for plugins. + +@sa KDevCore class documentation for an information about features which are available to plugins +from shell applications. +*/ +class KDevPlugin: public TQObject, public KXMLGUIClient +{ + Q_OBJECT + + +public: + /**Constructs a plugin. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevPlugin(const KDevPluginInfo *info, TQObject *parent, const char *name = 0); + + /**Destructs a plugin.*/ + virtual ~KDevPlugin(); + + /**Provides an information about the plugin. + @return TDEAboutData object which was initialized in the constructor.*/ + const KDevPluginInfo* info(); + + /**@return A reference to the toplevel widget.*/ + KDevMainWindow *mainWindow(); + + /**@return A reference to the application core - an object which provides + basic functionalities for inter-parts communications / cooperation.*/ + KDevCore *core() const; + + /**@return A reference to the current project component or 0 if no project is loaded.*/ + KDevProject *project() const; + + /**@return A reference to the language support component or 0 if no support available.*/ + KDevLanguageSupport *languageSupport() const; + + /**@return A reference to the memory symbol store.*/ + CodeModel *codeModel() const; + + /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/ + TQDomDocument *projectDom() const; + + /**@return A reference to the part controller which is used to manipulate loaded KParts.*/ + KDevPartController *partController() const; + + /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/ + virtual KDevPluginController *pluginController() const; + + /**@return A reference to the code repository (accessor to persistent symbol stores).*/ + KDevCodeRepository* codeRepository() const; + + /**Queries for the plugin which supports given service type (such plugins are called extensions in KDevelop). + All already loaded plugins will be queried and the first loaded one to support + the service type will be returned. Any plugin can be an extension, only "ServiceTypes=..." + entry is required in .desktop file for that plugin. + + Template argument is used as a type to cast the result to. This is done because extension + is usually derived from a certain base class and not directly from KDevPlugin. + @param serviceType The service type of an extension (like "TDevelop/SourceFormatter"). + @param constraint The constraint which is applied when quering for the service. This + constraint is a usual TDETrader constraint statement (like "[X-TDevelop-Foo]=='MyFoo'"). + @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/ + template + Extension *extension(const TQString &serviceType, const TQString &constraint = "") + { + return static_cast(extension_internal(serviceType, constraint)); + } + + /**Override this base class method to restore any settings which differs from project to project. + Data can be read from a certain subtree of the project session file. + During project loading, respectively project session (.kdevses) loading, + this method will be called to give a chance to adapt the plugin to + the newly loaded project. For instance, the debugger plugin might restore the + list of breakpoints from the previous debug session for the certain project. + @note Take attention to the difference to common not-project-related session stuff. + They belong to the application rc file (tdeveloprc) + @note Project session file is useful for settings which cannot be shared between + developers. If a setting should be shared, modify projectDom instead. + @param el The parent DOM element for plugins session settings.*/ + virtual void restorePartialProjectSession(const TQDomElement* el); + + /**Saves session settings. + @sa restorePartialProjectSession - this is the other way round, the same just for saving.*/ + virtual void savePartialProjectSession(TQDomElement* el); + +private: + KDevPlugin *extension_internal(const TQString &serviceType, const TQString &constraint = ""); + + KDevApi *m_api; + class Private; + Private *d; +}; + +#endif diff --git a/lib/interfaces/kdevplugincontroller.cpp b/lib/interfaces/kdevplugincontroller.cpp new file mode 100644 index 00000000..1cc6caa3 --- /dev/null +++ b/lib/interfaces/kdevplugincontroller.cpp @@ -0,0 +1,49 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevplugincontroller.h" + +#include "kdevplugin.h" + +KDevPluginController::KDevPluginController() +{ +} + +TDETrader::OfferList KDevPluginController::query(const TQString &serviceType, + const TQString &constraint) +{ + return TDETrader::self()->query(serviceType, + TQString("%1 and [X-TDevelop-Version] == %2").arg(constraint).arg(TDEVELOP_PLUGIN_VERSION)); +} + +TDETrader::OfferList KDevPluginController::queryPlugins(const TQString &constraint) +{ + return query("TDevelop/Plugin", constraint); +} + +KURL::List KDevPluginController::profileResources(const TQString &/*nameFilter*/) +{ + return KURL::List(); +} + +KURL::List KDevPluginController::profileResourcesRecursive(const TQString &/*nameFilter*/) +{ + return KURL::List(); +} + +#include "kdevplugincontroller.moc" diff --git a/lib/interfaces/kdevplugincontroller.h b/lib/interfaces/kdevplugincontroller.h new file mode 100644 index 00000000..05ee050b --- /dev/null +++ b/lib/interfaces/kdevplugincontroller.h @@ -0,0 +1,119 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVPLUGINCONTROLLER_H +#define KDEVPLUGINCONTROLLER_H + +#include + +#include +#include + +/** +@file kdevplugincontroller.h +TDevelop plugin controller interface. +*/ + +class KDevPlugin; +class ProfileEngine; + +/** +The base class for TDevelop plugin controller. +Plugin controller is responsible for quering, loading and unloading available plugins. +*/ +class KDevPluginController: public TQObject +{ + Q_OBJECT + +public: + + /** + * Returns a uniquely specified plugin. If it isn't already loaded, it will be. + * Use with caution! See extension for parameter details. + */ + virtual KDevPlugin * loadPlugin( const TQString & serviceType, const TQString & constraint ) = 0; + + /** + * Unloads the plugin specified by @p plugin + * @param plugin The plugin desktopEntryName of the plugin to unload + */ + virtual void unloadPlugin( const TQString & plugin ) = 0; + + /**Unloads plugins specified by @p list. + @param list The list of plugin names to unload. plugin name corresponds + to the "Name" property in plugin .desktop file.*/ + virtual void unloadPlugins(TQStringList const &list) = 0; + + /**@return The list of currently loaded plugins.*/ + virtual const TQValueList loadedPlugins() = 0; + + /**Queries for the plugin which supports given service type. + All already loaded plugins will be queried and the first one to support the service type + will be returned. Any plugin can be an extension, only "ServiceTypes=..." entry is + required in .desktop file for that plugin. + @param serviceType The service type of an extension (like "TDevelop/SourceFormatter") + @param constraint The constraint which is applied when quering for the service. This + constraint is a usual TDETrader constraint statement (like "[X-TDevelop-Foo]=='MyFoo'"). + @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/ + virtual KDevPlugin *extension(const TQString &serviceType, const TQString &constraint = "") = 0; + + /**Queries KDevelop services. Version is checked automatically + by adding proper X-TDevelop-Version=N statement into the query. + @param serviceType The service type to query, for example "TDevelop/Plugin" or + "TDevelop/SourceFormatter." + @param constraint A constraint for the service. Do not include plugin version number - it + is done automatically. + @return The list of plugin offers.*/ + static TDETrader::OfferList query(const TQString &serviceType, const TQString &constraint); + + /**Queries TDevelop plugins. Works like + KDevPluginController::query with serviceType set to "TDevelop/Plugin". + @param constraint A constraint for the service. Do not include plugin version number - it + is done automatically. + @return The list of plugin offers.*/ + static TDETrader::OfferList queryPlugins(const TQString &constraint); + + /**Reimplement this function only if your shell supports plugin profiles. + @return The list of URLs to the profile resources (files) with given @p extension. + @param nameFilter Name filter for files. @see TQDir::setNameFilter documentation + for name filters syntax.*/ + virtual KURL::List profileResources(const TQString &nameFilter); + + /**Reimplement this function only if your shell supports plugin profiles. + @return The list of URLs to the resources (files) with given @p extension. + This list is obtained by a recursive search that process given profile + and all it's subprofiles. + @param nameFilter Name filter for files. @see TQDir::setNameFilter documentation + for name filters syntax.*/ + virtual KURL::List profileResourcesRecursive(const TQString &nameFilter); + + /** @return The current Profile Engine */ + virtual ProfileEngine &engine() = 0; + +signals: + /**Emitted when a plugin profile was changed (reloaded, other profile opened, etc.). + Should work only on shells with plugin profiles support.*/ + void profileChanged(); + +protected: + /**Constructor.*/ + KDevPluginController(); + +}; + +#endif diff --git a/lib/interfaces/kdevplugininfo.cpp b/lib/interfaces/kdevplugininfo.cpp new file mode 100644 index 00000000..e80385cb --- /dev/null +++ b/lib/interfaces/kdevplugininfo.cpp @@ -0,0 +1,181 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include "kdevplugininfo.h" + +#include + +#include +#include + +#include "kdevplugincontroller.h" + +struct KDevPluginInfo::Private { + TQString m_pluginName; + TQString m_rawGenericName; + + TQString m_genericName; + TQString m_description; + TQString m_icon; + + TQString m_version; + int m_licenseType; + TQString m_copyrightStatement; + TQString m_homePageAddress; + TQString m_bugsEmailAddress; + + TQValueList m_authors; + TQValueList m_credits; + + TDEAboutData *m_data; +}; + + +KDevPluginInfo::KDevPluginInfo(const TQString &pluginName) + :d(new Private()) +{ + d->m_pluginName = pluginName; + + KService::Ptr offer = KService::serviceByDesktopName(pluginName); + if (offer != 0) + { + d->m_genericName = offer->genericName(); + d->m_icon = offer->icon(); + d->m_description = offer->comment(); + + d->m_rawGenericName = offer->untranslatedGenericName(); + + d->m_version = offer->property("X-TDevelop-Plugin-Version").toString(); + d->m_homePageAddress = offer->property("X-TDevelop-Plugin-Homepage").toString(); + d->m_bugsEmailAddress = offer->property("X-TDevelop-Plugin-BugsEmailAddress").toString(); + d->m_copyrightStatement = offer->property("X-TDevelop-Plugin-Copyright").toString(); + + TQString lic = offer->property("X-TDevelop-Plugin-License").toString(); + if (lic == "GPL") + d->m_licenseType = TDEAboutData::License_GPL; + else if (lic == "LGPL") + d->m_licenseType = TDEAboutData::License_LGPL; + else if (lic == "BSD") + d->m_licenseType = TDEAboutData::License_BSD; + else if (lic == "QPL") + d->m_licenseType = TDEAboutData::License_QPL; + else if (lic == "Artistic") + d->m_licenseType = TDEAboutData::License_Artistic; + else if (lic == "Custom") + d->m_licenseType = TDEAboutData::License_Custom; + else + d->m_licenseType = TDEAboutData::License_Unknown; + + d->m_data = new TDEAboutData(d->m_pluginName.ascii(), d->m_rawGenericName.ascii(), "1", 0, d->m_licenseType); + } + else + kdDebug() << "Unable to load information for plugin: " << pluginName + << ". Check if " << pluginName << ".desktop exists." << endl; +} + + +KDevPluginInfo::operator TDEAboutData *() const +{ + return d->m_data; +} + +TQString KDevPluginInfo::pluginName() const +{ + return d->m_pluginName; +} + +TQString KDevPluginInfo::genericName() const +{ + return d->m_genericName; +} + +TQString KDevPluginInfo::icon() const +{ + return d->m_icon; +} + +TQString KDevPluginInfo::description() const +{ + return d->m_description; +} + +TQString KDevPluginInfo::version() const +{ + return d->m_version; +} + +int KDevPluginInfo::licenseType() const +{ + return d->m_licenseType; +} + +TQString KDevPluginInfo::license() const +{ + KDevPluginInfo &info = *const_cast(this); +// return TDEAboutData(info).license(); + TDEAboutData *data = info; + return data->license(); +} + +TQString KDevPluginInfo::copyrightStatement() const +{ + return d->m_copyrightStatement; +} + +TQString KDevPluginInfo::homePageAddress() const +{ + return d->m_homePageAddress; +} + +TQString KDevPluginInfo::bugsEmailAddress() const +{ + return d->m_bugsEmailAddress; +} + +TQVariant KDevPluginInfo::property(const TQString &name) const +{ + TDETrader::OfferList offers = KDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName)); + if (offers.count() == 1) + return offers.first()->property(name); + return TQVariant(); +} + +TQVariant KDevPluginInfo::operator [](const TQString &name) const +{ + return property(name); +} + +TQStringList KDevPluginInfo::propertyNames( ) const +{ + TDETrader::OfferList offers = KDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName)); + if (offers.count() == 1) + return offers.first()->propertyNames(); + return TQStringList(); +} + +void KDevPluginInfo::addAuthor(const char *name, const char *task, + const char *emailAddress, const char *webAddress) +{ + d->m_authors.append(TDEAboutPerson(name, task, emailAddress, webAddress)); +} + +void KDevPluginInfo::addCredit(const char *name, const char *task, + const char *emailAddress, const char *webAddress) +{ + d->m_credits.append(TDEAboutPerson(name, task, emailAddress, webAddress)); +} diff --git a/lib/interfaces/kdevplugininfo.h b/lib/interfaces/kdevplugininfo.h new file mode 100644 index 00000000..ffd1c46e --- /dev/null +++ b/lib/interfaces/kdevplugininfo.h @@ -0,0 +1,111 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVPLUGININFO_H +#define KDEVPLUGININFO_H + +#include + +#include + +/** +@file kdevplugininfo.h +TDevelop plugin information container class. +*/ + +/** +Information about TDevelop plugin. +It uses plugin name to query plugin .desktop files and +retrieve most information. Names of authors and credits to other people +must be added manually using KDevPluginInfo::addAuthor and KDevPluginInfo::addCredit +methods. +@sa KDevPlugin class documentation for more information about .desktop files. +*/ +class KDevPluginInfo +{ +public: + /**Constructor. + @param pluginName A name of a plugin. Must be the same as the name of a .desktop file + and the same as the location of plugin resource files.*/ + KDevPluginInfo(const TQString &pluginName); + + /**Casts KDevPluginInfo to TDEAboutData. Uses KDevPluginInfo::pluginName as TDEAboutData::appName, + KDevPluginInfo::rawGenericName as TDEAboutData::programName KDevPluginInfo::licenseType as TDEAboutData::licenseType. Other parameters are ignored.*/ + operator TDEAboutData*() const; + + /**@return A name of a plugin (always untranslated).*/ + TQString pluginName() const; + /**@return A generic name of a plugin (translated). Use this in GUI. Information is taken from .desktop file.*/ + TQString genericName() const; + /**@return An icon name of a plugin. Information is taken from .desktop file.*/ + TQString icon() const; + /**@return A description of a plugin. Information is taken from .desktop file.*/ + TQString description() const; + /**@return A version of a plugin. Information is taken from .desktop file.*/ + TQString version() const; + /**@return A license type of a plugin. Information is taken from .desktop file.*/ + int licenseType() const; + /**@return A license text for known license types (GPL, LGPL, BSD, Artistic, TQPL).*/ + TQString license() const; + /**@return A copyright statement of a plugin. Information is taken from .desktop file.*/ + TQString copyrightStatement() const; + /**@return A home page of a plugin. Information is taken from .desktop file.*/ + TQString homePageAddress() const; + /**@return A email address for bugs of a plugin. Information is taken from .desktop file.*/ + TQString bugsEmailAddress() const; + + /**@param name The name of a property. + @return Any property value which exists in .desktop file.*/ + TQVariant property(const TQString &name) const; + /**@param name The name of a property. + @return Any property value which exists in .desktop file.*/ + TQVariant operator [] (const TQString &name) const; + /**@return A list of property names set in .desktop file.*/ + TQStringList propertyNames() const; + + /**@return A list of plugin authors.*/ + const TQValueList authors() const; + /**@return A list of other plugin contributors.*/ + const TQValueList credits() const; + + /**Adds an author to the list of authors. + You can call this function as many times you need. Each entry is appended to a list. + @param name The developer's name in UTF-8 encoding. + @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0. + @param emailAddress An Email address where the person can be reached. Can be 0. + @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/ + void addAuthor(const char *name, const char *task, + const char *emailAddress = 0, const char *webAddress = 0); + /**Adds a contributor to the list of contributors. + You can call this function as many times you need. Each entry is appended to a list. + @param name The developer's name in UTF-8 encoding. + @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0. + @param emailAddress An Email address where the person can be reached. Can be 0. + @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/ + void addCredit(const char *name, const char *task = 0, + const char *emailAddress = 0, const char *webAddress = 0); + +private: + /**Returns the untranslated generic name of a plugin as set in .desktop file.*/ + const char *rawGenericName() const; + + class Private; + Private *d; +}; + +#endif diff --git a/lib/interfaces/kdevproject.cpp b/lib/interfaces/kdevproject.cpp new file mode 100644 index 00000000..e8616df1 --- /dev/null +++ b/lib/interfaces/kdevproject.cpp @@ -0,0 +1,164 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2003 Jens Dagerbo + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003-2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include "kdevproject.h" +#include +#include +#include +#include "kdevprojectiface.h" + +struct KDevProject::Private { + TQMap m_absToRel; + TQStringList m_symlinkList; + TQTimer *m_timer; + KDevProjectIface *m_iface; +}; + +KDevProject::KDevProject(const KDevPluginInfo *info, TQObject *parent, const char *name) + : KDevPlugin(info, parent, name), d(new KDevProject::Private()) +{ + connect( this, TQT_SIGNAL(addedFilesToProject(const TQStringList& )), this, TQT_SLOT(buildFileMap()) ); + connect( this, TQT_SIGNAL(removedFilesFromProject(const TQStringList& )), this, TQT_SLOT(buildFileMap()) ); + + connect( this, TQT_SIGNAL(addedFilesToProject(const TQStringList& )), this, TQT_SLOT(slotAddFilesToFileMap(const TQStringList& )) ); + connect( this, TQT_SIGNAL(removedFilesFromProject(const TQStringList& )), this, TQT_SLOT(slotRemoveFilesFromFileMap(const TQStringList& )) ); + + d->m_timer = new TQTimer(this); + connect(d->m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotBuildFileMap())); + d->m_iface = new KDevProjectIface(this); +} + +KDevProject::~KDevProject() +{ + d->m_timer->stop(); + delete d->m_iface; + delete d->m_timer; + delete d; +} + +void KDevProject::changedFile( const TQString & fileName ) +{ + TQStringList fileList; + fileList.append ( fileName ); + + emit changedFilesInProject( fileList ); + +} + +void KDevProject::changedFiles( const TQStringList & fileList ) +{ + emit changedFilesInProject( fileList ); +} + +KDevProject::Options KDevProject::options() const +{ + return (KDevProject::Options)0; +} + +bool KDevProject::isProjectFile( const TQString & absFileName ) +{ + return d->m_absToRel.contains( absFileName ); +} + +TQString KDevProject::relativeProjectFile( const TQString & absFileName ) +{ + if( isProjectFile(absFileName) ) + return d->m_absToRel[ absFileName ]; + return TQString(); +} + +void KDevProject::buildFileMap() +{ + d->m_timer->stop(); + d->m_timer->start(0, true); +} + +void KDevProject::slotBuildFileMap() +{ + kdDebug(9000) << k_funcinfo << endl; + + d->m_absToRel.clear(); + d->m_symlinkList.clear(); + const TQStringList fileList = allFiles(); + for( TQStringList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) + { + TQFileInfo fileInfo( projectDirectory() + "/" + *it ); + d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it; + + if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() ) + { + d->m_symlinkList << *it; + } + } +} + +void KDevProject::openProject( const TQString & /*dirName*/, const TQString & /*projectName*/ ) +{ + buildFileMap(); +} + +TQStringList KDevProject::symlinkProjectFiles( ) +{ + return d->m_symlinkList; +} + +TQString KDevProject::defaultRunDirectory(const TQString& projectPluginName) const +{ + return DomUtil::readEntry(*projectDom(), "/" + projectPluginName + "/run/globalcwd"); +} + +void KDevProject::slotAddFilesToFileMap( const TQStringList & fileList ) +{ + TQStringList::ConstIterator it = fileList.begin(); + while( it != fileList.end() ) + { + TQFileInfo fileInfo( projectDirectory() + "/" + *it ); + d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it; + + if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() ) + { + d->m_symlinkList << *it; + } + + ++it; + } +} + +void KDevProject::slotRemoveFilesFromFileMap( const TQStringList & fileList ) +{ + TQStringList::ConstIterator it = fileList.begin(); + while( it != fileList.end() ) + { + TQFileInfo fileInfo( projectDirectory() + "/" + *it ); + d->m_absToRel.remove( URLUtil::canonicalPath(fileInfo.absFilePath()) ); + + d->m_symlinkList.remove( *it ); + + ++it; + } +} + +#include "kdevproject.moc" diff --git a/lib/interfaces/kdevproject.h b/lib/interfaces/kdevproject.h new file mode 100644 index 00000000..256b0c0c --- /dev/null +++ b/lib/interfaces/kdevproject.h @@ -0,0 +1,219 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2003 Jens Dagerbo + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003-2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVPROJECT_H +#define KDEVPROJECT_H + +#include "kdevplugin.h" +#include "domutil.h" + +#include +#include + +/** +@file kdevproject.h +KDevelop project interface. +*/ + +class TQTimer; + +/** +KDevelop project interface. +Plugins implementing the KDevProject interfaces are used to manage projects. + +Project can be considered as a way of grouping files (in text editors) or +as a way of providing support for a build system (like it is done in TDevelop IDE buildtools). +*/ +class KDevProject: public KDevPlugin +{ + Q_OBJECT + +public: + /**Constructs a project plugin. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref KDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + KDevProject(const KDevPluginInfo *info, TQObject *parent=0, const char *name=0); + /**Destructor.*/ + virtual ~KDevProject(); + + /**Options of the project plugin.*/ + enum Options { + UsesOtherBuildSystem = 0 /**/run/directoryradio == executable + * The directory where the executable is. + * if //run/directoryradio == build + * The build directory. + * if /kdevautoproject/run/directoryradio == custom + * The custom directory absolute path. + * Derived classes are supposed to explicitly call this implementation + */ + TQString defaultRunDirectory(const TQString& projectPluginName) const; + +private slots: + void buildFileMap(); + void slotBuildFileMap(); + void slotAddFilesToFileMap(const TQStringList & fileList ); + void slotRemoveFilesFromFileMap(const TQStringList & fileList ); + +signals: + /**Emitted when a new list of files has been added to the + project. Provided for convenience when many files were added. + @param fileList The file names relative to the project directory.*/ + void addedFilesToProject(const TQStringList& fileList); + + /**Emitted when a list of files has been removed from the project. + Provided for convenience when many files were removed. + @param fileList The file names relative to the project directory.*/ + void removedFilesFromProject(const TQStringList& fileList); + + /**Emitted when a list of files has changed in the project. + @param fileList The file names relative to the project directory.*/ + void changedFilesInProject(const TQStringList& fileList); + + /**Emitted when one compile related command (make, make install, make ...) ends sucessfuly. + Used to reparse the files after a sucessful compilation.*/ + void projectCompiled(); + + /**Emitted when the active directory of the project changes + * @param olddir The old active directory + * @param newdir The new active directory + */ + void activeDirectoryChanged( const TQString& olddir, const TQString& newdir ); + +private: + class Private; + Private *d; +}; + +#endif diff --git a/lib/interfaces/kdevprojectiface.cpp b/lib/interfaces/kdevprojectiface.cpp new file mode 100644 index 00000000..28d4501c --- /dev/null +++ b/lib/interfaces/kdevprojectiface.cpp @@ -0,0 +1,186 @@ + + +/* This file is part of the KDE project + Copyright (C) 2005 Ian Reinhart Geiser + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kdevprojectiface.h" +#include "kdevproject.h" +#include "domutil.h" + +KDevProjectIface::KDevProjectIface(KDevProject *prj) + : TQObject(prj), DCOPObject("KDevProject"), m_prj(prj) +{ +} + + +KDevProjectIface::~KDevProjectIface() +{ +} + +void KDevProjectIface::openProject( const TQString & dirName, const TQString & projectName ) +{ + m_prj->openProject(dirName,projectName); +} + +void KDevProjectIface::closeProject( ) +{ + m_prj->closeProject(); +} + +uint KDevProjectIface::options( ) const +{ + return (uint)m_prj->options(); +} + +TQString KDevProjectIface::projectDirectory( ) const +{ + return m_prj->projectDirectory(); +} + +TQString KDevProjectIface::projectName( ) const +{ + return m_prj->projectName(); +} + +TQString KDevProjectIface::mainProgram() const +{ + return m_prj->mainProgram(); +} + +TQString KDevProjectIface::runDirectory( ) const +{ + return m_prj->runDirectory(); +} + +TQString KDevProjectIface::activeDirectory( ) const +{ + return m_prj->activeDirectory(); +} + +TQString KDevProjectIface::buildDirectory( ) const +{ + return m_prj->buildDirectory(); +} + +TQStringList KDevProjectIface::allFiles( ) const +{ + return m_prj->allFiles(); +} + +TQStringList KDevProjectIface::distFiles( ) const +{ + return m_prj->distFiles(); +} + +void KDevProjectIface::addFiles( const TQStringList & fileList ) +{ + m_prj->addFiles(fileList); +} + +void KDevProjectIface::addFile( const TQString & fileName ) +{ + m_prj->addFile(fileName); +} + +void KDevProjectIface::removeFiles( const TQStringList & fileList ) +{ + m_prj->removeFiles(fileList); +} + +void KDevProjectIface::removeFile( const TQString & fileName ) +{ + m_prj->removeFile(fileName); +} + +void KDevProjectIface::changedFiles( const TQStringList & fileList ) +{ + m_prj->changedFiles(fileList); +} + +void KDevProjectIface::changedFile( const TQString & fileName ) +{ + m_prj->changedFile(fileName); +} + +bool KDevProjectIface::isProjectFile( const TQString & absFileName ) +{ + return m_prj->isProjectFile(absFileName); +} + +TQString KDevProjectIface::relativeProjectFile( const TQString & absFileName ) +{ + return m_prj->relativeProjectFile(absFileName); +} + +TQStringList KDevProjectIface::symlinkProjectFiles( ) +{ + return m_prj->symlinkProjectFiles(); +} + +TQString KDevProjectIface::readEntry( const TQString & path, const TQString & defaultEntry ) +{ + return DomUtil::readEntry( *m_prj->projectDom(), path, defaultEntry); +} + +int KDevProjectIface::readIntEntry( const TQString & path, int defaultEntry ) +{ + return DomUtil::readIntEntry(*m_prj->projectDom(), path,defaultEntry); +} + +bool KDevProjectIface::readBoolEntry( const TQString & path, bool defaultEntry ) +{ + return DomUtil::readBoolEntry(*m_prj->projectDom(), path, defaultEntry); +} + +TQStringList KDevProjectIface::readListEntry( const TQString & path, const TQString & tag ) +{ + return DomUtil::readListEntry(*m_prj->projectDom(), path, tag); +} + +TQMap< TQString, TQString > KDevProjectIface::readMapEntry( const TQString & path ) +{ + return DomUtil::readMapEntry(*m_prj->projectDom(), path); +} + +void KDevProjectIface::writeEntry( const TQString & path, const TQString & value ) +{ + DomUtil::writeEntry(*m_prj->projectDom(), path, value); +} + +void KDevProjectIface::writeIntEntry( const TQString & path, int value ) +{ + DomUtil::writeIntEntry(*m_prj->projectDom(), path, value); +} + +void KDevProjectIface::writeBoolEntry( const TQString & path, bool value ) +{ + DomUtil::writeBoolEntry(*m_prj->projectDom(), path, value); +} + +void KDevProjectIface::writeListEntry( const TQString & path, const TQString & tag, const TQStringList & value ) +{ + DomUtil::writeListEntry(*m_prj->projectDom(), path, tag, value); +} + +void KDevProjectIface::writeMapEntry( const TQString & path, const TQMap< TQString, TQString > & map ) +{ + DomUtil::writeMapEntry(*m_prj->projectDom(), path, map); +} + +#include "kdevprojectiface.moc" diff --git a/lib/interfaces/kdevprojectiface.h b/lib/interfaces/kdevprojectiface.h new file mode 100644 index 00000000..e30cd6cc --- /dev/null +++ b/lib/interfaces/kdevprojectiface.h @@ -0,0 +1,82 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Ian Reinhart Geiser + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDEVPROJECTIFACE_H +#define KDEVPROJECTIFACE_H + +#include +#include +#include + +class KDevProject; + +/** +DCOP Interface for the @ref KDevProject object. + +@author KDevelop Authors +*/ +class KDevProjectIface : public TQObject, public DCOPObject +{ + Q_OBJECT +// + K_DCOP +public: + KDevProjectIface(KDevProject *prj); + + ~KDevProjectIface(); +k_dcop: + void openProject(const TQString &dirName, const TQString &projectName); + void closeProject(); + uint options() const; + TQString projectDirectory() const; + TQString projectName() const; + TQString mainProgram() const; + TQString runDirectory() const; + TQString activeDirectory() const; + TQString buildDirectory() const; + TQStringList allFiles() const; + TQStringList distFiles() const; + void addFiles(const TQStringList &fileList); + void addFile(const TQString &fileName); + void removeFiles(const TQStringList& fileList); + void removeFile(const TQString &fileName); + void changedFiles(const TQStringList &fileList); + void changedFile(const TQString &fileName); + bool isProjectFile(const TQString &absFileName); + TQString relativeProjectFile(const TQString &absFileName); + TQStringList symlinkProjectFiles(); + + // Project DOM access + TQString readEntry(const TQString &path, const TQString &defaultEntry = TQString()); + int readIntEntry(const TQString &path, int defaultEntry = 0); + bool readBoolEntry(const TQString &path, bool defaultEntry = false); + TQStringList readListEntry(const TQString &path, const TQString &tag); + TQMap readMapEntry(const TQString &path); + + void writeEntry(const TQString &path, const TQString &value); + void writeIntEntry(const TQString &path, int value); + void writeBoolEntry( const TQString &path, bool value); + void writeListEntry(const TQString &path, const TQString &tag, const TQStringList &value); + void writeMapEntry(const TQString& path, const TQMap &map); + + private: + KDevProject *m_prj; +}; + +#endif diff --git a/lib/interfaces/tdevapi.cpp b/lib/interfaces/tdevapi.cpp deleted file mode 100644 index 4f726107..00000000 --- a/lib/interfaces/tdevapi.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2000-2001 Bernd Gehrmann - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevapi.h" - -#include "tdevcoderepository.h" - -/////////////////////////////////////////////////////////////////////////////// -// class TDevApi::Private -/////////////////////////////////////////////////////////////////////////////// - -class TDevApi::Private -{ -public: - Private() - : m_projectDom(0), m_project(0), m_languageSupport(0), - m_codeRepository(0) - {} - - TQDomDocument *m_projectDom; - TDevProject *m_project; - TDevLanguageSupport *m_languageSupport; - TDevCodeRepository* m_codeRepository; -}; - -/////////////////////////////////////////////////////////////////////////////// -// class TDevApi -/////////////////////////////////////////////////////////////////////////////// - -TDevApi::TDevApi() -{ - d = new TDevApi::Private; - d->m_codeRepository = new TDevCodeRepository(); -} - -TDevApi::~TDevApi() -{ - delete d->m_codeRepository; - delete d; -} - -TDevProject *TDevApi::project() const -{ - return d->m_project; -} - -void TDevApi::setProject(TDevProject *project) -{ - d->m_project = project; -} - -TDevLanguageSupport *TDevApi::languageSupport() const -{ - return d->m_languageSupport; -} - -void TDevApi::setLanguageSupport(TDevLanguageSupport *languageSupport) -{ - d->m_languageSupport = languageSupport; -} - -TQDomDocument *TDevApi::projectDom() const -{ - return d->m_projectDom; -} - -void TDevApi::setProjectDom(TQDomDocument *dom) -{ - d->m_projectDom = dom; -} - -TDevCodeRepository *TDevApi::codeRepository() const -{ - return d->m_codeRepository; -} - -#include "tdevapi.moc" diff --git a/lib/interfaces/tdevapi.h b/lib/interfaces/tdevapi.h deleted file mode 100644 index a2e38f7c..00000000 --- a/lib/interfaces/tdevapi.h +++ /dev/null @@ -1,104 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2000-2001 Bernd Gehrmann - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVAPI_H -#define TDEVAPI_H - -#include - -class TQStringList; -class TQDomDocument; -class TDevCore; -class TDevProject; -class TDevLanguageSupport; -class CodeModel; -class TDevPartController; -class TDevMainWindow; -class TDevCodeRepository; -class TDevPlugin; -class TDevPluginController; - -/** -@file tdevapi.h -KDevelop API interface. -*/ - -/** -The interface to KDevelop's core components. -Needs to be implemented in a shell. Developers do not need to use this -class because @ref TDevPlugin already provides API convenience methods. -*/ -class TDevApi: public TQObject -{ - Q_OBJECT - -public: - /**Constructor.*/ - TDevApi(); - - /**Destructor.*/ - virtual ~TDevApi(); - - /**@return A reference to the toplevel widget.*/ - virtual TDevMainWindow *mainWindow() const = 0; - - /**@return A reference to the part controller which is used to manipulate loaded KParts.*/ - virtual TDevPartController *partController() const = 0; - - /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/ - virtual TDevPluginController *pluginController() const = 0; - - /**@return A reference to the application core - an object which provides - basic functionalities for inter-parts communications / cooperation.*/ - virtual TDevCore *core() const = 0; - - /**@return A reference to the memory symbol store.*/ - virtual CodeModel *codeModel() const = 0; - - /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/ - TQDomDocument *projectDom() const; - - /**Sets the Document Object Model for the current project. - @param dom The project DOM.*/ - void setProjectDom(TQDomDocument *dom); - - /**@return A reference to the current project component or 0 if no project is loaded.*/ - TDevProject *project() const; - - /**Sets the current project. - @param project The project plugin which becames the current project.*/ - void setProject(TDevProject *project); - - /**@return A reference to the language support component or 0 if no support available.*/ - TDevLanguageSupport *languageSupport() const; - - /**Sets the object charged of providing handling for the source files written in particular - language (languages support component). - @param languageSupport The language support plugin.*/ - void setLanguageSupport(TDevLanguageSupport *languageSupport); - - /**@return A reference to the code repository (accessor to persistent symbol stores).*/ - TDevCodeRepository *codeRepository() const; - -private: - class Private; - Private *d; -}; - -#endif diff --git a/lib/interfaces/tdevcoderepository.cpp b/lib/interfaces/tdevcoderepository.cpp deleted file mode 100644 index f5716294..00000000 --- a/lib/interfaces/tdevcoderepository.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevcoderepository.h" - -struct TDevCodeRepositoryData -{ - Catalog* mainCatalog; - TQValueList catalogs; - - TDevCodeRepositoryData(): mainCatalog( 0 ) {} -}; - -TDevCodeRepository::TDevCodeRepository( ) - : d( new TDevCodeRepositoryData ) -{ -} - -TDevCodeRepository::~TDevCodeRepository( ) -{ - delete( d ); -} - -Catalog* TDevCodeRepository::mainCatalog() -{ - return d->mainCatalog; -} - -void TDevCodeRepository::setMainCatalog( Catalog * mainCatalog ) -{ - d->mainCatalog = mainCatalog; -} - -void TDevCodeRepository::registerCatalog( Catalog * catalog ) -{ - d->catalogs.append( catalog ); - emit catalogRegistered( catalog ); -} - -void TDevCodeRepository::unregisterCatalog( Catalog * catalog ) -{ - d->catalogs.remove( catalog ); - emit catalogUnregistered( catalog ); -} - -void TDevCodeRepository::touchCatalog( Catalog * catalog ) -{ - emit catalogChanged( catalog ); -} - -TQValueList< Catalog * > TDevCodeRepository::registeredCatalogs( ) -{ - return d->catalogs; -} - -#include "tdevcoderepository.moc" diff --git a/lib/interfaces/tdevcoderepository.h b/lib/interfaces/tdevcoderepository.h deleted file mode 100644 index b87d66e8..00000000 --- a/lib/interfaces/tdevcoderepository.h +++ /dev/null @@ -1,95 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Roberto Raggi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVCODEREPOSITORY_H -#define TDEVCODEREPOSITORY_H - -#include -#include - -/** -@file tdevcoderepository.h -Code repository - the persistent symbol store accessor. -*/ - -class TDevCodeRepositoryData; -class Catalog; - -/** -Code repository - the persistent symbol store accessor. -Symbols from parsed files can be saved to the persistent symbol store. -Persistence in this case means that symbol database is never loaded into memory -and works like a usual database which executes queries. - -Code repository consists from @ref Catalog objects that represent separate symbol -databases. Catalogs can be created/loaded/unloaded dynamically. -To find a symbol in the repository each catalog should be queried. - -Persistent symbol store is useful to keep information about code that -never or rarely changes. System libraries are perfect examples of such code. -Symbols from code contained in project files are better stored in memory -symbol store like @ref CodeModel. -*/ -class TDevCodeRepository : public TQObject -{ - Q_OBJECT - -public: - /**Constructor.*/ - TDevCodeRepository(); - /**Destructor.*/ - virtual ~TDevCodeRepository(); - - /**@return The main catalog. Each catalog can be marked is main - to provide easy access to it.*/ - Catalog* mainCatalog(); - /**Sets the main catalog. - @param mainCatalog The catalog to be marked as main.*/ - void setMainCatalog( Catalog* mainCatalog ); - - /**@return The list of registered catalogs.*/ - TQValueList registeredCatalogs(); - - /**Registers catalog in the repository. - @param catalog The catalog to register.*/ - void registerCatalog( Catalog* catalog ); - /**Unregisters catalog from the repository. - @param catalog The catalog to unregister.*/ - void unregisterCatalog( Catalog* catalog ); - /**Marks catalog as changed and emits @ref catalogChanged signal. - @param catalog The catalog to touch.*/ - void touchCatalog( Catalog* catalog ); - -signals: - /**Emitted when a new catalog is registered. - @param catalog The new catalog.*/ - void catalogRegistered( Catalog* catalog ); - - /**Emitted when a catalog in removed - @param catalog The catalog that was removed.*/ - void catalogUnregistered( Catalog* catalog ); - - /**Emitted when the contens of catalog is changed. - @param catalog Changed catalog.*/ - void catalogChanged( Catalog* catalog ); - -private: - TDevCodeRepositoryData* d; -}; - -#endif diff --git a/lib/interfaces/tdevcore.cpp b/lib/interfaces/tdevcore.cpp deleted file mode 100644 index 726bf2cb..00000000 --- a/lib/interfaces/tdevcore.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2003 Mario Scalas - Copyright (C) 2003 Amilcar do Carmo Lucas - Copyright (C) 2003 Jens Dagerbo - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "TDevCoreIface.h" -#include "tdevcore.h" - -#include "urlutil.h" - -/////////////////////////////////////////////////////////////////////////////// -// class Context -/////////////////////////////////////////////////////////////////////////////// - -Context::Context() -{ -} - -Context::~Context() -{ -} - -bool Context::hasType( int aType ) const -{ - return aType == this->type(); -} - -/////////////////////////////////////////////////////////////////////////////// -// class EditorContext -/////////////////////////////////////////////////////////////////////////////// - -class EditorContext::Private -{ -public: - Private( const KURL &url, int line, int col, const TQString &linestr, - const TQString &wordstr ) - : m_url(url), m_line(line), m_col(col), - m_linestr(linestr), m_wordstr(wordstr) - { - } - - KURL m_url; - int m_line, m_col; - TQString m_linestr, m_wordstr; -}; - -EditorContext::EditorContext( const KURL &url, int line, int col, - const TQString &linestr, const TQString &wordstr ) - : Context(), d( new Private(url, line, col, linestr, wordstr) ) -{ -} - -EditorContext::~EditorContext() -{ - delete d; - d = 0; -} - -int EditorContext::type() const -{ - return Context::EditorContext; -} - -const KURL &EditorContext::url() const -{ - return d->m_url; -} - -int EditorContext::line() const -{ - return d->m_line; -} - -int EditorContext::col() const -{ - return d->m_col; -} - -TQString EditorContext::currentLine() const -{ - return d->m_linestr; -} - -TQString EditorContext::currentWord() const -{ - return d->m_wordstr; -} - -/////////////////////////////////////////////////////////////////////////////// -// class FileContext -/////////////////////////////////////////////////////////////////////////////// - -class FileContext::Private -{ -public: - Private( const KURL::List &someURLs ) : m_urls(someURLs) - { - if (m_urls.count() == 0) - { - m_fileName = "INVALID-FILENAME"; - m_isDirectory = false; // well, "true" should be ok too ... - } - else - { - m_fileName = m_urls[0].path(); - m_isDirectory = URLUtil::isDirectory( m_urls[0] ); - } - } - Private( const TQString &fileName, bool isDirectory ) - : m_fileName(fileName), m_isDirectory(isDirectory) - { - } - - KURL::List m_urls; - /// \FIXME the following data members should be removed, but first other - // parts should be modified to comply with this change. - TQString m_fileName; - bool m_isDirectory; -}; - -FileContext::FileContext( const KURL::List &someURLs ) - : Context(), d( new Private(someURLs) ) -{ -} - -FileContext::~FileContext() -{ - delete d; - d = 0; -} - -int FileContext::type() const -{ - return Context::FileContext; -} - -const KURL::List &FileContext::urls() const -{ - return d->m_urls; -} - -/////////////////////////////////////////////////////////////////////////////// -// class DocumentationContext -/////////////////////////////////////////////////////////////////////////////// - -class DocumentationContext::Private -{ -public: - Private( const TQString &url, const TQString &selection ) - : m_url(url), m_selection(selection) - { - } - - TQString m_url; - TQString m_selection; -}; - -DocumentationContext::DocumentationContext( const TQString &url, const TQString &selection ) - : Context(), d( new Private(url, selection) ) -{ -} - -DocumentationContext::DocumentationContext( const DocumentationContext &aContext ) - : Context(), d( 0 ) -{ - *this = aContext; -} - -DocumentationContext &DocumentationContext::operator=( const DocumentationContext &aContext) -{ - if (d) { - delete d; d = 0; - } - d = new Private( *aContext.d ); - return *this; -} - -DocumentationContext::~DocumentationContext() -{ - delete d; - d = 0; -} - -int DocumentationContext::type() const -{ - return Context::DocumentationContext; -} - -TQString DocumentationContext::url() const -{ - return d->m_url; -} - -TQString DocumentationContext::selection() const -{ - return d->m_selection; -} - -/////////////////////////////////////////////////////////////////////////////// -// class CodeModelItemContext -/////////////////////////////////////////////////////////////////////////////// - -class CodeModelItemContext::Private -{ -public: - Private( const CodeModelItem* item ) : m_item( item ) {} - - const CodeModelItem* m_item; -}; - -CodeModelItemContext::CodeModelItemContext( const CodeModelItem* item ) - : Context(), d( new Private(item) ) -{ -} - -CodeModelItemContext::~CodeModelItemContext() -{ - delete d; - d = 0; -} - -int CodeModelItemContext::type() const -{ - return Context::CodeModelItemContext; -} - -const CodeModelItem* CodeModelItemContext::item() const -{ - return d->m_item; -} - -/////////////////////////////////////////////////////////////////////////////// -// class ProjectModelItemContext -/////////////////////////////////////////////////////////////////////////////// - -class ProjectModelItemContext::Private -{ -public: - Private( const ProjectModelItem* item ) : m_item( item ) {} - - const ProjectModelItem* m_item; -}; - -ProjectModelItemContext::ProjectModelItemContext( const ProjectModelItem* item ) - : Context(), d( new Private(item) ) -{ -} - -ProjectModelItemContext::~ProjectModelItemContext() -{ - delete d; - d = 0; -} - -int ProjectModelItemContext::type() const -{ - return Context::ProjectModelItemContext; -} - -const ProjectModelItem* ProjectModelItemContext::item() const -{ - return d->m_item; -} - - -/////////////////////////////////////////////////////////////////////////////// -// class TDevCore -/////////////////////////////////////////////////////////////////////////////// - -TDevCore::TDevCore( TQObject *parent, const char *name ) - : TQObject( parent, name ) -{ - new TDevCoreIface(this); -} - -TDevCore::~TDevCore() -{ -} - -#include "tdevcore.moc" diff --git a/lib/interfaces/tdevcore.h b/lib/interfaces/tdevcore.h deleted file mode 100644 index fadcdfde..00000000 --- a/lib/interfaces/tdevcore.h +++ /dev/null @@ -1,388 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2001 Sandy Meier - Copyright (C) 2002 Daniel Engelschalt - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2003 Mario Scalas - Copyright (C) 2003 Harald Fernengel - Copyright (C) 2003 Hamish Rodda - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVCORE_H -#define TDEVCORE_H - -/** -@file tdevcore.h -The interface to the application core and context menu classes. -*/ - -#include -#include -#include - -#include - -class KDialogBase; -class TDevPlugin; -class CodeModelItem; -class ProjectModelItem; - -namespace KParts -{ - class Part; -} - -class TQStatusBar; -class TQPopupMenu; - -/** -Base class for every context. -Think of a Context-based class as "useful -info associated to a context menu". Several context menu can be defined, -each defining different information: because of these context menus being -used in many modules, they are defined here. - -When context menu with a certain "context" associated appears, KDevelop core -sends a notification signal and all plugins which receive this signal have -the ability to add own items into the menu. For example, VCS plugin could -add "commit" and "update" menu items to the context menu of a file. - -How to use context from a plugin: --# Create a popup menu in context menu event handler: @code TDEPopupMenu menu(this); @endcode --# Create a context: @code MyContext context(param). @endcode --# Fill a context menu: @code core()->fillContextMenu(&menu, &context); @endcode --# Show the popup menu: @code menu.exec(event->globalPos()); @endcode -. -In this example @em event is an object of TQContextMenuEvent class which you have access -to if you reimplement TQWidget::contextMenuEvent method. - -How to fill context menu from a plugin: --# Create a @code contextMenu(TQPopupMenu *, const Context *) @endcode slot in your plugin class. --# Connect TDevCore::contextMenu(TQPopupMenu *, const Context *) signal to that slot in -the constructor of your plugin:\n -@code -connect(core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), - this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *))); -@endcode --# Fill the menu in the slot you created, for example:\n -@code -if (context->hasType(Context::EditorContext)) -{ - const EditorContext *econtext = static_cast(context); - int id = popup->insertItem(i18n("My Menu Item 1"), this, TQT_SLOT(myMenuAction1())); - popup->setWhatsThis(id, i18n("What's this for my menu item 1")); -} -else if context->hasType(MyContext)) -{ - int id = popup->insertItem(... - ... -} -... -@endcode -*/ -class Context -{ -public: - /**Pre-defined context types. More may be added so it is possible to add custom - contexts. We reserve enum values until 1000 (yeah, it is one thousand ) - for tdevelop official context types.*/ - enum Type - { - EditorContext, /** - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevdesignerintegration.h" -#include "tdevdesignerintegrationiface.h" - -class TDevDesignerIntegration::TDevDesignerIntegrationPrivate { -public: - TDevDesignerIntegrationIface *m_iface; -}; - -TDevDesignerIntegration::TDevDesignerIntegration(TQObject *parent, const char *name) - : TQObject(parent, name) -{ - dptr = new TDevDesignerIntegrationPrivate(); - - dptr->m_iface = new TDevDesignerIntegrationIface(this); -} - -TDevDesignerIntegration::~TDevDesignerIntegration() -{ - delete dptr; -} - -#include "tdevdesignerintegration.moc" diff --git a/lib/interfaces/tdevdesignerintegration.h b/lib/interfaces/tdevdesignerintegration.h deleted file mode 100644 index 532d8b8b..00000000 --- a/lib/interfaces/tdevdesignerintegration.h +++ /dev/null @@ -1,98 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVDESIGNERINTEGRATION_H -#define TDEVDESIGNERINTEGRATION_H - -#include -#include -#include - -/** -@file tdevdesignerintegration.h -TDevelop designer integration interface. -*/ - -/** -TDevelop designer integration interface. -Designer integration object provides functionality which is used by integrated -into KDevelop GUI designers: -- adding/removing/editing functions (class methods); -- opening form implementation files; -- saving and loading designer integration settings. -. - -Designer integration is a layer between visual form (GUI) designer of any type -and the current language support. Usually designers create some kind of forms -and allow developers to define actions which are executed upon some GUI events -(for example, TQt Designer allows to define slots connected to GUI signals). -The actual code with action implementations needs to be written by hand in source -files. Designer integration captures such implementation requests and opens -necessary files at desired line numbers and adds (edits, removes) code for implementations. - -For example, TQt Designer integration should be able to create an subclass for a form -and reimplement slots defined in the form. -*/ -class TDevDesignerIntegration : public TQObject -{ -Q_OBJECT - -public: - /**Constructor. - @param parent Parent object. - @param name Internal name.*/ - TDevDesignerIntegration(TQObject *parent = 0, const char *name = 0); - /**Destructor.*/ - ~TDevDesignerIntegration(); - - /**Saves designer integration settings.*/ - virtual void saveSettings(TQDomDocument dom, TQString path) = 0; - /**Loads designer integration settings.*/ - virtual void loadSettings(TQDomDocument dom, TQString path) = 0; - -public slots: - /**Adds the implementation for a function. - @param formName The name of a GUI form. - @param function The function which needs to be implemented in the source.*/ - virtual void addFunction(const TQString &formName, KInterfaceDesigner::Function function) = 0; - - /**Removes the implementation of a function. - @param formName The name of a GUI form. - @param function The function which needs to be removed from the source.*/ - virtual void removeFunction(const TQString &formName, KInterfaceDesigner::Function function) = 0; - - /**Edites the implementation of a function. - @param formName The name of a GUI form. - @param oldFunction The function which needs to be edited from the source. - @param function The new function declaration.*/ - virtual void editFunction(const TQString &formName, KInterfaceDesigner::Function oldFunction, KInterfaceDesigner::Function function) = 0; - - /**Opens the function and jumps to the line number of its definition (declaration). - @param formName The name of a GUI form. - @param functionName The name of a function to find in the source.*/ - virtual void openFunction(const TQString &formName, const TQString &functionName) = 0; - - /**Opens the form source. - @param formName The name of a GUI form.*/ - virtual void openSource(const TQString &formName) = 0; - private: - class TDevDesignerIntegrationPrivate; - TDevDesignerIntegrationPrivate *dptr; -}; - -#endif diff --git a/lib/interfaces/tdevdesignerintegrationiface.cpp b/lib/interfaces/tdevdesignerintegrationiface.cpp deleted file mode 100644 index bd4f349b..00000000 --- a/lib/interfaces/tdevdesignerintegrationiface.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2005 Ian Reinhart Geiser - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevdesignerintegrationiface.h" -#include -#include "tdevdesignerintegration.h" - -TDevDesignerIntegrationIface::TDevDesignerIntegrationIface(TDevDesignerIntegration *p) - : DCOPObject("GUIDesigner"), m_designer(p) -{ - //FIXME figure out what number our interface is... -} - - -TDevDesignerIntegrationIface::~TDevDesignerIntegrationIface() -{ -} - -void TDevDesignerIntegrationIface::addFunction( const TQString & formName, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) -{ - KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; - m_designer->addFunction(formName, f); -} - -void TDevDesignerIntegrationIface::removeFunction( const TQString & formName, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) -{ - KInterfaceDesigner::Function f = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; - m_designer->addFunction(formName, f); -} - -void TDevDesignerIntegrationIface::editFunction( const TQString & formName, TQString oldReturnType, TQString oldFunction, TQString oldSpecifier, TQString oldAccess, uint oldType, TQString returnType, TQString function, TQString specifier, TQString access, uint type ) -{ - KInterfaceDesigner::Function fold = {oldReturnType, oldFunction, oldSpecifier, oldAccess, (KInterfaceDesigner::FunctionType)oldType }; - KInterfaceDesigner::Function fnew = {returnType, function, specifier, access, (KInterfaceDesigner::FunctionType)type }; - m_designer->editFunction(formName,fold,fnew); -} - -void TDevDesignerIntegrationIface::openFunction( const TQString & formName, const TQString & functionName ) -{ - m_designer->openFunction(formName,functionName); -} - -void TDevDesignerIntegrationIface::openSource( const TQString & formName ) -{ - m_designer->openSource(formName); -} - - diff --git a/lib/interfaces/tdevdesignerintegrationiface.h b/lib/interfaces/tdevdesignerintegrationiface.h deleted file mode 100644 index 0dd6f8d1..00000000 --- a/lib/interfaces/tdevdesignerintegrationiface.h +++ /dev/null @@ -1,49 +0,0 @@ -/* I am drunk. - Copyright (C) 2005 Ian Reinhart Geiser - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVDESIGNERINTEGRATIONIFACE_H -#define TDEVDESIGNERINTEGRATIONIFACE_H - -#include -class TDevDesignerIntegration; -/** -The dcop interface for GUI designers in KDevelop. - -@author KDevelop Authors -*/ -class TDevDesignerIntegrationIface : public DCOPObject -{ - K_DCOP -public: - TDevDesignerIntegrationIface(TDevDesignerIntegration *p); - - ~TDevDesignerIntegrationIface(); -k_dcop: - void addFunction(const TQString &formName, TQString returnType, TQString function,TQString specifier,TQString access,uint type); - void removeFunction(const TQString &formName, TQString returnType, TQString function,TQString specifier,TQString access,uint type); - void editFunction(const TQString &formName, TQString oldReturnType, TQString oldFunction, - TQString oldSpecifier,TQString oldAccess,uint oldType, - TQString returnType, TQString function,TQString specifier,TQString access,uint type); - void openFunction(const TQString &formName, const TQString &functionName); - void openSource(const TQString &formName); - - private: - TDevDesignerIntegration *m_designer; -}; - -#endif diff --git a/lib/interfaces/tdevgenericfactory.h b/lib/interfaces/tdevgenericfactory.h deleted file mode 100644 index 7fdbdb28..00000000 --- a/lib/interfaces/tdevgenericfactory.h +++ /dev/null @@ -1,91 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Harald Fernengel - * Copyright (C) 2004 Alexander Dymo - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#include -#include - -/** -@file tdevgenericfactory.h -KDevelop generic plugin factory. -*/ - -/** -This class provides a generic implementation of a KLibFactory for -use with TDevelop plugins. -Usually it is convenient to use K_EXPORT_COMPONENT_FACTORY macro -to create factories for TDevelop plugins. For example, for DummyPlugin -the factory can be created (in dummyplugin.cpp file) as: -@code -typedef TDevGenericFactory DummyPluginFactory; -K_EXPORT_COMPONENT_FACTORY(libtdevdummyplugin, DummyPluginFactory( data ) ) -@endcode -Data should be a const static object. This way it complies with the requirements -for data objecs of TDevGenericFactory constructor. - -Important:
-There is no need to create @ref TDEAboutData objects. It is more useful to create -a static const @ref TDevPluginInfo object which can be used also in the constructor -of a plugin. - -For example, dummyplugin.cpp file could contain: -@code -#include - -static const TDevPluginInfo data("KDevDummyPlugin"); -typedef TDevGenericFactory DummyPluginFactory; -K_EXPORT_COMPONENT_FACTORY(libtdevdummyplugin, DummyPluginFactory( data ) ) - -DummyPlugin::DummyPlugin(TQObject *parent, const char *name, const TQStringList & ) - :TDevPlugin(&data, parent, name) -{ -} -@endcode - -In the example above the duplication of information is avoided as same @ref TDevPluginInfo -objects are used for plugin and for plugin factory. This is possible because @ref TDevPluginInfo -class has an operator to cast @ref TDevPluginInfo to @ref TDEAboutData. -*/ -template -class TDevGenericFactory: public KGenericFactory -{ -public: - /**Constructor. - @param data A reference to TDEAboutData with an information about the plugin. - Data should have: - - plugin name as an application name; - - untranslated plugin generic name as a product name; - - license type number. - . - data object should live as long as factory lives.*/ - TDevGenericFactory(TDEAboutData *data) - :KGenericFactory(data->appName()), aboutData(data) - { - } - - /**Creates an instance.*/ - TDEInstance *createInstance() - { - return new TDEInstance(aboutData); - } - -private: - TDEAboutData *aboutData; - -}; - diff --git a/lib/interfaces/tdevlanguagesupport.cpp b/lib/interfaces/tdevlanguagesupport.cpp deleted file mode 100644 index d283a434..00000000 --- a/lib/interfaces/tdevlanguagesupport.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Alexander Dymo - Copyright (C) 2003 Amilcar do Carmo Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "codemodel.h" - -#include - -#include "tdevdesignerintegration.h" -#include "tdevlanguagesupport.h" - -TDevLanguageSupport::TDevLanguageSupport(const TDevPluginInfo *info, TQObject *parent, const char *name) - : TDevPlugin(info, parent, name ? name : "TDevLanguageSupport" ) -{ -} - -TDevLanguageSupport::~TDevLanguageSupport() -{ -} - -TDevLanguageSupport::Features TDevLanguageSupport::features() -{ - return Features(0); -} - -KMimeType::List TDevLanguageSupport::mimeTypes() -{ - return KMimeType::List(); -} - -TQString TDevLanguageSupport::formatTag( const Tag& /*tag*/ ) -{ - return TQString(); -} - -TQString TDevLanguageSupport::formatClassName(const TQString &name) -{ - return name; -} - -TQString TDevLanguageSupport::unformatClassName(const TQString &name) -{ - return name; -} - -bool TDevLanguageSupport::shouldSplitDocument(const KURL &url) -{ - return false; -} - -Qt::Orientation TDevLanguageSupport::splitOrientation() const -{ - return Qt::Vertical; -} - -void TDevLanguageSupport::addClass() -{ -} - -void TDevLanguageSupport::addMethod( ClassDom /*klass*/ ) -{ -} - -void TDevLanguageSupport::implementVirtualMethods( ClassDom /*klass*/ ) -{ -} - -void TDevLanguageSupport::addAttribute( ClassDom /*klass*/ ) -{ -} - -TQStringList TDevLanguageSupport::subclassWidget(const TQString& /*formName*/) -{ - return TQStringList(); -} - -TQStringList TDevLanguageSupport::updateWidget(const TQString& /*formName*/, const TQString& /*fileName*/) -{ - return TQStringList(); -} - -TQString TDevLanguageSupport::formatModelItem( const CodeModelItem *item, bool /*shortDescription*/ ) -{ - return item->name(); -} - -void TDevLanguageSupport::addFunction( DesignerType type, const TQString & formName, Function function ) -{ -// kdDebug() << "TDevLanguageSupport::addFunction: 1" << endl; - TDevDesignerIntegration *designerIntegration = designer(type); -// kdDebug() << "TDevLanguageSupport::addFunction: 2" << endl; - if (!designerIntegration) - { -// kdDebug() << "TDevLanguageSupport::addFunction: x" << endl; - return; - } -// kdDebug() << "TDevLanguageSupport::addFunction: 3" << endl; - designerIntegration->addFunction(formName, function); -// kdDebug() << "TDevLanguageSupport::addFunction: 4" << endl; -} - -void TDevLanguageSupport::editFunction( DesignerType type, const TQString & formName, Function oldFunction, Function function ) -{ - TDevDesignerIntegration *designerIntegration = designer(type); - if (!designerIntegration) - return; - designerIntegration->editFunction(formName, oldFunction, function); -} - -void TDevLanguageSupport::removeFunction( DesignerType type, const TQString & formName, Function function ) -{ - TDevDesignerIntegration *designerIntegration = designer(type); - if (!designerIntegration) - return; - designerIntegration->removeFunction(formName, function); -} - -TDevDesignerIntegration * TDevLanguageSupport::designer( DesignerType // type - ) -{ - return 0; -} - -void TDevLanguageSupport::openFunction( DesignerType type, const TQString & formName, const TQString & functionName ) -{ - TDevDesignerIntegration *designerIntegration = designer(type); - if (!designerIntegration) - return; - designerIntegration->openFunction(formName, functionName); -} - -void TDevLanguageSupport::createAccessMethods( ClassDom // theClass - , VariableDom // theVariable - ) -{ -} - -void TDevLanguageSupport::openSource( DesignerType type, const TQString & formName) -{ - TDevDesignerIntegration *designerIntegration = designer(type); - if (!designerIntegration) - return; - designerIntegration->openSource(formName); -} - -#include "tdevlanguagesupport.moc" diff --git a/lib/interfaces/tdevlanguagesupport.h b/lib/interfaces/tdevlanguagesupport.h deleted file mode 100644 index a1778ff6..00000000 --- a/lib/interfaces/tdevlanguagesupport.h +++ /dev/null @@ -1,261 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Amilcar do Carmo Lucas - Copyright (C) 2003-2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVLANGUAGESUPPORT_H -#define TDEVLANGUAGESUPPORT_H - -#include -#include -#include -#include "tdevplugin.h" -#include "codemodel.h" -#include - -/** -@file tdevlanguagesupport.h -Interface to programming language specific features. -*/ - -class Tag; -class TDevDesignerIntegration; - -using namespace KInterfaceDesigner; - -/** -KDevelop language support interface - the base class for all programming language support plugins. -Language support is used to load facilities specific to certain programming language. -Language supports are usually loaded among with a project. In this case project file defines -which language support to load. - -Language support plugin is a good place for: -- a language parser which fills memory and persistent symbol store -(see @ref CodeModel and @ref TDevCodeRepository); -- code wizards specific to a programming language (like new class wizard); -- GUI designer integration (see @ref TDevLanguageSupport::designer method -documentation and @ref TDevDesignerIntegration class documentation; -- symbol (class, function, etc.) name formatting to a human-readable convention (pretty -formatted name). -. -*/ -class TDevLanguageSupport: public TDevPlugin -{ - Q_OBJECT - - -public: - - /**Features supported by this language support.*/ - enum Features { - /*features of the language itself*/ - Classes=1 /**loadSettings(*project()->projectDom(), "kdevmylangsupport/designerintegration"); - saveDesignerToCache(type, des); - } - break; - } - return des; - @endcode - @ref ImplementationWidget and @ref TQtDesignerIntegration classes are available - from designerintegration support library. - @param type The type of the designer to integrate. - @return The pointer to designer integration of given type or 0.*/ - virtual TDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type); - -public slots: - /**Adds a function requested by a GUI designer. No need to reimplement this slot - unless you want to use specific implementation of TDevDesignerIntegration interface. - @param type The type of integrated designer. - @param formName The name of a GUI form. - @param function The function to implement (add).*/ - void addFunction(DesignerType type, const TQString &formName, Function function); - - /**Removes a function requested by a GUI designer. No need to reimplement this slot - unless you want to use specific implementation of TDevDesignerIntegration interface. - @param type The type of integrated designer. - @param formName The name of a GUI form. - @param function The function to remove.*/ - void removeFunction(DesignerType type, const TQString &formName, Function function); - - /**Edits a function requested by a GUI designer. No need to reimplement this slot - unless you want to use specific implementation of TDevDesignerIntegration interface. - @param type The type of integrated designer. - @param formName The name of a GUI form. - @param oldFunction The old function signature before editing. - @param function The new function signature after editing.*/ - void editFunction(DesignerType type, const TQString &formName, Function oldFunction, Function function); - - /**Opens a function requested by a GUI designer. No need to reimplement this slot - unless you want to use specific implementation of TDevDesignerIntegration interface. - @param type The type of integrated designer. - @param formName The name of a GUI form. - @param functionName The name of a function to seek in the code for.*/ - void openFunction(DesignerType type, const TQString &formName, const TQString &functionName); - - /**Opens a form source requested by a GUI designer. No need to reimplement this slot - unless you want to use specific implementation of TDevDesignerIntegration interface. - @param type The type of integrated designer. - @param formName The name of a GUI form.*/ - void openSource(DesignerType type, const TQString &formName); - -signals: - /**Emitted when the content of the memory symbol store has been modified.*/ - void updatedSourceInfo(); - - /**Emitted before removing the file from the memory symbol store.*/ - void aboutToRemoveSourceInfo(const TQString& fileName); - - /**Emitted when a file has been removed from the memory symbol store.*/ - void removedSourceInfo(const TQString& fileName); - - /**Emitted when a file has been added to the memory symbol store.*/ - void addedSourceInfo( const TQString& fileName ); - - /**Emitted when the language part changes the Split View orientation.*/ - void splitOrientationChanged( Qt::Orientation orientation ); -}; - -#endif diff --git a/lib/interfaces/tdevmainwindow.cpp b/lib/interfaces/tdevmainwindow.cpp deleted file mode 100644 index e73250e9..00000000 --- a/lib/interfaces/tdevmainwindow.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 John Firebaugh - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevmainwindow.h" - -#include -#include - -KStatusBar *TDevMainWindow::statusBar() -{ - return main()->statusBar(); -} diff --git a/lib/interfaces/tdevmainwindow.h b/lib/interfaces/tdevmainwindow.h deleted file mode 100644 index 83aef3b0..00000000 --- a/lib/interfaces/tdevmainwindow.h +++ /dev/null @@ -1,101 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 F@lk Brettschneider - Copyright (C) 2003 John Firebaugh - Copyright (C) 2003 Amilcar do Carmo Lucas - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEV_MAINWINDOW_H -#define TDEV_MAINWINDOW_H - -#include - -class TQWidget; -class KStatusBar; -class TDEMainWindow; - -/** -@file tdevmainwindow.h -KDevelop main window interface. -*/ - -/** -KDevelop main window interface. -Provides methods to control the main window of an application. -*/ -class TDevMainWindow -{ -public: - /**Destroys the main window*/ - virtual ~TDevMainWindow() {} // must be virtual! - - /**Embeds a view of a part into the main window. - @param view The view to embed. Must be a KPart. - @param title The title of a view. - @param toolTip The tooltip of a view.*/ - virtual void embedPartView(TQWidget *view, const TQString &title, const TQString& toolTip = TQString()) = 0; - - /**Embeds a toolview at the left of the main window. - @param view The view to embed. Must be a KPart. - @param title The title of a view. - @param toolTip The tooltip of a view.*/ - virtual void embedSelectView(TQWidget *view, const TQString &title, const TQString &toolTip) = 0; - - /**Embeds a toolview at the bottom of the main window. - @param view The view to embed. Must be a KPart. - @param title The title of a view. - @param toolTip The tooltip of a view.*/ - virtual void embedOutputView(TQWidget *view, const TQString &title, const TQString &toolTip) = 0; - - /**Embeds a toolview at the right of the main window. - @param view The view to embed. Must be a KPart. - @param title The title of a view. - @param toolTip The tooltip of a view.*/ - virtual void embedSelectViewRight(TQWidget* view, const TQString& title, const TQString &toolTip) = 0; - - /**Removes a view from the main window. - @param view The view to remove.*/ - virtual void removeView(TQWidget *view) = 0; - - /**Shows or hides a view. - @param pView The view to show or hide. - @param bEnabled true if view should be shown, false it it is not.*/ - virtual void setViewAvailable(TQWidget *pView, bool bEnabled) = 0; - - /**Raises a view (shows it if it was minimized). - @param view The view to be raised.*/ - virtual void raiseView(TQWidget *view) = 0; - - /**Minimize a view. - @param view The view to be lowered.*/ - virtual void lowerView(TQWidget *view) = 0; - - /**Loads main window settings.*/ - virtual void loadSettings() = 0; - - /**Sets the current document's caption, if applicable. - @param caption the caption to set.*/ - virtual void setCurrentDocumentCaption( const TQString &caption ) = 0; - - /**@return TDEMainWindow object which actually represents the main window.*/ - virtual TDEMainWindow *main() = 0; - - /**@return KStatusBar object which actually represents the status bar in the main window.*/ - KStatusBar *statusBar(); -}; - -#endif diff --git a/lib/interfaces/tdevpartcontroller.cpp b/lib/interfaces/tdevpartcontroller.cpp deleted file mode 100644 index e718ecf4..00000000 --- a/lib/interfaces/tdevpartcontroller.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Matthias Hoelzer-Kluepfel - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "TDevPartControllerIface.h" -#include "tdevpartcontroller.h" -#include "katedocumentmanagerinterface.h" - -TDevPartController::TDevPartController(TQWidget *parent) - : KParts::PartManager(parent) -{ - new TDevPartControllerIface(this); - new KateDocumentManagerInterface(this); -} - -#include "tdevpartcontroller.moc" diff --git a/lib/interfaces/tdevpartcontroller.h b/lib/interfaces/tdevpartcontroller.h deleted file mode 100644 index 2bb593e6..00000000 --- a/lib/interfaces/tdevpartcontroller.h +++ /dev/null @@ -1,176 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Bernd Gehrmann - Copyright (C) 2003 Roberto Raggi - Copyright (C) 2003 Hamish Rodda - Copyright (C) 2003 Harald Fernengel - Copyright (C) 2003 Jens Dagerbo - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEV_PARTCONTROLLER_H -#define TDEV_PARTCONTROLLER_H - -#include -#include -#include - -/** -@file tdevpartcontroller.h -KDevelop part controller interface. -*/ - -namespace KParts -{ - class ReadOnlyPart; -} - -/**Document state enum.*/ -enum DocumentState -{ - Clean, /** - Copyright (C) 2002 Matthias Hoelzer-Kluepfel - Copyright (C) 2002 Harald Fernengel - Copyright (C) 2002 F@lk Brettschneider - Copyright (C) 2003 Julian Rockey - Copyright (C) 2003 Roberto Raggi - Copyright (C) 2003 Jens Dagerbo - Copyright (C) 2003 Mario Scalas - Copyright (C) 2003-2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevplugin.h" - -#include "tdevapi.h" -#include "tdevcore.h" -#include "tdevplugininfo.h" -#include "tdevpartcontroller.h" -#include "tdevplugincontroller.h" - -#include -#include -#include - -#include -#include - -#include - -/////////////////////////////////////////////////////////////////////////////// -// struct TDevPlugin::Private -/////////////////////////////////////////////////////////////////////////////// - -struct TDevPlugin::Private -{ - const TDevPluginInfo *info; -}; - -/////////////////////////////////////////////////////////////////////////////// -// class TDevPlugin -/////////////////////////////////////////////////////////////////////////////// - -TDevPlugin::TDevPlugin(const TDevPluginInfo *info, TQObject *parent, const char *name) - :TQObject(parent, name), d(new Private) -{ - assert(parent->inherits( "TDevApi" )); - m_api = static_cast( parent ); - - actionCollection()->setHighlightingEnabled( true ); - - d->info = info; - TDEGlobal::iconLoader()->addAppDir("tdevelop"); -} - -TDevPlugin::~TDevPlugin() -{ - delete( d ); -} - -TDevMainWindow *TDevPlugin::mainWindow() -{ - return m_api->mainWindow(); -} - -TDevCore *TDevPlugin::core() const -{ - return m_api->core(); -} - -TDevProject *TDevPlugin::project() const -{ - return m_api->project(); -} - -CodeModel *TDevPlugin::codeModel() const -{ - return m_api->codeModel(); -} - -TQDomDocument *TDevPlugin::projectDom() const -{ - return m_api->projectDom(); -} - -TDevLanguageSupport *TDevPlugin::languageSupport() const -{ - return m_api->languageSupport(); -} - -TDevPartController *TDevPlugin::partController() const -{ - return m_api->partController(); -} - -TDevPluginController *TDevPlugin::pluginController() const -{ - return m_api->pluginController(); -} - -void TDevPlugin::restorePartialProjectSession(const TQDomElement* /*el*/) -{ - // there's still nothing to do in the base class -} - -void TDevPlugin::savePartialProjectSession(TQDomElement* /*el*/) -{ - // there's still nothing to do in the base class -} - -TDevCodeRepository * TDevPlugin::codeRepository() const -{ - return m_api->codeRepository(); -} - -TDevPlugin * TDevPlugin::extension_internal(const TQString &serviceType, const TQString &constraint) -{ - return m_api->pluginController()->extension(serviceType, constraint); -} - -const TDevPluginInfo *TDevPlugin::info() -{ - return d->info; -} - -#include "tdevplugin.moc" diff --git a/lib/interfaces/tdevplugin.h b/lib/interfaces/tdevplugin.h deleted file mode 100644 index eaa66146..00000000 --- a/lib/interfaces/tdevplugin.h +++ /dev/null @@ -1,201 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 1999-2001 Bernd Gehrmann - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVPLUGIN_H -#define TDEVPLUGIN_H - -#include -#include -#include "tdevapi.h" - -class TDevCore; -class TDevProject; -class TDevVersionControl; -class TDevLanguageSupport; -class TDevPartController; -class TDevMainWindow; -class TDevCodeRepository; -class CodeModel; -class TDevPluginInfo; -class TQDomElement; - -/** -@file tdevplugin.h -TDevelop plugin interface. -*/ - -/**Current TDevelop plugin interface version. Interfaces declare plugin version to make sure -old source (or binary) incompatible plugins are not loaded. Increase this if -it is necessary that old plugins stop working.*/ -#define TDEVELOP_PLUGIN_VERSION 5 - -/** -The base class for all TDevelop plugins. -Plugin is a component which is loaded into TDevelop shell at startup or by request. -Each plugin should have corresponding .desktop file with a description. -.desktop file template looks like: -@code -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Name= -GenericName= -Comment= -Icon= -X-TDevelop-Plugin-Version= -X-TDevelop-Plugin-Homepage= -X-TDevelop-Plugin-BugsEmailAddress= -X-TDevelop-Plugin-Copyright= -X-TDE-Library= -X-TDevelop-Version= -X-TDevelop-Scope= -X-TDevelop-Properties= -X-TDevelop-Args= -@endcode -Description of parameters in .desktop file: -- Name is a non-translatable name of a plugin, it is used in TDETrader queries -to search for a plugin (required); -- GenericName is a translatable name of a plugin, it is used to show -plugin names in GUI (required); -- Comment is a short description about the plugin (optional); -- Icon is a plugin icon (preferred); -- X-TDevelop-Plugin-Version is a version of a plugin (optional); -- X-TDevelop-Plugin-Homepage is a home page of a plugin (optional); -- X-TDevelop-Plugin-License is a license (optional). can be: GPL, LGPL, BSD, Artistic, -TQPL or Custom. If this property is not set, license is considered as unknown; -- X-TDevelop-Plugin-BugsEmailAddress is an email address for bug reports (optional); -- X-TDevelop-Plugin-Copyright is a copyright statement (optional); -- X-TDE-Library is a name of library which contains the plugin (required); -- X-TDevelop-Version is a version of TDevelop interfaces which is supported by the plugin (required); -- X-TDevelop-Scope is a scope of a plugin (see below for explanation) (required); -- X-TDevelop-Args is a list of additional arguments passed to plugins constructor (optional); -- X-TDevelop-Properties is a list of properties which this plugin supports, see @ref Profile class documentation for explanation (required to work with shells that support profiles). -. -Plugin scope can be either: -- Core -- Global -- Project -. -Global plugins are plugins which require only shell to be loaded and do not operate on @ref TDevProject interface and/or do not use project wide information.\n -Core plugins are global plugins which offer some important "core" functionality and thus -are not selectable by user in plugin configuration pages.\n -Project plugins require a project to be loaded and are usually loaded/unloaded among with the project. -If your plugin use @ref TDevProject interface and/or operate on project-related information then this is the project plugin. - -@sa TDevGenericFactory class documentation for an information about plugin instantiation -and writing factories for plugins. - -@sa TDevCore class documentation for an information about features which are available to plugins -from shell applications. -*/ -class TDevPlugin: public TQObject, public KXMLGUIClient -{ - Q_OBJECT - - -public: - /**Constructs a plugin. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevPlugin(const TDevPluginInfo *info, TQObject *parent, const char *name = 0); - - /**Destructs a plugin.*/ - virtual ~TDevPlugin(); - - /**Provides an information about the plugin. - @return TDEAboutData object which was initialized in the constructor.*/ - const TDevPluginInfo* info(); - - /**@return A reference to the toplevel widget.*/ - TDevMainWindow *mainWindow(); - - /**@return A reference to the application core - an object which provides - basic functionalities for inter-parts communications / cooperation.*/ - TDevCore *core() const; - - /**@return A reference to the current project component or 0 if no project is loaded.*/ - TDevProject *project() const; - - /**@return A reference to the language support component or 0 if no support available.*/ - TDevLanguageSupport *languageSupport() const; - - /**@return A reference to the memory symbol store.*/ - CodeModel *codeModel() const; - - /**@return A reference to the DOM tree that represents the project file or 0 if no project is loaded.*/ - TQDomDocument *projectDom() const; - - /**@return A reference to the part controller which is used to manipulate loaded KParts.*/ - TDevPartController *partController() const; - - /**@return A reference to the plugin controller which is used to manipulate loaded plugin.*/ - virtual TDevPluginController *pluginController() const; - - /**@return A reference to the code repository (accessor to persistent symbol stores).*/ - TDevCodeRepository* codeRepository() const; - - /**Queries for the plugin which supports given service type (such plugins are called extensions in KDevelop). - All already loaded plugins will be queried and the first loaded one to support - the service type will be returned. Any plugin can be an extension, only "ServiceTypes=..." - entry is required in .desktop file for that plugin. - - Template argument is used as a type to cast the result to. This is done because extension - is usually derived from a certain base class and not directly from TDevPlugin. - @param serviceType The service type of an extension (like "TDevelop/SourceFormatter"). - @param constraint The constraint which is applied when quering for the service. This - constraint is a usual TDETrader constraint statement (like "[X-TDevelop-Foo]=='MyFoo'"). - @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/ - template - Extension *extension(const TQString &serviceType, const TQString &constraint = "") - { - return static_cast(extension_internal(serviceType, constraint)); - } - - /**Override this base class method to restore any settings which differs from project to project. - Data can be read from a certain subtree of the project session file. - During project loading, respectively project session (.kdevses) loading, - this method will be called to give a chance to adapt the plugin to - the newly loaded project. For instance, the debugger plugin might restore the - list of breakpoints from the previous debug session for the certain project. - @note Take attention to the difference to common not-project-related session stuff. - They belong to the application rc file (tdeveloprc) - @note Project session file is useful for settings which cannot be shared between - developers. If a setting should be shared, modify projectDom instead. - @param el The parent DOM element for plugins session settings.*/ - virtual void restorePartialProjectSession(const TQDomElement* el); - - /**Saves session settings. - @sa restorePartialProjectSession - this is the other way round, the same just for saving.*/ - virtual void savePartialProjectSession(TQDomElement* el); - -private: - TDevPlugin *extension_internal(const TQString &serviceType, const TQString &constraint = ""); - - TDevApi *m_api; - class Private; - Private *d; -}; - -#endif diff --git a/lib/interfaces/tdevplugincontroller.cpp b/lib/interfaces/tdevplugincontroller.cpp deleted file mode 100644 index bf1eb5e7..00000000 --- a/lib/interfaces/tdevplugincontroller.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevplugincontroller.h" - -#include "tdevplugin.h" - -TDevPluginController::TDevPluginController() -{ -} - -TDETrader::OfferList TDevPluginController::query(const TQString &serviceType, - const TQString &constraint) -{ - return TDETrader::self()->query(serviceType, - TQString("%1 and [X-TDevelop-Version] == %2").arg(constraint).arg(TDEVELOP_PLUGIN_VERSION)); -} - -TDETrader::OfferList TDevPluginController::queryPlugins(const TQString &constraint) -{ - return query("TDevelop/Plugin", constraint); -} - -KURL::List TDevPluginController::profileResources(const TQString &/*nameFilter*/) -{ - return KURL::List(); -} - -KURL::List TDevPluginController::profileResourcesRecursive(const TQString &/*nameFilter*/) -{ - return KURL::List(); -} - -#include "tdevplugincontroller.moc" diff --git a/lib/interfaces/tdevplugincontroller.h b/lib/interfaces/tdevplugincontroller.h deleted file mode 100644 index ee44764d..00000000 --- a/lib/interfaces/tdevplugincontroller.h +++ /dev/null @@ -1,119 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVPLUGINCONTROLLER_H -#define TDEVPLUGINCONTROLLER_H - -#include - -#include -#include - -/** -@file tdevplugincontroller.h -TDevelop plugin controller interface. -*/ - -class TDevPlugin; -class ProfileEngine; - -/** -The base class for TDevelop plugin controller. -Plugin controller is responsible for quering, loading and unloading available plugins. -*/ -class TDevPluginController: public TQObject -{ - Q_OBJECT - -public: - - /** - * Returns a uniquely specified plugin. If it isn't already loaded, it will be. - * Use with caution! See extension for parameter details. - */ - virtual TDevPlugin * loadPlugin( const TQString & serviceType, const TQString & constraint ) = 0; - - /** - * Unloads the plugin specified by @p plugin - * @param plugin The plugin desktopEntryName of the plugin to unload - */ - virtual void unloadPlugin( const TQString & plugin ) = 0; - - /**Unloads plugins specified by @p list. - @param list The list of plugin names to unload. plugin name corresponds - to the "Name" property in plugin .desktop file.*/ - virtual void unloadPlugins(TQStringList const &list) = 0; - - /**@return The list of currently loaded plugins.*/ - virtual const TQValueList loadedPlugins() = 0; - - /**Queries for the plugin which supports given service type. - All already loaded plugins will be queried and the first one to support the service type - will be returned. Any plugin can be an extension, only "ServiceTypes=..." entry is - required in .desktop file for that plugin. - @param serviceType The service type of an extension (like "TDevelop/SourceFormatter") - @param constraint The constraint which is applied when quering for the service. This - constraint is a usual TDETrader constraint statement (like "[X-TDevelop-Foo]=='MyFoo'"). - @return A KDevelop extension plugin for given service type or 0 if no plugin supports it*/ - virtual TDevPlugin *extension(const TQString &serviceType, const TQString &constraint = "") = 0; - - /**Queries KDevelop services. Version is checked automatically - by adding proper X-TDevelop-Version=N statement into the query. - @param serviceType The service type to query, for example "TDevelop/Plugin" or - "TDevelop/SourceFormatter." - @param constraint A constraint for the service. Do not include plugin version number - it - is done automatically. - @return The list of plugin offers.*/ - static TDETrader::OfferList query(const TQString &serviceType, const TQString &constraint); - - /**Queries TDevelop plugins. Works like - TDevPluginController::query with serviceType set to "TDevelop/Plugin". - @param constraint A constraint for the service. Do not include plugin version number - it - is done automatically. - @return The list of plugin offers.*/ - static TDETrader::OfferList queryPlugins(const TQString &constraint); - - /**Reimplement this function only if your shell supports plugin profiles. - @return The list of URLs to the profile resources (files) with given @p extension. - @param nameFilter Name filter for files. @see TQDir::setNameFilter documentation - for name filters syntax.*/ - virtual KURL::List profileResources(const TQString &nameFilter); - - /**Reimplement this function only if your shell supports plugin profiles. - @return The list of URLs to the resources (files) with given @p extension. - This list is obtained by a recursive search that process given profile - and all it's subprofiles. - @param nameFilter Name filter for files. @see TQDir::setNameFilter documentation - for name filters syntax.*/ - virtual KURL::List profileResourcesRecursive(const TQString &nameFilter); - - /** @return The current Profile Engine */ - virtual ProfileEngine &engine() = 0; - -signals: - /**Emitted when a plugin profile was changed (reloaded, other profile opened, etc.). - Should work only on shells with plugin profiles support.*/ - void profileChanged(); - -protected: - /**Constructor.*/ - TDevPluginController(); - -}; - -#endif diff --git a/lib/interfaces/tdevplugininfo.cpp b/lib/interfaces/tdevplugininfo.cpp deleted file mode 100644 index 2f607431..00000000 --- a/lib/interfaces/tdevplugininfo.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "tdevplugininfo.h" - -#include - -#include -#include - -#include "tdevplugincontroller.h" - -struct TDevPluginInfo::Private { - TQString m_pluginName; - TQString m_rawGenericName; - - TQString m_genericName; - TQString m_description; - TQString m_icon; - - TQString m_version; - int m_licenseType; - TQString m_copyrightStatement; - TQString m_homePageAddress; - TQString m_bugsEmailAddress; - - TQValueList m_authors; - TQValueList m_credits; - - TDEAboutData *m_data; -}; - - -TDevPluginInfo::TDevPluginInfo(const TQString &pluginName) - :d(new Private()) -{ - d->m_pluginName = pluginName; - - KService::Ptr offer = KService::serviceByDesktopName(pluginName); - if (offer != 0) - { - d->m_genericName = offer->genericName(); - d->m_icon = offer->icon(); - d->m_description = offer->comment(); - - d->m_rawGenericName = offer->untranslatedGenericName(); - - d->m_version = offer->property("X-TDevelop-Plugin-Version").toString(); - d->m_homePageAddress = offer->property("X-TDevelop-Plugin-Homepage").toString(); - d->m_bugsEmailAddress = offer->property("X-TDevelop-Plugin-BugsEmailAddress").toString(); - d->m_copyrightStatement = offer->property("X-TDevelop-Plugin-Copyright").toString(); - - TQString lic = offer->property("X-TDevelop-Plugin-License").toString(); - if (lic == "GPL") - d->m_licenseType = TDEAboutData::License_GPL; - else if (lic == "LGPL") - d->m_licenseType = TDEAboutData::License_LGPL; - else if (lic == "BSD") - d->m_licenseType = TDEAboutData::License_BSD; - else if (lic == "QPL") - d->m_licenseType = TDEAboutData::License_QPL; - else if (lic == "Artistic") - d->m_licenseType = TDEAboutData::License_Artistic; - else if (lic == "Custom") - d->m_licenseType = TDEAboutData::License_Custom; - else - d->m_licenseType = TDEAboutData::License_Unknown; - - d->m_data = new TDEAboutData(d->m_pluginName.ascii(), d->m_rawGenericName.ascii(), "1", 0, d->m_licenseType); - } - else - kdDebug() << "Unable to load information for plugin: " << pluginName - << ". Check if " << pluginName << ".desktop exists." << endl; -} - - -TDevPluginInfo::operator TDEAboutData *() const -{ - return d->m_data; -} - -TQString TDevPluginInfo::pluginName() const -{ - return d->m_pluginName; -} - -TQString TDevPluginInfo::genericName() const -{ - return d->m_genericName; -} - -TQString TDevPluginInfo::icon() const -{ - return d->m_icon; -} - -TQString TDevPluginInfo::description() const -{ - return d->m_description; -} - -TQString TDevPluginInfo::version() const -{ - return d->m_version; -} - -int TDevPluginInfo::licenseType() const -{ - return d->m_licenseType; -} - -TQString TDevPluginInfo::license() const -{ - TDevPluginInfo &info = *const_cast(this); -// return TDEAboutData(info).license(); - TDEAboutData *data = info; - return data->license(); -} - -TQString TDevPluginInfo::copyrightStatement() const -{ - return d->m_copyrightStatement; -} - -TQString TDevPluginInfo::homePageAddress() const -{ - return d->m_homePageAddress; -} - -TQString TDevPluginInfo::bugsEmailAddress() const -{ - return d->m_bugsEmailAddress; -} - -TQVariant TDevPluginInfo::property(const TQString &name) const -{ - TDETrader::OfferList offers = TDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName)); - if (offers.count() == 1) - return offers.first()->property(name); - return TQVariant(); -} - -TQVariant TDevPluginInfo::operator [](const TQString &name) const -{ - return property(name); -} - -TQStringList TDevPluginInfo::propertyNames( ) const -{ - TDETrader::OfferList offers = TDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName)); - if (offers.count() == 1) - return offers.first()->propertyNames(); - return TQStringList(); -} - -void TDevPluginInfo::addAuthor(const char *name, const char *task, - const char *emailAddress, const char *webAddress) -{ - d->m_authors.append(TDEAboutPerson(name, task, emailAddress, webAddress)); -} - -void TDevPluginInfo::addCredit(const char *name, const char *task, - const char *emailAddress, const char *webAddress) -{ - d->m_credits.append(TDEAboutPerson(name, task, emailAddress, webAddress)); -} diff --git a/lib/interfaces/tdevplugininfo.h b/lib/interfaces/tdevplugininfo.h deleted file mode 100644 index 419d61aa..00000000 --- a/lib/interfaces/tdevplugininfo.h +++ /dev/null @@ -1,111 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVPLUGININFO_H -#define TDEVPLUGININFO_H - -#include - -#include - -/** -@file tdevplugininfo.h -TDevelop plugin information container class. -*/ - -/** -Information about TDevelop plugin. -It uses plugin name to query plugin .desktop files and -retrieve most information. Names of authors and credits to other people -must be added manually using TDevPluginInfo::addAuthor and TDevPluginInfo::addCredit -methods. -@sa TDevPlugin class documentation for more information about .desktop files. -*/ -class TDevPluginInfo -{ -public: - /**Constructor. - @param pluginName A name of a plugin. Must be the same as the name of a .desktop file - and the same as the location of plugin resource files.*/ - TDevPluginInfo(const TQString &pluginName); - - /**Casts TDevPluginInfo to TDEAboutData. Uses TDevPluginInfo::pluginName as TDEAboutData::appName, - TDevPluginInfo::rawGenericName as TDEAboutData::programName TDevPluginInfo::licenseType as TDEAboutData::licenseType. Other parameters are ignored.*/ - operator TDEAboutData*() const; - - /**@return A name of a plugin (always untranslated).*/ - TQString pluginName() const; - /**@return A generic name of a plugin (translated). Use this in GUI. Information is taken from .desktop file.*/ - TQString genericName() const; - /**@return An icon name of a plugin. Information is taken from .desktop file.*/ - TQString icon() const; - /**@return A description of a plugin. Information is taken from .desktop file.*/ - TQString description() const; - /**@return A version of a plugin. Information is taken from .desktop file.*/ - TQString version() const; - /**@return A license type of a plugin. Information is taken from .desktop file.*/ - int licenseType() const; - /**@return A license text for known license types (GPL, LGPL, BSD, Artistic, TQPL).*/ - TQString license() const; - /**@return A copyright statement of a plugin. Information is taken from .desktop file.*/ - TQString copyrightStatement() const; - /**@return A home page of a plugin. Information is taken from .desktop file.*/ - TQString homePageAddress() const; - /**@return A email address for bugs of a plugin. Information is taken from .desktop file.*/ - TQString bugsEmailAddress() const; - - /**@param name The name of a property. - @return Any property value which exists in .desktop file.*/ - TQVariant property(const TQString &name) const; - /**@param name The name of a property. - @return Any property value which exists in .desktop file.*/ - TQVariant operator [] (const TQString &name) const; - /**@return A list of property names set in .desktop file.*/ - TQStringList propertyNames() const; - - /**@return A list of plugin authors.*/ - const TQValueList authors() const; - /**@return A list of other plugin contributors.*/ - const TQValueList credits() const; - - /**Adds an author to the list of authors. - You can call this function as many times you need. Each entry is appended to a list. - @param name The developer's name in UTF-8 encoding. - @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0. - @param emailAddress An Email address where the person can be reached. Can be 0. - @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/ - void addAuthor(const char *name, const char *task, - const char *emailAddress = 0, const char *webAddress = 0); - /**Adds a contributor to the list of contributors. - You can call this function as many times you need. Each entry is appended to a list. - @param name The developer's name in UTF-8 encoding. - @param task What the person is responsible for. This text can contain newlines. It should be marked for translation like this: I18N_NOOP("Task description..."). Can be 0. - @param emailAddress An Email address where the person can be reached. Can be 0. - @param webAddress The person's homepage or a relevant link. Start the address with "http://". "http://some.domain" is correct, "some.domain" is not. Can be 0.*/ - void addCredit(const char *name, const char *task = 0, - const char *emailAddress = 0, const char *webAddress = 0); - -private: - /**Returns the untranslated generic name of a plugin as set in .desktop file.*/ - const char *rawGenericName() const; - - class Private; - Private *d; -}; - -#endif diff --git a/lib/interfaces/tdevproject.cpp b/lib/interfaces/tdevproject.cpp deleted file mode 100644 index 77136ca0..00000000 --- a/lib/interfaces/tdevproject.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2003 Jens Dagerbo - Copyright (C) 2003 Mario Scalas - Copyright (C) 2003-2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "tdevproject.h" -#include -#include -#include -#include "tdevprojectiface.h" - -struct TDevProject::Private { - TQMap m_absToRel; - TQStringList m_symlinkList; - TQTimer *m_timer; - TDevProjectIface *m_iface; -}; - -TDevProject::TDevProject(const TDevPluginInfo *info, TQObject *parent, const char *name) - : TDevPlugin(info, parent, name), d(new TDevProject::Private()) -{ - connect( this, TQT_SIGNAL(addedFilesToProject(const TQStringList& )), this, TQT_SLOT(buildFileMap()) ); - connect( this, TQT_SIGNAL(removedFilesFromProject(const TQStringList& )), this, TQT_SLOT(buildFileMap()) ); - - connect( this, TQT_SIGNAL(addedFilesToProject(const TQStringList& )), this, TQT_SLOT(slotAddFilesToFileMap(const TQStringList& )) ); - connect( this, TQT_SIGNAL(removedFilesFromProject(const TQStringList& )), this, TQT_SLOT(slotRemoveFilesFromFileMap(const TQStringList& )) ); - - d->m_timer = new TQTimer(this); - connect(d->m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotBuildFileMap())); - d->m_iface = new TDevProjectIface(this); -} - -TDevProject::~TDevProject() -{ - d->m_timer->stop(); - delete d->m_iface; - delete d->m_timer; - delete d; -} - -void TDevProject::changedFile( const TQString & fileName ) -{ - TQStringList fileList; - fileList.append ( fileName ); - - emit changedFilesInProject( fileList ); - -} - -void TDevProject::changedFiles( const TQStringList & fileList ) -{ - emit changedFilesInProject( fileList ); -} - -TDevProject::Options TDevProject::options() const -{ - return (TDevProject::Options)0; -} - -bool TDevProject::isProjectFile( const TQString & absFileName ) -{ - return d->m_absToRel.contains( absFileName ); -} - -TQString TDevProject::relativeProjectFile( const TQString & absFileName ) -{ - if( isProjectFile(absFileName) ) - return d->m_absToRel[ absFileName ]; - return TQString(); -} - -void TDevProject::buildFileMap() -{ - d->m_timer->stop(); - d->m_timer->start(0, true); -} - -void TDevProject::slotBuildFileMap() -{ - kdDebug(9000) << k_funcinfo << endl; - - d->m_absToRel.clear(); - d->m_symlinkList.clear(); - const TQStringList fileList = allFiles(); - for( TQStringList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) - { - TQFileInfo fileInfo( projectDirectory() + "/" + *it ); - d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it; - - if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() ) - { - d->m_symlinkList << *it; - } - } -} - -void TDevProject::openProject( const TQString & /*dirName*/, const TQString & /*projectName*/ ) -{ - buildFileMap(); -} - -TQStringList TDevProject::symlinkProjectFiles( ) -{ - return d->m_symlinkList; -} - -TQString TDevProject::defaultRunDirectory(const TQString& projectPluginName) const -{ - return DomUtil::readEntry(*projectDom(), "/" + projectPluginName + "/run/globalcwd"); -} - -void TDevProject::slotAddFilesToFileMap( const TQStringList & fileList ) -{ - TQStringList::ConstIterator it = fileList.begin(); - while( it != fileList.end() ) - { - TQFileInfo fileInfo( projectDirectory() + "/" + *it ); - d->m_absToRel[ URLUtil::canonicalPath(fileInfo.absFilePath()) ] = *it; - - if ( URLUtil::canonicalPath( fileInfo.absFilePath() ) != fileInfo.absFilePath() ) - { - d->m_symlinkList << *it; - } - - ++it; - } -} - -void TDevProject::slotRemoveFilesFromFileMap( const TQStringList & fileList ) -{ - TQStringList::ConstIterator it = fileList.begin(); - while( it != fileList.end() ) - { - TQFileInfo fileInfo( projectDirectory() + "/" + *it ); - d->m_absToRel.remove( URLUtil::canonicalPath(fileInfo.absFilePath()) ); - - d->m_symlinkList.remove( *it ); - - ++it; - } -} - -#include "tdevproject.moc" diff --git a/lib/interfaces/tdevproject.h b/lib/interfaces/tdevproject.h deleted file mode 100644 index fa320edf..00000000 --- a/lib/interfaces/tdevproject.h +++ /dev/null @@ -1,219 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Matthias Hoelzer-Kluepfel - Copyright (C) 2001-2002 Bernd Gehrmann - Copyright (C) 2002-2003 Roberto Raggi - Copyright (C) 2002 Simon Hausmann - Copyright (C) 2003 Jens Dagerbo - Copyright (C) 2003 Mario Scalas - Copyright (C) 2003-2004 Alexander Dymo - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TDEVPROJECT_H -#define TDEVPROJECT_H - -#include "tdevplugin.h" -#include "domutil.h" - -#include -#include - -/** -@file tdevproject.h -KDevelop project interface. -*/ - -class TQTimer; - -/** -KDevelop project interface. -Plugins implementing the TDevProject interfaces are used to manage projects. - -Project can be considered as a way of grouping files (in text editors) or -as a way of providing support for a build system (like it is done in TDevelop IDE buildtools). -*/ -class TDevProject: public TDevPlugin -{ - Q_OBJECT - -public: - /**Constructs a project plugin. - @param info Important information about the plugin - plugin internal and generic - (GUI) name, description, a list of authors, etc. That information is used to show - plugin information in various places like "about application" dialog, plugin selector - dialog, etc. Plugin does not take ownership on info object, also its lifetime should - be equal to the lifetime of the plugin. - @param parent The parent object for the plugin. Parent object must implement @ref TDevApi - interface. Otherwise the plugin will not be constructed. - @param name The internal name which identifies the plugin.*/ - TDevProject(const TDevPluginInfo *info, TQObject *parent=0, const char *name=0); - /**Destructor.*/ - virtual ~TDevProject(); - - /**Options of the project plugin.*/ - enum Options { - UsesOtherBuildSystem = 0 /**/run/directoryradio == executable - * The directory where the executable is. - * if //run/directoryradio == build - * The build directory. - * if /kdevautoproject/run/directoryradio == custom - * The custom directory absolute path. - * Derived classes are supposed to explicitly call this implementation - */ - TQString defaultRunDirectory(const TQString& projectPluginName) const; - -private slots: - void buildFileMap(); - void slotBuildFileMap(); - void slotAddFilesToFileMap(const TQStringList & fileList ); - void slotRemoveFilesFromFileMap(const TQStringList & fileList ); - -signals: - /**Emitted when a new list of files has been added to the - project. Provided for convenience when many files were added. - @param fileList The file names relative to the project directory.*/ - void addedFilesToProject(const TQStringList& fileList); - - /**Emitted when a list of files has been removed from the project. - Provided for convenience when many files were removed. - @param fileList The file names relative to the project directory.*/ - void removedFilesFromProject(const TQStringList& fileList); - - /**Emitted when a list of files has changed in the project. - @param fileList The file names relative to the project directory.*/ - void changedFilesInProject(const TQStringList& fileList); - - /**Emitted when one compile related command (make, make install, make ...) ends sucessfuly. - Used to reparse the files after a sucessful compilation.*/ - void projectCompiled(); - - /**Emitted when the active directory of the project changes - * @param olddir The old active directory - * @param newdir The new active directory - */ - void activeDirectoryChanged( const TQString& olddir, const TQString& newdir ); - -private: - class Private; - Private *d; -}; - -#endif diff --git a/lib/interfaces/tdevprojectiface.cpp b/lib/interfaces/tdevprojectiface.cpp deleted file mode 100644 index 625a4118..00000000 --- a/lib/interfaces/tdevprojectiface.cpp +++ /dev/null @@ -1,186 +0,0 @@ - - -/* This file is part of the KDE project - Copyright (C) 2005 Ian Reinhart Geiser - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "tdevprojectiface.h" -#include "tdevproject.h" -#include "domutil.h" - -TDevProjectIface::TDevProjectIface(TDevProject *prj) - : TQObject(prj), DCOPObject("TDevProject"), m_prj(prj) -{ -} - - -TDevProjectIface::~TDevProjectIface() -{ -} - -void TDevProjectIface::openProject( const TQString & dirName, const TQString & projectName ) -{ - m_prj->openProject(dirName,projectName); -} - -void TDevProjectIface::closeProject( ) -{ - m_prj->closeProject(); -} - -uint TDevProjectIface::options( ) const -{ - return (uint)m_prj->options(); -} - -TQString TDevProjectIface::projectDirectory( ) const -{ - return m_prj->projectDirectory(); -} - -TQString TDevProjectIface::projectName( ) const -{ - return m_prj->projectName(); -} - -TQString TDevProjectIface::mainProgram() const -{ - return m_prj->mainProgram(); -} - -TQString TDevProjectIface::runDirectory( ) const -{ - return m_prj->runDirectory(); -} - -TQString TDevProjectIface::activeDirectory( ) const -{ - return m_prj->activeDirectory(); -} - -TQString TDevProjectIface::buildDirectory( ) const -{ - return m_prj->buildDirectory(); -} - -TQStringList TDevProjectIface::allFiles( ) const -{ - return m_prj->allFiles(); -} - -TQStringList TDevProjectIface::distFiles( ) const -{ - return m_prj->distFiles(); -} - -void TDevProjectIface::addFiles( const TQStringList & fileList ) -{ - m_prj->addFiles(fileList); -} - -void TDevProjectIface::addFile( const TQString & fileName ) -{ - m_prj->addFile(fileName); -} - -void TDevProjectIface::removeFiles( const TQStringList & fileList ) -{ - m_prj->removeFiles(fileList); -} - -void TDevProjectIface::removeFile( const TQString & fileName ) -{ - m_prj->removeFile(fileName); -} - -void TDevProjectIface::changedFiles( const TQStringList & fileList ) -{ - m_prj->changedFiles(fileList); -} - -void TDevProjectIface::changedFile( const TQString & fileName ) -{ - m_prj->changedFile(fileName); -} - -bool TDevProjectIface::isProjectFile( const TQString & absFileName ) -{ - return m_prj->isProjectFile(absFileName); -} - -TQString TDevProjectIface::relativeProjectFile( const TQString & absFileName ) -{ - return m_prj->relativeProjectFile(absFileName); -} - -TQStringList TDevProjectIface::symlinkProjectFiles( ) -{ - return m_prj->symlinkProjectFiles(); -} - -TQString TDevProjectIface::readEntry( const TQString & path, const TQString & defaultEntry ) -{ - return DomUtil::readEntry( *m_prj->projectDom(), path, defaultEntry); -} - -int TDevProjectIface::readIntEntry( const TQString & path, int defaultEntry ) -{ - return DomUtil::readIntEntry(*m_prj->projectDom(), path,defaultEntry); -} - -bool TDevProjectIface::readBoolEntry( const TQString & path, bool defaultEntry ) -{ - return DomUtil::readBoolEntry(*m_prj->projectDom(), path, defaultEntry); -} - -TQStringList TDevProjectIface::readListEntry( const TQString & path, const TQString & tag ) -{ - return DomUtil::readListEntry(*m_prj->projectDom(), path, tag); -} - -TQMap< TQString, TQString > TDevProjectIface::readMapEntry( const TQString & path ) -{ - return DomUtil::readMapEntry(*m_prj->projectDom(), path); -} - -void TDevProjectIface::writeEntry( const TQString & path, const TQString & value ) -{ - DomUtil::writeEntry(*m_prj->projectDom(), path, value); -} - -void TDevProjectIface::writeIntEntry( const TQString & path, int value ) -{ - DomUtil::writeIntEntry(*m_prj->projectDom(), path, value); -} - -void TDevProjectIface::writeBoolEntry( const TQString & path, bool value ) -{ - DomUtil::writeBoolEntry(*m_prj->projectDom(), path, value); -} - -void TDevProjectIface::writeListEntry( const TQString & path, const TQString & tag, const TQStringList & value ) -{ - DomUtil::writeListEntry(*m_prj->projectDom(), path, tag, value); -} - -void TDevProjectIface::writeMapEntry( const TQString & path, const TQMap< TQString, TQString > & map ) -{ - DomUtil::writeMapEntry(*m_prj->projectDom(), path, map); -} - -#include "tdevprojectiface.moc" diff --git a/lib/interfaces/tdevprojectiface.h b/lib/interfaces/tdevprojectiface.h deleted file mode 100644 index c3e0ddd4..00000000 --- a/lib/interfaces/tdevprojectiface.h +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2005 Ian Reinhart Geiser - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef TDEVPROJECTIFACE_H -#define TDEVPROJECTIFACE_H - -#include -#include -#include - -class TDevProject; - -/** -DCOP Interface for the @ref TDevProject object. - -@author KDevelop Authors -*/ -class TDevProjectIface : public TQObject, public DCOPObject -{ - Q_OBJECT -// - K_DCOP -public: - TDevProjectIface(TDevProject *prj); - - ~TDevProjectIface(); -k_dcop: - void openProject(const TQString &dirName, const TQString &projectName); - void closeProject(); - uint options() const; - TQString projectDirectory() const; - TQString projectName() const; - TQString mainProgram() const; - TQString runDirectory() const; - TQString activeDirectory() const; - TQString buildDirectory() const; - TQStringList allFiles() const; - TQStringList distFiles() const; - void addFiles(const TQStringList &fileList); - void addFile(const TQString &fileName); - void removeFiles(const TQStringList& fileList); - void removeFile(const TQString &fileName); - void changedFiles(const TQStringList &fileList); - void changedFile(const TQString &fileName); - bool isProjectFile(const TQString &absFileName); - TQString relativeProjectFile(const TQString &absFileName); - TQStringList symlinkProjectFiles(); - - // Project DOM access - TQString readEntry(const TQString &path, const TQString &defaultEntry = TQString()); - int readIntEntry(const TQString &path, int defaultEntry = 0); - bool readBoolEntry(const TQString &path, bool defaultEntry = false); - TQStringList readListEntry(const TQString &path, const TQString &tag); - TQMap readMapEntry(const TQString &path); - - void writeEntry(const TQString &path, const TQString &value); - void writeIntEntry(const TQString &path, int value); - void writeBoolEntry( const TQString &path, bool value); - void writeListEntry(const TQString &path, const TQString &tag, const TQStringList &value); - void writeMapEntry(const TQString& path, const TQMap &map); - - private: - TDevProject *m_prj; -}; - -#endif diff --git a/lib/util/CMakeLists.txt b/lib/util/CMakeLists.txt index 0114b5ae..1eb17f35 100644 --- a/lib/util/CMakeLists.txt +++ b/lib/util/CMakeLists.txt @@ -26,13 +26,13 @@ install( FILES DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/util ) -##### tdevutil (static) ######################### +##### kdevutil (static) ######################### -tde_add_library( tdevutil STATIC_PIC AUTOMOC +tde_add_library( kdevutil STATIC_PIC AUTOMOC SOURCES blockingkprocess.cpp configwidgetproxy.cpp domutil.cpp execcommand.cpp filetemplate.cpp - tdeveditorutil.cpp tdevjobtimer.cpp - tdevshellwidget.cpp tdescriptactionmanager.cpp + kdeveditorutil.cpp kdevjobtimer.cpp + kdevshellwidget.cpp tdescriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp ) diff --git a/lib/util/Makefile.am b/lib/util/Makefile.am index 52ededb0..8bf28091 100644 --- a/lib/util/Makefile.am +++ b/lib/util/Makefile.am @@ -1,10 +1,10 @@ INCLUDES = -I$(top_srcdir)/lib/compat -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/sourceinfo $(all_includes) -noinst_LTLIBRARIES = libtdevutil.la +noinst_LTLIBRARIES = libkdevutil.la -libtdevutil_la_SOURCES = blockingkprocess.cpp configwidgetproxy.cpp domutil.cpp \ - execcommand.cpp filetemplate.cpp tdeveditorutil.cpp tdevjobtimer.cpp \ - tdevshellwidget.cpp tdescriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp +libkdevutil_la_SOURCES = blockingkprocess.cpp configwidgetproxy.cpp domutil.cpp \ + execcommand.cpp filetemplate.cpp kdeveditorutil.cpp kdevjobtimer.cpp \ + kdevshellwidget.cpp tdescriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp METASOURCES = AUTO @@ -12,10 +12,10 @@ tdevelopincludedir = $(includedir)/tdevelop/util tdevelopinclude_HEADERS = domutil.h execcommand.h filetemplate.h urlutil.h \ configwidgetproxy.h rurl.h tdescriptactionmanager.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils tdevextensions tdevinterfaces -DOXYGEN_PROJECTNAME = TDevelop Utility Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevextensions kdevinterfaces +DOXYGEN_PROJECTNAME = KDevelop Utility Library +DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am -noinst_HEADERS = blockingkprocess.h tdeveditorutil.h tdevjobtimer.h \ - tdevshellwidget.h settings.h +noinst_HEADERS = blockingkprocess.h kdeveditorutil.h kdevjobtimer.h \ + kdevshellwidget.h settings.h diff --git a/lib/util/configwidgetproxy.cpp b/lib/util/configwidgetproxy.cpp index c2251158..bea1c79a 100644 --- a/lib/util/configwidgetproxy.cpp +++ b/lib/util/configwidgetproxy.cpp @@ -26,13 +26,13 @@ #include #include -#include +#include #include "configwidgetproxy.h" -ConfigWidgetProxy::ConfigWidgetProxy( TDevCore * core ) +ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core ) { connect( core, TQT_SIGNAL(configWidget(KDialogBase*)), this, TQT_SLOT(slotConfigWidget( KDialogBase*)) ); connect( core, TQT_SIGNAL(projectConfigWidget(KDialogBase*)), this, TQT_SLOT(slotProjectConfigWidget( KDialogBase*)) ); diff --git a/lib/util/configwidgetproxy.h b/lib/util/configwidgetproxy.h index f1ced178..7881f830 100644 --- a/lib/util/configwidgetproxy.h +++ b/lib/util/configwidgetproxy.h @@ -24,7 +24,7 @@ #include #include -class TDevCore; +class KDevCore; class KDialogBase; /** @@ -65,8 +65,8 @@ void MyPart::insertConfigWidget( TQObject const * dlg, TQWidget * page, unsigned } @endcode -Note that this replaces the functionality of typical TDevCore::configWidget() and -TDevCore::projectConfigWidget() slots. +Note that this replaces the functionality of typical KDevCore::configWidget() and +KDevCore::projectConfigWidget() slots. */ class ConfigWidgetProxy : public TQObject { @@ -76,7 +76,7 @@ Q_OBJECT public: /**Constructor. @param core An instance of KDevelop Core.*/ - ConfigWidgetProxy( TDevCore * core ); + ConfigWidgetProxy( KDevCore * core ); virtual ~ConfigWidgetProxy(); /** diff --git a/lib/util/filetemplate.cpp b/lib/util/filetemplate.cpp index 4d0facdf..c2454580 100644 --- a/lib/util/filetemplate.cpp +++ b/lib/util/filetemplate.cpp @@ -27,12 +27,12 @@ #include -#include "tdevplugin.h" -#include "tdevproject.h" +#include "kdevplugin.h" +#include "kdevproject.h" #include "domutil.h" -bool FileTemplate::exists(TDevPlugin *part, const TQString &name, Policy p) +bool FileTemplate::exists(KDevPlugin *part, const TQString &name, Policy p) { //TQString fileName = (p == Default) ? // (part->project()->projectDirectory() + "/templates/" + name) : name; @@ -40,17 +40,17 @@ bool FileTemplate::exists(TDevPlugin *part, const TQString &name, Policy p) return TQFile::exists( fullPathForName(part,name,p) ); } -TQString FileTemplate::read(TDevPlugin *part, const TQString &name, Policy p) +TQString FileTemplate::read(KDevPlugin *part, const TQString &name, Policy p) { - //TDevProject *project = part->project(); + //KDevProject *project = part->project(); //TQString fileName = (p == Default) ? (project->projectDirectory() + // "/templates/" + name) : name; return readFile(part, fullPathForName(part, name, p) ); } -TQString FileTemplate::readFile(TDevPlugin *part, const TQString &fileName) +TQString FileTemplate::readFile(KDevPlugin *part, const TQString &fileName) { TQDomDocument &dom = *part->projectDom(); @@ -87,7 +87,7 @@ TQString FileTemplate::makeSubstitutions( TQDomDocument & dom, const TQString & } -bool FileTemplate::copy(TDevPlugin *part, const TQString &name, +bool FileTemplate::copy(KDevPlugin *part, const TQString &name, const TQString &dest, Policy p) { TQString text = read(part, name, p); @@ -109,7 +109,7 @@ bool FileTemplate::copy(TDevPlugin *part, const TQString &name, return true; } -TQString FileTemplate::fullPathForName(TDevPlugin *part, const TQString &name, +TQString FileTemplate::fullPathForName(KDevPlugin *part, const TQString &name, Policy p) { // if Policy is not default, full path is just the name if (p!=Default) return name; @@ -123,6 +123,6 @@ TQString FileTemplate::fullPathForName(TDevPlugin *part, const TQString &name, } // next try global - TQString globalName = ::locate("data", "tdevfilecreate/file-templates/" + name); + TQString globalName = ::locate("data", "kdevfilecreate/file-templates/" + name); return globalName.isNull() ? fileName : globalName; } diff --git a/lib/util/filetemplate.h b/lib/util/filetemplate.h index 7802f9b7..8f863535 100644 --- a/lib/util/filetemplate.h +++ b/lib/util/filetemplate.h @@ -22,7 +22,7 @@ #include -class TDevPlugin; +class KDevPlugin; class TQDomDocument; /** @@ -49,21 +49,21 @@ public: * exists in the current project. File templates * are stored in the "templates" subdirectory of a project or in application shared dirs. */ - static bool exists(TDevPlugin *part, const TQString &name, Policy p = Default); + static bool exists(KDevPlugin *part, const TQString &name, Policy p = Default); /** * Reads a template with the given name (e.g. "cpp") * and makes variable substitutions (like $AUTHOR$ etc.) * in it. The resulting string is returned. */ - static TQString read(TDevPlugin *part, const TQString &name, Policy p = Default); + static TQString read(KDevPlugin *part, const TQString &name, Policy p = Default); /** * Reads a template with the given URL * and makes variable substitutions (like $AUTHOR$ etc.) * in it. The resulting string is returned. */ - static TQString readFile(TDevPlugin *part, const TQString &fileName); + static TQString readFile(KDevPlugin *part, const TQString &fileName); /** * Makes variable substitutions on a text, based on a specified TQDomDocument @@ -76,13 +76,13 @@ public: * file with the name dest and - while copying - * performs variable substitutions. */ - static bool copy(TDevPlugin *part, const TQString &name, + static bool copy(KDevPlugin *part, const TQString &name, const TQString &dest, Policy p = Default); /** * Translates a template name into a full path, or suggests a full path * for the template in the project directory if it doesn't exist. */ - static TQString fullPathForName(TDevPlugin *part, const TQString &name, Policy p = Default); + static TQString fullPathForName(KDevPlugin *part, const TQString &name, Policy p = Default); }; #endif diff --git a/lib/util/kdeveditorutil.cpp b/lib/util/kdeveditorutil.cpp new file mode 100644 index 00000000..198e9a42 --- /dev/null +++ b/lib/util/kdeveditorutil.cpp @@ -0,0 +1,89 @@ +/*************************************************************************** + * Copyright (C) 2007 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kdeveditorutil.h" + +#include +#include +#include +#include +#include + +bool KDevEditorUtil::currentPositionReal( unsigned int * line, unsigned int * col, KTextEditor::Document * doc, KTextEditor::View * view ) +{ + if ( !line || !col ) return false; + + KTextEditor::EditInterface * editIface = dynamic_cast( doc ); + if ( !editIface ) return false; + + view = view ? view : dynamic_cast( doc->widget() ); + + KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); + if ( !cursorIface ) return false; + + cursorIface->cursorPositionReal( line, col ); + return true; +} + +TQString KDevEditorUtil::currentLine( KTextEditor::Document * doc, KTextEditor::View * view ) +{ + KTextEditor::EditInterface * editIface = dynamic_cast( doc ); + if ( !editIface ) return TQString(); + + view = view ? view : dynamic_cast( doc->widget() ); + + KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); + if ( !cursorIface ) return TQString(); + + uint line = 0; + uint col = 0; + cursorIface->cursorPositionReal(&line, &col); + + return editIface->textLine(line); +} + +TQString KDevEditorUtil::currentWord( KTextEditor::Document * doc, KTextEditor::View * view ) +{ + KTextEditor::EditInterface * editIface = dynamic_cast( doc ); + if ( !editIface ) return TQString(); + + view = view ? view : dynamic_cast( doc->widget() ); + + KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); + if ( !cursorIface ) return TQString(); + + uint line = 0; + uint col = 0; + cursorIface->cursorPositionReal(&line, &col); + + TQString linestr = editIface->textLine(line); + + int startPos = TQMAX( TQMIN( (int)col, (int)linestr.length()-1 ), 0 ); + int endPos = startPos; + startPos--; + while (startPos >= 0 && ( linestr[startPos].isLetterOrNumber() || linestr[startPos] == '_' || linestr[startPos] == '~') ) + startPos--; + while (endPos < (int)linestr.length() && ( linestr[endPos].isLetterOrNumber() || linestr[endPos] == '_' ) ) + endPos++; + + return ( ( startPos == endPos ) ? TQString() : linestr.mid( startPos+1, endPos-startPos-1 ) ); +} + + +TQString KDevEditorUtil::currentSelection( KTextEditor::Document * doc ) +{ + KTextEditor::SelectionInterface * selectIface = dynamic_cast( doc ); + return selectIface ? selectIface->selection() : TQString(); +} + + +// kate: space-indent off; indent-width 4; tab-width 4; show-tabs on; + diff --git a/lib/util/kdeveditorutil.h b/lib/util/kdeveditorutil.h new file mode 100644 index 00000000..79a64fe1 --- /dev/null +++ b/lib/util/kdeveditorutil.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2007 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * 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 KDEVEDITOR_H +#define KDEVEDITOR_H + +namespace KTextEditor +{ +class Document; +class View; +} + +#include + +/** +Class with some common utility operations not currently supported by KTE + + @author Jens Dagerbo +*/ +class KDevEditorUtil +{ + KDevEditorUtil() {} +public: + + /** + * + * @param line + * @param col + * @param doc + * @param view + * @return + */ + static bool currentPositionReal( unsigned int * line, unsigned int * col, KTextEditor::Document * doc, KTextEditor::View * view = 0 ); + + /** + * + * @param doc + * @param view + * @return + */ + static TQString currentLine( KTextEditor::Document * doc, KTextEditor::View * view = 0 ); + + /** + * Call to get the text under the cursor of the currently active view. + * @return the text under the cursor of the currently active view + */ + static TQString currentWord( KTextEditor::Document * doc, KTextEditor::View * view = 0 ); + + /** + * Call to get the selection in the currently active view + * @return the selection in the currently active view + */ + static TQString currentSelection( KTextEditor::Document * doc ); +}; + +#endif + + +// kate: space-indent off; indent-width 4; tab-width 4; show-tabs on; diff --git a/lib/util/kdevjobtimer.cpp b/lib/util/kdevjobtimer.cpp new file mode 100644 index 00000000..b0b78250 --- /dev/null +++ b/lib/util/kdevjobtimer.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kdevjobtimer.h" + +KDevJobTimer::KDevJobTimer( void * payload, TQObject *parent, const char *name) + : TQTimer(parent, name) +{ + m_payload = payload; + connect( this, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout()) ); +} + +KDevJobTimer::~KDevJobTimer() +{ +} + +void KDevJobTimer::singleShot(int msec, TQObject * receiver, const char * member, void * payload) +{ + KDevJobTimer * p = new KDevJobTimer( payload ); + p->start( msec, true ); + connect( p, TQT_SIGNAL(timeout(void*)), receiver, member ); +} + +void KDevJobTimer::slotTimeout() +{ + emit timeout( m_payload ); + m_payload = 0; + deleteLater(); +} + +#include "kdevjobtimer.moc" diff --git a/lib/util/kdevjobtimer.h b/lib/util/kdevjobtimer.h new file mode 100644 index 00000000..b0fa829e --- /dev/null +++ b/lib/util/kdevjobtimer.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * 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 KDEVJOBTIMER_H +#define KDEVJOBTIMER_H + +#include + +class KDevJobTimer : public TQTimer +{ +Q_OBJECT + +public: + static void singleShot( int msec, TQObject * receiver, const char * member, void * payload ); + +signals: + void timeout(void*); + +private: + KDevJobTimer( void * payload, TQObject *parent = 0, const char *name = 0); + ~KDevJobTimer(); + +private slots: + void slotTimeout(); + +private: + void * m_payload; + +}; + + +#endif diff --git a/lib/util/kdevshellwidget.cpp b/lib/util/kdevshellwidget.cpp new file mode 100644 index 00000000..b9220250 --- /dev/null +++ b/lib/util/kdevshellwidget.cpp @@ -0,0 +1,125 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include + +#include "kdevshellwidget.h" + +KDevShellWidget::KDevShellWidget(TQWidget *parent, const char *name) + : TQVBox(parent, name), m_doAutoActivate( false ), m_isRunning( false ) +{ +} + + +KDevShellWidget::~KDevShellWidget() +{ +} + +void KDevShellWidget::setShell( const TQString & shell, const TQStrList & arguments ) +{ + m_shellName = shell; + m_shellArguments = arguments; +} + +void KDevShellWidget::activate( ) +{ + KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart"); + if ( !factory ) return; + + m_konsolePart = (KParts::ReadOnlyPart *) factory->create( TQT_TQOBJECT(this), "libkonsolepart", "KParts::ReadOnlyPart" ); + if ( !m_konsolePart ) return; + + connect( m_konsolePart, TQT_SIGNAL( processExited(TDEProcess *) ), this, TQT_SLOT( processExited(TDEProcess *) ) ); + connect( m_konsolePart, TQT_SIGNAL( receivedData( const TQString& ) ), this, TQT_SIGNAL( receivedData( const TQString& ) ) ); + connect( m_konsolePart, TQT_SIGNAL(destroyed()), this, TQT_SLOT(partDestroyed()) ); + + m_konsolePart->widget()->setFocusPolicy( TQ_WheelFocus ); + setFocusProxy( m_konsolePart->widget() ); + m_konsolePart->widget()->setFocus(); + + if ( m_konsolePart->widget()->inherits(TQFRAME_OBJECT_NAME_STRING) ) + ((TQFrame*)m_konsolePart->widget())->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); + + m_konsolePart->widget()->show(); + + TerminalInterface* ti = static_cast( m_konsolePart->tqt_cast( "TerminalInterface" ) ); + if( !ti ) return; + + if ( !m_shellName.isEmpty() ) + ti->startProgram( m_shellName, m_shellArguments ); + + m_isRunning = true; + +} + +void KDevShellWidget::partDestroyed( ) +{ + if ( m_doAutoActivate ) + { + activate(); + } +} + +void KDevShellWidget::processExited( TDEProcess * proc ) +{ + m_isRunning = false; + + if ( !proc ) return; + + kdDebug(9000) << proc->args() << endl; + + if ( proc->normalExit() ) + emit shellExited( proc->exitStatus() ); + else if ( proc->signalled() ) + emit shellSignalled( proc->exitSignal() ); +} + +void KDevShellWidget::sendInput( const TQString & text ) +{ + if ( !m_konsolePart ) return; + TerminalInterface* ti = static_cast( m_konsolePart->tqt_cast( "TerminalInterface" ) ); + if( !ti ) return; + + ti->sendInput( text ); +} + +bool KDevShellWidget::isRunning( ) +{ + return m_isRunning; +} + +void KDevShellWidget::setAutoReactivateOnClose( bool doAutoActivate ) +{ + // to auto reactivate can be dangerous, do it like this to avoid + // reactivating with a non-working setting (the partDestroyed() + // slot will have ran before m_doAutoActivate is set) + if ( doAutoActivate ) + TQTimer::singleShot( 3000, this, TQT_SLOT(setAutoReactivateOnCloseDelayed()) ); + else + m_doAutoActivate = false; +} + +void KDevShellWidget::setAutoReactivateOnCloseDelayed( ) +{ + m_doAutoActivate = true; +} + + +#include "kdevshellwidget.moc" + +// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off; diff --git a/lib/util/kdevshellwidget.h b/lib/util/kdevshellwidget.h new file mode 100644 index 00000000..6bb6a8d7 --- /dev/null +++ b/lib/util/kdevshellwidget.h @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * 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 KDEVSHELLWIDGET_H +#define KDEVSHELLWIDGET_H + +#include +#include +#include + +class TDEProcess; +namespace KParts +{ + class ReadOnlyPart; +} + +class KDevShellWidget : public TQVBox +{ + +Q_OBJECT + + +public: + KDevShellWidget(TQWidget *parent = 0, const char *name = 0); + virtual ~KDevShellWidget(); + + /** + * Stores the shell name and arguments, that will be used in @ref activate() + * @param shell The shell name, for example 'irb' or '/bin/bash' + * @param arguments Any optional arguments + */ + void setShell( const TQString & shell, const TQStrList & arguments = TQStrList() ); + + /** + * Executes the previously set shell. If @ref setShell wasn't called before + * konsolepart will decide what to use. + */ + void activate(); + + /** + * Should we auto launch the shell again if it was terminated? + * @param doAutoActivate + */ + void setAutoReactivateOnClose( bool doAutoActivate ); + + /** + * Send text to the running shell + * @param text The text to send to the shell + */ + void sendInput( const TQString & text ); + + /** + * Call to check if the shell is currently running + * @return true if the shell is currently running + */ + bool isRunning(); + +signals: + /** + * This signal will be emmitted when the started shell exits normally + * @param exitcode The return code of the process + */ + void shellExited( int exitcode ); + + /** + * This signal will be emitted when the started shell is terminated by a signal + * @param signalcode The signal the process was killed with + */ + void shellSignalled( int signalcode ); + + /** + * This signal will be emitted when the process receives data + * @param text received data + */ + void receivedData( const TQString & ); + +private slots: + void partDestroyed(); + void processExited( TDEProcess * ); + void setAutoReactivateOnCloseDelayed( ); + +private: + TQGuardedPtr m_konsolePart; + TQString m_shellName; + TQStrList m_shellArguments; + bool m_doAutoActivate; + bool m_isRunning; +}; + +#endif + +// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off; diff --git a/lib/util/tdeveditorutil.cpp b/lib/util/tdeveditorutil.cpp deleted file mode 100644 index 455909f8..00000000 --- a/lib/util/tdeveditorutil.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "tdeveditorutil.h" - -#include -#include -#include -#include -#include - -bool TDevEditorUtil::currentPositionReal( unsigned int * line, unsigned int * col, KTextEditor::Document * doc, KTextEditor::View * view ) -{ - if ( !line || !col ) return false; - - KTextEditor::EditInterface * editIface = dynamic_cast( doc ); - if ( !editIface ) return false; - - view = view ? view : dynamic_cast( doc->widget() ); - - KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); - if ( !cursorIface ) return false; - - cursorIface->cursorPositionReal( line, col ); - return true; -} - -TQString TDevEditorUtil::currentLine( KTextEditor::Document * doc, KTextEditor::View * view ) -{ - KTextEditor::EditInterface * editIface = dynamic_cast( doc ); - if ( !editIface ) return TQString(); - - view = view ? view : dynamic_cast( doc->widget() ); - - KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); - if ( !cursorIface ) return TQString(); - - uint line = 0; - uint col = 0; - cursorIface->cursorPositionReal(&line, &col); - - return editIface->textLine(line); -} - -TQString TDevEditorUtil::currentWord( KTextEditor::Document * doc, KTextEditor::View * view ) -{ - KTextEditor::EditInterface * editIface = dynamic_cast( doc ); - if ( !editIface ) return TQString(); - - view = view ? view : dynamic_cast( doc->widget() ); - - KTextEditor::ViewCursorInterface * cursorIface = dynamic_cast( view ); - if ( !cursorIface ) return TQString(); - - uint line = 0; - uint col = 0; - cursorIface->cursorPositionReal(&line, &col); - - TQString linestr = editIface->textLine(line); - - int startPos = TQMAX( TQMIN( (int)col, (int)linestr.length()-1 ), 0 ); - int endPos = startPos; - startPos--; - while (startPos >= 0 && ( linestr[startPos].isLetterOrNumber() || linestr[startPos] == '_' || linestr[startPos] == '~') ) - startPos--; - while (endPos < (int)linestr.length() && ( linestr[endPos].isLetterOrNumber() || linestr[endPos] == '_' ) ) - endPos++; - - return ( ( startPos == endPos ) ? TQString() : linestr.mid( startPos+1, endPos-startPos-1 ) ); -} - - -TQString TDevEditorUtil::currentSelection( KTextEditor::Document * doc ) -{ - KTextEditor::SelectionInterface * selectIface = dynamic_cast( doc ); - return selectIface ? selectIface->selection() : TQString(); -} - - -// kate: space-indent off; indent-width 4; tab-width 4; show-tabs on; - diff --git a/lib/util/tdeveditorutil.h b/lib/util/tdeveditorutil.h deleted file mode 100644 index d69e914b..00000000 --- a/lib/util/tdeveditorutil.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * 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 TDEVEDITOR_H -#define TDEVEDITOR_H - -namespace KTextEditor -{ -class Document; -class View; -} - -#include - -/** -Class with some common utility operations not currently supported by KTE - - @author Jens Dagerbo -*/ -class TDevEditorUtil -{ - TDevEditorUtil() {} -public: - - /** - * - * @param line - * @param col - * @param doc - * @param view - * @return - */ - static bool currentPositionReal( unsigned int * line, unsigned int * col, KTextEditor::Document * doc, KTextEditor::View * view = 0 ); - - /** - * - * @param doc - * @param view - * @return - */ - static TQString currentLine( KTextEditor::Document * doc, KTextEditor::View * view = 0 ); - - /** - * Call to get the text under the cursor of the currently active view. - * @return the text under the cursor of the currently active view - */ - static TQString currentWord( KTextEditor::Document * doc, KTextEditor::View * view = 0 ); - - /** - * Call to get the selection in the currently active view - * @return the selection in the currently active view - */ - static TQString currentSelection( KTextEditor::Document * doc ); -}; - -#endif - - -// kate: space-indent off; indent-width 4; tab-width 4; show-tabs on; diff --git a/lib/util/tdevjobtimer.cpp b/lib/util/tdevjobtimer.cpp deleted file mode 100644 index 0e1465e0..00000000 --- a/lib/util/tdevjobtimer.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "tdevjobtimer.h" - -TDevJobTimer::TDevJobTimer( void * payload, TQObject *parent, const char *name) - : TQTimer(parent, name) -{ - m_payload = payload; - connect( this, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout()) ); -} - -TDevJobTimer::~TDevJobTimer() -{ -} - -void TDevJobTimer::singleShot(int msec, TQObject * receiver, const char * member, void * payload) -{ - TDevJobTimer * p = new TDevJobTimer( payload ); - p->start( msec, true ); - connect( p, TQT_SIGNAL(timeout(void*)), receiver, member ); -} - -void TDevJobTimer::slotTimeout() -{ - emit timeout( m_payload ); - m_payload = 0; - deleteLater(); -} - -#include "tdevjobtimer.moc" diff --git a/lib/util/tdevjobtimer.h b/lib/util/tdevjobtimer.h deleted file mode 100644 index 313e56e5..00000000 --- a/lib/util/tdevjobtimer.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * 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 TDEVJOBTIMER_H -#define TDEVJOBTIMER_H - -#include - -class TDevJobTimer : public TQTimer -{ -Q_OBJECT - -public: - static void singleShot( int msec, TQObject * receiver, const char * member, void * payload ); - -signals: - void timeout(void*); - -private: - TDevJobTimer( void * payload, TQObject *parent = 0, const char *name = 0); - ~TDevJobTimer(); - -private slots: - void slotTimeout(); - -private: - void * m_payload; - -}; - - -#endif diff --git a/lib/util/tdevshellwidget.cpp b/lib/util/tdevshellwidget.cpp deleted file mode 100644 index b5b8d195..00000000 --- a/lib/util/tdevshellwidget.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include - -#include "tdevshellwidget.h" - -TDevShellWidget::TDevShellWidget(TQWidget *parent, const char *name) - : TQVBox(parent, name), m_doAutoActivate( false ), m_isRunning( false ) -{ -} - - -TDevShellWidget::~TDevShellWidget() -{ -} - -void TDevShellWidget::setShell( const TQString & shell, const TQStrList & arguments ) -{ - m_shellName = shell; - m_shellArguments = arguments; -} - -void TDevShellWidget::activate( ) -{ - KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart"); - if ( !factory ) return; - - m_konsolePart = (KParts::ReadOnlyPart *) factory->create( TQT_TQOBJECT(this), "libkonsolepart", "KParts::ReadOnlyPart" ); - if ( !m_konsolePart ) return; - - connect( m_konsolePart, TQT_SIGNAL( processExited(TDEProcess *) ), this, TQT_SLOT( processExited(TDEProcess *) ) ); - connect( m_konsolePart, TQT_SIGNAL( receivedData( const TQString& ) ), this, TQT_SIGNAL( receivedData( const TQString& ) ) ); - connect( m_konsolePart, TQT_SIGNAL(destroyed()), this, TQT_SLOT(partDestroyed()) ); - - m_konsolePart->widget()->setFocusPolicy( TQ_WheelFocus ); - setFocusProxy( m_konsolePart->widget() ); - m_konsolePart->widget()->setFocus(); - - if ( m_konsolePart->widget()->inherits(TQFRAME_OBJECT_NAME_STRING) ) - ((TQFrame*)m_konsolePart->widget())->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); - - m_konsolePart->widget()->show(); - - TerminalInterface* ti = static_cast( m_konsolePart->tqt_cast( "TerminalInterface" ) ); - if( !ti ) return; - - if ( !m_shellName.isEmpty() ) - ti->startProgram( m_shellName, m_shellArguments ); - - m_isRunning = true; - -} - -void TDevShellWidget::partDestroyed( ) -{ - if ( m_doAutoActivate ) - { - activate(); - } -} - -void TDevShellWidget::processExited( TDEProcess * proc ) -{ - m_isRunning = false; - - if ( !proc ) return; - - kdDebug(9000) << proc->args() << endl; - - if ( proc->normalExit() ) - emit shellExited( proc->exitStatus() ); - else if ( proc->signalled() ) - emit shellSignalled( proc->exitSignal() ); -} - -void TDevShellWidget::sendInput( const TQString & text ) -{ - if ( !m_konsolePart ) return; - TerminalInterface* ti = static_cast( m_konsolePart->tqt_cast( "TerminalInterface" ) ); - if( !ti ) return; - - ti->sendInput( text ); -} - -bool TDevShellWidget::isRunning( ) -{ - return m_isRunning; -} - -void TDevShellWidget::setAutoReactivateOnClose( bool doAutoActivate ) -{ - // to auto reactivate can be dangerous, do it like this to avoid - // reactivating with a non-working setting (the partDestroyed() - // slot will have ran before m_doAutoActivate is set) - if ( doAutoActivate ) - TQTimer::singleShot( 3000, this, TQT_SLOT(setAutoReactivateOnCloseDelayed()) ); - else - m_doAutoActivate = false; -} - -void TDevShellWidget::setAutoReactivateOnCloseDelayed( ) -{ - m_doAutoActivate = true; -} - - -#include "tdevshellwidget.moc" - -// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off; diff --git a/lib/util/tdevshellwidget.h b/lib/util/tdevshellwidget.h deleted file mode 100644 index f6476814..00000000 --- a/lib/util/tdevshellwidget.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Jens Dagerbo * - * jens.dagerbo@swipnet.se * - * * - * 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 TDEVSHELLWIDGET_H -#define TDEVSHELLWIDGET_H - -#include -#include -#include - -class TDEProcess; -namespace KParts -{ - class ReadOnlyPart; -} - -class TDevShellWidget : public TQVBox -{ - -Q_OBJECT - - -public: - TDevShellWidget(TQWidget *parent = 0, const char *name = 0); - virtual ~TDevShellWidget(); - - /** - * Stores the shell name and arguments, that will be used in @ref activate() - * @param shell The shell name, for example 'irb' or '/bin/bash' - * @param arguments Any optional arguments - */ - void setShell( const TQString & shell, const TQStrList & arguments = TQStrList() ); - - /** - * Executes the previously set shell. If @ref setShell wasn't called before - * konsolepart will decide what to use. - */ - void activate(); - - /** - * Should we auto launch the shell again if it was terminated? - * @param doAutoActivate - */ - void setAutoReactivateOnClose( bool doAutoActivate ); - - /** - * Send text to the running shell - * @param text The text to send to the shell - */ - void sendInput( const TQString & text ); - - /** - * Call to check if the shell is currently running - * @return true if the shell is currently running - */ - bool isRunning(); - -signals: - /** - * This signal will be emmitted when the started shell exits normally - * @param exitcode The return code of the process - */ - void shellExited( int exitcode ); - - /** - * This signal will be emitted when the started shell is terminated by a signal - * @param signalcode The signal the process was killed with - */ - void shellSignalled( int signalcode ); - - /** - * This signal will be emitted when the process receives data - * @param text received data - */ - void receivedData( const TQString & ); - -private slots: - void partDestroyed(); - void processExited( TDEProcess * ); - void setAutoReactivateOnCloseDelayed( ); - -private: - TQGuardedPtr m_konsolePart; - TQString m_shellName; - TQStrList m_shellArguments; - bool m_doAutoActivate; - bool m_isRunning; -}; - -#endif - -// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off; diff --git a/lib/widgets/CMakeLists.txt b/lib/widgets/CMakeLists.txt index 86303b6d..30e0ba3e 100644 --- a/lib/widgets/CMakeLists.txt +++ b/lib/widgets/CMakeLists.txt @@ -28,22 +28,22 @@ link_directories( install( FILES tdelistviewaction.h qcomboview.h flagboxes.h ksavealldialog.h resizablecombo.h kcomboview.h - tdevhtmlpart.h processlinemaker.h processwidget.h + kdevhtmlpart.h processlinemaker.h processwidget.h fancylistviewitem.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/widgets ) ##### other data ################################ -install( FILES tdevhtml_partui.rc DESTINATION ${DATA_INSTALL_DIR}/tdevelop ) +install( FILES kdevhtml_partui.rc DESTINATION ${DATA_INSTALL_DIR}/tdevelop ) -##### tdevwidgets (shared) ###################### +##### kdevwidgets (shared) ###################### -tde_add_library( tdevwidgets SHARED AUTOMOC +tde_add_library( kdevwidgets SHARED AUTOMOC SOURCES flagboxes.cpp qcomboview.cpp tdelistviewaction.cpp - kcomboview.cpp resizablecombo.cpp tdevhtmlpart.cpp + kcomboview.cpp resizablecombo.cpp kdevhtmlpart.cpp processlinemaker.cpp processwidget.cpp ksavealldialog.cpp fancylistviewitem.cpp VERSION 0.0.0 diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index 7181151e..69be7a11 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -2,29 +2,29 @@ INCLUDES = -I$(top_srcdir)/lib/compat -I$(top_srcdir)/lib/interfaces $(all_inclu METASOURCES = AUTO -lib_LTLIBRARIES = libtdevwidgets.la +lib_LTLIBRARIES = libkdevwidgets.la -tdevwidgetsincludedir = $(includedir)/tdevelop/widgets +kdevwidgetsincludedir = $(includedir)/tdevelop/widgets -libtdevwidgets_la_SOURCES = flagboxes.cpp qcomboview.cpp tdelistviewaction.cpp \ - kcomboview.cpp resizablecombo.cpp tdevhtmlpart.cpp processlinemaker.cpp \ +libkdevwidgets_la_SOURCES = flagboxes.cpp qcomboview.cpp tdelistviewaction.cpp \ + kcomboview.cpp resizablecombo.cpp kdevhtmlpart.cpp processlinemaker.cpp \ processwidget.cpp ksavealldialog.cpp fancylistviewitem.cpp -tdevwidgetsinclude_HEADERS = tdelistviewaction.h qcomboview.h flagboxes.h \ - ksavealldialog.h resizablecombo.h kcomboview.h tdevhtmlpart.h processlinemaker.h \ +kdevwidgetsinclude_HEADERS = tdelistviewaction.h qcomboview.h flagboxes.h \ + ksavealldialog.h resizablecombo.h kcomboview.h kdevhtmlpart.h processlinemaker.h \ processwidget.h fancylistviewitem.h SUBDIRS = propeditor -libtdevwidgets_la_LIBADD = $(top_builddir)/lib/interfaces/libtdevinterfaces.la -libtdevwidgets_la_LDFLAGS = -no-undefined $(all_libraries) +libkdevwidgets_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la +libkdevwidgets_la_LDFLAGS = -no-undefined $(all_libraries) rcdir = $(kde_datadir)/tdevelop -rc_DATA = tdevhtml_partui.rc +rc_DATA = kdevhtml_partui.rc -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils tdevutil tdevinterfaces -DOXYGEN_PROJECTNAME = TDevelop Widgets Library -DOXYGEN_DOCDIRPREFIX = tdev +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils kdevutil kdevinterfaces +DOXYGEN_PROJECTNAME = KDevelop Widgets Library +DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/widgets/kdevhtml_partui.rc b/lib/widgets/kdevhtml_partui.rc new file mode 100644 index 00000000..5a55b7bf --- /dev/null +++ b/lib/widgets/kdevhtml_partui.rc @@ -0,0 +1,18 @@ + + + + + &File + + + + + + + + + + + + + diff --git a/lib/widgets/kdevhtmlpart.cpp b/lib/widgets/kdevhtmlpart.cpp new file mode 100644 index 00000000..76697cfa --- /dev/null +++ b/lib/widgets/kdevhtmlpart.cpp @@ -0,0 +1,512 @@ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +#include "kdevhtmlpart.h" + +KDevHTMLPart::KDevHTMLPart() + : TDEHTMLPart(0L, 0L, 0L, "KDevHTMLPart", DefaultGUI ) +{ + setXMLFile(locate("data", "tdevelop/kdevhtml_partui.rc"), true); + + connect(browserExtension(), TQT_SIGNAL(openURLRequestDelayed(const KURL &,const KParts::URLArgs &)), + this, TQT_SLOT(openURLRequest(const KURL &)) ); + + connect(this, TQT_SIGNAL(started(TDEIO::Job *)), this, TQT_SLOT(slotStarted(TDEIO::Job* ))); + connect(this, TQT_SIGNAL(completed()), this, TQT_SLOT(slotCompleted())); + connect(this, TQT_SIGNAL(canceled(const TQString &)), this, TQT_SLOT(slotCancelled(const TQString &))); + + TDEActionCollection * actions = actionCollection();// new TDEActionCollection( this ); + reloadAction = new TDEAction( i18n( "Reload" ), "reload", 0, + this, TQT_SLOT( slotReload() ), actions, "doc_reload" ); + reloadAction->setWhatsThis(i18n("Reload

Reloads the current document.")); + stopAction = new TDEAction( i18n( "Stop" ), "stop", 0, + this, TQT_SLOT( slotStop() ), actions, "doc_stop" ); + stopAction->setWhatsThis(i18n("Stop

Stops the loading of current document.")); + duplicateAction = new TDEAction( i18n( "Duplicate Tab" ), "window_new", 0, + this, TQT_SLOT( slotDuplicate() ), actions, "doc_dup" ); + duplicateAction->setWhatsThis(i18n("Duplicate window

Opens current document in a new window.")); + printAction = KStdAction::print(this, TQT_SLOT(slotPrint()), actions, "print_doc"); + copyAction = KStdAction::copy(this, TQT_SLOT(slotCopy()), actions, "copy_doc_selection"); + + connect( this, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)), this, TQT_SLOT(popup(const TQString &, const TQPoint &))); + connect(this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSelectionChanged())); + +//BEGIN documentation history stuff + + m_backAction = new TDEToolBarPopupAction(i18n("Back"), "back", 0, + this, TQT_SLOT(slotBack()), + actions, "browser_back"); + m_backAction->setEnabled( false ); + m_backAction->setToolTip(i18n("Back")); + m_backAction->setWhatsThis(i18n("Back

Moves backwards one step in the documentation browsing history.")); + + connect(m_backAction->popupMenu(), TQT_SIGNAL(aboutToShow()), + this, TQT_SLOT(slotBackAboutToShow())); + connect(m_backAction->popupMenu(), TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotPopupActivated(int))); + + m_forwardAction = new TDEToolBarPopupAction(i18n("Forward"), "forward", 0, + this, TQT_SLOT(slotForward()), + actions, "browser_forward"); + m_forwardAction->setEnabled( false ); + m_forwardAction->setToolTip(i18n("Forward")); + m_forwardAction->setWhatsThis(i18n("Forward

Moves forward one step in the documentation browsing history.")); + + connect(m_forwardAction->popupMenu(), TQT_SIGNAL(aboutToShow()), + this, TQT_SLOT(slotForwardAboutToShow())); + connect(m_forwardAction->popupMenu(), TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotPopupActivated(int))); + + m_restoring = false; + m_Current = m_history.end(); +//END documentation history stuff + + //settings: + TDEConfig *appConfig = TDEGlobal::config(); + appConfig->setGroup("TDEHTMLPart"); + setStandardFont(appConfig->readEntry("StandardFont", + settings()->stdFontName())); + setFixedFont(appConfig->readEntry("FixedFont", + settings()->fixedFontName())); + setZoomFactor(appConfig->readEntry("Zoom", "100").toInt()); +} + +void KDevHTMLPart::popup( const TQString & url, const TQPoint & p ) +{ +// TDEPopupMenu popup( i18n( "Documentation Viewer" ), this->widget() ); + TDEPopupMenu popup(this->widget()); + + bool needSep = false; + int idNewWindow = -2; + if (!url.isEmpty() && (m_options & CanOpenInNewWindow)) + { + idNewWindow = popup.insertItem(SmallIcon("window_new"),i18n("Open in New Tab")); + popup.TQMenuData::setWhatsThis(idNewWindow, i18n("Open in new window

Opens current link in a new window.")); + needSep = true; + } + if (m_options & CanDuplicate) + { + duplicateAction->plug(&popup); + needSep = true; + } + if (needSep) + popup.insertSeparator(); + + m_backAction->plug( &popup ); + m_forwardAction->plug( &popup ); + reloadAction->plug(&popup); +// stopAction->plug(&popup); + popup.insertSeparator(); + + copyAction->plug( &popup ); + popup.insertSeparator(); + + printAction->plug(&popup); + popup.insertSeparator(); + + TDEAction * incFontAction = this->action("incFontSizes"); + TDEAction * decFontAction = this->action("decFontSizes"); + if ( incFontAction && decFontAction ) + { + incFontAction->plug( &popup ); + decFontAction->plug( &popup ); + popup.insertSeparator(); + } + + TDEAction *ac = action("setEncoding"); + if (ac) + ac->plug(&popup); + + int r = popup.exec(p); + + if (r == idNewWindow) + { + KURL kurl; + if (!KURL(url).path().startsWith("/")) + { + kdDebug() << "processing relative url: " << url << endl; + if (url.startsWith("#")) + { + kurl = KURL(KDevHTMLPart::url()); + kurl.setRef(url.mid(1)); + } + else + kurl = KURL(KDevHTMLPart::url().upURL().url(true)+url); + } + else + kurl = KURL(url); + + if (kurl.isValid()) + slotOpenInNewWindow(kurl); + } +} + +void KDevHTMLPart::setContext(const TQString &context) +{ + m_context = context; +} + + +TQString KDevHTMLPart::context() const +{ + return m_context; +} + + +// Note: this function is a copy of code in tdecore/tdeconfigbase.cpp ;) +static bool isUtf8(const char *buf) { + int i, n; + register unsigned char c; + bool gotone = false; + +#define F 0 /* character never appears in text */ +#define T 1 /* character appears in plain ASCII text */ +#define I 2 /* character appears in ISO-8859 text */ +#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ + + static const unsigned char text_chars[256] = { + /* BEL BS HT LF FF CR */ + F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ + /* ESC */ + F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ + /* NEL */ + X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ + X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ + }; + + /* *ulen = 0; */ + for (i = 0; (c = buf[i]); i++) { + if ((c & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ + /* + * Even if the whole file is valid UTF-8 sequences, + * still reject it if it uses weird control characters. + */ + + if (text_chars[c] != T) + return false; + + } else if ((c & 0x40) == 0) { /* 10xxxxxx never 1st byte */ + return false; + } else { /* 11xxxxxx begins UTF-8 */ + int following; + + if ((c & 0x20) == 0) { /* 110xxxxx */ + following = 1; + } else if ((c & 0x10) == 0) { /* 1110xxxx */ + following = 2; + } else if ((c & 0x08) == 0) { /* 11110xxx */ + following = 3; + } else if ((c & 0x04) == 0) { /* 111110xx */ + following = 4; + } else if ((c & 0x02) == 0) { /* 1111110x */ + following = 5; + } else + return false; + + for (n = 0; n < following; n++) { + i++; + if (!(c = buf[i])) + goto done; + + if ((c & 0x80) == 0 || (c & 0x40)) + return false; + } + gotone = true; + } + } +done: + return gotone; /* don't claim it's UTF-8 if it's all 7-bit */ +} +#undef F +#undef T +#undef I +#undef X + +TQString KDevHTMLPart::resolveEnvVarsInURL(const TQString& url) +{ + // check for environment variables and make necessary translations + TQString path = url; + int nDollarPos = path.find( '$' ); + + // Note: the while loop below is a copy of code in tdecore/tdeconfigbase.cpp ;) + while( nDollarPos != -1 && nDollarPos+1 < static_cast(path.length())) { + // there is at least one $ + if( (path)[nDollarPos+1] == '(' ) { + uint nEndPos = nDollarPos+1; + // the next character is no $ + while ( (nEndPos <= path.length()) && (path[nEndPos]!=')') ) + nEndPos++; + nEndPos++; + TQString cmd = path.mid( nDollarPos+2, nEndPos-nDollarPos-3 ); + + TQString result; + FILE *fs = popen(TQFile::encodeName(cmd).data(), "r"); + if (fs) + { + TQTextStream ts(fs, IO_ReadOnly); + result = ts.read().stripWhiteSpace(); + pclose(fs); + } + path.replace( nDollarPos, nEndPos-nDollarPos, result ); + } else if( (path)[nDollarPos+1] != '$' ) { + uint nEndPos = nDollarPos+1; + // the next character is no $ + TQString aVarName; + if (path[nEndPos]=='{') + { + while ( (nEndPos <= path.length()) && (path[nEndPos]!='}') ) + nEndPos++; + nEndPos++; + aVarName = path.mid( nDollarPos+2, nEndPos-nDollarPos-3 ); + } + else + { + while ( nEndPos <= path.length() && (path[nEndPos].isNumber() + || path[nEndPos].isLetter() || path[nEndPos]=='_' ) ) + nEndPos++; + aVarName = path.mid( nDollarPos+1, nEndPos-nDollarPos-1 ); + } + const char* pEnv = 0; + if (!aVarName.isEmpty()) + pEnv = getenv( aVarName.ascii() ); + if( pEnv ) { + // !!! Sergey A. Sukiyazov !!! + // A environment variables may contain values in 8bit + // locale cpecified encoding or in UTF8 encoding. + if (isUtf8( pEnv )) + path.replace( nDollarPos, nEndPos-nDollarPos, TQString::fromUtf8(pEnv) ); + else + path.replace( nDollarPos, nEndPos-nDollarPos, TQString::fromLocal8Bit(pEnv) ); + } else + path.remove( nDollarPos, nEndPos-nDollarPos ); + } else { + // remove one of the dollar signs + path.remove( nDollarPos, 1 ); + nDollarPos++; + } + nDollarPos = path.find( '$', nDollarPos ); + } + + return path; +} + +bool KDevHTMLPart::openURL(const KURL &url) +{ + TQString path = resolveEnvVarsInURL(url.url()); + KURL newUrl(path); + + bool retval = TDEHTMLPart::openURL(newUrl); + if ( retval ) + { + emit fileNameChanged(this); + if ( !m_restoring ) + { + addHistoryEntry(); + } + } + + m_backAction->setEnabled( m_Current != m_history.begin() ); + m_forwardAction->setEnabled( m_Current != m_history.fromLast() ); + + return retval; +} + +void KDevHTMLPart::openURLRequest(const KURL &url) +{ + openURL( url ); +} + +void KDevHTMLPart::slotReload( ) +{ + openURL( url() ); +} + +void KDevHTMLPart::slotStop( ) +{ + closeURL(); +} + +void KDevHTMLPart::slotStarted( TDEIO::Job * ) +{ + stopAction->setEnabled(true); +} + +void KDevHTMLPart::slotCompleted( ) +{ + stopAction->setEnabled(false); +} + +void KDevHTMLPart::slotCancelled( const TQString & /*errMsg*/ ) +{ + stopAction->setEnabled(false); +} + +/*void KDevHTMLPart::slotDuplicate( ) +{ + PartController::getInstance()->showDocument(url(), true); +}*/ + +void KDevHTMLPart::slotPrint( ) +{ + view()->print(); +} + +void KDevHTMLPart::slotBack() +{ + if ( m_Current != m_history.begin() ) + { + --m_Current; + m_restoring = true; + openURL( (*m_Current).url ); + m_restoring = false; + } +} + +void KDevHTMLPart::slotForward() +{ + if ( m_Current != m_history.fromLast() ) + { + ++m_Current; + m_restoring = true; + openURL( (*m_Current).url ); + m_restoring = false; + } +} + +void KDevHTMLPart::slotBackAboutToShow() +{ + TDEPopupMenu *popup = m_backAction->popupMenu(); + popup->clear(); + + if ( m_Current == m_history.begin() ) return; + + TQValueList::Iterator it = m_Current; + --it; + + int i = 0; + while( i < 10 ) + { + if ( it == m_history.begin() ) + { + popup->insertItem( (*it).url.url(), (*it).id ); + return; + } + + popup->insertItem( (*it).url.url(), (*it).id ); + ++i; + --it; + } +} + +void KDevHTMLPart::slotForwardAboutToShow() +{ + TDEPopupMenu *popup = m_forwardAction->popupMenu(); + popup->clear(); + + if ( m_Current == m_history.fromLast() ) return; + + TQValueList::Iterator it = m_Current; + ++it; + + int i = 0; + while( i < 10 ) + { + if ( it == m_history.fromLast() ) + { + popup->insertItem( (*it).url.url(), (*it).id ); + return; + } + + popup->insertItem( (*it).url.url(), (*it).id ); + ++i; + ++it; + } +} + +void KDevHTMLPart::slotPopupActivated( int id ) +{ + kdDebug(9000) << "id: " << id << endl; + + TQValueList::Iterator it = m_history.begin(); + while( it != m_history.end() ) + { + kdDebug(9000) << "(*it).id: " << (*it).id << endl; + if ( (*it).id == id ) + { + m_Current = it; + m_restoring = true; + openURL( (*m_Current).url ); + m_restoring = false; + return; + } + ++it; + } +} + +void KDevHTMLPart::addHistoryEntry() +{ + TQValueList::Iterator it = m_Current; + + // if We're not already the last entry, we truncate the list here before adding an entry + if ( it != m_history.end() && it != m_history.fromLast() ) + { + m_history.erase( ++it, m_history.end() ); + } + + DocumentationHistoryEntry newEntry( url() ); + + // Only save the new entry if it is different from the last + if ( newEntry.url != (*m_Current).url ) + { + m_history.append( newEntry ); + m_Current = m_history.fromLast(); + } +} + +void KDevHTMLPart::slotCopy( ) +{ + TQString text = selectedText(); + text.replace( TQChar( 0xa0 ), ' ' ); + TQClipboard *cb = TQApplication::clipboard(); + disconnect( cb, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotClearSelection() ) ); + cb->setText(text); + connect( cb, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotClearSelection() ) ); +} + +void KDevHTMLPart::slotSelectionChanged( ) +{ + if (selectedText().isEmpty()) + copyAction->setEnabled(false); + else + copyAction->setEnabled(true); +} + +#include "kdevhtmlpart.moc" diff --git a/lib/widgets/kdevhtmlpart.h b/lib/widgets/kdevhtmlpart.h new file mode 100644 index 00000000..6c8f7dc3 --- /dev/null +++ b/lib/widgets/kdevhtmlpart.h @@ -0,0 +1,111 @@ +#ifndef __KDEVHTMLPART_H__ +#define __KDEVHTMLPART_H__ + +#include + +#include + +#include + +/** +@file kdevhtmlpart.h +Customized TDEHTML part for KDevelop. +*/ + +class TDEAction; +class TDEToolBarPopupAction; + +struct DocumentationHistoryEntry { + KURL url; + int id; + + DocumentationHistoryEntry() {} + DocumentationHistoryEntry( const KURL& u ): url( u ) + { + id = abs( TQTime::currentTime().msecsTo( TQTime() ) ); // nasty, but should provide a reasonably unique number + } +}; + +/** +Customized TDEHTML part for KDevelop. +Used as HTML documentation and file viewer. + +Represents customized BrowserViewGUI mode of TDEHTMLPart. Provides also actions for: +- reload; +- stop; +- duplicate; +- print; +- copy text; +- back; +- forward. +. +It has it's own popup menu and font/zoom settings. +*/ +class KDevHTMLPart : public TDEHTMLPart +{ + Q_OBJECT + + +public: + + enum Options { CanDuplicate=1, CanOpenInNewWindow=2 }; + + KDevHTMLPart(); + + void setContext(const TQString &context); + TQString context() const; + virtual bool openURL(const KURL &url); + static TQString resolveEnvVarsInURL(const TQString& url); + + void setOptions(int options) { m_options = options; } + +signals: + void fileNameChanged(KParts::ReadOnlyPart *part); + +protected slots: + + void slotStarted(TDEIO::Job *); + void slotCompleted(); + void slotCancelled(const TQString &errMsg); + + void openURLRequest(const KURL &url); + void popup( const TQString & url, const TQPoint & p ); + + void slotReload(); + void slotStop(); + virtual void slotDuplicate() = 0; + virtual void slotOpenInNewWindow(const KURL &url) = 0; + void slotPrint(); + void slotCopy(); + void slotSelectionChanged(); + + void slotBack(); + void slotForward(); + void slotBackAboutToShow(); + void slotForwardAboutToShow(); + + void slotPopupActivated( int id ); + void addHistoryEntry(); + + +private: + + TQValueList< DocumentationHistoryEntry > m_history; + TQValueList< DocumentationHistoryEntry >::Iterator m_Current; + + TDEToolBarPopupAction* m_backAction; + TDEToolBarPopupAction* m_forwardAction; + + bool m_restoring; + + TQString m_context; + TDEAction *stopAction; + TDEAction *reloadAction; + TDEAction *duplicateAction; + TDEAction *printAction; + TDEAction *copyAction; + + int m_options; +}; + +#endif diff --git a/lib/widgets/kdevtabwidget.cpp b/lib/widgets/kdevtabwidget.cpp new file mode 100644 index 00000000..33c9f733 --- /dev/null +++ b/lib/widgets/kdevtabwidget.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2001-2003 * + * The KDevelop Team * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "kdevtabwidget.h" + +KDevTabWidget::KDevTabWidget(TQWidget *parent, const char *name) : TQTabWidget(parent,name) +{ + m_pTabBar = new KTabBar(this, "tabbar"); + setTabBar(m_pTabBar); + connect(m_pTabBar, TQT_SIGNAL(closeWindow(const TQWidget*)), this, TQT_SIGNAL(closeWindow(const TQWidget*))); + connect(m_pTabBar, TQT_SIGNAL(closeOthers(TQWidget*)), this, TQT_SIGNAL(closeOthers(TQWidget*))); +} + +KTabBar::KTabBar(TQWidget *parent, const char *name) : TQTabBar(parent,name) +{ + m_pPopupMenu = new TQPopupMenu(this); + + TQPixmap closePixmap = TDEGlobal::instance()->iconLoader()->loadIcon( "tab_remove", TDEIcon::Small, 0, TDEIcon::DefaultState, 0, true ); + if (closePixmap.isNull()) + closePixmap = SmallIcon("fileclose"); + + m_pPopupMenu->insertItem(closePixmap, i18n("&Close"), this, TQT_SLOT(closeWindowSlot())); + m_pPopupMenu->insertItem(i18n("Close &Others"), this, TQT_SLOT(closeOthersSlot())); +} + +void KTabBar::closeWindowSlot() +{ + emit closeWindow(m_pPage); +} + +void KTabBar::closeOthersSlot() +{ + emit closeOthers(m_pPage); +} + +void KTabBar::mousePressEvent(TQMouseEvent *e) +{ + if(e->button() == Qt::RightButton) { + + TQTab *tab = selectTab(e->pos() ); + if( tab == 0L ) return; + + m_pPage = ((KDevTabWidget*)parent())->page(indexOf(tab->identifier() ) ); + if(m_pPage == 0L) return; + + m_pPopupMenu->exec(mapToGlobal(e->pos())); + } + TQTabBar::mousePressEvent(e); +} + +#include "kdevtabwidget.moc" diff --git a/lib/widgets/propeditor/CMakeLists.txt b/lib/widgets/propeditor/CMakeLists.txt index 1cffb908..2620aaa0 100644 --- a/lib/widgets/propeditor/CMakeLists.txt +++ b/lib/widgets/propeditor/CMakeLists.txt @@ -38,9 +38,9 @@ install( FILES DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/propeditor ) -##### tdevpropertyeditor (shared) ############### +##### kdevpropertyeditor (shared) ############### -tde_add_library( tdevpropertyeditor SHARED AUTOMOC +tde_add_library( kdevpropertyeditor SHARED AUTOMOC SOURCES childproperty.cpp pcombobox.cpp pdummywidget.cpp ppointedit.cpp propertymachinefactory.cpp diff --git a/lib/widgets/propeditor/Makefile.am b/lib/widgets/propeditor/Makefile.am index a01eb4d3..e07d5c69 100644 --- a/lib/widgets/propeditor/Makefile.am +++ b/lib/widgets/propeditor/Makefile.am @@ -1,18 +1,18 @@ INCLUDES = -I$(top_srcdir)/lib/compat $(all_includes) METASOURCES = AUTO -lib_LTLIBRARIES = libtdevpropertyeditor.la -libtdevpropertyeditor_la_LIBADD = $(LIB_TDEIO) -libtdevpropertyeditor_la_LDFLAGS = -no-undefined $(all_libraries) -libtdevpropertyeditor_la_SOURCES = childproperty.cpp pcombobox.cpp pdummywidget.cpp ppointedit.cpp propertymachinefactory.cpp pstringlistedit.cpp\ +lib_LTLIBRARIES = libkdevpropertyeditor.la +libkdevpropertyeditor_la_LIBADD = $(LIB_TDEIO) +libkdevpropertyeditor_la_LDFLAGS = -no-undefined $(all_libraries) +libkdevpropertyeditor_la_SOURCES = childproperty.cpp pcombobox.cpp pdummywidget.cpp ppointedit.cpp propertymachinefactory.cpp pstringlistedit.cpp\ multiproperty.cpp pcursoredit.cpp pfontbutton.cpp prectedit.cpp propertywidget.cpp psymbolcombo.cpp\ pcheckbox.cpp pdateedit.cpp pfontcombo.cpp property.cpp psizeedit.cpp purledit.cpp\ pcolorbutton.cpp pdatetimeedit.cpp plineedit.cpp propertyeditor.cpp psizepolicyedit.cpp pyesnobutton.cpp\ pcolorcombo.cpp pdoublenuminput.cpp ppixmapedit.cpp propertylist.cpp pspinbox.cpp propertywidgetproxy.cpp plinestyleedit.cpp qeditlistbox.cpp -tdevpropeditorincludedir = $(includedir)/tdevelop/propeditor -tdevpropeditorinclude_HEADERS = childproperty.h pcombobox.h pdummywidget.h ppointedit.h propertymachinefactory.h pcursoredit.h pfontbutton.h prectedit.h propertywidget.h pdateedit.h pfontcombo.h property.h psizeedit.h pdatetimeedit.h plineedit.h propertyeditor.h psizepolicyedit.h pdoublenuminput.h ppixmapedit.h propertylist.h pspinbox.h propertywidgetproxy.h multiproperty.h pyesnobutton.h purledit.h psymbolcombo.h pstringlistedit.h pcolorcombo.h pcolorbutton.h pcheckbox.h plinestyleedit.h +kdevpropeditorincludedir = $(includedir)/tdevelop/propeditor +kdevpropeditorinclude_HEADERS = childproperty.h pcombobox.h pdummywidget.h ppointedit.h propertymachinefactory.h pcursoredit.h pfontbutton.h prectedit.h propertywidget.h pdateedit.h pfontcombo.h property.h psizeedit.h pdatetimeedit.h plineedit.h propertyeditor.h psizepolicyedit.h pdoublenuminput.h ppixmapedit.h propertylist.h pspinbox.h propertywidgetproxy.h multiproperty.h pyesnobutton.h purledit.h psymbolcombo.h pstringlistedit.h pcolorcombo.h pcolorbutton.h pcheckbox.h plinestyleedit.h DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi tdeio kjs tdeparts tdeutils -DOXYGEN_PROJECTNAME = TDevelop Property Editing Library +DOXYGEN_PROJECTNAME = KDevelop Property Editing Library include ../../../Doxyfile.am diff --git a/lib/widgets/tdevhtml_partui.rc b/lib/widgets/tdevhtml_partui.rc deleted file mode 100644 index a62fa22f..00000000 --- a/lib/widgets/tdevhtml_partui.rc +++ /dev/null @@ -1,18 +0,0 @@ - - - - -

&File - - - - - - - - - - - - - diff --git a/lib/widgets/tdevhtmlpart.cpp b/lib/widgets/tdevhtmlpart.cpp deleted file mode 100644 index 6ec74651..00000000 --- a/lib/widgets/tdevhtmlpart.cpp +++ /dev/null @@ -1,512 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -#include "tdevhtmlpart.h" - -TDevHTMLPart::TDevHTMLPart() - : TDEHTMLPart(0L, 0L, 0L, "TDevHTMLPart", DefaultGUI ) -{ - setXMLFile(locate("data", "tdevelop/tdevhtml_partui.rc"), true); - - connect(browserExtension(), TQT_SIGNAL(openURLRequestDelayed(const KURL &,const KParts::URLArgs &)), - this, TQT_SLOT(openURLRequest(const KURL &)) ); - - connect(this, TQT_SIGNAL(started(TDEIO::Job *)), this, TQT_SLOT(slotStarted(TDEIO::Job* ))); - connect(this, TQT_SIGNAL(completed()), this, TQT_SLOT(slotCompleted())); - connect(this, TQT_SIGNAL(canceled(const TQString &)), this, TQT_SLOT(slotCancelled(const TQString &))); - - TDEActionCollection * actions = actionCollection();// new TDEActionCollection( this ); - reloadAction = new TDEAction( i18n( "Reload" ), "reload", 0, - this, TQT_SLOT( slotReload() ), actions, "doc_reload" ); - reloadAction->setWhatsThis(i18n("Reload

Reloads the current document.")); - stopAction = new TDEAction( i18n( "Stop" ), "stop", 0, - this, TQT_SLOT( slotStop() ), actions, "doc_stop" ); - stopAction->setWhatsThis(i18n("Stop

Stops the loading of current document.")); - duplicateAction = new TDEAction( i18n( "Duplicate Tab" ), "window_new", 0, - this, TQT_SLOT( slotDuplicate() ), actions, "doc_dup" ); - duplicateAction->setWhatsThis(i18n("Duplicate window

Opens current document in a new window.")); - printAction = KStdAction::print(this, TQT_SLOT(slotPrint()), actions, "print_doc"); - copyAction = KStdAction::copy(this, TQT_SLOT(slotCopy()), actions, "copy_doc_selection"); - - connect( this, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)), this, TQT_SLOT(popup(const TQString &, const TQPoint &))); - connect(this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSelectionChanged())); - -//BEGIN documentation history stuff - - m_backAction = new TDEToolBarPopupAction(i18n("Back"), "back", 0, - this, TQT_SLOT(slotBack()), - actions, "browser_back"); - m_backAction->setEnabled( false ); - m_backAction->setToolTip(i18n("Back")); - m_backAction->setWhatsThis(i18n("Back

Moves backwards one step in the documentation browsing history.")); - - connect(m_backAction->popupMenu(), TQT_SIGNAL(aboutToShow()), - this, TQT_SLOT(slotBackAboutToShow())); - connect(m_backAction->popupMenu(), TQT_SIGNAL(activated(int)), - this, TQT_SLOT(slotPopupActivated(int))); - - m_forwardAction = new TDEToolBarPopupAction(i18n("Forward"), "forward", 0, - this, TQT_SLOT(slotForward()), - actions, "browser_forward"); - m_forwardAction->setEnabled( false ); - m_forwardAction->setToolTip(i18n("Forward")); - m_forwardAction->setWhatsThis(i18n("Forward

Moves forward one step in the documentation browsing history.")); - - connect(m_forwardAction->popupMenu(), TQT_SIGNAL(aboutToShow()), - this, TQT_SLOT(slotForwardAboutToShow())); - connect(m_forwardAction->popupMenu(), TQT_SIGNAL(activated(int)), - this, TQT_SLOT(slotPopupActivated(int))); - - m_restoring = false; - m_Current = m_history.end(); -//END documentation history stuff - - //settings: - TDEConfig *appConfig = TDEGlobal::config(); - appConfig->setGroup("TDEHTMLPart"); - setStandardFont(appConfig->readEntry("StandardFont", - settings()->stdFontName())); - setFixedFont(appConfig->readEntry("FixedFont", - settings()->fixedFontName())); - setZoomFactor(appConfig->readEntry("Zoom", "100").toInt()); -} - -void TDevHTMLPart::popup( const TQString & url, const TQPoint & p ) -{ -// TDEPopupMenu popup( i18n( "Documentation Viewer" ), this->widget() ); - TDEPopupMenu popup(this->widget()); - - bool needSep = false; - int idNewWindow = -2; - if (!url.isEmpty() && (m_options & CanOpenInNewWindow)) - { - idNewWindow = popup.insertItem(SmallIcon("window_new"),i18n("Open in New Tab")); - popup.TQMenuData::setWhatsThis(idNewWindow, i18n("Open in new window

Opens current link in a new window.")); - needSep = true; - } - if (m_options & CanDuplicate) - { - duplicateAction->plug(&popup); - needSep = true; - } - if (needSep) - popup.insertSeparator(); - - m_backAction->plug( &popup ); - m_forwardAction->plug( &popup ); - reloadAction->plug(&popup); -// stopAction->plug(&popup); - popup.insertSeparator(); - - copyAction->plug( &popup ); - popup.insertSeparator(); - - printAction->plug(&popup); - popup.insertSeparator(); - - TDEAction * incFontAction = this->action("incFontSizes"); - TDEAction * decFontAction = this->action("decFontSizes"); - if ( incFontAction && decFontAction ) - { - incFontAction->plug( &popup ); - decFontAction->plug( &popup ); - popup.insertSeparator(); - } - - TDEAction *ac = action("setEncoding"); - if (ac) - ac->plug(&popup); - - int r = popup.exec(p); - - if (r == idNewWindow) - { - KURL kurl; - if (!KURL(url).path().startsWith("/")) - { - kdDebug() << "processing relative url: " << url << endl; - if (url.startsWith("#")) - { - kurl = KURL(TDevHTMLPart::url()); - kurl.setRef(url.mid(1)); - } - else - kurl = KURL(TDevHTMLPart::url().upURL().url(true)+url); - } - else - kurl = KURL(url); - - if (kurl.isValid()) - slotOpenInNewWindow(kurl); - } -} - -void TDevHTMLPart::setContext(const TQString &context) -{ - m_context = context; -} - - -TQString TDevHTMLPart::context() const -{ - return m_context; -} - - -// Note: this function is a copy of code in tdecore/tdeconfigbase.cpp ;) -static bool isUtf8(const char *buf) { - int i, n; - register unsigned char c; - bool gotone = false; - -#define F 0 /* character never appears in text */ -#define T 1 /* character appears in plain ASCII text */ -#define I 2 /* character appears in ISO-8859 text */ -#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ - - static const unsigned char text_chars[256] = { - /* BEL BS HT LF FF CR */ - F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ - /* ESC */ - F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ - /* NEL */ - X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ - X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ - }; - - /* *ulen = 0; */ - for (i = 0; (c = buf[i]); i++) { - if ((c & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ - /* - * Even if the whole file is valid UTF-8 sequences, - * still reject it if it uses weird control characters. - */ - - if (text_chars[c] != T) - return false; - - } else if ((c & 0x40) == 0) { /* 10xxxxxx never 1st byte */ - return false; - } else { /* 11xxxxxx begins UTF-8 */ - int following; - - if ((c & 0x20) == 0) { /* 110xxxxx */ - following = 1; - } else if ((c & 0x10) == 0) { /* 1110xxxx */ - following = 2; - } else if ((c & 0x08) == 0) { /* 11110xxx */ - following = 3; - } else if ((c & 0x04) == 0) { /* 111110xx */ - following = 4; - } else if ((c & 0x02) == 0) { /* 1111110x */ - following = 5; - } else - return false; - - for (n = 0; n < following; n++) { - i++; - if (!(c = buf[i])) - goto done; - - if ((c & 0x80) == 0 || (c & 0x40)) - return false; - } - gotone = true; - } - } -done: - return gotone; /* don't claim it's UTF-8 if it's all 7-bit */ -} -#undef F -#undef T -#undef I -#undef X - -TQString TDevHTMLPart::resolveEnvVarsInURL(const TQString& url) -{ - // check for environment variables and make necessary translations - TQString path = url; - int nDollarPos = path.find( '$' ); - - // Note: the while loop below is a copy of code in tdecore/tdeconfigbase.cpp ;) - while( nDollarPos != -1 && nDollarPos+1 < static_cast(path.length())) { - // there is at least one $ - if( (path)[nDollarPos+1] == '(' ) { - uint nEndPos = nDollarPos+1; - // the next character is no $ - while ( (nEndPos <= path.length()) && (path[nEndPos]!=')') ) - nEndPos++; - nEndPos++; - TQString cmd = path.mid( nDollarPos+2, nEndPos-nDollarPos-3 ); - - TQString result; - FILE *fs = popen(TQFile::encodeName(cmd).data(), "r"); - if (fs) - { - TQTextStream ts(fs, IO_ReadOnly); - result = ts.read().stripWhiteSpace(); - pclose(fs); - } - path.replace( nDollarPos, nEndPos-nDollarPos, result ); - } else if( (path)[nDollarPos+1] != '$' ) { - uint nEndPos = nDollarPos+1; - // the next character is no $ - TQString aVarName; - if (path[nEndPos]=='{') - { - while ( (nEndPos <= path.length()) && (path[nEndPos]!='}') ) - nEndPos++; - nEndPos++; - aVarName = path.mid( nDollarPos+2, nEndPos-nDollarPos-3 ); - } - else - { - while ( nEndPos <= path.length() && (path[nEndPos].isNumber() - || path[nEndPos].isLetter() || path[nEndPos]=='_' ) ) - nEndPos++; - aVarName = path.mid( nDollarPos+1, nEndPos-nDollarPos-1 ); - } - const char* pEnv = 0; - if (!aVarName.isEmpty()) - pEnv = getenv( aVarName.ascii() ); - if( pEnv ) { - // !!! Sergey A. Sukiyazov !!! - // A environment variables may contain values in 8bit - // locale cpecified encoding or in UTF8 encoding. - if (isUtf8( pEnv )) - path.replace( nDollarPos, nEndPos-nDollarPos, TQString::fromUtf8(pEnv) ); - else - path.replace( nDollarPos, nEndPos-nDollarPos, TQString::fromLocal8Bit(pEnv) ); - } else - path.remove( nDollarPos, nEndPos-nDollarPos ); - } else { - // remove one of the dollar signs - path.remove( nDollarPos, 1 ); - nDollarPos++; - } - nDollarPos = path.find( '$', nDollarPos ); - } - - return path; -} - -bool TDevHTMLPart::openURL(const KURL &url) -{ - TQString path = resolveEnvVarsInURL(url.url()); - KURL newUrl(path); - - bool retval = TDEHTMLPart::openURL(newUrl); - if ( retval ) - { - emit fileNameChanged(this); - if ( !m_restoring ) - { - addHistoryEntry(); - } - } - - m_backAction->setEnabled( m_Current != m_history.begin() ); - m_forwardAction->setEnabled( m_Current != m_history.fromLast() ); - - return retval; -} - -void TDevHTMLPart::openURLRequest(const KURL &url) -{ - openURL( url ); -} - -void TDevHTMLPart::slotReload( ) -{ - openURL( url() ); -} - -void TDevHTMLPart::slotStop( ) -{ - closeURL(); -} - -void TDevHTMLPart::slotStarted( TDEIO::Job * ) -{ - stopAction->setEnabled(true); -} - -void TDevHTMLPart::slotCompleted( ) -{ - stopAction->setEnabled(false); -} - -void TDevHTMLPart::slotCancelled( const TQString & /*errMsg*/ ) -{ - stopAction->setEnabled(false); -} - -/*void TDevHTMLPart::slotDuplicate( ) -{ - PartController::getInstance()->showDocument(url(), true); -}*/ - -void TDevHTMLPart::slotPrint( ) -{ - view()->print(); -} - -void TDevHTMLPart::slotBack() -{ - if ( m_Current != m_history.begin() ) - { - --m_Current; - m_restoring = true; - openURL( (*m_Current).url ); - m_restoring = false; - } -} - -void TDevHTMLPart::slotForward() -{ - if ( m_Current != m_history.fromLast() ) - { - ++m_Current; - m_restoring = true; - openURL( (*m_Current).url ); - m_restoring = false; - } -} - -void TDevHTMLPart::slotBackAboutToShow() -{ - TDEPopupMenu *popup = m_backAction->popupMenu(); - popup->clear(); - - if ( m_Current == m_history.begin() ) return; - - TQValueList::Iterator it = m_Current; - --it; - - int i = 0; - while( i < 10 ) - { - if ( it == m_history.begin() ) - { - popup->insertItem( (*it).url.url(), (*it).id ); - return; - } - - popup->insertItem( (*it).url.url(), (*it).id ); - ++i; - --it; - } -} - -void TDevHTMLPart::slotForwardAboutToShow() -{ - TDEPopupMenu *popup = m_forwardAction->popupMenu(); - popup->clear(); - - if ( m_Current == m_history.fromLast() ) return; - - TQValueList::Iterator it = m_Current; - ++it; - - int i = 0; - while( i < 10 ) - { - if ( it == m_history.fromLast() ) - { - popup->insertItem( (*it).url.url(), (*it).id ); - return; - } - - popup->insertItem( (*it).url.url(), (*it).id ); - ++i; - ++it; - } -} - -void TDevHTMLPart::slotPopupActivated( int id ) -{ - kdDebug(9000) << "id: " << id << endl; - - TQValueList::Iterator it = m_history.begin(); - while( it != m_history.end() ) - { - kdDebug(9000) << "(*it).id: " << (*it).id << endl; - if ( (*it).id == id ) - { - m_Current = it; - m_restoring = true; - openURL( (*m_Current).url ); - m_restoring = false; - return; - } - ++it; - } -} - -void TDevHTMLPart::addHistoryEntry() -{ - TQValueList::Iterator it = m_Current; - - // if We're not already the last entry, we truncate the list here before adding an entry - if ( it != m_history.end() && it != m_history.fromLast() ) - { - m_history.erase( ++it, m_history.end() ); - } - - DocumentationHistoryEntry newEntry( url() ); - - // Only save the new entry if it is different from the last - if ( newEntry.url != (*m_Current).url ) - { - m_history.append( newEntry ); - m_Current = m_history.fromLast(); - } -} - -void TDevHTMLPart::slotCopy( ) -{ - TQString text = selectedText(); - text.replace( TQChar( 0xa0 ), ' ' ); - TQClipboard *cb = TQApplication::clipboard(); - disconnect( cb, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotClearSelection() ) ); - cb->setText(text); - connect( cb, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotClearSelection() ) ); -} - -void TDevHTMLPart::slotSelectionChanged( ) -{ - if (selectedText().isEmpty()) - copyAction->setEnabled(false); - else - copyAction->setEnabled(true); -} - -#include "tdevhtmlpart.moc" diff --git a/lib/widgets/tdevhtmlpart.h b/lib/widgets/tdevhtmlpart.h deleted file mode 100644 index e822488b..00000000 --- a/lib/widgets/tdevhtmlpart.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef __TDEVHTMLPART_H__ -#define __TDEVHTMLPART_H__ - -#include - -#include - -#include - -/** -@file tdevhtmlpart.h -Customized TDEHTML part for KDevelop. -*/ - -class TDEAction; -class TDEToolBarPopupAction; - -struct DocumentationHistoryEntry { - KURL url; - int id; - - DocumentationHistoryEntry() {} - DocumentationHistoryEntry( const KURL& u ): url( u ) - { - id = abs( TQTime::currentTime().msecsTo( TQTime() ) ); // nasty, but should provide a reasonably unique number - } -}; - -/** -Customized TDEHTML part for KDevelop. -Used as HTML documentation and file viewer. - -Represents customized BrowserViewGUI mode of TDEHTMLPart. Provides also actions for: -- reload; -- stop; -- duplicate; -- print; -- copy text; -- back; -- forward. -. -It has it's own popup menu and font/zoom settings. -*/ -class TDevHTMLPart : public TDEHTMLPart -{ - Q_OBJECT - - -public: - - enum Options { CanDuplicate=1, CanOpenInNewWindow=2 }; - - TDevHTMLPart(); - - void setContext(const TQString &context); - TQString context() const; - virtual bool openURL(const KURL &url); - static TQString resolveEnvVarsInURL(const TQString& url); - - void setOptions(int options) { m_options = options; } - -signals: - void fileNameChanged(KParts::ReadOnlyPart *part); - -protected slots: - - void slotStarted(TDEIO::Job *); - void slotCompleted(); - void slotCancelled(const TQString &errMsg); - - void openURLRequest(const KURL &url); - void popup( const TQString & url, const TQPoint & p ); - - void slotReload(); - void slotStop(); - virtual void slotDuplicate() = 0; - virtual void slotOpenInNewWindow(const KURL &url) = 0; - void slotPrint(); - void slotCopy(); - void slotSelectionChanged(); - - void slotBack(); - void slotForward(); - void slotBackAboutToShow(); - void slotForwardAboutToShow(); - - void slotPopupActivated( int id ); - void addHistoryEntry(); - - -private: - - TQValueList< DocumentationHistoryEntry > m_history; - TQValueList< DocumentationHistoryEntry >::Iterator m_Current; - - TDEToolBarPopupAction* m_backAction; - TDEToolBarPopupAction* m_forwardAction; - - bool m_restoring; - - TQString m_context; - TDEAction *stopAction; - TDEAction *reloadAction; - TDEAction *duplicateAction; - TDEAction *printAction; - TDEAction *copyAction; - - int m_options; -}; - -#endif diff --git a/lib/widgets/tdevtabwidget.cpp b/lib/widgets/tdevtabwidget.cpp deleted file mode 100644 index adfd4566..00000000 --- a/lib/widgets/tdevtabwidget.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2001-2003 * - * The KDevelop Team * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include - -#include -#include -#include -#include - -#include "tdevtabwidget.h" - -TDevTabWidget::TDevTabWidget(TQWidget *parent, const char *name) : TQTabWidget(parent,name) -{ - m_pTabBar = new KTabBar(this, "tabbar"); - setTabBar(m_pTabBar); - connect(m_pTabBar, TQT_SIGNAL(closeWindow(const TQWidget*)), this, TQT_SIGNAL(closeWindow(const TQWidget*))); - connect(m_pTabBar, TQT_SIGNAL(closeOthers(TQWidget*)), this, TQT_SIGNAL(closeOthers(TQWidget*))); -} - -KTabBar::KTabBar(TQWidget *parent, const char *name) : TQTabBar(parent,name) -{ - m_pPopupMenu = new TQPopupMenu(this); - - TQPixmap closePixmap = TDEGlobal::instance()->iconLoader()->loadIcon( "tab_remove", TDEIcon::Small, 0, TDEIcon::DefaultState, 0, true ); - if (closePixmap.isNull()) - closePixmap = SmallIcon("fileclose"); - - m_pPopupMenu->insertItem(closePixmap, i18n("&Close"), this, TQT_SLOT(closeWindowSlot())); - m_pPopupMenu->insertItem(i18n("Close &Others"), this, TQT_SLOT(closeOthersSlot())); -} - -void KTabBar::closeWindowSlot() -{ - emit closeWindow(m_pPage); -} - -void KTabBar::closeOthersSlot() -{ - emit closeOthers(m_pPage); -} - -void KTabBar::mousePressEvent(TQMouseEvent *e) -{ - if(e->button() == Qt::RightButton) { - - TQTab *tab = selectTab(e->pos() ); - if( tab == 0L ) return; - - m_pPage = ((TDevTabWidget*)parent())->page(indexOf(tab->identifier() ) ); - if(m_pPage == 0L) return; - - m_pPopupMenu->exec(mapToGlobal(e->pos())); - } - TQTabBar::mousePressEvent(e); -} - -#include "tdevtabwidget.moc" -- cgit v1.2.1