summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp20
-rw-r--r--src/libs/installer/packagemanagercore.h2
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp8
-rw-r--r--src/libs/installer/packagemanagercore_p.h1
-rw-r--r--src/libs/installer/packagemanagergui.cpp8
5 files changed, 33 insertions, 6 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 73909e365..3462e7147 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -1658,6 +1658,26 @@ void PackageManagerCore::setValidatorForCustomPage(Component *component, const Q
}
/*!
+ Selects the component with \a id.
+ \sa {installer::selectComponent}{installer.selectComponent}
+ \sa deselectComponent()
+*/
+void PackageManagerCore::selectComponent(const QString &id)
+{
+ d->setComponentSelection(id, Qt::Checked);
+}
+
+/*!
+ Deselects the component with \a id.
+ \sa {installer::deselectComponent}{installer.deselectComponent}
+ \sa selectComponent()
+*/
+void PackageManagerCore::deselectComponent(const QString &id)
+{
+ d->setComponentSelection(id, Qt::Unchecked);
+}
+
+/*!
\fn PackageManagerCore::addWizardPageItem(QInstaller::Component * component, const QString & name, int page)
Adds the widget with the object name \a name registered by \a component as a GUI element
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index 13b4c47ad..66efb6539 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -286,6 +286,8 @@ public:
Q_INVOKABLE bool setDefaultPageVisible(int page, bool visible);
Q_INVOKABLE void setValidatorForCustomPage(QInstaller::Component *component, const QString &name,
const QString &callbackName);
+ Q_INVOKABLE void selectComponent(const QString &id);
+ Q_INVOKABLE void deselectComponent(const QString &id);
void rollBackInstallation();
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 5fdba4bd0..49df7958d 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2016,6 +2016,14 @@ bool PackageManagerCorePrivate::runningProcessesFound()
return false;
}
+void PackageManagerCorePrivate::setComponentSelection(const QString &id, Qt::CheckState state)
+{
+ ComponentModel *model = m_core->isUpdater() ? m_core->updaterComponentModel() : m_core->defaultComponentModel();
+ const QModelIndex &idx = model->indexFromComponentName(id);
+ if (idx.isValid())
+ model->setData(idx, state, Qt::CheckStateRole);
+}
+
// -- private
void PackageManagerCorePrivate::deleteMaintenanceTool()
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index d75a4a0ce..27baec1aa 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -164,6 +164,7 @@ public:
bool adminRightsGained = false);
bool runningProcessesFound();
+ void setComponentSelection(const QString &id, Qt::CheckState state);
signals:
void installationStarted();
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index 090465b28..f1496ce9f 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -2149,9 +2149,7 @@ void ComponentSelectionPage::selectDefault()
*/
void ComponentSelectionPage::selectComponent(const QString &id)
{
- const QModelIndex &idx = d->m_currentModel->indexFromComponentName(id);
- if (idx.isValid())
- d->m_currentModel->setData(idx, Qt::Checked, Qt::CheckStateRole);
+ d->m_core->selectComponent(id);
}
/*!
@@ -2159,9 +2157,7 @@ void ComponentSelectionPage::selectComponent(const QString &id)
*/
void ComponentSelectionPage::deselectComponent(const QString &id)
{
- const QModelIndex &idx = d->m_currentModel->indexFromComponentName(id);
- if (idx.isValid())
- d->m_currentModel->setData(idx, Qt::Unchecked, Qt::CheckStateRole);
+ d->m_core->deselectComponent(id);
}
/*!