Exemplo n.º 1
0
void
NepomukTrack::valueChangedInNepomuk( qint64 value, const Soprano::LiteralValue &literal )
{
    
    // TODO: find a better way to ignore own writes
    // ignore if last own write is less than 3 seconds ago
    // the change will be our own
    if ( !m_lastWrote.isNull() && m_lastWrote.secsTo( QTime::currentTime() ) < 3 )
        return;

    debug() << "nepo data changed " << m_collection->getNameForValue( value ) << " last wrote " << m_lastWrote.secsTo( QTime::currentTime() ) << endl;
    switch ( value )
    {
        case Meta::valUrl:
            m_url = KUrl ( literal.toString() );
            break;
        case Meta::valRating:
            m_rating = literal.toInt();
            break;
    }
    emit notifyObservers();
}
QDebug operator<<( QDebug dbg, const Soprano::LiteralValue& v )
{
    dbg << v.toString();
    return dbg;
}