Exemple #1
0
KasItem *KasGrouper::maybeAddToDesktopGroup( Task::Ptr t )
{
   if ( t->isOnCurrentDesktop() )
       return 0;

   KasItem *item = 0;
   for ( uint i = 0; i < kasbar->itemCount(); i++ ) {
      KasItem *ei = kasbar->itemAt( i );

      if ( ei->inherits( "KasTaskItem" ) ) {
	 KasTaskItem *eti = static_cast<KasTaskItem *> (ei);
	 if ( eti->task()->desktop() == t->desktop() ) {
	    KasGroupItem *egi = kasbar->convertToGroup( eti->task() );
	    egi->setGroupType( KasGroupItem::GroupDesktop );
	    egi->addTask( t );
	    item = egi;
	 }
      }
      else if ( ei->inherits( "KasGroupItem" ) ) {
	  KasGroupItem *egi = static_cast<KasGroupItem *> (ei);
	  if ( egi->groupType() == KasGroupItem::GroupDesktop ) {
	      if ( egi->task(0)->desktop() == t->desktop() ) {
		  egi->addTask( t );
		  item = egi;
	      }
	  }
      }
   }

   return item;
}
Exemple #2
0
KasItem *KasGrouper::maybeAddToGroup( Task::Ptr t )
{
   KasItem *item = 0;

   TQString taskClass = t->className().lower();

   for ( uint i = 0; (!item) && (i < kasbar->itemCount()); i++ ) {
      KasItem *ei = kasbar->itemAt( i );

      if ( ei->inherits( "KasTaskItem" ) ) {

	 KasTaskItem *eti = static_cast<KasTaskItem *> (ei);

	 // NB This calls Task::className() not TQObject::className()
	 TQString currClass = eti->task()->className().lower();

	 if ( Task::idMatch( currClass, taskClass ) ) {
	    KasGroupItem *egi = kasbar->convertToGroup( eti->task() );
	    egi->addTask( t );
	    item = egi;
	    break;
	 }
      }
      else if ( ei->inherits( "KasGroupItem" ) ) {
	  KasGroupItem *egi = static_cast<KasGroupItem *> (ei);

	  for ( int i = 0; i < egi->taskCount(); i++ ) {

	      // NB This calls Task::className() not TQObject::className()
	      TQString currClass = egi->task( i )->className().lower();
	     
	      if ( Task::idMatch( currClass, taskClass ) ) {
		  egi->addTask( t );
		  item = egi;
		  break;
	      }
	  }
      }
   }

   return item;
}