Merge lp:~artmello/ubuntu-ui-extras/ubuntu-ui-extras-fix_1524973 into lp:ubuntu-ui-extras

Proposed by Arthur Mello
Status: Merged
Approved by: Bill Filler
Approved revision: 73
Merged at revision: 73
Proposed branch: lp:~artmello/ubuntu-ui-extras/ubuntu-ui-extras-fix_1524973
Merge into: lp:ubuntu-ui-extras
Diff against target: 27 lines (+17/-1)
1 file modified
modules/Ubuntu/Components/Extras/plugin/photoeditor/file-utils.cpp (+17/-1)
To merge this branch: bzr merge lp:~artmello/ubuntu-ui-extras/ubuntu-ui-extras-fix_1524973
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+280339@code.launchpad.net

Commit message

After editing a photo modify the original file instead of removing/moving it

Description of the change

After editing a photo modify the original file instead of removing/moving it

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Extras/plugin/photoeditor/file-utils.cpp'
2--- modules/Ubuntu/Components/Extras/plugin/photoeditor/file-utils.cpp 2014-11-25 15:44:31 +0000
3+++ modules/Ubuntu/Components/Extras/plugin/photoeditor/file-utils.cpp 2015-12-11 17:35:57 +0000
4@@ -69,7 +69,23 @@
5 {
6 if (sourceFile.isEmpty() || destinationFile.isEmpty()) return false;
7
8- if (QFileInfo(destinationFile).exists()) QFile::remove(destinationFile);
9+ if (QFileInfo(destinationFile).exists()) {
10+ QFile src(sourceFile);
11+ QFile dst(destinationFile);
12+
13+ if (!src.open(QIODevice::ReadOnly) || !dst.open(QIODevice::WriteOnly)) {
14+ return false;
15+ }
16+
17+ if (dst.write(src.readAll()) < 0) {
18+ return false;
19+ }
20+
21+ src.close();
22+ dst.close();
23+ return true;
24+ }
25+
26 return QFile::rename(sourceFile, destinationFile);
27 }
28

Subscribers

People subscribed via source and target branches