summaryrefslogtreecommitdiffstats
path: root/tools/assistant
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-12-14 17:13:13 (GMT)
committerck <qt-info@nokia.com>2009-12-14 17:13:13 (GMT)
commit2e0fb5914f5dcb58681ec4d5a2709e33fda80f37 (patch)
treea9b55284878826111112fbf048e346c2fe9fd29f /tools/assistant
parent767260d1f4d7f667ca788756a98a3ce3497419b9 (diff)
downloadQt-2e0fb5914f5dcb58681ec4d5a2709e33fda80f37.zip
Qt-2e0fb5914f5dcb58681ec4d5a2709e33fda80f37.tar.gz
Qt-2e0fb5914f5dcb58681ec4d5a2709e33fda80f37.tar.bz2
Assistant: Topic chooser links correctly to Urls with identical titles.
Diffstat (limited to 'tools/assistant')
-rw-r--r--tools/assistant/tools/assistant/topicchooser.cpp16
-rw-r--r--tools/assistant/tools/assistant/topicchooser.h9
2 files changed, 13 insertions, 12 deletions
diff --git a/tools/assistant/tools/assistant/topicchooser.cpp b/tools/assistant/tools/assistant/topicchooser.cpp
index 803ea04..e860ce4 100644
--- a/tools/assistant/tools/assistant/topicchooser.cpp
+++ b/tools/assistant/tools/assistant/topicchooser.cpp
@@ -40,9 +40,6 @@
****************************************************************************/
#include "tracer.h"
-#include <QtCore/QMap>
-#include <QtCore/QUrl>
-
#include "topicchooser.h"
QT_BEGIN_NAMESPACE
@@ -55,10 +52,11 @@ TopicChooser::TopicChooser(QWidget *parent, const QString &keyword,
ui.setupUi(this);
ui.label->setText(tr("Choose a topic for <b>%1</b>:").arg(keyword));
- m_links = links;
- QMap<QString, QUrl>::const_iterator it = m_links.constBegin();
- for (; it != m_links.constEnd(); ++it)
+ QMap<QString, QUrl>::const_iterator it = links.constBegin();
+ for (; it != links.constEnd(); ++it) {
ui.listWidget->addItem(it.key());
+ m_links.append(it.value());
+ }
if (ui.listWidget->count() != 0)
ui.listWidget->setCurrentRow(0);
@@ -80,10 +78,12 @@ QUrl TopicChooser::link() const
return QUrl();
QString title = item->text();
- if (title.isEmpty() || !m_links.contains(title))
+ if (title.isEmpty())
return QUrl();
- return m_links.value(title);
+ const int row = ui.listWidget->row(item);
+ Q_ASSERT(row < m_links.count());
+ return m_links.at(row);
}
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/topicchooser.h b/tools/assistant/tools/assistant/topicchooser.h
index 949c7da..d3ca96e 100644
--- a/tools/assistant/tools/assistant/topicchooser.h
+++ b/tools/assistant/tools/assistant/topicchooser.h
@@ -44,9 +44,10 @@
#include "ui_topicchooser.h"
-#include <QUrl>
-#include <QMap>
-#include <QString>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QUrl>
#include <QtGui/QDialog>
@@ -64,7 +65,7 @@ public:
private:
Ui::TopicChooser ui;
- QMap<QString, QUrl> m_links;
+ QList<QUrl> m_links;
};
QT_END_NAMESPACE