diff options
-rw-r--r-- | doc/src/development/assistant-manual.qdoc | 11 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/contentwindow.cpp | 6 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/mainwindow.cpp | 1 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/remotecontrol.cpp | 13 |
4 files changed, 22 insertions, 9 deletions
diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index 3ecadc7..9b52df4 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -722,13 +722,20 @@ \o Selects the item in the contents widget which corresponds to the currently displayed page. \row - \o \c{setCurrentFilter} + \o \c{setCurrentFilter <filter>} \o Selects the specified filter and updates the visual representation accordingly. \row \o \c{expandToc <Depth>} \o Expands the table of contents tree to the given depth. If depth - is less than 1, the tree will be collapsed completely. + is 0, the tree will be collapsed completely. If depth is -1, + the tree will be expanded completely. + \row + \o \c{register <help file>} + \o Adds the given Qt compressed help file to the collection. + \row + \o \c{unregister <help file>} + \o Removes the given Qt compressed help file from the collection. \endtable If you want to send several commands within a short period of time, it is diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index 3ae7702..1e3953a 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -89,6 +89,7 @@ bool ContentWindow::syncToContent(const QUrl& url) void ContentWindow::expandTOC() { + Q_ASSERT(m_expandDepth >= -2); if (m_expandDepth > -2) { expandToDepth(m_expandDepth); m_expandDepth = -2; @@ -97,11 +98,14 @@ void ContentWindow::expandTOC() void ContentWindow::expandToDepth(int depth) { + Q_ASSERT(depth >= -2); m_expandDepth = depth; if (depth == -1) m_contentWidget->expandAll(); + else if (depth == 0) + m_contentWidget->collapseAll(); else - m_contentWidget->expandToDepth(depth); + m_contentWidget->expandToDepth(depth - 1); } void ContentWindow::focusInEvent(QFocusEvent *e) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 08feb4e..4f99714 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -1007,6 +1007,7 @@ void MainWindow::filterDocumentation(const QString &customFilter) void MainWindow::expandTOC(int depth) { + Q_ASSERT(depth >= -1); m_contentWindow->expandToDepth(depth); } diff --git a/tools/assistant/tools/assistant/remotecontrol.cpp b/tools/assistant/tools/assistant/remotecontrol.cpp index 55780e1..0ccf743 100644 --- a/tools/assistant/tools/assistant/remotecontrol.cpp +++ b/tools/assistant/tools/assistant/remotecontrol.cpp @@ -112,7 +112,7 @@ RemoteControl::RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine) , m_debug(false) , m_caching(true) , m_syncContents(false) - , m_expandTOC(-3) + , m_expandTOC(-2) { connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache())); @@ -265,15 +265,15 @@ void RemoteControl::handleActivateIdentifierCommand(const QString &arg) void RemoteControl::handleExpandTocCommand(const QString &arg) { bool ok = false; - int depth = -1; + int depth = -2; if (!arg.isEmpty()) depth = arg.toInt(&ok); - if (!ok) - depth = -1; + if (!ok || depth < -2) + depth = -2; if (m_caching) m_expandTOC = depth; - else + else if (depth != -2) m_mainWindow->expandTOC(depth); } @@ -330,7 +330,8 @@ void RemoteControl::applyCache() if (m_syncContents) m_mainWindow->syncContents(); - if (m_expandTOC != -3) + Q_ASSERT(m_expandTOC >= -2); + if (m_expandTOC != -2) m_mainWindow->expandTOC(m_expandTOC); m_caching = false; |