summaryrefslogtreecommitdiffstats
path: root/parts/documentation/interfaces
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2014-10-30 14:50:07 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-10-30 14:50:07 +0900
commitd676f93b5f3a7481fc0588f087bef418879e6f78 (patch)
tree8bcbe99d2f62e6216afa3bd9b56c99a2eb163d07 /parts/documentation/interfaces
parent565f0ae626aeff1ec26ce379abe2c3838b54cdf6 (diff)
downloadtdevelop-d676f93b5f3a7481fc0588f087bef418879e6f78.tar.gz
tdevelop-d676f93b5f3a7481fc0588f087bef418879e6f78.zip
Added backend logic for allowing the user to manually update the Documentation Plugin lists. GUI part still to be done.
In the process, fixed some bugs related to deallocation and reinitialization of documentation catalogs and project catalogs. This relates to bug 1859. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'parts/documentation/interfaces')
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.cpp61
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.h2
2 files changed, 26 insertions, 37 deletions
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();