[PC-BSD Commits] r12171 - pcbsd/current/src-qt4/pc-updategui
svn at pcbsd.org
svn at pcbsd.org
Thu Aug 18 13:51:31 PDT 2011
Author: kris
Date: 2011-08-18 13:51:31 -0700 (Thu, 18 Aug 2011)
New Revision: 12171
Modified:
pcbsd/current/src-qt4/pc-updategui/mainWin.cpp
Log:
Make sure that we always check if its sane to enable the "install" button or not
Modified: pcbsd/current/src-qt4/pc-updategui/mainWin.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-updategui/mainWin.cpp 2011-08-18 20:24:32 UTC (rev 12170)
+++ pcbsd/current/src-qt4/pc-updategui/mainWin.cpp 2011-08-18 20:51:31 UTC (rev 12171)
@@ -25,7 +25,10 @@
connect(buttonRescan, SIGNAL(clicked()), this, SLOT(slotRescanUpdates()));
connect(pushInstallUpdates, SIGNAL(clicked()), this, SLOT(slotInstallClicked()));
connect(checkAll, SIGNAL(clicked()), this, SLOT(slotSelectAllClicked()));
- connect(listViewUpdates, SIGNAL(clicked()),this,SLOT(slotListClicked()));
+ connect(listViewUpdates, SIGNAL(itemClicked(QListWidgetItem *)),this,SLOT(slotListClicked()));
+ connect(listViewUpdates, SIGNAL(itemActivated(QListWidgetItem *)),this,SLOT(slotListClicked()));
+ connect(listViewUpdates, SIGNAL(itemChanged(QListWidgetItem *)),this,SLOT(slotListClicked()));
+ connect(listViewUpdates, SIGNAL(itemPressed(QListWidgetItem *)),this,SLOT(slotListClicked()));
progressUpdate->setHidden(true);
QTimer::singleShot(200, this, SLOT(slotRescanUpdates() ) );
@@ -33,12 +36,17 @@
//Check whether an update was selected to enable the button
void mainWin::slotListClicked(){
- if(listViewUpdates->currentRow()==-1){
- pushInstallUpdates->setEnabled(false);
- }else{
- pushInstallUpdates->setEnabled(true);
- }
- return;
+ bool found = false;
+
+ // Get the total number of updates
+ for (int z=0; z < listViewUpdates->count(); ++z)
+ if ( listViewUpdates->item(z)->checkState() == Qt::Checked )
+ found = true;
+
+ if(!found)
+ pushInstallUpdates->setEnabled(false);
+ else
+ pushInstallUpdates->setEnabled(true);
}
bool mainWin::sanityCheck()
@@ -293,6 +301,8 @@
for (int z=0; z < listViewUpdates->count(); ++z) {
listViewUpdates->item(z)->setCheckState(checkAll->checkState());
}
+
+ slotListClicked();
}
void mainWin::slotRescanUpdates()
More information about the Commits
mailing list