diff options
Diffstat (limited to 'parts/documentation/documentation_part.cpp')
-rw-r--r-- | parts/documentation/documentation_part.cpp | 111 |
1 files changed, 61 insertions, 50 deletions
diff --git a/parts/documentation/documentation_part.cpp b/parts/documentation/documentation_part.cpp index 75bb7c13..9515fad7 100644 --- a/parts/documentation/documentation_part.cpp +++ b/parts/documentation/documentation_part.cpp @@ -48,17 +48,17 @@ #include <twin.h> #include <tdetexteditor/document.h> -#include "kdevplugininfo.h" -#include "kdevcore.h" -#include "kdevproject.h" -#include "kdevmainwindow.h" -#include "kdevgenericfactory.h" -#include "kdevdocumentationplugin.h" +#include "tdevplugininfo.h" +#include "tdevcore.h" +#include "tdevproject.h" +#include "tdevmainwindow.h" +#include "tdevgenericfactory.h" +#include "tdevdocumentationplugin.h" #include "configwidgetproxy.h" -#include "kdevpartcontroller.h" +#include "tdevpartcontroller.h" #include "domutil.h" #include "urlutil.h" -#include "kdeveditorutil.h" +#include "tdeveditorutil.h" #include "documentation_widget.h" #include "docglobalconfigwidget.h" @@ -66,22 +66,22 @@ #include "contentsview.h" #include "find_documentation.h" -#include "KDevDocumentationIface.h" +#include "TDevDocumentationIface.h" #define GLOBALDOC_OPTIONS 1 #define PROJECTDOC_OPTIONS 2 -static const KDevPluginInfo data("kdevdocumentation"); +static const TDevPluginInfo data("tdevdocumentation"); -typedef KDevGenericFactory<DocumentationPart> DocumentationFactory; -K_EXPORT_COMPONENT_FACTORY( libkdevdocumentation, DocumentationFactory( data ) ) +typedef TDevGenericFactory<DocumentationPart> DocumentationFactory; +K_EXPORT_COMPONENT_FACTORY( libtdevdocumentation, DocumentationFactory( data ) ) DocumentationPart::DocumentationPart(TQObject *parent, const char *name, const TQStringList& ) - :KDevPlugin(&data, parent, name ? name : "DocumentationPart" ), + :TDevPlugin(&data, parent, name ? name : "DocumentationPart" ), m_projectDocumentationPlugin(0), m_userManualPlugin(0), m_hasIndex(false) { setInstance(DocumentationFactory::instance()); - setXMLFile("kdevpart_documentation.rc"); + setXMLFile("tdevpart_documentation.rc"); m_configProxy = new ConfigWidgetProxy(core()); m_configProxy->createGlobalConfigPage(i18n("Documentation"), GLOBALDOC_OPTIONS, info()->icon() ); @@ -109,7 +109,7 @@ DocumentationPart::DocumentationPart(TQObject *parent, const char *name, const T TQTimer::singleShot(0, this, TQT_SLOT(init())); - new KDevDocumentationIface(this); + new TDevDocumentationIface(this); } DocumentationPart::~DocumentationPart() @@ -250,6 +250,12 @@ void DocumentationPart::setupActions() "all possible sources of documentation like " "table of contents, index, man and info databases, " "Google, etc.")); + action = new TDEAction(i18n("TDevelop Programming Handbook"), 0, + this, TQT_SLOT(programmingHandbook()), + actionCollection(), "help_programming_handbook" ); + action->setToolTip(i18n("Open the TDevelop Programming Handbook")); + action->setWhatsThis(i18n("<b>Open the TDevelop Programming Handbook</b><p>Opens Open the TDevelop Programming Handbook.")); + } void DocumentationPart::emitBookmarkLocation(const TQString &title, const KURL &url) @@ -259,12 +265,12 @@ void DocumentationPart::emitBookmarkLocation(const TQString &title, const KURL & void DocumentationPart::searchInDocumentation() { - TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); + TQString word = TDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); if ( word.isEmpty() ) { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "searchInDocumentation()" ); + callAssistant ( "TDevDocumentation", "searchInDocumentation()" ); else { mainWindow()->raiseView ( m_widget ); @@ -274,7 +280,7 @@ void DocumentationPart::searchInDocumentation() else { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "searchInDocumentation(TQString)", word ); + callAssistant ( "TDevDocumentation", "searchInDocumentation(TQString)", word ); else { mainWindow()->raiseView ( m_widget ); @@ -292,24 +298,29 @@ void DocumentationPart::searchInDocumentation(const TQString &term) void DocumentationPart::contextSearchInDocumentation() { if (isAssistantUsed()) - callAssistant("KDevDocumentation", "searchInDocumentation(TQString)", m_contextStr); + callAssistant("TDevDocumentation", "searchInDocumentation(TQString)", m_contextStr); else searchInDocumentation(m_contextStr); } +void DocumentationPart::programmingHandbook() +{ + kapp->invokeHelp (TQString::null, "tde_app_devel"); +} + void DocumentationPart::manPage() { - TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); + TQString word = TDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); if ( isAssistantUsed() ) { if ( word.isEmpty() ) { - callAssistant ( "KDevDocumentation", "manPage()" ); + callAssistant ( "TDevDocumentation", "manPage()" ); } else { - callAssistant ( "KDevDocumentation", "manPage(TQString)", word ); + callAssistant ( "TDevDocumentation", "manPage(TQString)", word ); } } else @@ -323,17 +334,17 @@ void DocumentationPart::manPage() void DocumentationPart::infoPage() { - TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); + TQString word = TDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); if ( isAssistantUsed() ) { if ( word.isEmpty() ) { - callAssistant ( "KDevDocumentation", "infoPage()" ); + callAssistant ( "TDevDocumentation", "infoPage()" ); } else { - callAssistant ( "KDevDocumentation", "infoPage(TQString)", word ); + callAssistant ( "TDevDocumentation", "infoPage(TQString)", word ); } } else @@ -360,7 +371,7 @@ void DocumentationPart::infoPage(const TQString &term) void DocumentationPart::contextManPage() { if (isAssistantUsed()) - callAssistant("KDevDocumentation", "manPage(TQString)", m_contextStr); + callAssistant("TDevDocumentation", "manPage(TQString)", m_contextStr); else manPage(m_contextStr); } @@ -368,7 +379,7 @@ void DocumentationPart::contextManPage() void DocumentationPart::contextInfoPage() { if (isAssistantUsed()) - callAssistant("KDevDocumentation", "infoPage(TQString)", m_contextStr); + callAssistant("TDevDocumentation", "infoPage(TQString)", m_contextStr); else infoPage(m_contextStr); } @@ -376,19 +387,19 @@ void DocumentationPart::contextInfoPage() void DocumentationPart::contextFindDocumentation() { if (isAssistantUsed()) - callAssistant("KDevDocumentation", "findInFinder(TQString)", m_contextStr); + callAssistant("TDevDocumentation", "findInFinder(TQString)", m_contextStr); else findInDocumentation(m_contextStr); } void DocumentationPart::findInDocumentation() { - TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); + TQString word = TDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); if ( word.isEmpty() ) { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "findInFinder()" ); + callAssistant ( "TDevDocumentation", "findInFinder()" ); else { mainWindow()->raiseView ( m_widget ); @@ -398,7 +409,7 @@ void DocumentationPart::findInDocumentation() else { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "findInFinder(TQString)", word ); + callAssistant ( "TDevDocumentation", "findInFinder(TQString)", word ); else { mainWindow()->raiseView ( m_widget ); @@ -415,12 +426,12 @@ void DocumentationPart::findInDocumentation(const TQString &term) void DocumentationPart::lookInDocumentationIndex() { - TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); + TQString word = TDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); if ( word.isEmpty() ) { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "lookupInIndex()" ); + callAssistant ( "TDevDocumentation", "lookupInIndex()" ); else { mainWindow()->raiseView ( m_widget ); @@ -430,7 +441,7 @@ void DocumentationPart::lookInDocumentationIndex() else { if ( isAssistantUsed() ) - callAssistant ( "KDevDocumentation", "lookupInIndex(TQString)", word ); + callAssistant ( "TDevDocumentation", "lookupInIndex(TQString)", word ); else { mainWindow()->raiseView ( m_widget ); @@ -448,7 +459,7 @@ void DocumentationPart::lookInDocumentationIndex(const TQString &term) void DocumentationPart::contextLookInDocumentationIndex() { if (isAssistantUsed()) - callAssistant("KDevDocumentation", "lookupInIndex(TQString)", m_contextStr); + callAssistant("TDevDocumentation", "lookupInIndex(TQString)", m_contextStr); else lookInDocumentationIndex(m_contextStr); } @@ -564,11 +575,11 @@ void DocumentationPart::setContextFeature(ContextFeature feature, bool b) void DocumentationPart::projectOpened() { - TQString projectDocSystem = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem"); - TQString projectDocURL = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl"); + TQString projectDocSystem = DomUtil::readEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docsystem"); + TQString projectDocURL = DomUtil::readEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docurl"); if (!projectDocURL.isEmpty()) projectDocURL = TQDir::cleanDirPath(project()->projectDirectory() + "/" + projectDocURL); - TQString userManualURL = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl"); + TQString userManualURL = DomUtil::readEntry(*(projectDom()), "/tdevdocumentation/projectdoc/usermanualurl"); for (TQValueList<DocumentationPlugin*>::const_iterator it = m_plugins.constBegin(); it != m_plugins.constEnd(); ++it) @@ -602,21 +613,21 @@ void DocumentationPart::saveProjectDocumentationInfo() { if (m_projectDocumentationPlugin) { - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem", m_projectDocumentationPlugin->pluginName()); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docsystem", m_projectDocumentationPlugin->pluginName()); TQString relPath = URLUtil::extractPathNameRelative(project()->projectDirectory(), m_projectDocumentationPlugin->catalogURL()); - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl", relPath); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docurl", relPath); } else { - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem", ""); - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl", ""); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docsystem", ""); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/docurl", ""); } if (m_userManualPlugin) - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl", m_userManualPlugin->catalogURL()); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/usermanualurl", m_userManualPlugin->catalogURL()); else - DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl", ""); + DomUtil::writeEntry(*(projectDom()), "/tdevdocumentation/projectdoc/usermanualurl", ""); } TQCString DocumentationPart::startAssistant() @@ -627,7 +638,7 @@ TQCString DocumentationPart::startAssistant() return lastAssistant; const char *function = 0; - TQString app = "kdevassistant"; + TQString app = "tdevassistant"; function = "start_service_by_desktop_name(TQString,TQStringList)"; TQStringList URLs; @@ -665,7 +676,7 @@ TQCString DocumentationPart::startAssistant() kdDebug() << dcopName.data() << endl; //@fixme: is there another way to wait for the remote object to be loaded - while (!TDEApplication::dcopClient()->remoteObjects(dcopName).contains("KDevDocumentation")) + while (!TDEApplication::dcopClient()->remoteObjects(dcopName).contains("TDevDocumentation")) usleep(500); } } @@ -674,8 +685,8 @@ TQCString DocumentationPart::startAssistant() bool DocumentationPart::isAssistantUsed() const { - // hack to solve BR #90334 - don't call kdevassistant via DCOP if we ARE kdevassistant - if ( kapp->instanceName().find("kdevassistant") != -1 ) + // hack to solve BR #90334 - don't call tdevassistant via DCOP if we ARE tdevassistant + if ( kapp->instanceName().find("tdevassistant") != -1 ) { return false; } @@ -686,7 +697,7 @@ bool DocumentationPart::isAssistantUsed() const void DocumentationPart::setAssistantUsed(bool b) { m_assistantUsed = b; - //use global config to store different settings for kdevassistant and tdevelop + //use global config to store different settings for tdevassistant and tdevelop TDEConfig *config = kapp->config(); config->setGroup("Documentation"); config->writeEntry("UseAssistant", isAssistantUsed()); @@ -739,7 +750,7 @@ void DocumentationPart::loadSettings() config->setGroup("Documentation"); m_assistantUsed = config->readBoolEntry("UseAssistant", false); - if (TQString(TDEGlobal::instance()->aboutData()->appName()) == "kdevassistant") + if (TQString(TDEGlobal::instance()->aboutData()->appName()) == "tdevassistant") { int page = config->readNumEntry("LastPage", 0); switch (page) |