Example #1
0
void Nepomuk::TagAnnotation::setTag( const Tag& tag )
{
    // We do not save the resource itself for one simple reason: it would
    // mean that non-existing tags would stay in memory and thus, be
    // handled as existing ones by libnepomuk
    if(tag.exists())
        d->m_tagUri = tag.resourceUri();
    else
        d->m_tag = tag.genericLabel();
    setLabel( tag.genericLabel() );
    setIcon( KIcon( tag.genericIcon() ) );
}
Example #2
0
/**
 * Removes a tag from the note
 *
 * @param tagName
 * @return true if the tag was removed from the note
 */
bool NoteApi::removeTag(QString tagName) {
    Tag tag = Tag::fetchByName(tagName);
    if (!tag.exists()) {
        return false;
    }

    Note note = Note::fetch(id);
    if (!note.exists()) {
        return false;
    }

    return tag.removeLinkToNote(note);
}