Esempio n. 1
0
ResourceBrowserWidget::ResourceBrowserWidget( QWidget* parent )
    : QWidget( parent )
{
    setupUi( this );

    m_pimoView->header()->hide();
    m_pimoView->setSelectionMode( QAbstractItemView::SingleSelection );

    m_pimoModel = new Nepomuk2::Utils::ClassModel( m_pimoView );
    m_pimoModel->addRootClass( Nepomuk2::Vocabulary::PIMO::Thing() );
    m_pimoSortModel = new KRecursiveFilterProxyModel( m_pimoView );
    m_pimoSortModel->setSourceModel( m_pimoModel );
    m_pimoSortModel->setSortCaseSensitivity( Qt::CaseInsensitive );
    m_pimoSortModel->setDynamicSortFilter( true );
    m_pimoView->setModel( m_pimoSortModel );
    m_pimoView->setContextMenuPolicy( Qt::CustomContextMenu );
    m_pimoView->setSortingEnabled( true );
    m_pimoView->sortByColumn( 0, Qt::AscendingOrder );
    m_pimoView->setDragEnabled(true);
    m_pimoView->setAcceptDrops(true);
    m_pimoView->setDropIndicatorShown(true);

    m_classFilter->setProxy( m_pimoSortModel );

    m_baseClassCombo->addItem( i18nc( "@item:inlistbox Referring to all RDF classes in the Nepomuk PIMO ontology", "PIMO Classes" ), QVariant( Nepomuk2::Vocabulary::PIMO::Thing() ) );
    m_baseClassCombo->addItem( i18nc( "@item:inlistbox Referring to all RDF classes in the Nepomuk db", "All Classes" ), QVariant( Soprano::Vocabulary::RDFS::Resource() ) );

    connect( m_pimoView, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(slotPIMOViewContextMenu(QPoint)) );
    connect( m_pimoView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
             this, SLOT(slotCurrentPIMOClassChanged(QModelIndex,QModelIndex)) );
    connect( m_resourceView, SIGNAL(selectionChanged(QList<Nepomuk2::Resource>)),
             this, SIGNAL(resourcesSelected(QList<Nepomuk2::Resource>)) );
    connect( m_baseClassCombo, SIGNAL(activated(int)),
             this, SLOT(slotBaseClassChanged(int)) );
    connect( m_resourceView, SIGNAL(resourceActivated(Nepomuk2::Resource)),
             this, SIGNAL(resourceActivated(Nepomuk2::Resource)) );
    connect( m_resourceView, SIGNAL(resourceTypeActivated(Nepomuk2::Types::Class)),
             this, SLOT(setSelectedClass(Nepomuk2::Types::Class)) );
}
Esempio n. 2
0
void Nepomuk::ResourceCompletion::itemActivated( const KCompletionItem& item )
{
    emit resourceActivated( item.userData().toUrl() );
}
Esempio n. 3
0
void ResourceMenu::actionActivated()
{
	QAction* action = static_cast<QAction*>(sender());
	emit resourceActivated(action->property("resource").toString());
}