Replace dummy URI in AttachmentViewInfo instances

This is a first step towards fixing viewing of attachments.
This commit is contained in:
cketti 2015-01-16 00:12:47 +01:00
parent 41bd420213
commit ac365567ee
2 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import com.fsck.k9.mail.internet.MimeHeader;
import com.fsck.k9.mail.internet.MimeMultipart;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.internet.Viewable;
import com.fsck.k9.provider.AttachmentProvider;
import java.util.ArrayList;
import java.util.Date;
@ -495,7 +496,10 @@ public class LocalMessageExtractor {
} catch (NumberFormatException e) { /* ignore */ }
}
Uri uri = Uri.parse("dummy://this.needs.fixing"); //FIXME
LocalPart localPart = (LocalPart) part;
String accountUuid = localPart.getAccountUuid();
long messagePartId = localPart.getId();
Uri uri = AttachmentProvider.getAttachmentUri(accountUuid, messagePartId);
return new AttachmentViewInfo(mimeType, name, size, uri, firstClassAttachment, part);
}

View File

@ -52,9 +52,9 @@ public class AttachmentProvider extends ContentProvider {
}
public static Uri getAttachmentUri(Account account, long id) {
public static Uri getAttachmentUri(String accountUuid, long id) {
return CONTENT_URI.buildUpon()
.appendPath(account.getUuid())
.appendPath(accountUuid)
.appendPath(Long.toString(id))
.appendPath(FORMAT_RAW)
.build();