コード例 #1
0
ファイル: syncrunner.cpp プロジェクト: rodrigoccurvo/nixnote2
// Synchronize remote tags with the current database
// If there is a conflict, the remote wins
void SyncRunner::syncRemoteTags(QList<Tag> tags, qint32 account) {
    QLOG_TRACE() << "Entering SyncRunner::syncRemoteTags";
    TagTable tagTable(db);

    for (int i=0; i<tags.size() && keepRunning; i++) {
        Tag t = tags.at(i);

        // There are two ways to get the tag.  We can get
        // it by name or by guid.  We check both.  We'll find it by
        // name if a new tag was created locally with the same name
        // as an unsynced remote.  We then merge them.  We'll find it by guid
        // if a note was synchrozied with this tag before a chunk
        // with this tag was downloaded.

        qint32 lid = tagTable.findByName(t.name, account);
        if (lid == 0)
            lid = tagTable.getLid(t.guid);

        if (lid > 0) {
            Tag currentTag;
            tagTable.get(currentTag, lid);
            QString tagname = "";
            if (currentTag.name.isSet())
                tagname = currentTag.name;
            QString tname = "";
            if (t.name.isSet())
                tname = t.name;
            if (tagname != tname)
                changedTags.insert(t.guid, t.name);
            lid = tagTable.sync(lid, t, account);
        } else {
            tagTable.sync(t, account);
            lid = tagTable.getLid(t.guid);
            changedTags.insert(t.guid, t.name);
        }
        QString parentGuid = "";
        if (t.parentGuid.isSet())
            parentGuid = t.parentGuid;
        if (!finalSync) {
            if (t.name.isSet())
                emit tagUpdated(lid, t.name, parentGuid, account);
            else
                emit(tagUpdated(lid, "", parentGuid, account));
            }
    }

    QLOG_TRACE() << "Leaving SyncRunner::syncRemoteTags";
}
コード例 #2
0
ファイル: ntagview.cpp プロジェクト: JelF/nixnote2
// Add a new tag to the table
void NTagView::addNewTag(qint32 lid) {
    TagTable tagTable(global.db);
    Tag newTag;
    tagTable.get(newTag, lid);
    if (newTag.name.isSet()) {
        tagUpdated(lid, newTag.name, "", 0);
    }
}
コード例 #3
0
void PlayWidgetEntryController::setTrack(Track * t){
    track = t;
    connect(t,SIGNAL(tagUpdated()),this,SLOT(updateTrackInfos()));
    initPlayer();
}