ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #04466
[Merge] lp:~gang65/ubuntu-clock-app/ubuntu-clock-custom-sound-moving-fix into lp:ubuntu-clock-app
Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-clock-app/ubuntu-clock-custom-sound-moving-fix into lp:ubuntu-clock-app.
Commit message:
If custom sound file name already exists during changing alarm sound, then delete it to avoid error.
Requested reviews:
Ubuntu Clock Developers (ubuntu-clock-dev)
For more details, see:
https://code.launchpad.net/~gang65/ubuntu-clock-app/ubuntu-clock-custom-sound-moving-fix/+merge/268835
If custom sound file name already exists during changing alarm sound, then delete it to avoid error.
--
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~gang65/ubuntu-clock-app/ubuntu-clock-custom-sound-moving-fix into lp:ubuntu-clock-app.
=== modified file 'app/alarm/AlarmSound.qml'
--- app/alarm/AlarmSound.qml 2015-08-22 13:41:11 +0000
+++ app/alarm/AlarmSound.qml 2015-08-22 21:23:01 +0000
@@ -94,10 +94,12 @@
if (_alarmSoundPage.activeTransfer.state === ContentTransfer.Charged) {
_alarmSoundPage.importItems = _alarmSoundPage.activeTransfer.items
console.log("[LOG] Original Custom Alarm Sound URL: " + _alarmSoundPage.importItems[0].url)
- _alarmSoundPage.importItems[0].move(customSound.alarmSoundDirectory)
+ customSound.prepareToAddAlarmSound(_alarmSoundPage.importItems[0].url)
+ if (_alarmSoundPage.importItems[0].move(customSound.alarmSoundDirectory) === true) {
+ // Wait for folder model to update and then select the imported sound
+ waitForCustomSoundModelToUpdate.start()
+ }
console.log("[LOG] Final Custom Alarm Sound URL: " + _alarmSoundPage.importItems[0].url)
- // Wait for folder model to update and then select the imported sound
- waitForCustomSoundModelToUpdate.start()
}
}
}
=== modified file 'backend/modules/Clock/Utility/customalarmsound.cpp'
--- backend/modules/Clock/Utility/customalarmsound.cpp 2015-08-20 23:19:35 +0000
+++ backend/modules/Clock/Utility/customalarmsound.cpp 2015-08-22 21:23:01 +0000
@@ -17,6 +17,7 @@
*/
#include <QDir>
+#include <QFileInfo>
#include <QStandardPaths>
#include "customalarmsound.h"
@@ -35,7 +36,17 @@
void CustomAlarmSound::deleteAlarmSound(const QString &soundName)
{
QDir dir(m_customAlarmDir);
- dir.remove(soundName);
+ if (dir.exists(soundName))
+ {
+ dir.remove(soundName);
+ }
+}
+
+void CustomAlarmSound::prepareToAddAlarmSound(const QString &soundPath)
+{
+ QFileInfo soundFile(soundPath);
+ QString soundFileName = soundFile.fileName();
+ deleteAlarmSound(soundFileName);
}
void CustomAlarmSound::createAlarmSoundDirectory()
=== modified file 'backend/modules/Clock/Utility/customalarmsound.h'
--- backend/modules/Clock/Utility/customalarmsound.h 2015-08-20 23:19:35 +0000
+++ backend/modules/Clock/Utility/customalarmsound.h 2015-08-22 21:23:01 +0000
@@ -39,6 +39,10 @@
// Function to delete a custom alarm sound
void deleteAlarmSound(const QString &soundName);
+ // Function to delete old alarm file sound according to file name from full path.
+ // It will able to replace sound alarm with new version
+ void prepareToAddAlarmSound(const QString &soundPath);
+
// Function to create the CustomSounds alarm directory
void createAlarmSoundDirectory();
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-22 13:42:20 +0000
+++ debian/changelog 2015-08-22 21:23:01 +0000
@@ -8,6 +8,7 @@
* Translate city and country names after language switch (LP: #1477492)
* Fix issue when unable to add city/country with apostrophes (LP: #1473074)
* Keep running stopwatch even when the clock or phone is turned off (LP: #1484942)
+ * If custom sound file name already exists during changing alarm sound, then delete it.
[Nekhelesh Ramananthan]
* Increase the height of times in the alarm screen (LP: #1365428)
Follow ups