summaryrefslogtreecommitdiffstats
path: root/src/assistant/help/qhelpenginecore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/assistant/help/qhelpenginecore.cpp')
-rw-r--r--src/assistant/help/qhelpenginecore.cpp110
1 files changed, 73 insertions, 37 deletions
diff --git a/src/assistant/help/qhelpenginecore.cpp b/src/assistant/help/qhelpenginecore.cpp
index c9fbde232..6f1a7a840 100644
--- a/src/assistant/help/qhelpenginecore.cpp
+++ b/src/assistant/help/qhelpenginecore.cpp
@@ -48,6 +48,7 @@
#include <QtCore/QPluginLoader>
#include <QtCore/QFileInfo>
#include <QtCore/QThread>
+#include <QtHelp/QHelpLink>
#include <QtWidgets/QApplication>
#include <QtSql/QSqlQuery>
@@ -110,12 +111,9 @@ void QHelpEngineCorePrivate::errorReceived(const QString &msg)
undefined meaning unusable state.
The core help engine can be used to perform different tasks.
- By calling linksForIdentifier() the engine returns
+ By calling documentsForIdentifier() the engine returns
URLs specifying the file locations inside the help system. The
- actual file data can then be retrived by calling fileData(). In
- contrast to all other functions in this class, linksForIdentifier()
- depends on the currently set custom filter. Depending on the filter,
- the function may return different results.
+ actual file data can then be retrived by calling fileData().
The help engine can contain any number of custom filters.
The management of the filters, including adding new filters,
@@ -612,7 +610,12 @@ QByteArray QHelpEngineCore::fileData(const QUrl &url) const
return d->collectionHandler->fileData(url);
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
+ \obsolete
+
+ Use documentsForIdentifier() instead.
+
Returns a map of the documents found for the \a id. The map contains the
document titles and their URLs. The returned map contents depend on
the current filter, and therefore only the identifiers registered for
@@ -620,33 +623,53 @@ QByteArray QHelpEngineCore::fileData(const QUrl &url) const
*/
QMap<QString, QUrl> QHelpEngineCore::linksForIdentifier(const QString &id) const
{
- return linksForIdentifier(id, d->usesFilterEngine
- ? d->filterEngine->activeFilter()
- : d->currentFilter);
+ if (!d->setup())
+ return QMap<QString, QUrl>();
+
+ if (d->usesFilterEngine)
+ return d->collectionHandler->linksForIdentifier(id, d->filterEngine->activeFilter());
+
+ // obsolete
+ return d->collectionHandler->linksForIdentifier(id, filterAttributes(d->currentFilter));
}
+#endif
/*!
\since 5.15
- Returns a map of the documents found for the \a id, filtered by \a filterName.
- The map contains the document titles and their URLs. The returned map contents depend on
- the passed filter, and therefore only the identifiers registered for
- this filter will be returned. If you want to get all results unfiltered,
- pass empty string as \a filterName.
+ Returns a list of all the document links found for the \a id.
+ The returned list contents depend on the current filter, and therefore only the keywords
+ registered for the current filter will be returned.
*/
-QMap<QString, QUrl> QHelpEngineCore::linksForIdentifier(const QString &id, const QString &filterName) const
+QList<QHelpLink> QHelpEngineCore::documentsForIdentifier(const QString &id) const
{
- if (!d->setup())
- return QMap<QString, QUrl>();
+ return documentsForIdentifier(id, d->usesFilterEngine
+ ? d->filterEngine->activeFilter()
+ : d->currentFilter);
+}
- if (d->usesFilterEngine)
- return d->collectionHandler->linksForIdentifier(id, filterName);
+/*!
+ \since 5.15
- // obsolete
- return d->collectionHandler->linksForIdentifier(id, filterAttributes(filterName));
+ Returns a list of the document links found for the \a id, filtered by \a filterName.
+ The returned list contents depend on the passed filter, and therefore only the keywords
+ registered for this filter will be returned. If you want to get all results unfiltered,
+ pass empty string as \a filterName.
+*/
+QList<QHelpLink> QHelpEngineCore::documentsForIdentifier(const QString &id, const QString &filterName) const
+{
+ if (!d->setup() || !d->usesFilterEngine)
+ return QList<QHelpLink>();
+
+ return d->collectionHandler->documentsForIdentifier(id, filterName);
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
+ \obsolete
+
+ Use documentsForKeyword() instead.
+
Returns a map of all the documents found for the \a keyword. The map
contains the document titles and URLs. The returned map contents depend
on the current filter, and therefore only the keywords registered for
@@ -654,33 +677,46 @@ QMap<QString, QUrl> QHelpEngineCore::linksForIdentifier(const QString &id, const
*/
QMap<QString, QUrl> QHelpEngineCore::linksForKeyword(const QString &keyword) const
{
- return linksForKeyword(keyword, d->usesFilterEngine
- ? d->filterEngine->activeFilter()
- : d->currentFilter);
+ if (!d->setup())
+ return QMap<QString, QUrl>();
+
+ if (d->usesFilterEngine)
+ return d->collectionHandler->linksForKeyword(keyword, d->filterEngine->activeFilter());
+
+ // obsolete
+ return d->collectionHandler->linksForKeyword(keyword, filterAttributes(d->currentFilter));
}
+#endif
/*!
\since 5.15
- Returns a map of the documents found for the \a keyword, filtered by \a filterName.
- The map contains the document titles and their URLs. The returned map contents depend on
- the passed filter, and therefore only the keywords registered for
- this filter will be returned. If you want to get all results unfiltered,
- pass empty string as \a filterName.
-
+ Returns a list of all the document links found for the \a keyword.
+ The returned list contents depend on the current filter, and therefore only the keywords
+ registered for the current filter will be returned.
*/
-QMap<QString, QUrl> QHelpEngineCore::linksForKeyword(const QString &keyword, const QString &filterName) const
+QList<QHelpLink> QHelpEngineCore::documentsForKeyword(const QString &keyword) const
{
- if (!d->setup())
- return QMap<QString, QUrl>();
+ return documentsForKeyword(keyword, d->usesFilterEngine
+ ? d->filterEngine->activeFilter()
+ : d->currentFilter);
+}
- if (d->usesFilterEngine)
- return d->collectionHandler->linksForKeyword(keyword, filterName);
+/*!
+ \since 5.15
- // obsolete
- return d->collectionHandler->linksForKeyword(keyword, filterAttributes(filterName));
-}
+ Returns a list of the document links found for the \a keyword, filtered by \a filterName.
+ The returned list contents depend on the passed filter, and therefore only the keywords
+ registered for this filter will be returned. If you want to get all results unfiltered,
+ pass empty string as \a filterName.
+*/
+QList<QHelpLink> QHelpEngineCore::documentsForKeyword(const QString &keyword, const QString &filterName) const
+{
+ if (!d->setup() || !d->usesFilterEngine)
+ return QList<QHelpLink>();
+ return d->collectionHandler->documentsForKeyword(keyword, filterName);
+}
/*!
Removes the \a key from the settings section in the