Make it possible to return editor mode if the last help page was closed.

This commit is contained in:
kh1
2010-09-21 17:00:41 +02:00
parent 718433d27e
commit 55fe83c291
5 changed files with 60 additions and 5 deletions

View File

@@ -45,6 +45,10 @@
#include <QtHelp/QHelpEngine>
#include <coreplugin/coreconstants.h>
#include <coreplugin/helpmanager.h>
#include <coreplugin/modemanager.h>
using namespace Help::Internal;
OpenPagesManager *OpenPagesManager::m_instance = 0;
@@ -226,11 +230,22 @@ void OpenPagesManager::closeCurrentPage()
{
if (!m_openPagesWidget)
return;
QModelIndexList indexes = m_openPagesWidget->selectionModel()->selectedRows();
if (indexes.isEmpty())
return;
Q_ASSERT(indexes.count() == 1);
removePage(indexes.first().row());
Core::HelpManager *manager = Core::HelpManager::instance();
const bool closeOnReturn = manager->customValue(QLatin1String("ReturnOnClose"),
false).toBool();
if (m_model->rowCount() == 1 && closeOnReturn) {
Core::ModeManager *modeManager = Core::ModeManager::instance();
modeManager->activateMode(Core::Constants::MODE_EDIT);
} else {
Q_ASSERT(indexes.count() == 1);
removePage(indexes.first().row());
}
}
void OpenPagesManager::closePage(const QModelIndex &index)