예제 #1
0
void VideoResourceWidget::setResource(Nepomuk::Resource resource)
{
    m_video = Nepomuk::Video(resource);
    kDebug() << "VERT:" << m_video.heights();
    kDebug() << "WITH" << m_video.widths();
    m_width = resource.property(Nepomuk::Image().verticalResolutionUri()).toString().toInt();
    m_height = resource.property(Nepomuk::Image().horizontalResolutionUri()).toString().toInt();
    kDebug() << "------> video resolution wxh::" << m_width << m_height;
    ResourceWidget::setResource(resource);
}
예제 #2
0
void ResourceBrowser::slotOpenLinkedResource(QModelIndex selectedResource)
{
    m_linkedResourceView->selectionModel()->setCurrentIndex(selectedResource,QItemSelectionModel::NoUpdate);
    Nepomuk::Resource currentResource = (m_linkedResourceViewModel->resourceForIndex(
                                             m_linkedResourceView->selectionModel()->currentIndex()));
    KUrl url = currentResource.property(Nepomuk::Vocabulary::NIE::url()).toString();
    qDebug()<<url<<"usagecount="<<currentResource.usageCount();
    if(!url.isEmpty()) {
        new KRun(url,this);
        currentResource.increaseUsageCount();
    }
}
void Nepomuk::QueryClientWrapper::slotNewEntries(const QList<Nepomuk::Query::Result>& results)
{
    QList<Plasma::QueryMatch> matches;
    foreach(const Query::Result& result, results) {
        Plasma::QueryMatch match(m_runner);
        match.setType(Plasma::QueryMatch::PossibleMatch);
        match.setRelevance(normalizeScore(result.score()));

        Nepomuk::Resource res = result.resource();

        QString type;
        QString iconName;

        KMimeType::Ptr mimetype;
        if (res.hasProperty(Nepomuk::Vocabulary::NIE::mimeType())) {
            mimetype = KMimeType::mimeType(res.property(Nepomuk::Vocabulary::NIE::mimeType()).toString());
        }
        if (!mimetype && res.isFile() && res.toFile().url().isLocalFile()) {
            const KUrl url(res.toFile().url());
            mimetype = KMimeType::findByUrl(url);
        }

        if (mimetype) {
            type = mimetype->comment();
            iconName = mimetype->iconName();
        }

        if (type.isEmpty() ) {
            type = Nepomuk::Types::Class(res.resourceType()).label();
            iconName = res.genericIcon();
        }

        match.setText(res.genericLabel());
        match.setSubtext(type);
        match.setIcon(KIcon(iconName.isEmpty() ? QString::fromLatin1("nepomuk") : iconName));

        match.setData(qVariantFromValue(res));
        match.setId(KUrl(res.resourceUri()).url());
        matches << match;
    }