<div dir="ltr">Jack,<div><br></div><div>I believe that originally the 'kmm-brokerage-account' property was supposed to be used to look-up the linked-up brokerage account id.<br><div>This, however, does not seem to work, see:</div><div><a href="https://bugs.kde.org/show_bug.cgi?id=329701">https://bugs.kde.org/show_bug.cgi?id=329701</a></div><div>and <a href="https://bugs.kde.org/show_bug.cgi?id=350360">https://bugs.kde.org/show_bug.cgi?id=350360</a></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 22, 2022 at 4:13 PM Jack via KMyMoney-devel <<a href="mailto:kmymoney-devel@kde.org">kmymoney-devel@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 6/22/22 02:18, Thomas Baumgart via KMyMoney-devel wrote:<br>
> On Dienstag, 21. Juni 2022 22:46:35 CEST Jack via KMyMoney-devel wrote:<br>
>> I'm trying to find an way to easily switch between an investment<br>
>> account and it's brokerage account.  I have figured out how to test for<br>
>> the two types of accounts (testing the .accountType() or looking for "<br>
>> (Brokerage)" at the end of the name.)  However, I don't see any way to<br>
>> look up an account by name.  Does this actually require looping through<br>
>> all accounts and testing if the name matches?<br>
> In master you can do this:<br>
><br>
>    QString accountName;<br>
>    auto account = MyMoneyFile::instance()->accountsModel()->itemByName(accountName);<br>
><br>
>    or if you want to stick with the model type access to the data:<br>
><br>
>    auto idx = MyMoneyFile::instance()->accountsModel()->indexByName(accountName);<br>
>    auto name = idx.data(eMyMoney::Model::AccountNameRole).toString();<br>
><br>
> which in fact does the looping for you in AccountsModel::indexListByName().<br>
><br>
> Hope that helps.<br>
<br>
Thanks.  Either of those is shorter than what I came up with, although <br>
mine does seem to work (looking with gdb.)<br>
<br>
My current problem is that I'm trying to add a "go to brokerage" line <br>
after the "go to account" and "go to payee" menu choices, but it is not <br>
appearing in any of the menus (either main menu or context menu.)  I <br>
can't find anywhere in the code where either of the old ones appears <br>
where I haven't added the new one, so I don't know what I am missing.<br>
<br>
Jack<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Best Regards,<div>Dawid Wrobel</div></div></div>