summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2014-10-31 12:01:24 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-10-31 12:01:24 +0900
commitb9688b905acbb256fb56b18f8006e5bcbb8117f4 (patch)
treeb536b329e3075ce4fa8511d3774fd1acff9b6ff6
parentd676f93b5f3a7481fc0588f087bef418879e6f78 (diff)
downloadtdevelop-b9688b905acbb256fb56b18f8006e5bcbb8117f4.tar.gz
tdevelop-b9688b905acbb256fb56b18f8006e5bcbb8117f4.zip
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>
-rw-r--r--parts/documentation/docglobalconfigwidget.cpp59
-rw-r--r--parts/documentation/docglobalconfigwidget.h8
-rw-r--r--parts/documentation/docglobalconfigwidgetbase.ui16
-rw-r--r--parts/documentation/documentation_part.cpp42
-rw-r--r--parts/documentation/documentation_part.h2
5 files changed, 104 insertions, 23 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"
diff --git a/parts/documentation/docglobalconfigwidget.h b/parts/documentation/docglobalconfigwidget.h
index c2d08a37..8fee856c 100644
--- a/parts/documentation/docglobalconfigwidget.h
+++ b/parts/documentation/docglobalconfigwidget.h
@@ -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,7 +54,8 @@ protected:
/*$PROTECTED_FUNCTIONS$*/
TDEListView *activeView();
void updateConfigForHTMLParts();
-
+ void reloadDocumentationPlugins();
+
protected slots:
/*$PROTECTED_SLOTS$*/
diff --git a/parts/documentation/docglobalconfigwidgetbase.ui b/parts/documentation/docglobalconfigwidgetbase.ui
index 9c2678be..4de6dc2f 100644
--- a/parts/documentation/docglobalconfigwidgetbase.ui
+++ b/parts/documentation/docglobalconfigwidgetbase.ui
@@ -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>
diff --git a/parts/documentation/documentation_part.cpp b/parts/documentation/documentation_part.cpp
index b0d59e24..3b9e9b78 100644
--- a/parts/documentation/documentation_part.cpp
+++ b/parts/documentation/documentation_part.cpp
@@ -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"
diff --git a/parts/documentation/documentation_part.h b/parts/documentation/documentation_part.h
index ef59c49a..02564a3f 100644
--- a/parts/documentation/documentation_part.h
+++ b/parts/documentation/documentation_part.h
@@ -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);