Logo Search packages:      
Sourcecode: packagesearch version File versions

void PackageSearchImpl::updateShortInformation ( Tagcoll::OpSet< int > &  packages  ) 

Shows the short information for the given packages.

Parameters:
packages the packages to be shown in the short information listing.

Definition at line 631 of file packagesearchimpl.cpp.

References _shortInformationColumn, handleMaker(), and NPlugin::ShortInformationPlugin::shortInformationText().

Referenced by onSearchChanged().

{
      int lastPackageId = -1; // it seems like -1 is no valid package id (or seldom used..)
      // if a package is selected
      if ( !_currentPackage.isEmpty() )
            lastPackageId = handleMaker().getHandle(toString(_currentPackage));
      // this pointer holds the new item for the formerly selected package, 
      // 0 if the package is not in the new result
      QListViewItem* pSelectItem = 0;
      _pPackageView->clear();
      for (Tagcoll::OpSet<int>::iterator it = packages.begin(); it != packages.end(); ++it)
      {
            int packageId = *it;
            // add the item with its name
            QListViewItem* pItem = new PackageListViewItem(_pPackageView, packageId);
            //, toQString(handleMaker().getItem(packageId))
            if (lastPackageId == packageId)
                  pSelectItem = pItem;
            // iterate all shown columns
            for ( map<NPlugin::ShortInformationPlugin*, int>::iterator jt = _shortInformationColumn.begin();
                  jt != _shortInformationColumn.end(); ++jt)
            {
                  try 
                  {
                        NPlugin::ShortInformationPlugin* pPlugin = jt->first;
                        pItem->setText( jt->second, pPlugin->shortInformationText(packageId) );
                  }
                  // simply ignore it if the package was not available for this plugin
                  catch (NPlugin::PackageNotFoundException& e) {}
            }
      }
      if (pSelectItem)
      {
            _pPackageView->ensureItemVisible(pSelectItem);
            _pPackageView->setSelected(pSelectItem, true);
      }
      // select the first item of the site to be shown
      else if (_pPackageView->firstChild())
      {
            _pPackageView->setSelected(_pPackageView->firstChild(), true);
      }

}


Generated by  Doxygen 1.6.0   Back to index