models: Move QML Connections to separate objects

This commit is contained in:
Thomas Perl 2014-07-28 14:02:55 +02:00
parent deaa5e8268
commit 77bac09899
7 changed files with 108 additions and 60 deletions

View file

@ -30,31 +30,4 @@ ListModel {
Util.updateModelFrom(podcastListModel, podcasts);
});
}
property var connections: Connections {
target: py
onPodcastListChanged: {
podcastListModel.reload();
}
onUpdatingPodcast: {
for (var i=0; i<podcastListModel.count; i++) {
var podcast = podcastListModel.get(i);
if (podcast.id == podcast_id) {
podcastListModel.setProperty(i, 'updating', true);
break;
}
}
}
onUpdatedPodcast: {
for (var i=0; i<podcastListModel.count; i++) {
if (podcastListModel.get(i).id == podcast.id) {
podcastListModel.set(i, podcast);
break;
}
}
}
}
}