diff --git a/src/plugins/madde/maddedevice.cpp b/src/plugins/madde/maddedevice.cpp index eee242e29e648699f8eb52783f340cc693e5d22b..702713d46b8124282c47fdede286627d3d69bef5 100644 --- a/src/plugins/madde/maddedevice.cpp +++ b/src/plugins/madde/maddedevice.cpp @@ -103,19 +103,21 @@ QString MaddeDevice::displayNameForActionId(Core::Id actionId) const return QString(); // Can't happen. } -QDialog *MaddeDevice::createAction(Core::Id actionId, QWidget *parent) const +void MaddeDevice::executeAction(Core::Id actionId, QWidget *parent) { - QTC_ASSERT(actionIds().contains(actionId), return 0); + QTC_ASSERT(actionIds().contains(actionId), return); + QDialog *d; const LinuxDeviceConfiguration::ConstPtr device = sharedFromThis().staticCast<const LinuxDeviceConfiguration>(); if (actionId == Core::Id(MaddeDeviceTestActionId)) - return new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent); - if (actionId == Core::Id(MaddeRemoteProcessesActionId)) - return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device), parent); - if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId)) - return PublicKeyDeploymentDialog::createDialog(device, parent); - return 0; // Can't happen. + d = new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent); + else if (actionId == Core::Id(MaddeRemoteProcessesActionId)) + d = new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device), parent); + else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId)) + d = PublicKeyDeploymentDialog::createDialog(device, parent); + if (d) + d->exec(); } QString MaddeDevice::maddeDisplayType(const QString &type) diff --git a/src/plugins/madde/maddedevice.h b/src/plugins/madde/maddedevice.h index 4c83589302a664f75281ca201c6045e47328d9c0..385fb012e7b132e6d32973080db0443f8bee88eb 100644 --- a/src/plugins/madde/maddedevice.h +++ b/src/plugins/madde/maddedevice.h @@ -53,7 +53,7 @@ public: QString displayType() const; QList<Core::Id> actionIds() const; QString displayNameForActionId(Core::Id actionId) const; - QDialog *createAction(Core::Id actionId, QWidget *parent) const; + void executeAction(Core::Id actionId, QWidget *parent); ProjectExplorer::IDevice::Ptr clone() const; static QString maddeDisplayType(const QString &type); diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index e496a41f8830dc5bff2555ed039b2ab9efe89e16..cc11299b09fcb5ca848e2ddb4aa7e8ed8eec69d1 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -283,12 +283,9 @@ void DeviceSettingsWidget::clearDetails() void DeviceSettingsWidget::handleAdditionalActionRequest(int actionId) { - const IDevice::ConstPtr &device = currentDevice(); + const IDevice::Ptr &device = m_deviceManager->mutableDeviceAt(currentIndex()); QTC_ASSERT(device, return); - QDialog * const action = device->createAction(Core::Id::fromUniqueIdentifier(actionId), this); - if (action) - action->exec(); - delete action; + device->executeAction(Core::Id::fromUniqueIdentifier(actionId), this); } } // namespace Internal diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 1f31a20ec38142c1792d57f57d1ca9e9ea01d64c..5f2a4da4b34cd5833248923934f2d4b981c0a0ef 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -114,10 +114,9 @@ */ /*! - * \fn QDialog *ProjectExplorer::IDevice::createAction(const QString &actionId) const - * \brief Produces a dialog implementing the respective action. The dialog is supposed to be - * modal, so implementers must make sure to make whatever it does interruptible as - * to not needlessly block the UI. + * \fn void ProjectExplorer::IDevice::executeAction(Core::Id actionId, QWidget *parent) + * \brief Executes the respective action. This is typically done via some sort of dialog or + * wizard, so a parent widget argument is provided. */ /*! diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index ad6aaba74093c324220b14eae71e8903d06fc892..905b0c6d7bfcdb35117e7d203cd0d766d6464817 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -41,7 +41,6 @@ #include <QVariantMap> QT_BEGIN_NAMESPACE -class QDialog; class QWidget; QT_END_NAMESPACE @@ -83,7 +82,7 @@ public: virtual IDeviceWidget *createWidget() = 0; virtual QList<Core::Id> actionIds() const = 0; virtual QString displayNameForActionId(Core::Id actionId) const = 0; - virtual QDialog *createAction(Core::Id actionId, QWidget *parent = 0) const = 0; + virtual void executeAction(Core::Id actionId, QWidget *parent = 0) = 0; enum AvailabilityState { DeviceAvailable, DeviceUnavailable, DeviceAvailabilityUnknown }; AvailabilityState availability() const; diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianidevice.cpp b/src/plugins/qt4projectmanager/qt-s60/symbianidevice.cpp index d4f3fa39899748232677f6887500664c989b0ae3..292e008b5489eb1d52e232dc9d8e1975c8a86f4d 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianidevice.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/symbianidevice.cpp @@ -207,11 +207,10 @@ QString SymbianIDevice::displayNameForActionId(Core::Id actionId) const return QString(); } -QDialog *SymbianIDevice::createAction(Core::Id actionId, QWidget *parent) const +void SymbianIDevice::executeAction(Core::Id actionId, QWidget *parent) { Q_UNUSED(actionId); Q_UNUSED(parent); - return 0; } QVariantMap SymbianIDevice::toMap() const diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianidevice.h b/src/plugins/qt4projectmanager/qt-s60/symbianidevice.h index e3ee1943c254b882d347a9b7ae389c8447474942..8400b5336c131f46ab1259edb200435f82c5d2ca 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianidevice.h +++ b/src/plugins/qt4projectmanager/qt-s60/symbianidevice.h @@ -78,7 +78,7 @@ public: ProjectExplorer::IDeviceWidget* createWidget(); QList<Core::Id> actionIds() const; QString displayNameForActionId(Core::Id actionId) const; - QDialog* createAction(Core::Id actionId, QWidget*parent) const; + void executeAction(Core::Id actionId, QWidget*parent); protected: SymbianIDevice(const SymbianIDevice &other); diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp index 43764956bb1987eecc59802b56af3418ec0c4398..e96b76da6b3c0e5335988dfaaa943d24e95276bd 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp @@ -120,19 +120,21 @@ QString LinuxDeviceConfiguration::displayNameForActionId(Core::Id actionId) cons return QString(); // Can't happen. } -QDialog *LinuxDeviceConfiguration::createAction(Core::Id actionId, QWidget *parent) const +void LinuxDeviceConfiguration::executeAction(Core::Id actionId, QWidget *parent) { - QTC_ASSERT(actionIds().contains(actionId), return 0); + QTC_ASSERT(actionIds().contains(actionId), return); + QDialog *d; const LinuxDeviceConfiguration::ConstPtr device = sharedFromThis().staticCast<const LinuxDeviceConfiguration>(); if (actionId == Core::Id(Constants::GenericTestDeviceActionId)) - return new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent); - if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId)) - return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device, parent)); - if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId)) - return PublicKeyDeploymentDialog::createDialog(device, parent); - return 0; // Can't happen. + d = new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent); + else if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId)) + d = new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device, parent)); + else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId)) + d = PublicKeyDeploymentDialog::createDialog(device, parent); + if (d) + d->exec(); } LinuxDeviceConfiguration::LinuxDeviceConfiguration() : d(new LinuxDeviceConfigurationPrivate) diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.h b/src/plugins/remotelinux/linuxdeviceconfiguration.h index 44da35a0d42accbd60384b6166c0e10805008516..60c4746dbb2ef988ea2c223de447941d1b010210 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.h +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.h @@ -77,7 +77,7 @@ public: ProjectExplorer::IDeviceWidget *createWidget(); QList<Core::Id> actionIds() const; QString displayNameForActionId(Core::Id actionId) const; - QDialog *createAction(Core::Id actionId, QWidget *parent) const; + void executeAction(Core::Id actionId, QWidget *parent); void fromMap(const QVariantMap &map); ProjectExplorer::IDevice::Ptr clone() const;