diff options
-rw-r--r-- | tools/assistant/tools/assistant/mainwindow.cpp | 21 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/mainwindow.h | 1 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/remotecontrol.cpp | 2 |
3 files changed, 14 insertions, 10 deletions
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index de3f695..c56e7e4 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -227,16 +227,8 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) if (!m_cmdLine->currentFilter().isEmpty()) { const QString &curFilter = m_cmdLine->currentFilter(); - m_helpEngine->setCurrentFilter(curFilter); - if (m_filterCombo) { - int idx = m_filterCombo->findText(curFilter); - if (idx >= 0) { - bool blocked = m_filterCombo->signalsBlocked(); - m_filterCombo->blockSignals(true); - m_filterCombo->setCurrentIndex(idx); - m_filterCombo->blockSignals(blocked); - } - } + if (m_helpEngine->customFilters().contains(curFilter)) + m_helpEngine->setCurrentFilter(curFilter); } if (usesDefaultCollection()) @@ -664,6 +656,8 @@ void MainWindow::setupFilterToolbar() SLOT(setupFilterCombo())); connect(m_filterCombo, SIGNAL(activated(QString)), this, SLOT(filterDocumentation(QString))); + connect(m_helpEngine, SIGNAL(currentFilterChanged(QString)), this, + SLOT(currentFilterChanged(QString))); setupFilterCombo(); } @@ -1041,4 +1035,11 @@ QString MainWindow::defaultHelpCollectionFileName() arg(QLatin1String(QT_VERSION_STR)); } +void MainWindow::currentFilterChanged(const QString &filter) +{ + const int index = m_filterCombo->findText(filter); + Q_ASSERT(index != -1); + m_filterCombo->setCurrentIndex(index); +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 6b858e9..7559fe4 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -95,6 +95,7 @@ public slots: void showSearchWidget(); void syncContents(); void activateCurrentCentralWidgetTab(); + void currentFilterChanged(const QString &filter); private slots: void insertLastPages(); diff --git a/tools/assistant/tools/assistant/remotecontrol.cpp b/tools/assistant/tools/assistant/remotecontrol.cpp index be1c197..474a681 100644 --- a/tools/assistant/tools/assistant/remotecontrol.cpp +++ b/tools/assistant/tools/assistant/remotecontrol.cpp @@ -237,6 +237,8 @@ void RemoteControl::handleCommandString(const QString &cmdString) else m_mainWindow->expandTOC(depth); } else if (cmd == QLatin1String("setcurrentfilter")) { + if (!m_helpEngine->customFilters().contains(arg)) + return; if (m_caching) { clearCache(); m_currentFilter = arg; |