We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

How to resolve failed email inbox access in release 3.1.0.11?

asked 2019-08-10 22:35:51 +0300

jsommer gravatar image

updated 2019-08-10 22:36:32 +0300

My app uses org.nemomobile.email 0.1 to access the user's inbox. Unfortunately the following code causes an error in the QML page with the following element:

EmailMessageListModel {
    id: combinedInboxModel
    combinedInbox: true
    filterUnread: false
}

The log says:

Cannot assign to non-existent property "filterUnread"

If I remove this line just for testing the log says:

Cannot assign to non-existent property "combinedInbox"

Has Jolla replaced or removed the nemo mobile library for emails? Any idea? The code was working propertly for the previous Sailfish releases.

edit retag flag offensive close delete

Comments

2 Answers

Sort by » oldest newest most voted
0

answered 2019-08-11 01:46:28 +0300

Spam Hunter gravatar image

updated 2019-08-11 01:52:35 +0300

Try adding (one or both) these import statements in place of org.nemomobile.email 0.1;

import Nemo.Email 0.1
import com.jolla.email 1.1

I did a search for org.nemomobile.email 0.1 in /usr/share/jolla-email/ and it was not found.

edit flag offensive delete publish link more

Comments

Thanks so much for your suggestion. I think, the API has changed and the properties combinedInbox and filterUnread are not valid properties of EmailMessageListModel any more. I can't find them in the documentation of git.merproject.org. The impact is, that it's not as easy any more to fetch emails for a timeline (I hate fundamental API changes). I think I have to use a so called folter accessor:

Component {
    name: "EmailAgent"
    prototype: "QObject"
    exports: ["Nemo.Email/EmailAgent 0.1"]
    ...
    Method { name: "combinedInboxAccessor"; type: "FolderAccessor*" }

Then I may have to define this object as a property of EmailMessageListModel.

Component {
    name: "EmailMessageListModel"
    prototype: "QMailMessageListModel"
    exports: ["Nemo.Email/EmailMessageListModel 0.1"]
    ...
    Property { name: "folderAccessor"; type: "FolderAccessor"; isPointer: true }

I'm not sure, whether my code should look like this:

EmailMessageListModel {
     id: combinedInboxModel
     folderAccessor: anyNameOfThePointer
}

I'm not sure, whether this is sufficient. Where and how should I instaniate the EmailAgent and trigger the method. I tried this, but the list is empty:

EmailMessageListModel {
    id: combinedInboxModel
}
EmailAgent {
    id: emailAgent
}
Component.onCompleted: {
    combinedInboxModel.folderAccessor = emailAgent.combinedInboxAccessor()
    combinedInboxModel.selectAllMessages()
}

The log says:

Messaging :  opening database

So I think I'm on the right way. Any idea?

jsommer ( 2019-08-11 12:39:55 +0300 )edit

I don't know, maybe. I don't know the ins & outs of your application, I only have jolla-email app to reference.

Spam Hunter ( 2019-08-11 13:27:36 +0300 )edit

This feature is currently in a very simple stage. I just reference the model in a list view:

SilicaListView {
     id: listView
     anchors.fill: parent
     model: combinedInboxModel
     header: ...
     delegate: ....

Maybe I have to trigger somehow the loading process.

jsommer ( 2019-08-11 13:48:11 +0300 )edit
0

answered 2019-08-11 18:07:15 +0300

jsommer gravatar image

updated 2019-08-11 18:14:28 +0300

It's frustrating. This code works, but it shows only unread messages. I can't find a property, that was available before to get also the read messages.

EmailMessageListModel {
    id: combinedInboxModel
    folderAccessor: emailAgent.combinedInboxAccessor()
}
EmailAgent {
    id: emailAgent
}

I'm afraid, I need to configure a more complicate business logic of my app:

  1. Iterating over the accounts of an EmailAccountListModel.
  2. Using the EmailAgent to call the method inboxFolderId for each accountId
  3. Using the EmailAgent again to call the method retrieveMessageList for each inboxFolderId
  4. Merging the emailMessageListModels into one model for my SilicaListView

I'm not sure how to merge the lists. The EmailMessageListModel is based on the QAbstractListModel that is based on the QAbstractItemModel. I think I have to use somehow the insertRows method.

Doeas someone know how to do that?

It's frustrating because a unified inbox is state of the art of any modern mail client of operation systems in particular iOS and Android. I don't understand why the property to fetch read messages was removed from the Nemo library.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2019-08-10 22:35:51 +0300

Seen: 192 times

Last updated: Aug 11 '19