Merge lp:~mzanetti/reminders-app/fix-nameless-files into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 354
Merged at revision: 356
Proposed branch: lp:~mzanetti/reminders-app/fix-nameless-files
Merge into: lp:reminders-app
Prerequisite: lp:~mzanetti/reminders-app/jobqueue-tweaks
Diff against target: 15 lines (+4/-1)
1 file modified
src/libqtevernote/resource.cpp (+4/-1)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/fix-nameless-files
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+251194@code.launchpad.net

Commit message

Set a filename if we don't get one from the api.

In some cases evernote doesn't give us a filename. Let's set "Unnamed" ourselves and guess the filename extension from the mimetype

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/libqtevernote/resource.cpp'
2--- src/libqtevernote/resource.cpp 2015-02-24 22:21:04 +0000
3+++ src/libqtevernote/resource.cpp 2015-02-27 00:47:37 +0000
4@@ -34,7 +34,10 @@
5 m_fileName(fileName),
6 m_type(type)
7 {
8-
9+ if (m_fileName.isEmpty()) {
10+ // TRANSLATORS: A default file name if we don't get one from the server. Avoid weird characters.
11+ m_fileName = tr("Unnamed") + "." + m_type.split("/").last();
12+ }
13 m_filePath = NotesStore::instance()->storageLocation() + hash + "." + m_fileName.split('.').last();
14
15 QFile file(m_filePath);

Subscribers

People subscribed via source and target branches