Commit 3b707461 authored by con's avatar con

Add a configure item to the external tools menu.

parent 1d3adef2
......@@ -253,6 +253,7 @@ const char * const SETTINGS_CATEGORY_CORE = "A.Core";
const char * const SETTINGS_CATEGORY_CORE_ICON = ":/core/images/category_core.png";
const char * const SETTINGS_TR_CATEGORY_CORE = QT_TRANSLATE_NOOP("Core", "Environment");
const char * const SETTINGS_ID_ENVIRONMENT = "A.General";
const char * const SETTINGS_ID_TOOLS = "G.ExternalTools";
const char * const SETTINGS_DEFAULTTEXTENCODING = "General/DefaultFileEncoding";
......
......@@ -47,7 +47,6 @@
#include <QtCore/QFile>
#include <QtCore/QDateTime>
#include <QtGui/QMenu>
#include <QtGui/QMenuItem>
#include <QtGui/QAction>
#include <QtDebug>
......@@ -677,6 +676,11 @@ ExternalToolManager::~ExternalToolManager()
void ExternalToolManager::initialize()
{
m_configureSeparator = new QAction(this);
m_configureSeparator->setSeparator(true);
m_configureAction = new QAction(tr("Configure..."), this);
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences()));
// add the external tools menu
ActionManager *am = m_core->actionManager();
ActionContainer *mexternaltools = am->createMenu(Id(Constants::M_TOOLS_EXTERNAL));
......@@ -844,6 +848,10 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
qDeleteAll(m_containers);
// remember the new containers
m_containers = newContainers;
// (re)add the configure menu item
mexternaltools->menu()->addAction(m_configureSeparator);
mexternaltools->menu()->addAction(m_configureAction);
}
void ExternalToolManager::readSettings(const QMap<QString, ExternalTool *> &tools,
......@@ -901,3 +909,9 @@ void ExternalToolManager::writeSettings()
settings->endGroup();
}
void ExternalToolManager::openPreferences()
{
ICore::instance()->showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE),
QLatin1String(Core::Constants::SETTINGS_ID_TOOLS));
}
......@@ -43,6 +43,7 @@
#include <QtCore/QProcess>
#include <QtCore/QSharedPointer>
#include <QtCore/QTextCodec>
#include <QtGui/QMenu>
namespace Core {
namespace Internal {
......@@ -176,6 +177,7 @@ signals:
private slots:
void menuActivated();
void openPreferences();
private:
void initialize();
......@@ -193,6 +195,8 @@ private:
QMap<QString, QList<Internal::ExternalTool *> > m_categoryMap;
QMap<QString, QAction *> m_actions;
QMap<QString, ActionContainer *> m_containers;
QAction *m_configureSeparator;
QAction *m_configureAction;
// for sending the replaceSelectionRequested signal
friend class Core::Internal::ExternalToolRunner;
......
......@@ -49,7 +49,7 @@ ToolSettings::ToolSettings(QObject *parent) :
QString ToolSettings::id() const
{
return QLatin1String("G.ExternalTools");
return QLatin1String(Core::Constants::SETTINGS_ID_TOOLS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment