summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqt-info@nokia.com <qt-info@nokia.com>2009-11-09 10:43:34 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-11-11 17:21:21 (GMT)
commit0ad7366f9349846dbb18b97c5da54f4b767cc249 (patch)
tree4081a88002dc3c8ab64572c1f66c70f5e76f0524
parentdb566a8389fbc3adee5b62fc737b2b67bbaa9611 (diff)
downloadQt-0ad7366f9349846dbb18b97c5da54f4b767cc249.zip
Qt-0ad7366f9349846dbb18b97c5da54f4b767cc249.tar.gz
Qt-0ad7366f9349846dbb18b97c5da54f4b767cc249.tar.bz2
Assistant: Fix bugs related to setting the current filter remotely.
1. Filter combo box now gets updated on remote setCurrentFilter. 2. Argument to remote setCurrentFilter now gets checked. If there is no such filter, we reject it.
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp21
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h1
-rw-r--r--tools/assistant/tools/assistant/remotecontrol.cpp2
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;