From 2fb700f92bb787fab0845a63a541cd5640daa449 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:18:13 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- lib/CMakeLists.txt | 2 +- lib/Makefile.am | 2 +- lib/catalog/Makefile.am | 2 +- lib/cppparser/Makefile.am | 2 +- lib/interfaces/Makefile.am | 4 +- lib/interfaces/extensions/Makefile.am | 2 +- lib/interfaces/external/CMakeLists.txt | 2 +- lib/interfaces/external/Makefile.am | 2 +- lib/interfaces/external/designer.h | 2 +- lib/interfaces/extras/Makefile.am | 2 +- lib/interfaces/kdevpartcontroller.h | 2 +- lib/util/CMakeLists.txt | 4 +- lib/util/Makefile.am | 6 +- lib/util/kdeveditorutil.cpp | 10 +- lib/util/kdevshellwidget.cpp | 2 +- lib/util/kscriptactionmanager.cpp | 177 --------------------------------- lib/util/kscriptactionmanager.h | 141 -------------------------- lib/util/tdescriptactionmanager.cpp | 177 +++++++++++++++++++++++++++++++++ lib/util/tdescriptactionmanager.h | 141 ++++++++++++++++++++++++++ lib/widgets/CMakeLists.txt | 2 +- lib/widgets/Makefile.am | 2 +- lib/widgets/kdevhtmlpart.cpp | 4 +- lib/widgets/kdevhtmlpart.h | 2 +- lib/widgets/propeditor/Makefile.am | 2 +- 24 files changed, 347 insertions(+), 347 deletions(-) delete mode 100644 lib/util/kscriptactionmanager.cpp delete mode 100644 lib/util/kscriptactionmanager.h create mode 100644 lib/util/tdescriptactionmanager.cpp create mode 100644 lib/util/tdescriptactionmanager.h (limited to 'lib') diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 025e1819..0398ddf0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -34,6 +34,6 @@ tde_add_library( tdevelop SHARED EMBED kdevutil-static kdevinterfaces-static LINK kdevpropertyeditor-shared - kscript-shared kparts-shared ktexteditor-shared + tdescript-shared tdeparts-shared tdetexteditor-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/lib/Makefile.am b/lib/Makefile.am index 4e722350..2314d6e7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,7 +11,7 @@ libtdevelop_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.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 \ -# -lktexteditor $(LIB_KPARTS) $(LIB_KIO) -lkscript +# -ltdetexteditor $(LIB_KPARTS) $(LIB_KIO) -ltdescript libtdevelop_la_SOURCES = dummy.cpp diff --git a/lib/catalog/Makefile.am b/lib/catalog/Makefile.am index f9c81448..1aaa40ef 100644 --- a/lib/catalog/Makefile.am +++ b/lib/catalog/Makefile.am @@ -7,7 +7,7 @@ libkdevcatalog_la_LIBADD = -l$(DB3LIB) $(LIB_TDECORE) $(LIB_QT) kdevcatalogincludedir = $(includedir)/tdevelop/catalog kdevcataloginclude_HEADERS = catalog.h tag.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = TDevelop Catalog Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/cppparser/Makefile.am b/lib/cppparser/Makefile.am index a40c5518..414fea6f 100644 --- a/lib/cppparser/Makefile.am +++ b/lib/cppparser/Makefile.am @@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) AM_CXXFLAGS = -DKDEVELOP_BGPARSER 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_KPARTS) -lktexteditor $(LIB_KIO) -lkscript +libkdevcppparser_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(top_builddir)/lib/interfaces/libkdevinterfaces.la -lDCOP $(LIB_TDEUI) $(LIB_KPARTS) -ltdetexteditor $(LIB_KIO) -ltdescript libkdevcppparser_la_SOURCES = ast.cpp cachemanager.cpp driver.cpp errors.cpp \ lexer.cpp lexercache.cpp lookup.cpp parser.cpp tree_parser.cpp diff --git a/lib/interfaces/Makefile.am b/lib/interfaces/Makefile.am index 3e8cbc7c..21deec16 100644 --- a/lib/interfaces/Makefile.am +++ b/lib/interfaces/Makefile.am @@ -14,7 +14,7 @@ libkdevinterfaces_la_SOURCES = kdevcore.cpp kdevproject.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_KHTML) $(LIB_KPARTS) -lktexteditor -lkscript -lDCOP + $(LIB_TDEUI) $(LIB_KHTML) $(LIB_KPARTS) -ltdetexteditor -ltdescript -lDCOP tdevelopincludedir = $(includedir)/tdevelop/interfaces tdevelopinclude_HEADERS = kdevlanguagesupport.h kdevmainwindow.h \ @@ -33,7 +33,7 @@ METASOURCES = AUTO SUBDIRS = extensions external extras -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil designer_integration kdevcatalog kdevprofileslib kdevextensions DOXYGEN_PROJECTNAME = TDevelop Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/interfaces/extensions/Makefile.am b/lib/interfaces/extensions/Makefile.am index 29ab44e4..211439b0 100644 --- a/lib/interfaces/extensions/Makefile.am +++ b/lib/interfaces/extensions/Makefile.am @@ -16,7 +16,7 @@ libkdevextensions_la_SOURCES = kdevappfrontend.cpp kdevmakefrontend.cpp INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) METASOURCES = AUTO -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Extension Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am diff --git a/lib/interfaces/external/CMakeLists.txt b/lib/interfaces/external/CMakeLists.txt index cee645d0..353721fd 100644 --- a/lib/interfaces/external/CMakeLists.txt +++ b/lib/interfaces/external/CMakeLists.txt @@ -27,7 +27,7 @@ install( FILES tde_add_library( kinterfacedesigner SHARED AUTOMOC SOURCES designer.cpp - LINK kparts-shared tdeui-shared + LINK tdeparts-shared tdeui-shared VERSION 0.0.0 DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/lib/interfaces/external/Makefile.am b/lib/interfaces/external/Makefile.am index 63e15465..8d022993 100644 --- a/lib/interfaces/external/Makefile.am +++ b/lib/interfaces/external/Makefile.am @@ -10,6 +10,6 @@ libkinterfacedesigner_la_LIBADD = $(LIB_QT) $(LIB_KPARTS) $(LIB_TDEUI) libkinterfacedesigner_la_LDFLAGS = $(all_libraries) libkinterfacedesigner_la_SOURCES = designer.cpp -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KInterfaceDesigner Library include ../../../Doxyfile.am diff --git a/lib/interfaces/external/designer.h b/lib/interfaces/external/designer.h index 4396c1ab..b84e2268 100644 --- a/lib/interfaces/external/designer.h +++ b/lib/interfaces/external/designer.h @@ -19,7 +19,7 @@ #ifndef KINTERFACEDESIGNER_FORMEDITOR_H #define KINTERFACEDESIGNER_FORMEDITOR_H -#include +#include /**Contains KInterfaceDesigner classes.*/ namespace KInterfaceDesigner{ diff --git a/lib/interfaces/extras/Makefile.am b/lib/interfaces/extras/Makefile.am index 49107f8f..a554ad30 100644 --- a/lib/interfaces/extras/Makefile.am +++ b/lib/interfaces/extras/Makefile.am @@ -12,7 +12,7 @@ libkdevextras_la_SOURCES = kdevcompileroptions.cpp kdevvcsintegrator.cpp servicetype_DATA = tdevelopcompileroptions.desktop \ tdevelopvcsintegrator.desktop -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevinterfaces DOXYGEN_PROJECTNAME = TDevelop Extra Interfaces Library DOXYGEN_DOCDIRPREFIX = kdev include ../../../Doxyfile.am diff --git a/lib/interfaces/kdevpartcontroller.h b/lib/interfaces/kdevpartcontroller.h index 8c237bf3..0e24c8fc 100644 --- a/lib/interfaces/kdevpartcontroller.h +++ b/lib/interfaces/kdevpartcontroller.h @@ -26,7 +26,7 @@ #define KDEV_PARTCONTROLLER_H #include -#include +#include #include /** diff --git a/lib/util/CMakeLists.txt b/lib/util/CMakeLists.txt index 378c4dca..1eb17f35 100644 --- a/lib/util/CMakeLists.txt +++ b/lib/util/CMakeLists.txt @@ -22,7 +22,7 @@ include_directories( install( FILES domutil.h execcommand.h filetemplate.h urlutil.h - configwidgetproxy.h rurl.h kscriptactionmanager.h + configwidgetproxy.h rurl.h tdescriptactionmanager.h DESTINATION ${INCLUDE_INSTALL_DIR}/tdevelop/util ) @@ -33,6 +33,6 @@ tde_add_library( kdevutil STATIC_PIC AUTOMOC blockingkprocess.cpp configwidgetproxy.cpp domutil.cpp execcommand.cpp filetemplate.cpp kdeveditorutil.cpp kdevjobtimer.cpp - kdevshellwidget.cpp kscriptactionmanager.cpp + kdevshellwidget.cpp tdescriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp ) diff --git a/lib/util/Makefile.am b/lib/util/Makefile.am index 3a31f258..4dbaa33b 100644 --- a/lib/util/Makefile.am +++ b/lib/util/Makefile.am @@ -4,15 +4,15 @@ noinst_LTLIBRARIES = libkdevutil.la libkdevutil_la_SOURCES = blockingkprocess.cpp configwidgetproxy.cpp domutil.cpp \ execcommand.cpp filetemplate.cpp kdeveditorutil.cpp kdevjobtimer.cpp \ - kdevshellwidget.cpp kscriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp + kdevshellwidget.cpp tdescriptactionmanager.cpp rurl.cpp settings.cpp urlutil.cpp METASOURCES = AUTO tdevelopincludedir = $(includedir)/tdevelop/util tdevelopinclude_HEADERS = domutil.h execcommand.h filetemplate.h urlutil.h \ - configwidgetproxy.h rurl.h kscriptactionmanager.h + configwidgetproxy.h rurl.h tdescriptactionmanager.h -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils kdevextensions kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevextensions kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Utility Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/util/kdeveditorutil.cpp b/lib/util/kdeveditorutil.cpp index 3c01f780..198e9a42 100644 --- a/lib/util/kdeveditorutil.cpp +++ b/lib/util/kdeveditorutil.cpp @@ -11,11 +11,11 @@ #include "kdeveditorutil.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include bool KDevEditorUtil::currentPositionReal( unsigned int * line, unsigned int * col, KTextEditor::Document * doc, KTextEditor::View * view ) { diff --git a/lib/util/kdevshellwidget.cpp b/lib/util/kdevshellwidget.cpp index b85bea80..b9220250 100644 --- a/lib/util/kdevshellwidget.cpp +++ b/lib/util/kdevshellwidget.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/util/kscriptactionmanager.cpp b/lib/util/kscriptactionmanager.cpp deleted file mode 100644 index 28756841..00000000 --- a/lib/util/kscriptactionmanager.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004 by ian geiser * -* geiseri@sourcextreme.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#include "kscriptactionmanager.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -KScriptAction::KScriptAction( const TQString &scriptDesktopFile, TQObject *interface, KActionCollection *ac ) - : TQObject(interface), KScriptClientInterface( ) -{ - m_interface = 0L; - m_action = 0L; - m_isValid = false; - m_refs = 0; - // Read the desktop file - if(KDesktopFile::isDesktopFile(scriptDesktopFile)) - { - KDesktopFile desktop(scriptDesktopFile, true); - TQFileInfo scriptPath(scriptDesktopFile); - - m_scriptFile = scriptPath.dirPath(true) + "/" + desktop.readEntry("X-TDE-ScriptName", ""); - m_scriptName = desktop.readName(); - m_scriptType = desktop.readType(); - TQString scriptTypeQuery = "([X-TDE-Script-Runner] == '" + m_scriptType + "')"; - KTrader::OfferList offers = KTrader::self()->query( "KScriptRunner/KScriptRunner", scriptTypeQuery ); - if ( !offers.isEmpty() ) - { - m_action = new KAction(m_scriptName, KShortcut(), this, TQT_SLOT(activate()), ac, "script"); - m_isValid = true; - m_timeout = new TQTimer(this); - TQString icon = desktop.readIcon(); - m_action->setStatusText(desktop.readComment()); - if( !icon.isEmpty() ) - m_action->setIcon(icon); - m_action->setShortcutConfigurable(true); - connect( m_timeout, TQT_SIGNAL(timeout()), TQT_SLOT(cleanup()) ); - } - } -} - -KScriptAction::~KScriptAction() -{ - if( m_interface ) delete m_interface; - if( m_action ) delete m_action; -} - - - -KAction * KScriptAction::action( ) -{ - return m_action; -} - -void KScriptAction::activate( ) -{ - if( m_interface == 0L) - { - TQString scriptTypeQuery = "([X-TDE-Script-Runner] == '" + m_scriptType + "')"; - m_interface= KParts::ComponentFactory::createInstanceFromQuery( "KScriptRunner/KScriptRunner", scriptTypeQuery, this ); - if ( m_interface != 0L) - { - m_interface->ScriptClientInterface= this; - if( m_scriptMethod.isEmpty() ) - m_interface->setScript(m_scriptFile); - else - m_interface->setScript(m_scriptFile, m_scriptMethod); - connect(this, TQT_SIGNAL(done(KScriptClientInterface::Result, const TQVariant &)), this, TQT_SLOT(scriptFinished())); - } - else - { - KMessageBox::sorry(0, i18n("Unable to get KScript Runner for type \"%1\".").arg(m_scriptType), i18n("KScript Error")); - kdDebug() << "Query string: " << scriptTypeQuery << endl; - return; - } - } - m_interface->run(parent(), TQVariant()); - m_timeout->start(60000,FALSE); // after 1 minute unload - m_refs++; -} - -void KScriptAction::cleanup() -{ - if( m_interface && m_refs == 0) - { - delete m_interface; - m_interface = 0L; - } -} - -void KScriptAction::scriptFinished() -{ - m_refs--; -} - -KScriptActionManager::KScriptActionManager( TQObject *parent, KActionCollection * ac ) : TQObject(parent), m_ac(ac) -{ - m_actions.setAutoDelete(true); -} - -KScriptActionManager::~ KScriptActionManager( ) -{ - m_actions.clear(); -} - -TQPtrList< KAction > KScriptActionManager::scripts( TQObject * interface , const TQStringList &dirs) const -{ - m_actions.clear(); - TQPtrList actions; - TQStringList scripts; - - scripts += TDEGlobal::dirs()->findAllResources("data", - TQString(kapp->name())+"/scripts/*.desktop", false, true ); - - for( TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) - { - scripts += TDEGlobal::dirs()->findAllResources("data", - (*it)+"/*.desktop", false, true ); - } - - for (TQStringList::Iterator it = scripts.begin(); it != scripts.end(); ++it ) - { - kdDebug() << "Loading " << *it << endl; - KScriptAction *script = new KScriptAction(*it, interface, m_ac); - if( script->isValid()) - { - actions.append(script->action()); - m_actions.append(script); - connect(script, TQT_SIGNAL(error( const TQString&)), this, - TQT_SIGNAL(scriptError( const TQString&))); - connect(script, TQT_SIGNAL(warning( const TQString&)), this, - TQT_SIGNAL(scriptWarning( const TQString&))); - connect(script, TQT_SIGNAL(output( const TQString&)), this, - TQT_SIGNAL(scriptOutput( const TQString&))); - connect(script, TQT_SIGNAL(progress( int )), this, - TQT_SIGNAL(scriptProgress(int))); - connect(script, TQT_SIGNAL(done( KScriptClientInterface::Result, const TQVariant &)),this, - TQT_SIGNAL(scriptDone( KScriptClientInterface::Result, const TQVariant &))); - } - else - delete script; - } - return actions; -} - -bool KScriptAction::isValid( ) const -{ - return m_isValid; -} - -#include "kscriptactionmanager.moc" diff --git a/lib/util/kscriptactionmanager.h b/lib/util/kscriptactionmanager.h deleted file mode 100644 index c2e43238..00000000 --- a/lib/util/kscriptactionmanager.h +++ /dev/null @@ -1,141 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004 by ian geiser * -* geiseri@sourcextreme.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -***************************************************************************/ -#ifndef KScriptAction_H -#define KScriptAction_H - -#include -#include -#include - -class KAction; -class KActionCollection; -class KScriptInterface; -class KScriptActionManager; -class TQTimer; - -/** -* Connects a KAction to a script runner. -* -* @author ian geiser geiseri@sourcextreme.com -*/ -class KScriptAction : public TQObject, public KScriptClientInterface { - Q_OBJECT - -public: - - KScriptAction( const TQString &scriptDesktopFile, TQObject *interface, KActionCollection *ac ); - - virtual ~KScriptAction(); - - /** - * KAction for the current script - */ - KAction *action(); - - /** - * Returns the validity of the current script. - */ - bool isValid() const; - -signals: - // Reimplemented from KScript - void error ( const TQString &msg ); - void warning ( const TQString &msg ); - void output ( const TQString &msg ); - void progress ( int percent ); - void done ( KScriptClientInterface::Result result, const TQVariant &returned ); - -signals: - void scriptError ( const TQString &msg ); - void scriptWarning ( const TQString &msg ); - void scriptOutput ( const TQString &msg ); - void scriptProgress ( int percent ); - void scriptDone ( KScriptClientInterface::Result result, const TQVariant &returned ); - -private slots: - void activate(); - void cleanup(); - void scriptFinished(); - -private: - KAction *m_action; - TQString m_scriptName; - TQString m_scriptType; - TQString m_scriptFile; - TQString m_scriptMethod; - KScriptInterface *m_interface; - bool m_isValid; - TQTimer *m_timeout; - uint m_refs; -}; - -/** - * Provides an actionlist of scripts that are currently available. - * Scripts are not actually loaded until they are actually executed. - * @author ian geiser - */ -class KScriptActionManager : public TQObject { -Q_OBJECT - - -public: - /** - * Create a script manager that is attached to an action collection. - */ - KScriptActionManager( TQObject *parent, KActionCollection *ac ); - ~KScriptActionManager(); - - /** - * Return all currently loaded scripts in a direcotry and attaches them - * to a TQObject interface. If the dirs are empty the current applications - * scripts directory is used. The dirs are actual directories to search - * in the $KDEPATH/data/ direcories. So if you add "coolapp/data" then - * the manager will search in $KDEPATH/data/coolapp/data for all desktop - * files that are scripts. - */ - TQPtrList scripts( TQObject *interface, const TQStringList &dirs = TQStringList() ) const; - -signals: - /** - * Returns an error message from a script. - */ - void scriptError ( const TQString &msg ); - /** - * Returns a warning message from a script. - */ - void scriptWarning ( const TQString &msg ); - /** - * Returns a standard out message from a script. - */ - void scriptOutput ( const TQString &msg ); - /** - * Returns the percentage complete of an operation in the script. - */ - void scriptProgress ( int percent ); - /** - * Notifies that the script has finished. - */ - void scriptDone( KScriptClientInterface::Result result, const TQVariant &returned ); - -private: - mutable TQPtrList m_actions; - KActionCollection *m_ac; -}; -#endif diff --git a/lib/util/tdescriptactionmanager.cpp b/lib/util/tdescriptactionmanager.cpp new file mode 100644 index 00000000..3b0aa8ac --- /dev/null +++ b/lib/util/tdescriptactionmanager.cpp @@ -0,0 +1,177 @@ +/*************************************************************************** +* Copyright (C) 2004 by ian geiser * +* geiseri@sourcextreme.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +***************************************************************************/ +#include "tdescriptactionmanager.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +KScriptAction::KScriptAction( const TQString &scriptDesktopFile, TQObject *interface, KActionCollection *ac ) + : TQObject(interface), KScriptClientInterface( ) +{ + m_interface = 0L; + m_action = 0L; + m_isValid = false; + m_refs = 0; + // Read the desktop file + if(KDesktopFile::isDesktopFile(scriptDesktopFile)) + { + KDesktopFile desktop(scriptDesktopFile, true); + TQFileInfo scriptPath(scriptDesktopFile); + + m_scriptFile = scriptPath.dirPath(true) + "/" + desktop.readEntry("X-TDE-ScriptName", ""); + m_scriptName = desktop.readName(); + m_scriptType = desktop.readType(); + TQString scriptTypeQuery = "([X-TDE-Script-Runner] == '" + m_scriptType + "')"; + KTrader::OfferList offers = KTrader::self()->query( "KScriptRunner/KScriptRunner", scriptTypeQuery ); + if ( !offers.isEmpty() ) + { + m_action = new KAction(m_scriptName, KShortcut(), this, TQT_SLOT(activate()), ac, "script"); + m_isValid = true; + m_timeout = new TQTimer(this); + TQString icon = desktop.readIcon(); + m_action->setStatusText(desktop.readComment()); + if( !icon.isEmpty() ) + m_action->setIcon(icon); + m_action->setShortcutConfigurable(true); + connect( m_timeout, TQT_SIGNAL(timeout()), TQT_SLOT(cleanup()) ); + } + } +} + +KScriptAction::~KScriptAction() +{ + if( m_interface ) delete m_interface; + if( m_action ) delete m_action; +} + + + +KAction * KScriptAction::action( ) +{ + return m_action; +} + +void KScriptAction::activate( ) +{ + if( m_interface == 0L) + { + TQString scriptTypeQuery = "([X-TDE-Script-Runner] == '" + m_scriptType + "')"; + m_interface= KParts::ComponentFactory::createInstanceFromQuery( "KScriptRunner/KScriptRunner", scriptTypeQuery, this ); + if ( m_interface != 0L) + { + m_interface->ScriptClientInterface= this; + if( m_scriptMethod.isEmpty() ) + m_interface->setScript(m_scriptFile); + else + m_interface->setScript(m_scriptFile, m_scriptMethod); + connect(this, TQT_SIGNAL(done(KScriptClientInterface::Result, const TQVariant &)), this, TQT_SLOT(scriptFinished())); + } + else + { + KMessageBox::sorry(0, i18n("Unable to get KScript Runner for type \"%1\".").arg(m_scriptType), i18n("KScript Error")); + kdDebug() << "Query string: " << scriptTypeQuery << endl; + return; + } + } + m_interface->run(parent(), TQVariant()); + m_timeout->start(60000,FALSE); // after 1 minute unload + m_refs++; +} + +void KScriptAction::cleanup() +{ + if( m_interface && m_refs == 0) + { + delete m_interface; + m_interface = 0L; + } +} + +void KScriptAction::scriptFinished() +{ + m_refs--; +} + +KScriptActionManager::KScriptActionManager( TQObject *parent, KActionCollection * ac ) : TQObject(parent), m_ac(ac) +{ + m_actions.setAutoDelete(true); +} + +KScriptActionManager::~ KScriptActionManager( ) +{ + m_actions.clear(); +} + +TQPtrList< KAction > KScriptActionManager::scripts( TQObject * interface , const TQStringList &dirs) const +{ + m_actions.clear(); + TQPtrList actions; + TQStringList scripts; + + scripts += TDEGlobal::dirs()->findAllResources("data", + TQString(kapp->name())+"/scripts/*.desktop", false, true ); + + for( TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) + { + scripts += TDEGlobal::dirs()->findAllResources("data", + (*it)+"/*.desktop", false, true ); + } + + for (TQStringList::Iterator it = scripts.begin(); it != scripts.end(); ++it ) + { + kdDebug() << "Loading " << *it << endl; + KScriptAction *script = new KScriptAction(*it, interface, m_ac); + if( script->isValid()) + { + actions.append(script->action()); + m_actions.append(script); + connect(script, TQT_SIGNAL(error( const TQString&)), this, + TQT_SIGNAL(scriptError( const TQString&))); + connect(script, TQT_SIGNAL(warning( const TQString&)), this, + TQT_SIGNAL(scriptWarning( const TQString&))); + connect(script, TQT_SIGNAL(output( const TQString&)), this, + TQT_SIGNAL(scriptOutput( const TQString&))); + connect(script, TQT_SIGNAL(progress( int )), this, + TQT_SIGNAL(scriptProgress(int))); + connect(script, TQT_SIGNAL(done( KScriptClientInterface::Result, const TQVariant &)),this, + TQT_SIGNAL(scriptDone( KScriptClientInterface::Result, const TQVariant &))); + } + else + delete script; + } + return actions; +} + +bool KScriptAction::isValid( ) const +{ + return m_isValid; +} + +#include "tdescriptactionmanager.moc" diff --git a/lib/util/tdescriptactionmanager.h b/lib/util/tdescriptactionmanager.h new file mode 100644 index 00000000..c2e43238 --- /dev/null +++ b/lib/util/tdescriptactionmanager.h @@ -0,0 +1,141 @@ +/*************************************************************************** +* Copyright (C) 2004 by ian geiser * +* geiseri@sourcextreme.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +***************************************************************************/ +#ifndef KScriptAction_H +#define KScriptAction_H + +#include +#include +#include + +class KAction; +class KActionCollection; +class KScriptInterface; +class KScriptActionManager; +class TQTimer; + +/** +* Connects a KAction to a script runner. +* +* @author ian geiser geiseri@sourcextreme.com +*/ +class KScriptAction : public TQObject, public KScriptClientInterface { + Q_OBJECT + +public: + + KScriptAction( const TQString &scriptDesktopFile, TQObject *interface, KActionCollection *ac ); + + virtual ~KScriptAction(); + + /** + * KAction for the current script + */ + KAction *action(); + + /** + * Returns the validity of the current script. + */ + bool isValid() const; + +signals: + // Reimplemented from KScript + void error ( const TQString &msg ); + void warning ( const TQString &msg ); + void output ( const TQString &msg ); + void progress ( int percent ); + void done ( KScriptClientInterface::Result result, const TQVariant &returned ); + +signals: + void scriptError ( const TQString &msg ); + void scriptWarning ( const TQString &msg ); + void scriptOutput ( const TQString &msg ); + void scriptProgress ( int percent ); + void scriptDone ( KScriptClientInterface::Result result, const TQVariant &returned ); + +private slots: + void activate(); + void cleanup(); + void scriptFinished(); + +private: + KAction *m_action; + TQString m_scriptName; + TQString m_scriptType; + TQString m_scriptFile; + TQString m_scriptMethod; + KScriptInterface *m_interface; + bool m_isValid; + TQTimer *m_timeout; + uint m_refs; +}; + +/** + * Provides an actionlist of scripts that are currently available. + * Scripts are not actually loaded until they are actually executed. + * @author ian geiser + */ +class KScriptActionManager : public TQObject { +Q_OBJECT + + +public: + /** + * Create a script manager that is attached to an action collection. + */ + KScriptActionManager( TQObject *parent, KActionCollection *ac ); + ~KScriptActionManager(); + + /** + * Return all currently loaded scripts in a direcotry and attaches them + * to a TQObject interface. If the dirs are empty the current applications + * scripts directory is used. The dirs are actual directories to search + * in the $KDEPATH/data/ direcories. So if you add "coolapp/data" then + * the manager will search in $KDEPATH/data/coolapp/data for all desktop + * files that are scripts. + */ + TQPtrList scripts( TQObject *interface, const TQStringList &dirs = TQStringList() ) const; + +signals: + /** + * Returns an error message from a script. + */ + void scriptError ( const TQString &msg ); + /** + * Returns a warning message from a script. + */ + void scriptWarning ( const TQString &msg ); + /** + * Returns a standard out message from a script. + */ + void scriptOutput ( const TQString &msg ); + /** + * Returns the percentage complete of an operation in the script. + */ + void scriptProgress ( int percent ); + /** + * Notifies that the script has finished. + */ + void scriptDone( KScriptClientInterface::Result result, const TQVariant &returned ); + +private: + mutable TQPtrList m_actions; + KActionCollection *m_ac; +}; +#endif diff --git a/lib/widgets/CMakeLists.txt b/lib/widgets/CMakeLists.txt index b819bc91..d7e92092 100644 --- a/lib/widgets/CMakeLists.txt +++ b/lib/widgets/CMakeLists.txt @@ -47,6 +47,6 @@ tde_add_library( kdevwidgets SHARED AUTOMOC processlinemaker.cpp processwidget.cpp ksavealldialog.cpp fancylistviewitem.cpp VERSION 0.0.0 - LINK kio-shared khtml-shared + LINK kio-shared tdehtml-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index f42447e7..ecf57f7f 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -24,7 +24,7 @@ rcdir = $(kde_datadir)/tdevelop rc_DATA = kdevhtml_partui.rc -DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils kdevutil kdevinterfaces DOXYGEN_PROJECTNAME = KDevelop Widgets Library DOXYGEN_DOCDIRPREFIX = kdev include ../../Doxyfile.am diff --git a/lib/widgets/kdevhtmlpart.cpp b/lib/widgets/kdevhtmlpart.cpp index abbeebbc..85990989 100644 --- a/lib/widgets/kdevhtmlpart.cpp +++ b/lib/widgets/kdevhtmlpart.cpp @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/lib/widgets/kdevhtmlpart.h b/lib/widgets/kdevhtmlpart.h index 805134a0..13f155a5 100644 --- a/lib/widgets/kdevhtmlpart.h +++ b/lib/widgets/kdevhtmlpart.h @@ -5,7 +5,7 @@ #include -#include +#include /** @file kdevhtmlpart.h diff --git a/lib/widgets/propeditor/Makefile.am b/lib/widgets/propeditor/Makefile.am index 00bc07ca..0c037873 100644 --- a/lib/widgets/propeditor/Makefile.am +++ b/lib/widgets/propeditor/Makefile.am @@ -13,6 +13,6 @@ pcolorcombo.cpp pdoublenuminput.cpp ppixmapedit.cpp propertylist.cpp ps 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 khtml kmdi kio kjs kparts kutils +DOXYGEN_REFERENCES = dcop interfaces tdecore tdefx tdeui tdehtml tdemdi kio kjs tdeparts tdeutils DOXYGEN_PROJECTNAME = KDevelop Property Editing Library include ../../../Doxyfile.am -- cgit v1.2.1