Help: Make it possible to create multiple index views

This unfortunately means doing the filtering by hand,
because filtering on the QHelpIndexModel would be shared
between multiple views.

Change-Id: Iae38952a92dbb1b4a9685aea6f057d96f0d0784f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2014-09-29 17:35:04 +02:00
parent a10f207756
commit 9cc88836f7
5 changed files with 299 additions and 77 deletions

View File

@@ -31,6 +31,7 @@
#include "helpviewer.h"
#include "localhelpmanager.h"
#include "openpagesmanager.h"
#include "topicchooser.h"
#include <utils/qtcassert.h>
@@ -76,10 +77,18 @@ CentralWidget *CentralWidget::instance()
return gStaticCentralWidget;
}
void CentralWidget::open(const QUrl &url, bool newPage)
{
if (newPage)
OpenPagesManager::instance().createPage(url);
else
setSource(url);
}
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
const QString &keyword)
const QString &keyword, bool newPage)
{
TopicChooser tc(this, keyword, links);
if (tc.exec() == QDialog::Accepted)
setSource(tc.link());
open(tc.link(), newPage);
}

View File

@@ -50,8 +50,11 @@ public:
static CentralWidget *instance();
void open(const QUrl &url, bool newPage = false);
public slots:
void showTopicChooser(const QMap<QString, QUrl> &links, const QString &key);
void showTopicChooser(const QMap<QString, QUrl> &links, const QString &key,
bool newPage = false);
};

View File

@@ -299,10 +299,10 @@ void HelpPlugin::setupUi()
indexWindow->setWindowTitle(tr(SB_INDEX));
m_indexItem = new SideBarItem(indexWindow, QLatin1String(SB_INDEX));
connect(indexWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget,
SLOT(setSource(QUrl)));
connect(indexWindow, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)),
m_centralWidget, SLOT(showTopicChooser(QMap<QString,QUrl>,QString)));
connect(indexWindow, &IndexWindow::linkActivated,
m_centralWidget, &CentralWidget::open);
connect(indexWindow, &IndexWindow::linksActivated,
m_centralWidget, &CentralWidget::showTopicChooser);
QMap<QString, Command*> shortcutMap;
QAction *action = new QAction(tr("Activate Index in Help mode"), m_splitter);