summaryrefslogtreecommitdiffstats
path: root/parts/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'parts/documentation')
-rw-r--r--parts/documentation/contentsview.cpp4
-rw-r--r--parts/documentation/docprojectconfigwidget.cpp2
-rw-r--r--parts/documentation/documentation_part.cpp18
-rw-r--r--parts/documentation/documentation_part.h1
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.cpp61
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.h2
-rw-r--r--parts/documentation/plugins/chm/docchmplugin.cpp15
-rw-r--r--parts/documentation/plugins/chm/docchmplugin.h3
-rw-r--r--parts/documentation/plugins/devhelp/docdevhelpplugin.cpp10
-rw-r--r--parts/documentation/plugins/doxygen/docdoxygenplugin.cpp10
-rw-r--r--parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp9
-rw-r--r--parts/documentation/plugins/qt/docqtplugin.cpp12
12 files changed, 102 insertions, 45 deletions
diff --git a/parts/documentation/contentsview.cpp b/parts/documentation/contentsview.cpp
index 532feefd..3707f318 100644
--- a/parts/documentation/contentsview.cpp
+++ b/parts/documentation/contentsview.cpp
@@ -59,9 +59,7 @@ ContentsView::~ContentsView()
m_widget->index()->clear();
}
-void ContentsView::itemExecuted(TQListViewItem *item, const TQPoint &// p
- , int // col
- )
+void ContentsView::itemExecuted(TQListViewItem *item, const TQPoint &/*p*/, int /*col*/)
{
DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
if (!docItem)
diff --git a/parts/documentation/docprojectconfigwidget.cpp b/parts/documentation/docprojectconfigwidget.cpp
index a37ad5cb..205bb4f5 100644
--- a/parts/documentation/docprojectconfigwidget.cpp
+++ b/parts/documentation/docprojectconfigwidget.cpp
@@ -138,6 +138,8 @@ void DocProjectConfigWidget::accept()
m_part->m_projectDocumentationPlugin = 0;
}
m_part->m_projectDocumentationPlugin = plugin->projectDocumentationPlugin(DocumentationPlugin::APIDocs);
+ if (!m_part->m_projectDocumentationPlugin) // In case the plugin does not support APIDocs project documentation
+ return;
m_part->m_projectDocumentationPlugin->init(m_part->m_widget->contents(), m_part->m_widget->index(), catalogURL->url());
m_part->saveProjectDocumentationInfo();
diff --git a/parts/documentation/documentation_part.cpp b/parts/documentation/documentation_part.cpp
index c68add0e..b0d59e24 100644
--- a/parts/documentation/documentation_part.cpp
+++ b/parts/documentation/documentation_part.cpp
@@ -93,7 +93,7 @@ DocumentationPart::DocumentationPart(TQObject *parent, const char *name, const T
connect(core(), TQT_SIGNAL(projectClosed()), this, TQT_SLOT(projectClosed()));
m_widget = new DocumentationWidget(this);
- m_widget->setIcon(SmallIcon( info()->icon() ));
+ m_widget->setIcon(SmallIcon(info()->icon()));
m_widget->setCaption(i18n("Documentation"));
TQWhatsThis::add(m_widget, i18n("<b>Documentation browser</b><p>"
@@ -151,6 +151,18 @@ void DocumentationPart::loadDocumentationPlugins()
}
}
+void DocumentationPart::reloadDocumentationPlugins()
+{
+ TQValueList<DocumentationPlugin*>::iterator it;
+ for (it = m_plugins.begin(); it != m_plugins.end(); ++it)
+ {
+ DocumentationPlugin *plugin=*it;
+ plugin->clear();
+ plugin->autoSetupPlugin();
+ plugin->reinit(m_widget->contents(), m_widget->index(), TQStringList());
+ }
+}
+
void DocumentationPart::emitIndexSelected(IndexBox *indexBox)
{
if (!m_hasIndex)
@@ -322,7 +334,7 @@ void DocumentationPart::manPage()
void DocumentationPart::infoPage()
{
- TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ TQString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
if ( isAssistantUsed() )
{
@@ -573,7 +585,7 @@ void DocumentationPart::projectOpened()
it != m_plugins.constEnd(); ++it)
{
if ((*it)->hasCapability(DocumentationPlugin::ProjectDocumentation) &&
- ((*it)->pluginName() == projectDocSystem))
+ ((*it)->pluginName() == projectDocSystem))
m_projectDocumentationPlugin = (*it)->projectDocumentationPlugin(DocumentationPlugin::APIDocs);
if ((*it)->hasCapability(DocumentationPlugin::ProjectUserManual))
{
diff --git a/parts/documentation/documentation_part.h b/parts/documentation/documentation_part.h
index 722ad4bd..ef59c49a 100644
--- a/parts/documentation/documentation_part.h
+++ b/parts/documentation/documentation_part.h
@@ -84,6 +84,7 @@ signals:
protected:
void loadDocumentationPlugins();
+ void reloadDocumentationPlugins();
TDEConfig *config();
void setupActions();
void loadSettings();
diff --git a/parts/documentation/interfaces/kdevdocumentationplugin.cpp b/parts/documentation/interfaces/kdevdocumentationplugin.cpp
index 74122b1f..636731f9 100644
--- a/parts/documentation/interfaces/kdevdocumentationplugin.cpp
+++ b/parts/documentation/interfaces/kdevdocumentationplugin.cpp
@@ -61,7 +61,6 @@ DocumentationItem::DocumentationItem(DocumentationItem::Type type, TDEListViewIt
init();
}
-
void DocumentationItem::init( )
{
TQString icon;
@@ -83,11 +82,8 @@ void DocumentationItem::init( )
}
-
-
-
+//----------------------------------------------------
//class DocumentationCatalogItem
-
DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin,
TDEListView *parent, TDEListViewItem *after, const TQString &name)
@@ -107,7 +103,7 @@ DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin,
m_plugin->addCatalog(this);
}
-DocumentationCatalogItem::~ DocumentationCatalogItem( )
+DocumentationCatalogItem::~DocumentationCatalogItem()
{
m_plugin->clearCatalog(this);
}
@@ -141,8 +137,7 @@ void DocumentationCatalogItem::activate()
}
-
-
+//----------------------------------------------------
//class IndexItemProto
IndexItemProto::IndexItemProto(DocumentationPlugin *plugin, DocumentationCatalogItem *catalog,
@@ -159,6 +154,7 @@ IndexItemProto::~IndexItemProto()
}
+//----------------------------------------------------
//class IndexItem
IndexItem::IndexItem(IndexBox *listbox, const TQString &text)
@@ -177,8 +173,7 @@ IndexItem::List IndexItem::urls() const
}
-
-
+//----------------------------------------------------
//class ConfigurationItem
ConfigurationItem::ConfigurationItem(TQListView *parent, DocumentationPlugin * plugin, const TQString &title, const TQString &url,
@@ -245,12 +240,7 @@ int ConfigurationItem::width(const TQFontMetrics &fm, const TQListView *lv, int
}
-
-
-
-
-
-
+//----------------------------------------------------
//class DocumentationPlugin
DocumentationPlugin::DocumentationPlugin(TDEConfig *pluginConfig, TQObject *parent, const char *name)
@@ -274,22 +264,22 @@ void DocumentationPlugin::autoSetup()
}
}
-void DocumentationPlugin::reload()
-{
- clear();
- for (TQValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin();
- it != catalogs.end(); ++it)
- {
- createTOC(*it);
- }
-}
-
void DocumentationPlugin::clear()
{
+ // Do not clear the project documentation catalogs, since those are handled by
+ // the ProjectDocumentationPlugin class
for (TQValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin();
- it != catalogs.end(); ++it)
+ it != catalogs.end(); /*none*/)
{
- clearCatalog(*it);
+ if (!(*it)->isProjectDocumentationItem())
+ {
+ DocumentationCatalogItem *curr = *it;
+ ++it; // Need to advance before destroying the catalog, otherwise it could crash
+ //clearCatalog(curr); -- not necessary, already invoked by ~DocumentationCatalogItem()
+ delete curr; // Destroy and removes the item from the TDEListView
+ }
+ else
+ ++it;
}
}
@@ -312,9 +302,8 @@ void DocumentationPlugin::clearCatalog(DocumentationCatalogItem *item)
delete *it;
}
indexes.remove(item);
-
- //remove catalog
- catalogs.remove(item);
+ //clear the catalog
+ catalogs.remove(item); // Removes the item from the catalog list
}
void DocumentationPlugin::createIndex(IndexBox *index)
@@ -633,8 +622,7 @@ void DocumentationPlugin::setCatalogEnabled(const TQString &name, bool e)
}
-
-
+//----------------------------------------------------
//class IndexBox
IndexBox::IndexBox(TQWidget *parent, const char *name)
@@ -744,8 +732,11 @@ void ProjectDocumentationPlugin::reinit()
void ProjectDocumentationPlugin::deinit()
{
m_watch->removeFile(m_url);
- delete m_catalog;
- m_catalog = 0;
+ if (m_catalog)
+ {
+ delete m_catalog;
+ m_catalog = 0;
+ }
}
TQString ProjectDocumentationPlugin::pluginName() const
diff --git a/parts/documentation/interfaces/kdevdocumentationplugin.h b/parts/documentation/interfaces/kdevdocumentationplugin.h
index 00ba207d..ba9d1948 100644
--- a/parts/documentation/interfaces/kdevdocumentationplugin.h
+++ b/parts/documentation/interfaces/kdevdocumentationplugin.h
@@ -315,8 +315,6 @@ public:
/**Returns a title of catalog defined by an url parameter.*/
virtual TQString catalogTitle(const TQString &url) = 0;
- /**Reloads documentation catalogs and indices.*/
- virtual void reload();
/**Clears documentation catalogs and indices.*/
virtual void clear();
diff --git a/parts/documentation/plugins/chm/docchmplugin.cpp b/parts/documentation/plugins/chm/docchmplugin.cpp
index cbd89a60..cfb0f8c0 100644
--- a/parts/documentation/plugins/chm/docchmplugin.cpp
+++ b/parts/documentation/plugins/chm/docchmplugin.cpp
@@ -115,6 +115,13 @@ bool DocCHMPlugin::needRefreshIndex(DocumentationCatalogItem* // item
void DocCHMPlugin::autoSetupPlugin()
{
+ // Clear groups, to allow for re-autosetup calls
+ config->deleteGroup("Index");
+ config->deleteGroup("Index Settings");
+ config->deleteGroup("Locations");
+ config->deleteGroup("Search Settings");
+ config->deleteGroup("TOC Settings");
+ config->sync();
return;
}
@@ -194,4 +201,12 @@ void DocCHMPlugin::setCatalogURL(DocumentationCatalogItem* item)
item->setURL(chmURL);
}
+ProjectDocumentationPlugin *DocCHMPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == APIDocs)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
+
+
#include "docchmplugin.moc"
diff --git a/parts/documentation/plugins/chm/docchmplugin.h b/parts/documentation/plugins/chm/docchmplugin.h
index 4d053333..5ac7d120 100644
--- a/parts/documentation/plugins/chm/docchmplugin.h
+++ b/parts/documentation/plugins/chm/docchmplugin.h
@@ -44,6 +44,9 @@ public:
virtual TQStringList fullTextSearchLocations();
virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin* projectDocumentationPlugin(ProjectDocType type);
+
protected:
TQString getSpecialData(const TQString& name, KURL url);
};
diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
index 5bdfa618..2710fe25 100644
--- a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
+++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
@@ -161,6 +161,14 @@ bool DocDevHelpPlugin::needRefreshIndex(DocumentationCatalogItem* item)
void DocDevHelpPlugin::autoSetupPlugin()
{
+ // Clear groups, to allow for re-autosetup calls
+ config->deleteGroup("Index");
+ config->deleteGroup("Index Settings");
+ config->deleteGroup("Locations");
+ config->deleteGroup("Search Settings");
+ config->deleteGroup("TOC Settings");
+ config->sync();
+
TQValueStack<TQString> scanStack;
pushToScanStack(scanStack, getenv("DEVHELP_SEARCH_PATH"));
@@ -214,6 +222,8 @@ void DocDevHelpPlugin::autoSetupPlugin()
{
scanDevHelpDir(*it);
}
+
+ config->sync();
}
void DocDevHelpPlugin::scanDevHelpDir(const TQString &path)
diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp
index 1a6c98c5..239fc2ef 100644
--- a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp
+++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp
@@ -187,9 +187,17 @@ bool DocDoxygenPlugin::needRefreshIndex(DocumentationCatalogItem* item)
void DocDoxygenPlugin::autoSetupPlugin()
{
+ // Clear groups, to allow for re-autosetup calls
+ config->deleteGroup("Index");
+ config->deleteGroup("Index Settings");
+ config->deleteGroup("Locations");
+ config->deleteGroup("Search Settings");
+ config->deleteGroup("TOC Settings");
+ config->sync();
+
autoSetupDocs(TDELIBS_DOXYDIR, "en/tdelibs-apidocs", "The TDE API Reference");
autoSetupDocs("", "en/tdevelop-apidocs", "The TDevelop Platform API Documentation");
-
+ config->sync();
}
void DocDoxygenPlugin::autoSetupDocs(const TQString &defaultDir, const TQString &searchDir,
diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp
index 10fe853d..d0a00eb6 100644
--- a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp
+++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp
@@ -123,6 +123,14 @@ bool DocKDevTOCPlugin::needRefreshIndex(DocumentationCatalogItem* /*item*/)
void DocKDevTOCPlugin::autoSetupPlugin()
{
+ // Clear groups, to allow for re-autosetup calls
+ config->deleteGroup("Index");
+ config->deleteGroup("Index Settings");
+ config->deleteGroup("Locations");
+ config->deleteGroup("Search Settings");
+ config->deleteGroup("TOC Settings");
+ config->sync();
+
TQStringList tocsDir = DocKDevTOCPluginFactory::instance()->dirs()->findAllResources("data", "kdevdocumentation/tocs/*.toc");
for (TQStringList::const_iterator it = tocsDir.begin(); it != tocsDir.end(); ++it)
@@ -130,6 +138,7 @@ void DocKDevTOCPlugin::autoSetupPlugin()
config->setGroup("Locations");
config->writePathEntry(catalogTitle(*it), *it);
}
+ config->sync();
}
void DocKDevTOCPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item)
diff --git a/parts/documentation/plugins/qt/docqtplugin.cpp b/parts/documentation/plugins/qt/docqtplugin.cpp
index 2a7ddae8..47d0baff 100644
--- a/parts/documentation/plugins/qt/docqtplugin.cpp
+++ b/parts/documentation/plugins/qt/docqtplugin.cpp
@@ -137,6 +137,14 @@ void DocQtPlugin::createTOC(DocumentationCatalogItem *item)
void DocQtPlugin::autoSetupPlugin()
{
+ // Clear groups, to allow for re-autosetup calls
+ config->deleteGroup("Index");
+ config->deleteGroup("Index Settings");
+ config->deleteGroup("Locations");
+ config->deleteGroup("Search Settings");
+ config->deleteGroup("TOC Settings");
+ config->sync();
+
TQString qtDocDir(QT_DOCDIR);
qtDocDir = URLUtil::envExpand(qtDocDir);
if (qtDocDir.isEmpty())
@@ -144,7 +152,7 @@ void DocQtPlugin::autoSetupPlugin()
qtDocDir = getenv("QTDIR");
}
if (!qtDocDir.isEmpty())
- {
+ {
config->setGroup("Search Settings");
config->writeEntry("TQt Reference Documentation", true);
config->setGroup("Index Settings");
@@ -156,6 +164,8 @@ void DocQtPlugin::autoSetupPlugin()
config->writePathEntry("Guide to the TQt Translation Tools", qtDocDir + TQString("/linguist.dcf"));
config->writePathEntry("qmake User Guide", qtDocDir + TQString("/qmake.dcf"));
}
+
+ config->sync();
}
void DocQtPlugin::setCatalogURL(DocumentationCatalogItem *item)