Human readable file names when copying on usb...

Conflicts:

	NEWS
master
Marco Pesenti Gritti 17 years ago
parent c74276dcdb
commit 0f2a58d737

@ -1,3 +1,7 @@
* #3649 Human readable file names on USB. (marco)
Snapshot b8ce5083b7
* #3601 Always remove invites from the frame. (cassidy)
Snapshot b8ce5083b7

@ -27,6 +27,7 @@ from sugar import activity
from sugar.activity.bundle import Bundle
from sugar.activity.activityhandle import ActivityHandle
from sugar.bundle.contentbundle import ContentBundle
from sugar.objects import mime
class DSMetadata(gobject.GObject):
__gsignals__ = {
@ -259,6 +260,17 @@ def copy(jobject, mount_point):
new_jobject = jobject.copy()
new_jobject.metadata['mountpoint'] = mount_point
if jobject.metadata.has_key('title'):
filename = jobject.metadata['title']
if jobject.metadata.has_key('mime_type'):
mime_type = jobject.metadata['mime_type']
extension = mime.get_primary_extension(mime_type)
if extension:
filename += '.' + extension
new_jobject.metadata['suggested_filename'] = filename
# this will cause the file be retrieved from the DS
new_jobject.file_path = jobject.file_path

Loading…
Cancel
Save