Added GUI for allowing the user to manually update the Documentation Plugin lists.

Added check + information message to inform the user that he/she should update the Documentation Plugin lists when TDevelop is being run for the first time under a new TDE version.
This relates to bug 1859.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 10 years ago
parent d676f93b5f
commit b9688b905a

@ -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"
@ -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"

@ -43,9 +43,10 @@ public slots:
/*$PUBLIC_SLOTS$*/
virtual void collectionsBoxCurrentChanged(int box);
virtual void removeCollectionButtonClicked();
virtual void editCollectionButtonClicked();
virtual void addCollectionButtonClicked();
virtual void editCollectionButtonClicked();
virtual void removeCollectionButtonClicked();
virtual void rescanCollectionButtonClicked();
virtual void accept();
@ -53,6 +54,7 @@ protected:
/*$PROTECTED_FUNCTIONS$*/
TDEListView *activeView();
void updateConfigForHTMLParts();
void reloadDocumentationPlugins();
protected slots:
/*$PROTECTED_SLOTS$*/

@ -90,6 +90,14 @@
<string>&amp;Remove</string>
</property>
</widget>
<widget class="TQPushButton">
<property name="name">
<cstring>rescanCollectionButton</cstring>
</property>
<property name="text">
<string>&amp;Rescan</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
@ -525,12 +533,19 @@
<receiver>DocGlobalConfigWidgetBase</receiver>
<slot>removeCollectionButtonClicked()</slot>
</connection>
<connection>
<sender>rescanCollectionButton</sender>
<signal>clicked()</signal>
<receiver>DocGlobalConfigWidgetBase</receiver>
<slot>rescanCollectionButtonClicked()</slot>
</connection>
</connections>
<tabstops>
<tabstop>docTab</tabstop>
<tabstop>addCollectionButton</tabstop>
<tabstop>editCollectionButton</tabstop>
<tabstop>removeCollectionButton</tabstop>
<tabstop>rescanCollectionButton</tabstop>
<tabstop>databaseDirEdit</tabstop>
<tabstop>htdigbinEdit</tabstop>
<tabstop>htmergebinEdit</tabstop>
@ -546,6 +561,7 @@
<slot>addCollectionButtonClicked()</slot>
<slot>editCollectionButtonClicked()</slot>
<slot>removeCollectionButtonClicked()</slot>
<slot>rescanCollectionButtonClicked()</slot>
<slot>collectionsBoxCurrentChanged( int )</slot>
<slot>updateConfig()</slot>
<slot>updateIndex()</slot>

@ -33,6 +33,7 @@
#include <dcopclient.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <tdemessagebox.h>
#include <ktrader.h>
#include <kdebug.h>
#include <tdeparts/componentfactory.h>
@ -106,6 +107,7 @@ DocumentationPart::DocumentationPart(TQObject *parent, const char *name, const T
i18n("Documentation browser"));
setupActions();
checkLastVersion();
TQTimer::singleShot(5, this, TQT_SLOT(init()));
@ -151,18 +153,6 @@ 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)
@ -774,4 +764,32 @@ void DocumentationPart::init( )
loadSettings();
}
void DocumentationPart::checkLastVersion()
{
// Check whether TDevelop is run for the first time under
// a new TDE version. If so displays a message to invite
// the user to update the documentation plugin lists
TDEConfig *config = DocumentationFactory::instance()->config();
TQString group = config->group();
config->setGroup("General");
TQString lastVersion = config->readEntry("Last version");
if (lastVersion != TDE_VERSION_STRING)
{
config->writeEntry("Last version", TDE_VERSION_STRING);
config->sync();
KMessageBox::information(m_widget,
i18n("It seems TDevelop is being run for the first time "
"under TDE version " TDE_VERSION_STRING ".\n"
"Some documentation catalogs may have changed "
"since the previous version, so we suggest "
"that you use the Rescan button in "
"Settings --> Configure TDevelop --> Documentation "
"to update the list of the available items.\n"
"This operation has not been automated to allow you "
"to preserve local changes that you may have made before."),
i18n("Rescan documentation"));
}
config->setGroup(group);
}
#include "documentation_part.moc"

@ -84,11 +84,11 @@ signals:
protected:
void loadDocumentationPlugins();
void reloadDocumentationPlugins();
TDEConfig *config();
void setupActions();
void loadSettings();
void saveProjectDocumentationInfo();
void checkLastVersion();
TQCString startAssistant();
void activateAssistantWindow(const TQCString &ref);

Loading…
Cancel
Save