From cbe7d1ed9eedb083cebfc8b9f17451d6c6d4717f Mon Sep 17 00:00:00 2001
From: ck <qt-info@nokia.com>
Date: Thu, 17 Dec 2009 13:49:32 +0100
Subject: [PATCH] Maemo: Add link from projects page to options page.

This makes finding the device configuration dialog much easier
for newbies (and saves clicks for everybody).

Reviewed-by: kh1
---
 .../qt4projectmanager/qt-maemo/maemomanager.h |  2 ++
 .../qt-maemo/maemorunconfiguration.cpp        | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
index 445cd636480..b57d2d9c9bb 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
@@ -74,6 +74,8 @@ public:
 
     void setQemuSimulatorStarterEnabled(bool state);
 
+    MaemoSettingsPage *settingsPage() const { return m_settingsPage; }
+
 public slots:
     void triggered();
     void updateQemuSimulatorStarter(bool running);
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
index 738c3c0bc57..60827b7d24e 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
@@ -31,6 +31,7 @@
 
 #include "maemodeviceconfigurations.h"
 #include "maemomanager.h"
+#include "maemosettingspage.h"
 #include "maemotoolchain.h"
 #include "profilereader.h"
 #include "qt4project.h"
@@ -81,6 +82,7 @@ private slots:
     void argumentsEdited(const QString &args);
     void deviceConfigurationChanged(const QString &name);
     void resetDeviceConfigurations();
+    void showSettingsDialog();
 
     void updateSimulatorPath();
     void updateTargetInformation();
@@ -752,9 +754,15 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
     mainLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     m_configNameLineEdit = new QLineEdit(m_runConfiguration->name());
     mainLayout->addRow(tr("Run configuration name:"), m_configNameLineEdit);
+    QWidget *devConfWidget = new QWidget;
+    QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
     m_devConfBox = new QComboBox;
     m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-    mainLayout->addRow(new QLabel(tr("Device Configuration:")), m_devConfBox);
+    devConfLayout->addWidget(m_devConfBox);
+    QLabel *addDevConfLabel
+        = new QLabel(tr("<a href=\"#\">Manage device configurations</a>"));
+    devConfLayout->addWidget(addDevConfLabel);
+    mainLayout->addRow(new QLabel(tr("Device Configuration:")), devConfWidget);
     m_executableLabel = new QLabel(m_runConfiguration->executable());
     mainLayout->addRow(tr("Executable:"), m_executableLabel);
     m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
@@ -780,6 +788,8 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
             SLOT(deviceConfigurationChanged(QString)));
     connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
         SLOT(updateTargetInformation()));
+    connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
+        SLOT(showSettingsDialog()));
 }
 
 void MaemoRunConfigurationWidget::configNameEdited(const QString &text)
@@ -833,6 +843,13 @@ void MaemoRunConfigurationWidget::resetDeviceConfigurations()
     setSimInfoVisible(devConf);
 }
 
+void MaemoRunConfigurationWidget::showSettingsDialog()
+{
+    MaemoSettingsPage *settingsPage = MaemoManager::instance()->settingsPage();
+    Core::ICore::instance()->showOptionsDialog(settingsPage->category(),
+                                               settingsPage->id());
+}
+
 // #pragma mark -- MaemoRunConfigurationFactory
 
 
-- 
GitLab