Commit 8cfdd749 authored by Matthias Möller's avatar Matthias Möller

fix: does not unregister help files if unnecessary

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15774 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2bdde5ff
......@@ -76,7 +76,6 @@ HelpWidget::HelpWidget(QWidget* parent, const QString& _homeSite /*=""*/, const
filename += "Help.qhc";
QDir helpDir = QDir(OpenFlipper::Options::helpDirStr());
QStringList helpFiles = helpDir.entryList(QStringList("*.qch"),QDir::Files);
QString iconPath = QString(OpenFlipper::Options::iconDirStr())+QString(OpenFlipper::Options::dirSeparator());
......@@ -99,24 +98,32 @@ HelpWidget::HelpWidget(QWidget* parent, const QString& _homeSite /*=""*/, const
QStringList documentationFiles;
// Get a list of all loaded documentation files from the namespaces
for ( int i = 0; i < registeredNamespaces.size() ; ++i)
documentationFiles.push_back( helpEngine_->documentationFileName(registeredNamespaces[i]) );
// Get a list of all loaded documentation files from the namespaces
QStringList helpFiles = helpDir.entryList(QStringList("*.qch"),QDir::Files);
// Write absolute path into filenames
for (QStringList::iterator iter = helpFiles.begin(); iter != helpFiles.end(); ++iter)
*iter = helpDir.path()+ OpenFlipper::Options::dirSeparator() + *iter;
for ( int i = 0; i < registeredNamespaces.size() ; ++i)
{
QString registredFilename (helpEngine_->documentationFileName(registeredNamespaces[i]));
QStringList::iterator iter = std::find(helpFiles.begin(),helpFiles.end(),registredFilename);
// re-register documentation if location changed
if (iter != helpFiles.end())
documentationFiles.push_back( registredFilename );
else
helpEngine_->unregisterDocumentation(registeredNamespaces[i]);
}
for ( int i = 0 ; i < helpFiles.size() ; ++i ) {
const QString filename = helpDir.path()+ "/" + helpFiles[i];
const QString filename = helpFiles[i];
// Don't register files twice (stored between multiple OpenFlipper executions)
if (documentationFiles.contains(filename))
continue;
// re-register documentation if location changed
int index = registeredNamespaces.indexOf(helpEngine_->namespaceName(filename));
if (index != -1)
helpEngine_->unregisterDocumentation(registeredNamespaces[i]);
// Try to register the file
if ( !helpEngine_->registerDocumentation( filename ) ) {
std::cerr << "Error when trying to register file " << filename.toStdString() << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment