Logo Search packages:      
Sourcecode: packagesearch version File versions

void PackageSearchImpl::onPackageViewContextMenu ( QListViewItem *  pItem,
const QPoint &  pos 
) [protected]

This maps the caption of the short information plugins to the column where they are displayed.

Definition at line 848 of file packagesearchimpl.cpp.

References _hiddenShortInformation, _shortInformationColumn, _shortInformationPlugins, _shownShortInformation, onSearchChanged(), refreshShownAndHidden(), and updateShortInformationPluginGui().

{
      QPopupMenu menu(_pPackageView);
      if (pItem)
      {
            menu.insertItem(tr("Create apt-get line and copy to clipboard"), 0);
      }
      menu.insertItem(tr("Customize columns"), 1);
      switch (menu.exec(pos))
      {
            case 0:
            {
                  QClipboard *pCb = QApplication::clipboard();
                  pCb->setText("apt-get install "+pItem->text(0), QClipboard::Clipboard);
                  pCb->setText("apt-get install "+pItem->text(0), QClipboard::Selection);
                  break;
            }
            case 1:
            {
                  ColumnControlDlg dlg;
                  refreshShownAndHidden();
                  
                  /** @brief This maps the caption of the short information plugins to the 
                  * column where they are displayed.
                  */
                  map<QString, NPlugin::ShortInformationPlugin*> captionToPlugin;
                  for (ShortInformationPluginContainer::const_iterator it = _shortInformationPlugins.begin(); 
                        it != _shortInformationPlugins.end(); ++it)
                  {
                        captionToPlugin.insert( make_pair((*it)->shortInformationCaption(), *it) );
                  }
                  dlg.setContent(_shownShortInformation, _hiddenShortInformation);
                  if (dlg.exec() == QDialog::Accepted)
                  {
                        _shortInformationColumn.clear();    
                        _shownShortInformation = dlg.getShown();
                        _hiddenShortInformation = dlg.getHidden();
                        updateShortInformationPluginGui();
                        // request an update of the columns
                        onSearchChanged(0);
                  }
                  break;
            }
            default:
                  break;
      }
}


Generated by  Doxygen 1.6.0   Back to index