Merge lp:~artmello/gallery-app/gallery-app-remove_sdcard_during_load into lp:gallery-app

Proposed by Arthur Mello
Status: Merged
Merged at revision: 1135
Proposed branch: lp:~artmello/gallery-app/gallery-app-remove_sdcard_during_load
Merge into: lp:gallery-app
Diff against target: 50 lines (+18/-0)
3 files modified
src/media-object-factory.cpp (+2/-0)
src/media/media-collection.cpp (+15/-0)
src/media/media-collection.h (+1/-0)
To merge this branch: bzr merge lp:~artmello/gallery-app/gallery-app-remove_sdcard_during_load
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+247616@code.launchpad.net

Commit message

Do not create objects if the file was removed from the time the create was requested and when it was started

Description of the change

Do not create objects if the file was removed from the time the create was requested and when it was started

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/media-object-factory.cpp'
2--- src/media-object-factory.cpp 2015-01-25 20:09:25 +0000
3+++ src/media-object-factory.cpp 2015-01-26 16:47:14 +0000
4@@ -177,6 +177,8 @@
5 Q_ASSERT(m_mediaTable);
6
7 QFileInfo file(path);
8+ if(!file.exists())
9+ return;
10
11 clearMetadata();
12
13
14=== modified file 'src/media/media-collection.cpp'
15--- src/media/media-collection.cpp 2015-01-23 20:00:50 +0000
16+++ src/media/media-collection.cpp 2015-01-26 16:47:14 +0000
17@@ -161,6 +161,21 @@
18 /*!
19 * \reimp
20 */
21+void MediaCollection::add(DataObject *object)
22+{
23+ MediaSource* media = qobject_cast<MediaSource*>(object);
24+ if (media->file().exists()) {
25+ m_idMap.insert(media->id(), media);
26+ DataCollection::add(object);
27+ } else {
28+ m_mediaTable->remove(media->id());
29+ media->deleteLater();
30+ }
31+}
32+
33+/*!
34++ * \reimp
35++ */
36 void MediaCollection::addMany(const QSet<DataObject *> &objects)
37 {
38 foreach (DataObject* data, objects) {
39
40=== modified file 'src/media/media-collection.h'
41--- src/media/media-collection.h 2015-01-23 20:00:50 +0000
42+++ src/media/media-collection.h 2015-01-26 16:47:14 +0000
43@@ -48,6 +48,7 @@
44 const MediaSource* mediaFromFileinfo(const QFileInfo &file) const;
45 bool containsFile(const QString& filename) const;
46
47+ virtual void add(DataObject* object);
48 virtual void addMany(const QSet<DataObject*>& objects);
49
50 void destroy(MediaSource *media, bool destroy_backing);

Subscribers

People subscribed via source and target branches