summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-03-26 12:54:17 +0100
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-03-28 11:23:53 +0100
commita836615d85f68b0c57319e349484747b72f4f09d (patch)
treee8293b1c0298785a04571c386ed0cee150149a08 /src
parentb1f223370e59f2fea188bf07f8ea8fec3d04e51e (diff)
Fix broken update behavior (size and description label).
One could trigger an size label update for unchecked components cause the selection was still on a checked component. Change-Id: I953db1140a283aa92706129852f7ae56f62f1247 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagergui.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index ae5b6c916..90375f710 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -1105,10 +1105,10 @@ public:
{
m_checkDefault->setVisible(m_core->isInstaller() || m_core->isPackageManager());
if (m_treeView->selectionModel()) {
- disconnect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- this, SLOT(currentChanged(QModelIndex)));
disconnect(m_currentModel, SIGNAL(checkStateChanged(QModelIndex)), this,
- SLOT(currentChanged(QModelIndex)));
+ SLOT(currentCheckedChanged(QModelIndex)));
+ disconnect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ this, SLOT(currentSelectedChanged(QModelIndex)));
}
m_currentModel = m_core->isUpdater() ? m_updaterModel : m_allModel;
@@ -1131,39 +1131,38 @@ public:
hasChildren = m_currentModel->hasChildren(m_currentModel->index(row, 0));
m_treeView->setRootIsDecorated(hasChildren);
- connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- this, SLOT(currentChanged(QModelIndex)));
connect(m_currentModel, SIGNAL(checkStateChanged(QModelIndex)), this,
- SLOT(currentChanged(QModelIndex)));
+ SLOT(currentCheckedChanged(QModelIndex)));
+ connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ this, SLOT(currentSelectedChanged(QModelIndex)));
m_treeView->setCurrentIndex(m_currentModel->index(0, 0));
}
public slots:
- void currentChanged(const QModelIndex &current)
+ void currentCheckedChanged(const QModelIndex &current)
+ {
+ if (m_treeView->selectionModel()->currentIndex() == current)
+ currentSelectedChanged(current);
+ }
+
+ void currentSelectedChanged(const QModelIndex &current)
{
- // if there is no selection, return
if (!current.isValid())
return;
+ m_sizeLabel->setText(QString());
m_descriptionLabel->setText(m_currentModel->data(m_currentModel->index(current.row(),
ComponentModelHelper::NameColumn, current.parent()), Qt::ToolTipRole).toString());
- m_sizeLabel->clear();
- if (!m_core->isUninstaller()) {
- const QModelIndex currentSelected = m_treeView->selectionModel()->currentIndex();
- if (!currentSelected.isValid())
- return;
-
- Component *component = m_currentModel->componentFromIndex(currentSelected);
- if (component == 0)
- return;
+ Component *component = m_currentModel->componentFromIndex(current);
+ if ((m_core->isUninstaller()) || (!component))
+ return;
- if (component->updateUncompressedSize() > 0) {
- m_sizeLabel->setText(ComponentSelectionPage::tr("This component "
- "will occupy approximately %1 on your hard disk drive.")
- .arg(humanReadableSize(component->value(scUncompressedSizeSum).toLongLong())));
- }
+ if ((component->checkState() != Qt::Unchecked) && (component->updateUncompressedSize() > 0)) {
+ m_sizeLabel->setText(ComponentSelectionPage::tr("This component "
+ "will occupy approximately %1 on your hard disk drive.")
+ .arg(humanReadableSize(component->value(scUncompressedSizeSum).toLongLong())));
}
}