diff options
Diffstat (limited to 'parts/documentation/docglobalconfigwidget.cpp')
-rw-r--r-- | parts/documentation/docglobalconfigwidget.cpp | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/parts/documentation/docglobalconfigwidget.cpp b/parts/documentation/docglobalconfigwidget.cpp index b27cb5f9..8dd6c0b8 100644 --- a/parts/documentation/docglobalconfigwidget.cpp +++ b/parts/documentation/docglobalconfigwidget.cpp @@ -37,6 +37,8 @@ #include <tdefontcombo.h> #include <tdehtml_part.h> #include <tdehtml_settings.h> +#include <tdelocale.h> +#include <tdemessagebox.h> #include "kdevdocumentationplugin.h" #include "kdevpartcontroller.h" @@ -168,13 +170,13 @@ TDEListView *DocGlobalConfigWidget::activeView() void DocGlobalConfigWidget::accept() { //write catalog settings - for (TQValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin(); - it != m_part->m_plugins.constEnd(); ++it) - { - (*it)->saveCatalogConfiguration( m_View ); - //@todo: take restrictions into account - (*it)->reinit(m_widget->contents(), m_widget->index(), TQStringList()); - } + for (TQValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin(); + it != m_part->m_plugins.constEnd(); ++it) + { + (*it)->saveCatalogConfiguration( m_View ); + //@todo: take restrictions into account + (*it)->reinit(m_widget->contents(), m_widget->index(), TQStringList()); + } TDEConfig *config = m_part->config(); //write full text search settings @@ -259,4 +261,47 @@ void DocGlobalConfigWidget::updateConfigForHTMLParts() } } +void DocGlobalConfigWidget::rescanCollectionButtonClicked() +{ + if (KMessageBox::questionYesNo(this, + i18n("This will restore the default settings " + "for the following documentation plugins: " + "chm, devhelp, doxygen, kdevtoc, qt.\n" + "Any change made to documentation catalogs " + "belonging to those plugins will be lost. " + "Changes made to documentation catalogs " + "belonging to the custom plugin will be preserved.\n" + "Do you wish to continue?"), + i18n("Rescan documentation")) == KMessageBox::Yes) + { + reloadDocumentationPlugins(); + } +} + +void DocGlobalConfigWidget::reloadDocumentationPlugins() +{ + // Clear current list + TQListViewItem *first = m_View->firstChild(); + while (first) + { + m_View->takeItem(first); + delete first; + first = m_View->firstChild(); + } + // Rescan configuration + TQValueList<DocumentationPlugin*>::iterator it; + for (it = m_part->m_plugins.begin(); it != m_part->m_plugins.end(); ++it) + { + DocumentationPlugin *plugin=*it; + plugin->clear(); + plugin->autoSetupPlugin(); + plugin->reinit(m_part->m_widget->contents(), m_part->m_widget->index(), TQStringList()); + } + // Recreate list + for (TQValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin(); + it != m_part->m_plugins.constEnd(); ++it) + { + (*it)->loadCatalogConfiguration(m_View); + } +} #include "docglobalconfigwidget.moc" |