maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Rename 'Folders' to currently selected account (https://talk.maemo.org/showthread.php?t=100752)

Markkyboy 2019-05-27 11:53

Rename 'Folders' to currently selected account
 
2 Attachment(s)
Hi all, within the Jolla email application, we find a page named Folders, showing inbox/outbox/etc.

I manage multiple accounts (mostly on my PC) but also find it handy to be able to monitor all accounts from my Jolla1.

I have made several unsuccessful attempts to edit 'FoldersListPage.qml' to reflect the desired changes, at worst, the folders page becomes inaccessible.
I thought that by using a line of code** from AccountList.qml (line 90) and inserting into the header title of FoldersListPage.qml (line 38) that I would then see the display name/email address of the account, but it didn't work, I get an error from console;

Code:

** title: displayName != "" ? displayName : emailAddress
Code:

[W] unknown:38 - file:///usr/share/jolla-email//pages/FolderListPage.qml:38:
    ReferenceError: displayName is not defined

So I tried adding an ID as reference to the original text, but this also doesn't work, the folder title remains blank.

However, the above is just one example of many different attempts

Any ideas appreciated as I am out of ideas, if i cannot crack it myself, I'll possibly post as a feature request on TJC.

Regards,

Before edit......then after

dcaliste 2019-05-27 12:25

Re: Rename 'Folders' to currently selected account
 
Not tested, but you can try:

title: mailAccountListModel.displayNameFromAccountId(acco untKey)

The email address for the accountid can be retrieved the same way with:
mailAccountListModel.emailAddressFromAccountId(acc ountKey)

Markkyboy 2019-05-27 16:27

Re: Rename 'Folders' to currently selected account
 
Thanks @dcaliste, your code is spot on, bang on the money!

Regards,

p.s. I'm curious as to how you arrived at that particular code?, is this something you basically already knew?

dcaliste 2019-05-27 16:43

Re: Rename 'Folders' to currently selected account
 
Happy that it's working. Besides, it's not a bad suggestion, I would say. What do you think about posting a feature request on TJC ? I would like to hear the opinion of other people about this proposition.

If enough people approve, I'll submit a patch to Jolla and try to advocate for the change.

About how I find this, I've access to the email code through NDA. But it is in clear in QML anyway. The solution is based also on nemo-qml-plugin-email (see src/emailAccountListModel.h) which is Open Source and in the SailfishOS git repository.

To fully answer your question, the code you try to paste is from a delegate. So the displayName is an attribute of the model at a given index. It cannot be accessed out of the delegate. But nemo-qml-plugin-email provides accessors to the display name and some other attributes directly from the account id. The mailAccountListModel object I'm using, can be found in the email.qml file. It is a global object that is available in all the app.

Markkyboy 2019-05-27 17:22

Re: Rename 'Folders' to currently selected account
 
Quote:

Originally Posted by dcaliste (Post 1557368)
Happy that it's working. Besides, it's not a bad suggestion, I would say. What do you think about posting a feature request on TJC ? I would like to hear the opinion of other people about this proposition.

If enough people approve, I'll submit a patch to Jolla and try to advocate for the change.

About how I find this, I've access to the email code through NDA. But it is in clear in QML anyway. The solution is based also on nemo-qml-plugin-email (see src/emailAccountListModel.h) which is Open Source and in the SailfishOS git repository.

To fully answer your question, the code you try to paste is from a delegate. So the displayName is an attribute of the model at a given index. It cannot be accessed out of the delegate. But nemo-qml-plugin-email provides accessors to the display name and some other attributes directly from the account id. The mailAccountListModel object I'm using, can be found in the email.qml file. It is a global object that is available in all the app.

Okay, there's some knowledge for us all, I had little to no idea about the delegate item but looking back at the code, I now understand, thanks.

I'm glad you like the idea, at your suggestion I will certainly post on TJC, it's always nice when Jolla gives the nod and includes end users ideas into the OS/apps.

Thanks again,...

Markkyboy 2019-05-27 17:34

Re: Rename 'Folders' to currently selected account
 
Posted:

https://together.jolla.com/question/...-folders-page/

Markkyboy 2019-05-31 22:31

Re: Rename 'Folders' to currently selected account
 
Quote:

Originally Posted by Markkyboy (Post 1557370)

Hmmm, only 14 votes....not much eh, bugger!


All times are GMT. The time now is 18:56.

vBulletin® Version 3.8.8