~elopio/gallery-app/revert_workaround-1302706-click_toolbar_button_failure

« back to all changes in this revision

Viewing changes to src/qml/qml-media-collection-model.cpp

  • Committer: Leo Arias
  • Date: 2015-05-15 08:05:23 UTC
  • mfrom: (954.1.241 gallery-app)
  • Revision ID: leo.arias@canonical.com-20150515080523-i2of3vr8h7dioj59
Now the toolbar object is not needed at all.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
}
113
113
 
114
114
/*!
 
115
 * \brief QmlMediaCollectionModel::removeMediaFromAlbum
 
116
 * \param valbum
 
117
 * \param vmedia
 
118
 */
 
119
void QmlMediaCollectionModel::removeMediaFromAlbum(QVariant valbum, QVariant vmedia)
 
120
{
 
121
    Album* album = VariantToObject<Album*>(valbum);
 
122
    if (album == NULL)
 
123
        return;
 
124
 
 
125
    MediaSource* media = VariantToObject<MediaSource*>(vmedia);
 
126
    if (media == NULL)
 
127
        return;
 
128
 
 
129
    album->detach(media, true);
 
130
}
 
131
 
 
132
/*!
115
133
 * \brief QmlMediaCollectionModel::monitored
116
134
 * \return
117
135
 */
158
176
{
159
177
    return UncheckedVariantToObject<MediaSource*>(var);
160
178
}
 
179
 
 
180
/*!
 
181
 * \brief QmlMediaCollectionModel::isAccepted
 
182
 * \param item
 
183
 * \return
 
184
 */
 
185
bool QmlMediaCollectionModel::isAccepted(DataObject *item)
 
186
{
 
187
    if (mediaTypeFilter() == MediaSource::None) return true;
 
188
    MediaSource* source = qobject_cast<MediaSource*>(item);
 
189
    return source != 0 && source->type() == mediaTypeFilter();
 
190
}