Salome HOME
Implement features:
[tools/install.git] / src / SALOME_ProductsView.cxx
index 713962c4a05030a3a0cd16f337f1b99692ce77f4..8bb8161fbf306b8a5fe6a3692fc7438133d286fd 100644 (file)
@@ -128,7 +128,7 @@ void ProductsView::itemActivated( QCheckListItem* item ) {
 // ================================================================
 bool ProductsView::isBinaries( QCheckListItem* item ) const
 {
-  if ( item->childCount() > 0 ) {
+  if ( item->childCount() > 0 && item->isEnabled() ) {
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -146,7 +146,7 @@ bool ProductsView::isBinaries( QCheckListItem* item ) const
 // ================================================================
 bool ProductsView::isSources( QCheckListItem* item ) const
 {
-  if ( item->childCount() > 0 ) {
+  if ( item->childCount() > 0 && item->isEnabled() ) {
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -167,7 +167,7 @@ bool ProductsView::isSources( QCheckListItem* item ) const
 // ================================================================
 bool ProductsView::isNative( QCheckListItem* item ) const
 {
-  if ( item->childCount() > 0 ) {
+  if ( item->childCount() > 0 && item->isEnabled() ) {
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -361,3 +361,38 @@ bool ProductsView::hasNative( QCheckListItem* item ) const
   }
   return false;
 }
+
+// ================================================================
+/*!
+ *  ProductsView::setItemEnabled
+ *  Enable/disable item
+ */
+// ================================================================
+void ProductsView::setItemEnabled( QCheckListItem* item, const bool enable )
+{
+  item->setEnabled( enable );
+  QListViewItem* subItem = item->firstChild();
+  while( subItem ) {
+    subItem->setEnabled( enable );
+    subItem = subItem->nextSibling();
+  }
+}
+  
+// ================================================================
+/*!
+ *  ProductsView::findBinItem
+ *  Find bin item which corresponds to the src item
+ */
+// ================================================================
+QCheckListItem* ProductsView::findBinItem( const QString& srcName )
+{
+  QString binName = srcName.lower().replace( "src", "bin" );
+  QCheckListItem* subItem = (QCheckListItem*)( firstChild() );
+  while( subItem ) {
+    if ( subItem->text().lower() == binName )
+      return subItem;
+    subItem = (QCheckListItem*)( subItem->nextSibling() );
+  }
+  return 0;
+}
+